I've been trying to convert an array [R,G,B,..]
in Mat object with opencv. But is returning wrong data, someone knows why?
double data[12] = {0,0,255,0,0,255,0,0,255,0,0,255};
Mat src = Mat(2,2, CV_16UC3, data);
and returns:
M =
[0, 0, 0, 0, 0, 0;
0, 0, 0, 0, 57344, 16495]
EDIT:
Solved! use uchar instead double, and CV_8UC3
i think, you wanted:
uchar data[12] = {0,0,255,0,0,255,0,0,255,0,0,255};
Mat src = Mat(2,2, CV_8UC3, data);
(all red, 2x2 rbg image)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With