Reputation: 683
How is the data laid out in a 4 channel image matrix in OpencV (CV_8UC4
)?
cv::Mat A = cv::Mat::zeros(height, width, CV_8UC4);
is it:
[R1,G1,B1,A1,R2,G2,B2,A2,...]
or:
[B1,G1,R1,A1,B2,G2,R2,A2,...]
or anything else?
Upvotes: 2
Views: 638
Reputation: 20284
It depends. If you are in BGRA space then it is:
[B1,G1,R1,A1,B2,G2,R2,A2,...]
If you are in RGBA space then it is:
[R1,G1,B1,A1,R2,G2,B2,A2,...]
And by default, OpenCV loads images as BGR (BGRA) sapce. So if you did not chage anything it should be:
[B1,G1,R1,A1,B2,G2,R2,A2,...]
Upvotes: 1