随笔分类 -  OpenCV

摘要:When compile program using Visual Studio 2015, Matlab 2016b, and OpenCV 3.1.0, one might get the error as follow: Undefined function or variable ‘setI 阅读全文
posted @ 2017-02-07 02:14 Grandyang 阅读(1923) 评论(0) 推荐(0) 编辑
摘要:在OpenCV中,有强大的处理相机事件的api,但是貌似没有直接获取相机的最大分辨率的函数,通过属性CV_CAP_PROP_FRAME_HEIGHT和CV_CAP_PROP_FRAME_WIDTH直接获取的貌似只是默认的分辨率640x480,不过我们可以通过手动设置来修改分辨率,使其可以达到自身所支 阅读全文
posted @ 2017-01-06 14:30 Grandyang 阅读(8598) 评论(0) 推荐(0) 编辑
摘要:OpenCV更新到3.0版本后,Stereo模块变化的挺多的,首先去掉了StereoBMState和StereoSGBMState这两个专门控制BM和SGBM算法参数的类,而且StereoBM不能直接声明实例,需要放到智能指针里cv::Ptr<cv::StereoBM>声明才行,而且不能直接通过访问 阅读全文
posted @ 2016-08-25 05:43 Grandyang 阅读(15124) 评论(0) 推荐(0) 编辑
摘要:After OpenCV 3.0, CvMat cannot be directly converted to cv::Mat, we need to use function cvarrToMat() to do it. Please see the code below: 阅读全文
posted @ 2016-08-17 06:29 Grandyang 阅读(1085) 评论(0) 推荐(0) 编辑
摘要:Download OpenCV 3.1 Download OpenCV Extra Modules Download VS2010 Download CMake 3.2.0 Download Cuda 7.5 Download GPU Computing SDK 4.0 Download Intel 阅读全文
posted @ 2016-08-09 12:19 Grandyang 阅读(1431) 评论(0) 推荐(0) 编辑
摘要:在使用OpenCV的三维立体重建的库时,一个重要的步骤就是生成左右视图的差异图Disparity,而控制生成disparity的参数的类是cv::StereoBM,我们有时候需要拷贝一份cv::StereoBM,然后改变其中的参数值,但是如果用默认的等号‘=’来进行拷贝,其实是浅拷贝,如果改变拷贝项 阅读全文
posted @ 2016-06-23 12:07 Grandyang 阅读(1296) 评论(0) 推荐(0) 编辑
摘要:在使用Qt和OpenCV混合编程时,我们有时需要在两种图片类cv::Mat和QImage之间进行转换,下面的代码参考了网上这个帖子: 还可以用下面的这个代码,参考了这个帖子: 阅读全文
posted @ 2016-06-21 06:46 Grandyang 阅读(4177) 评论(0) 推荐(0) 编辑
摘要:这是一个用OpenCV2.4.10打开摄像头的一个例子,参见代码如下:#include #include #include using namespace cv;using namespace std;int main(int argc, char *argv[]){ CvCapture* c... 阅读全文
posted @ 2015-11-28 14:18 Grandyang 阅读(4555) 评论(0) 推荐(0) 编辑
摘要:OpenCV中的CvArr*的定义的一个空类型的指针,可以转换为其派生类CvMat和IplImage,那么如何将其转化为cv::Mat呢,其实很简单,只需要一行代码即可:// CvArr *_imgcv::Mat img = cv::cvarrToMat(_img); 阅读全文
posted @ 2015-08-15 10:46 Grandyang 阅读(6495) 评论(0) 推荐(0) 编辑
摘要:在OpenCV中,比较常见的是矩形遮罩CvRect,没有专门提供圆形的mask,那么我们只能自己写一个来模拟圆形mask的函数,需要提供的参数为原图的大小,以及圆形mask的圆心位置和半径即可,返回一个cv::Mat型的mask,参见代码如下:// C APIcv::Mat extractCircu... 阅读全文
posted @ 2015-08-15 09:51 Grandyang 阅读(2935) 评论(0) 推荐(0) 编辑
摘要:我们在使用OpenCV时,有时候需要对现有图片剪裁,比如只需要一个小窗口中的内容,那么我们可以通过OpenCV的兴趣区域 Region of Interest (ROI) 来很轻易的实现,操作也很简单,首先建立一个新的IplImage图片,大小为你需要剪裁出来的大小,然后建立一个该大小的CvRect... 阅读全文
posted @ 2015-08-04 11:48 Grandyang 阅读(3304) 评论(0) 推荐(0) 编辑
摘要:我们有时候在项目中需要将OpenCV中的cv::Mat导入MatLab进行分析与处理,那么如果把数据转过去呢,我们的做法是首先将cv::Mat导出为txt文件,或者是yml文件,请参见我之前的博客Write cv::Mat to a file。导出的txt文件可以直接load进MatLab,如果数据... 阅读全文
posted @ 2015-08-02 07:42 Grandyang 阅读(1115) 评论(0) 推荐(0) 编辑
摘要:在OpenCv中,我们有时候需要查看CvRect变量的值,我们可以通过将其保存到文件来查看,保存的代码如下:void writeCvRectToFile(CvRect &rect, const char *filename) { CvFileStorage *fs = cvOpenFi... 阅读全文
posted @ 2015-07-27 11:32 Grandyang 阅读(676) 评论(0) 推荐(0) 编辑
摘要:cvReleaseImage是OpenCV中C语言库中的释放图片内存的函数,比如我们加载或者克隆了一幅图片,当不需要这幅图片了时,我们为了避免内存泄露,需要释放这些空间,可以参见我之前的博客OpenCV Show Image cvShowImage() 使用方法,其使用方法如下:IplImage *... 阅读全文
posted @ 2015-07-02 03:03 Grandyang 阅读(5444) 评论(0) 推荐(0) 编辑
摘要:fc2Image是FlyCapture SDK的C语言库中的图片格式,由于在Windows上的MinGW无法编译FlyCapture2的C++库,只能使用C语言库,所以当我们在同时使用OpenCV的图像格式IplImage时,有时候就需要两种格式相互转换。如果需要FlyCapture2 Image和... 阅读全文
posted @ 2015-07-01 03:12 Grandyang 阅读(2142) 评论(0) 推荐(0) 编辑
摘要:// Write data FileStorage fs("test.yml", FileStorage::WRITE); fs << "MyString" << "123abc"; fs.release(); // Read data FileStorage ... 阅读全文
posted @ 2015-05-06 04:56 Grandyang 阅读(677) 评论(0) 推荐(0) 编辑
摘要:Add in the system Path:C:\opencv\build\x86\vc11\bin;Project->Project Property->Configuration Properties->VC++Directories ->Include Directories:C:\open... 阅读全文
posted @ 2015-04-25 06:05 Grandyang 阅读(490) 评论(0) 推荐(0) 编辑
摘要:The OpenCV function imread() not working in OpenCV 2.4.11 Debug mode of VS2010 under Win32, the way we want to make it work is to change it to Release... 阅读全文
posted @ 2015-04-22 07:36 Grandyang 阅读(540) 评论(0) 推荐(0) 编辑
摘要:Add in the system Path:C:\opencv\build\x86\vc10\bin;Project->Project Property->Configuration Properties->VC++Directories ->Include Directories:C:\open... 阅读全文
posted @ 2015-04-22 02:52 Grandyang 阅读(782) 评论(0) 推荐(0) 编辑
摘要:SIFT and SURF were moved to nonfree module. You need to add #include header and link with opencv_nonfree library. 阅读全文
posted @ 2015-04-01 23:17 Grandyang 阅读(995) 评论(0) 推荐(0) 编辑

Fork me on GitHub

喜欢请打赏

扫描二维码打赏

Venmo 打赏

点击右上角即可分享
微信分享提示