Improving Harris Angle Detector Result

I read about feature detection and wanted to try Harris's angle detector. I understand that this is achieved by calling

void cornerHarris(InputArray src, OutputArray dst, int blockSize, int ksize, double k, int borderType=BORDER_DEFAULT )

where dst is a floating-point image containing angular values ​​in each pixel.

I wanted it to work, and I wanted to apply it to the following picture:

pic of a laptop

The result is the following:

corners not detected

As you can tell, the results are not very good. It seems to me that he just caught the noise, the main corners were not even detected.

Here is the code that I used to print the corners on the image, I used the threshold and set any arbitrary value for the threshold.

 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.

Did I miss something? How can I improve the quality of this feature?

thanks

+4
source share
1 answer

You can try goodFeaturesToTrack . It is built on top of a Harris corner detector, but filters out our noise and returns only strong angles.

+9
source

Source: https://habr.com/ru/post/1443880/


All Articles