Determine the correct number of CORNER coordinates from a Polygon image in MATLAB

I have polygonal images like hexagon, pentagon, any quadrangle, etc. I need to generalize the detection method to detect the CORRECT number of angular coordinates. No additional coordinates should be created.

for example: - the code should detect only 4 for a quadrangle, 3 for a triangle, 5 for a pentagon, etc.

I used the HARRIS angle definition to determine the correct angles by specifying the number of angle values, but I cannot use the same code for an image with a different number of edges.

The reason for using the same code is that I am trying to perform a volumetric process β†’ Detect corners and print them ... I cannot change the code for each image.

Image Samples:

Octagon:

enter image description here

Pentagon:

enter image description here

+1
source share
1 answer

There is a function called corner that works very well, given the correct input parameters.

For example, setting the appropriate QualityLevel yields accurate results:

 clear clc A = imread('Octagon.jpg'); A_gray = rgb2gray(A); figure; Ca = corner(A_gray,'QualityLevel',.2) 

The coordinates ar are stored in Ca as an N x 2 matrix. Here N = 8.

 imshow(A) hold on scatter(Ca(:,1),Ca(:,2),80,'filled','k') hold off B = imread('Pentagon.jpg'); B_gray = rgb2gray(B); figure; Cb = corner(B_gray,'QualityLevel',.2) imshow(B) hold on scatter(Cb(:,1),Cb(:,2),80,'filled','k') hold off 

Outputs:

enter image description here

and

enter image description here

Yay

+4
source

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


All Articles