How to find "rectangular" corners?
이전 댓글 표시
Hey,
I have this image:

I want to find the 4 corners of the "rectangular", but I don't want to use the "corner" function. What can I do?
Thanks.
댓글 수: 1
Cedric
2014년 5월 24일
If your rectangles are not too degenerate, you could get corners with four 2D convolutions using appropriate kernels.
채택된 답변
추가 답변 (4개)
Matt J
2020년 2월 6일
numVertices=4;
corners=pgonCorners(Image,numVertices)
Image Analyst
2014년 5월 23일
편집: Image Analyst
2014년 5월 23일
1 개 추천
Why not try the corner() function in the Image Processing Toolbox. What do you have against using that?
Or else call bwboundaries() and go along the coordinates looking for kinks in the curve as shown by the FAQ: http://matlab.wikia.com/wiki/FAQ#How_do_I_find_.22kinks.22_in_a_curve.3F
Matt J
2014년 5월 24일
1 개 추천
Maybe use edge() followed by houghlines() with an appropriate FillGap selection? The endpoints of the line segments returned by houghlines would be the corners of the quadrilateral.
댓글 수: 3
Mor
2014년 5월 24일
Image Analyst
2014년 5월 24일
If you need the exact corner, use (untested)
boundaries = bwboundaries(binaryImage);
x = boundaries{:,1};
y = boundaries{:,2};
and compare every x and y to see which is closest to the hough points
distances = sqrt((xh - x).^ 2 + (yh - y) .^ 2)
[minDistance, indexOfMin] = min(distances);
xc = x(indexOfMin);
yc = y(indexOfMin);
Do the above for each hough estimated point to find the point in the blob which is closest to the hough point (xh, yh).
You can be generous with the RhoResolution, given the large size of the quadrilateral. I get a pretty good fit to the edges with the following,
[H,T,R] = hough(E,'RhoResolution',4,'Theta',-90:.5:89);

Similar to what ImageAnalyst was saying, this initial line fit should allow you to segment the boundary points into 4 separate edges. You do this by finding the closest point to each initial line. You can then do a more refined line fit to each edge using each group of points (e.g., using polyfit).
Image Analyst
2014년 5월 24일
0 개 추천
If the quad is roughly aligned with the edges of the image you could also get the distance from the 4 corners. For each corner, take the one point on the white boundary that has the minimum distance. No need to mess with hough in that case.
카테고리
도움말 센터 및 File Exchange에서 Geometric Transformation and Image Registration에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



