Ill*_*lSc 6 graphics opencv computer-vision canny-operator
我正在使用一个使用OpenCV的项目来检测将放置在一个可用的卡上.我已经使用Canny Edge成功检测到它.但是,对于不同的图像,必须手动调整参数.我希望我的项目能够处理每个图像,而无需手动调整参数.我该怎么办?
如果您的图像由Distinct Background&Foreground组成,您可以自动获取该阈值,如本文http://www.academypublisher.com/proc/isip09/papers/isip09p109.pdf中所述.
Mat mCanny_Gray,mThres_Gray;
Mat mSrc_Gray=imread("Test.bmp",0);
double CannyAccThresh = threshold(mSrc_Gray,mThres_Gray,0,255,CV_THRESH_BINARY|CV_THRESH_OTSU);
double CannyThresh = 0.1 * CannyAccThresh;
Canny(mSrc_Gray,mCanny_Gray,CannyThresh,CannyAccThresh);
imshow("mCanny_Gray",mCanny_Gray);
Run Code Online (Sandbox Code Playgroud)
你也可以参考这个帖子.