python - How to find polygon vertices from edge detection images? -
1. problem
given images of house roof, trying find contours of roofs. have labelled data available (as polygon vertices) interpolate , create truth image shown below
i use canny, hough-lines, lbp features train ml model results decent. model output shown in middle, , overlay on test image shown on right.
2. need.
the final output should set of polygons , need find points on these polygons should drawn (see highlighted points in image below). output can set of n line segments. each line segment 2 points [(x1,y1),(x2,y2)]
3. thoughts/ideas;
a. erosion,dilation,opening,closing,skeletonize operations
while these operations make lines in above image neater, don’t me find polygon vertices looking for.
i'd fit (a number of) lines white pixels in image (something hough lines).
the intersections of these lines give me vertices polygons looking for.
i wondering if there more standard/better way of accomplishing above.
i think houghlinesp in goal. find line segments , output them in vector [x1,y1,x2,y2]
(x,y) pairs represent start , endpoints of line segments.
each vertex should near end of 2 or more line segments. go through each of endpoints , count how many times appear. when you've processed points can eliminate have less 2 occurances. of course need small threshold determining point unique because gaps in lines psuedocode: dist(point1, point2) < some_delta_threshold
i'm not sure how find polygons @ point, offers assistance
Comments
Post a Comment