Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 19555

Reading from RGB24 buffer is producing weird results

$
0
0
Hi, I am trying to get Unity3D to work with OpenCV. This looks good so far, but now I need to get some data from Unity3D to OpenCV. I created a RGB24 buffer from Unity and am reading it from OpenCV, but the output is not what I expect it to be. Here is how I read it: Mat fromunity(imageSize, CV_8UC3, buffer, Mat::AUTO_STEP); I am checking the result by writing it into a file, like this: imwrite("test.png", fromunity); This is a sample image that I get: ![sample for wrong image, look overlaid](/upfiles/1475927106198439.png) But it should look like this (taken directly from the camera, without unity) EDIT> This image is actually upside-down: ![how it should look like, a picture of a calibration-checkerboard-pattern](/upfiles/14759271541742747.jpg) This is how the buffers are created in Unity: Texture2D left = new Texture2D (640, 480,TextureFormat.RGB24, false, true); left.SetPixels (((WebCamTexture)leftImage.texture).GetPixels ()); left.Apply (); detectCheckerboard (left.GetRawTextureData()); //call to native plugin with OpenCV I know that OpenCV expects the channels to be in BGR order, but the next step would be to convert to grayscale anyway so I do not care if the colors are right. Does this have to do anything with the step argument? I never used it, AUTO_STEP always did the job. What would other values that I could try out be?

Viewing all articles
Browse latest Browse all 19555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>