Opencv初探

环境一览:WINXP SP3+DX9.0C+VC6.0 SP6+IPP5.3.2.073+DX9.0bSDK

环境变量设置:

set OPENCV=E:\Program Files\OpenCV\
set include=%include%;%OPENCV%\CXCORE\INCLUDE;%OPENCV%\CV\INCLUDE;%OPENCV%\CVAUX\INCLUDE;%OPENCV%\ML\INCLUDE;%OPENCV%\OTHERLIBS\HIGHGUI;%OPENCV\OTHERLIBS\_GRAPHICS
\INCLUDE
set lib=%lib%;%OPENCV%\LIB

对于VC IDE 在工具-选项-目录里面设置与以上相应的include和libs

参考书籍:
OReilly-LearningOpenCV

第二章例子更正:
example 1
cvLoadImage( argv[1],CV_LOAD_IMAGE_COLOR );

example 2

不是所有格式avi都能放,可安装XVID,或者K-lite codec pack
支持格式可参考http://opencv.willowgarage.com/wiki/VideoCodecs

mencoder in.avi -ovc raw -vf format=i420 -o out.avi

example 3
注释掉Hack代码
拖放使能:去注释cvGetCaptureProperty

不需要#include "cv.h"

example 4
图片不要放在Debug文件夹里

example 5
filter
cvPyrDown有第三个参数filter

example 10
cvCreateVideoWriter中CV_FOURCC改成你机子上支持的格式,否则不生成AVI

TO remember:
although it’s important to take care of garbage collection in OpenCV, we should only clean up the garbage that we have created.

另外example 9 应该是用的vfw,可用Directshow的实现
参考链接:
http://www.opencv.org.cn/index.php/%E4%BD%BF%E7%94%A8DirectShow%E9%87%87%E9%9B%86%E5%9B%BE%E5%83%8F


Code
原文地址:https://www.cnblogs.com/westwind/p/1528667.html