嘿偷看我在这里尝试做的是加载视频播放它,在播放视频时捕获帧并将其输出到新窗口中。这就是下面的代码在 atm 中所做的。
但是我现在想通过向捕获的帧添加模糊和阈值来将其提升到一个新的水平,它可能会在阈值之前或之后平滑边缘。
#include<opencv\cv.h>
#include<opencv\highgui.h>
#include<opencv\ml.h>
#include<opencv\cxcore.h>
#include<fstream>
int main( int argc, char** argv ) {
//Main Window
cvNamedWindow( "DisplayVideo", CV_WINDOW_AUTOSIZE );
CvCapture* capture = cvCreateFileCapture( argv[1] ); //Video captured and stored in CAPTURE
IplImage* frame; //Image captured and stored in FRAME
int num=0;
char s [20];
while(1) {
num++;
frame = cvQueryFrame(capture);
if( !frame ) break;
cvShowImage( "DisplayVideo", frame );
char c = cvWaitKey(33);
if( c == 27 ) break;
if (c == 'f')
{
sprintf(s,"frame%d.jpg",num);
cvSaveImage(s,frame);
cvNamedWindow("FrameWindow", 0);
cvShowImage("FrameWindow",frame);
}
}
cvReleaseCapture( &capture );
cvDestroyWindow("DisplayVideo" );
}