OPENCV c++ 求助~着急阿,谢谢阿!!!!!!!!!!!!!!!!!
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 );
}