Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is a couple of links that might help you:</p> <ul> <li><a href="http://tech.groups.yahoo.com/group/OpenCV/message/59027" rel="nofollow noreferrer">Load, Save and Show YUV 420 images</a></li> <li><a href="https://stackoverflow.com/q/2231518/176769">How to read a frame from YUV file in OpenCV?</a></li> <li><a href="https://stackoverflow.com/q/7954416/176769">Converting YUV into BGR or RGB in OpenCV</a></li> </ul> <p><strong>Edit</strong>:</p> <p>I must clear something first: <strong>OpenCV is capable of reading YUV frames from a video file</strong> because it's the underlying library (FFmpeg/GStreamer) that does the job. OpenCV also supports converting between a specific type of <a href="https://stackoverflow.com/a/2906294/176769">YUV and RGB</a> through <code>cvCvtColor()</code> with <code>CV_YCrCb2RGB</code> or <code>CV_RGBYCrCb</code>.</p> <p>Upon examining your question again, I noticed you didn't specify the kind of error that happened. You could <a href="https://stackoverflow.com/a/14713072/176769">do a better job</a> at <a href="https://stackoverflow.com/a/8919567/176769">dealing</a> with a <a href="https://stackoverflow.com/a/14505372/176769">possible</a> <a href="https://stackoverflow.com/a/12588520/176769">failure</a> from the capture interface by printing a message to the screen instead of <code>throw</code>ing it. </p> <p>I tested the video file you shared and I had no problems playing it on a window using the following code:</p> <pre><code>#include &lt;cv.h&gt; #include &lt;highgui.h&gt; #include &lt;iostream&gt; int main(int argc, char* argv[]) { cv::VideoCapture cap(argv[1]); if (!cap.isOpened()) { std::cout &lt;&lt; "!!! Failed to open file: " &lt;&lt; argv[1] &lt;&lt; std::endl; return -1; } cv::Mat frame; for(;;) { if (!cap.read(frame)) break; cv::imshow("window", frame); char key = cvWaitKey(10); if (key == 27) // ESC break; } return 0; } </code></pre> <p>If, for some reason, the capture interface fails to open the file it will quit the application immediately, instead of going further just to crash at <code>cap.read(frame)</code>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload