Is there a way to extract the 4 corners points from all the points found with detectMinEigenFeatures?
7 views (last 30 days)
Show older comments
I am trying to make an Augmented Reality video feature using automatic detection after designating an area using 4 points with drawpolygon. I am getting a lot of matches, and I want to make a generic solution that can find the 4 corner points for the homography as marked in red below:![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/609635/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/609635/image.png)
I have tried using max- and min-points, but this does not work for all camera angles as different directions might render the upper right corner as the minX instead of the upper left corner and so on.
edit; In particular, this breaks when seeing the checkerboard "straight on" as for example both minX goes to the same value as maxY and can occupy neighbouring detections.
0 Comments
Accepted Answer
Matt J
on 6 May 2021
If you have a binary map of the chequerboard, you can use imerode to separate the black squares and then pgonCorners
to identify the corners of each.
3 Comments
Matt J
on 7 May 2021
Something in how you displayed the results, I'm guessing. In the code below, you can see that I'm getting a very decent corner detection with your image.
load Image
corners=pgonCorners(BW,4);
imshow(BW)
hold on
plot( corners(:,2),corners(:,1),'yo','MarkerFaceColor','r','MarkerSize',15);
hold off
More Answers (1)
Gatech AE
on 6 May 2021
I think an interesting way might be using the convex hull of your points. Running on the assumption that you have an Nx2 array of points,
x = Pts(:,1);
y = Pts(:,2);
k = convhull(x,y);
The variable k returns the indices of the points that form the perimeter sorted in counter-clockwise order. So for the corners,
corners = Pts(k,:);
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!