LoginSignup
1
0

More than 5 years have passed since last update.

Kinect V2でミラー表示をやめるには

Last updated at Posted at 2017-09-20

Kinect V1では、kinect.setMirror(false);とすれば左右反転の鏡面表示でなく
そのまま表示されるらしいですが
Kinect V2は、そのメソッドがないみたい。。。

before(鏡面になっている状態):
before.png

そのため、下記関数を使って左右反転を戻しました。

void reflectImage(byte* colorData, int width, int height)
{
    byte* imageBase = colorData;
        // Get the base position as an integer pointer
        int* imagePosition = (int*)imageBase;
        // repeat for each row
        for (int row = 0; row < height; row++)
        {
            // read from the left edge
            int* fromPos = imagePosition + (row * width);
            // write to the right edge
            int* toPos = fromPos + width - 1;
            int tempPos;
            while (fromPos < toPos)
            {
                tempPos = *toPos;
                *toPos = *fromPos;
                *fromPos = tempPos;
                //copy the pixel
                fromPos++; // move towards the middle
                toPos--; // move back from the right edge
            }
        }

}

after:
after.png

下記のコードほとんどそのままです。

参考:
https://stackoverflow.com/questions/18253032/creating-oposite-mirror-picture-by-manipulate-kinect-color-pixels

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0