With OpenCV its just few lines of code (for RGB24 images). This will extract frame number frameNo from video and convert to QImage:
CvCapture * capture = cvCaptureFromAVI( pathToVideo.toAscii(),constData() );
cvSetCaptureProperty(capture, CV_CAP_PROP_POS_FRAMES, frameNo);
IplImage * cvimg = cvQueryFrame(capture);
if(cvimg){ // this will be NULL if you specify invalid frame index
QImage temp
= QImage((const uchar
*)cvimg
->imageData,cvimg
->width,cvimg
->height,
QImage::Format_RGB888);
QImage image
= temp.
rgbSwapped();
// opencv images are BGR }
cvReleaseCapture(&capture);
QString pathToVideo = ...
CvCapture * capture = cvCaptureFromAVI( pathToVideo.toAscii(),constData() );
cvSetCaptureProperty(capture, CV_CAP_PROP_POS_FRAMES, frameNo);
IplImage * cvimg = cvQueryFrame(capture);
if(cvimg){ // this will be NULL if you specify invalid frame index
QImage temp = QImage((const uchar*)cvimg->imageData,cvimg->width,cvimg->height,QImage::Format_RGB888);
QImage image = temp.rgbSwapped(); // opencv images are BGR
}
cvReleaseCapture(&capture);
To copy to clipboard, switch view to plain text mode
To work with other image formats, you will have to do some direct pixel manipulation.
Bookmarks