How to find out image format retrieved via VideoCapture ?
I am retrieving frames from a video file. I am using VideoCapture class to perform this operation (the code that I am using is given below). It is retrieving a frame but I don't know whether it is RGB or HSV or some other format. How do I find out ?
Mat mFrame = new Mat();
VideoCapture camera = new VideoCapture("/home/ganesh/Videos/my_video_3.mkv");
boolean isCaptured = camera.grab();
boolean isRetrieved = camera.retrieve(mFrame);
you're safe to assume 24bit bgr here.
how is it so ?
BGR is the default color format for OpenCV, it has always been that way. Moreover, if you want to get more information about the loaded image you can use the .type() and .depth() attributes of the Mat structure.
As berak said, it is always 24 BPP format. It can either be 8-bit gray scale with padded 16 bit or can also be BGR color data. Depends on data stored in the video.
@ganesh17, mark answers if it was helpful