i playing video on label in qt. using open cv same. video playing fast. how can decrease playback speed. tried using setcaptureproperty not working. code follows
headerfile declarations:
cvcapture *capture; iplimge *frame; cv::mat source_image; cv::mat dest_image; qtimer *imagetimer; button click slot:
void mainwindow::onbuttonclick() { capture = cvcapturefromfile("/mp.mp4"); while(capture { frame = cvqueryframe((capture); source_image = frame; cv::resize(source_image,source_image,cv::size(420,180),0,0); cv::cvtcolor(source_image,source_image,cv_bgr2rgb); qimage qimg = qimage((const unsigned char*)source_image.data,source_image.cols,source_imge.rows,qimage::format_rgb888); label->setpixmap(qpixmap::fromimage(qimg)); label->resize(label->pixmap()->size()); } } somebody please guide on this...thank :)
i use qtimer in way,not while loop,like following:
void on_button_click() { cap.open(0); timer->start(50); } void readframe() { //display image in label cap>>frame; mat2qimage(); // convert mat qimage; ... //setpixmap(); ... } and in main window,
connet(timer,timeout(),this,readframe());
Comments
Post a Comment