OPENCV c++ 求助~着急阿,谢谢阿!!!!!!!!!!!!!!!!!

qq_15810557 2018-02-27 06:30:14
OpenCV Error: Assertion failed (0 <= anchor.x && anchor.x < ksize.width && 0 <= anchor.y && anchor.y < ksize.height) in init, file /home/mclarry/OpenCV/opencv-3.1.0/modules/imgproc/src/filter.cpp, line 139
terminate called after throwing an instance of 'cv::Exception'
what(): /home/mclarry/OpenCV/opencv-3.1.0/modules/imgproc/src/filter.cpp:139: error: (-215) 0 <= anchor.x && anchor.x < ksize.width && 0 <= anchor.y && anchor.y < ksize.height in function init


在进行opencv中的shi-tomasi特征提取时出现这个问题!!!!!!
以下是代码片段在进行特征点提取时就出现这个问题,图片的格式我是把rgb图像转换为单通道的灰度图到特征提取中的!!
void VisualOdometry::extractKeyPoints()
{
cv::Mat rgbimg_Gray;
cv::cvtColor(currentframe_->rgbimg_, rgbimg_Gray,CV_BGR2GRAY,1);
cv::imshow("gray",rgbimg_Gray);
cv::waitKey(1000);
cv::goodFeaturesToTrack( rgbimg_Gray, keypoints_curr_, maxnum_features_, quality_Level_, min_Distance_, Mat(), blockSize_, useHarrisDetector_, Shi_Tomasi_k_);
/// 深度拷贝原图像用于绘制角点
cv::Mat rgbimg_GrayCopy = rgbimg_Gray.clone();
/// 绘制出角点
int r = 4;
for( int i = 0; i < keypoints_curr_.size(); i++ )
cv::circle( rgbimg_GrayCopy, keypoints_curr_[i], r, cv::Scalar(0,255,0), -1, 8, 0 );
// 显示结果
cv::namedWindow( "src", CV_WINDOW_AUTOSIZE );
cv::imshow( "src", rgbimg_GrayCopy );
}
...全文
481 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
qq_15810557 2018-03-01
  • 打赏
  • 举报
回复
我知道了啦,我shitomasi 特征函数参数有一个没有定义值,不过还是谢谢各位
赵4老师 2018-02-28
  • 打赏
  • 举报
回复
崩溃的时候在弹出的对话框按相应按钮进入调试,按Alt+7键查看Call Stack即“调用堆栈”里面从上到下列出的对应从里层到外层的函数调用历史。双击某一行可将光标定位到此次调用的源代码或汇编指令处,看不懂时双击下一行,直到能看懂为止。 将每一步的处理结果显示出来辅助调试。
L-talent 2018-02-28
  • 打赏
  • 举报
回复
opencv的错误一般都是配置问题,你再好好检查一下

24,854

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 工具平台和程序库
社区管理员
  • 工具平台和程序库社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧