Ask Your Question

Read and Display RGB video file using opencv2.2

asked 2013-04-07 00:14:43 -0600

jay_sil_viper gravatar image

updated 2013-04-07 00:15:39 -0600

Hey Guys, I have an Uncompressed RGB video file. The extension is (.rgb)

I am not able to read and display the video. I am not able to even grab the frame .

cvNamedWindow( “Example2”, CV_WINDOW_AUTOSIZE );
CvCapture* capture = cvCreateFileCapture( "test.rgb" );
IplImage* frame;
while(1) {
frame = cvQueryFrame( capture );
if( !frame ) break;
cvShowImage( “Example2”, frame );
char c = cvWaitKey(33);
if( c == 27 )
cvReleaseCapture( &capture );
cvDestroyWindow( “Example2” );
edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2013-04-07 02:38:02 -0600

First of all, I highly recommend using the C++ interface when using images and video's. It basically helps you with releasing resources and such. This would turn your code into something like this:

NamedWindow( “Example2”, CV_WINDOW_AUTOSIZE );
VideoCapture capture = VideoCapture( "C://absolute_link_to_video_file.rgb" );
Mat frame;
while(1) {
    frame = read( capture );
    imshow( “Example Image C++ style”, frame );
    if( !frame ) break;

More information about the functions can be used here:

Can you go and try this. Basically if this code does not work, then just place a debug point at the frame read function and see if it is throwing information back. If not, then probably the *.rgb type is not supported in OpenCV.

edit flag offensive delete link more



I've pretty much tried everything... I am going to try what you just posted and try to paste the debug statements.... Thanks...

jay_sil_viper gravatar imagejay_sil_viper ( 2013-04-07 12:47:21 -0600 )edit

Question Tools


Asked: 2013-04-07 00:14:43 -0600

Seen: 1,556 times

Last updated: Apr 07 '13