In OpenCV, I see that imread () and VideoCapture () take a string to the file path of several extensions. Is there a way to get a list of the extensions they support? For example, getting a list of "jpg", "png", "mov", "mpg", etc.? I assume this is system dependent, and others needed to request this at runtime.
In addition, how is support determined? If there is something like the code below and Mat I return, it always seems partially corrupted (I see a little image). It does not seem to change regardless of the frame number that I ask. I can play this video in the totem of the video player, but I'm not even sure that the totem and OpenCV even use the same codec for this file.
Mat fromVideo(std::string _videoPath, int frame) {
VideoCapture capture(_videoPath);
Mat f;
for (int i = 0; i < frame; i++) {
capture >> f;
}
return f;
}
source
share