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);
}
yes, that constructor does not exist (for reasons unknown). you can still use
cvyuv.put(0,0,Still)
later.and you cannot retrieve the color information from a b/w image, so the
cvtColor
currently does not make any sense.see documentation here
it seems, that your YUVYImage has color information, but that might be in seperate image planes, consecutive, not interleaved. (so you'd have to get 3 seperate Y,U,V Mat's (like: with System.arraycopy and some offset) from your
byte[]
and latermerge()
those to a yuv image, then you can convert that to bgr.