Is there a way to extract the 4 corners points from all the points found with detectMinEigenFeatures?
7 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Matt J
2021-5-6
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 个评论
Matt J
2021-5-7
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
更多回答(1 个)
Gatech AE
2021-5-6
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,:);
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!