电脑桌面
添加小米粒文库到电脑桌面
安装后可以在桌面快捷访问

光流法OPenCV

光流法OPenCV_第1页
1/9
光流法OPenCV_第2页
2/9
光流法OPenCV_第3页
3/9
/* --Sparse Optical Flow Demo Program-- * Written by David Stavens (david.stavens@ai.stanford.edu) */ #include #include #include #include staticconst double pi = 3.14159265358979323846; inline static double square(int a) { return a * a; } /* This is just an inline that allocates images. I did this to reduce clutter in the * actual computer vision algorithmic code. Basically it allocates the requested image * unless that image is already non-NULL. It always leaves a non-NULL image as-is even * if that image's size, depth, and/or channels are different than the request. */ inline static void allocateOnDemand( IplImage **img, CvSize size, int depth, int channels ) { if ( *img != NULL ) return; *img = cvCreateImage( size, depth, channels ); if ( *img == NULL ) { fprintf(stderr, "Error: Couldn't allocate image. Out of memory?\n"); exit(-1); } } int main(void) { /* Create an object that decodes the input video stream. */ CvCapture *input_video = cvCaptureFromFile( "C:\\Documents and Settings\\David Stavens\\Desktop\\223B-Demo\\optical_flow_input.avi" ); if (input_video == NULL) { /* Either the video didn't exist OR it uses a codec OpenCV * doesn't support. */ fprintf(stderr, "Error: Can't open video.\n"); return -1; } /* Read the video's frame size out of the AVI. */ CvSizeframe_size; frame_size.height = (int) cvGetCaptureProperty( input_video, CV_CAP_PROP_FRAME_HEIGHT ); frame_size.width = (int) cvGetCaptureProperty( input_video, CV_CAP_PROP_FRAME_WIDTH ); /* Determine the number of frames in the AVI. */ longnumber_of_frames; /* Go to the end of the AVI (ie: the fraction is "1") */ cvSetCaptureProperty(input_video, CV_CAP_PROP_POS_AVI_RATIO, 1. ); /* Now that we're at the end, rea...

1、当您付费下载文档后,您只拥有了使用权限,并不意味着购买了版权,文档只能用于自身使用,不得用于其他商业用途(如 [转卖]进行直接盈利或[编辑后售卖]进行间接盈利)。
2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。
3、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。

碎片内容

确认删除?
VIP
微信客服
  • 扫码咨询
会员Q群
  • 会员专属群点击这里加入QQ群
客服邮箱
回到顶部