Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Mat (int, int, int, byte[]) is undefinded

My camera outputs data in the form byte[] and I can get to a black and white image. But, I need to convert to Mat color. My attempt gets me the error message above. Is there a different method? Working code.

byte[] Still;
Insten.grabFrame(Still);
YUYVImage BlackWhiteImage;
BlackWhiteImage = new YUYVImage(Still, WIDTH, HEIGHT);

Code I need to work.

byte[] Still;
Insten.grabFrame(Still);
if(Still.length == HEIGHT * WIDTH * 3)
    {    Mat cvyuv = new Mat(HEIGHT, WIDTH, CvType.CV_8UC1, Still);
         Mat cvbgr = new Mat();
        Imgproc.cvtColor(cvyuv, cvbgr, Imgproc.COLOR_YUV2BGR);
   }