您的位置:首页 > 运维架构

OpenCV学习笔记

2013-11-22 01:51 162 查看
OpenCV中创建矩阵后访问其中的元素出现错误:

Mat dst(image_width,image_height,CV_64FC1,Scalar(0));

dst.at<float>(0,0) = 0;

出现如下错误:[code]

OpenCV Error: Assertion failed (dims <= 2 && data && (unsigned)i0 < (unsigned)si
ze.p[0] && (unsigned)(i1*DataType<_Tp>::channels) < (unsigned)(size.p[1]*channel
s()) && ((((sizeof(size_t)<<28)|0x8442211) >> ((DataType<_Tp>::depth) & ((1 << 3
) - 1))*4) & 15) == elemSize1()) in unknown function, file C:\OpenCV2.2\include\
opencv2/core/mat.hpp, line 517

几经尝试后发现是数据类型的问题:既然我初始化矩阵dst时是定义的CV_64FC1,为double型,则以at方法访问的时候应该用double类型访问而不是float,将float改为double即可或将64改为32亦可。

 [/code]
OpenCV工程出现如下错误:

1>  main.cpp
1>main.obj : error LNK2001: 无法解析的外部符号 "public: __cdecl cv::SURF::SURF(void)" (??0SURF@cv@@QEAA@XZ)
1>main.obj : error LNK2001: 无法解析的外部符号 "public: __cdecl cv::SURF::SURF(double,int,int,bool,bool)" (??0SURF@cv@@QEAA@NHH_N0@Z)
1>E:\visual_studio_2010\Projects\ImageMatching\x64\Release\ImageMatching.exe : fatal error LNK1120: 2 个无法解析的外部命令
1>

解决:配置库的问题,之前的工程都未曾用到suft,这次使用需在属性->配置属性->链接器->输入 附加依赖库中加入opencv_nonfree246d.lib
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: