【发布时间】:2012-10-24 05:42:13
【问题描述】:
我一直在阅读有关特征检测的信息,并想尝试使用 harris 角检测器。我意识到这是通过调用来实现的
void cornerHarris(InputArray src, OutputArray dst, int blockSize, int ksize, double k, int borderType=BORDER_DEFAULT )
其中 dst 是包含每个像素角强度的浮点图像。
我想看到它起作用,所以我想将它应用到下图:
产生的结果是这样的:
如您所知,结果并不好。在我看来,它只是拾取了噪音,甚至没有检测到主要角落。
这是我用来在图像上打印角的代码,我使用阈值并为阈值设置任意值。
int _tmain(int argc, _TCHAR* argv[])
{
Mat img, dst, threshed;
img = imread("c:\\laptop.jpg",0);
dst = Mat::zeros(img.size(), CV_32FC1);
cornerHarris(img, dst, 2, 3, 0.04, BORDER_DEFAULT);
threshold(dst, threshed, 0.00001, 255, THRESH_BINARY_INV);
namedWindow("meh", CV_WINDOW_AUTOSIZE);
imshow("meh", threshed);
//imwrite("harris.jpg", threshed);
waitKey(0);
return 0;
If I reduce threshold the result is white with just a few black dots (detections) Increasing threshold just produces a more noisy like image.
我错过了什么吗?如何提高此功能的质量?
谢谢
【问题讨论】: