OpenCVForUnity
OpenCVForUnity copied to clipboard
texture2DToMat require a new Mat() on every frame
I am using an external USB Camera to get Texture2d and then convert it to Mat for further processing. In the WebCamtexturetoMat example, i can see the "frameMat" in created only once in the _Initialize() and on every update the webCamTexture is converted to "framMat", without creating the framMat with new initialization every time.
In my case, if I initialize the frameMat just once at Start and just converty texture2d to mat using "Utils.texture2DToMat(tempTexture2D, frameMat, false);" I always get a black screen.
however, if I recreate the mat at every update before converting texture2d to Mat
frameMat = new Mat(height, width, CvType.CV_8UC4); Utils.texture2DToMat(tempTexture2D, frameMat, false);
then I can see the image, (not black screen), even though the image is still shaky.
can anyone tell me what the actual problem is