opencv - extract lines from canny edge detection -
in opencv after applying canny edge detection i'd further process result (show horizontal lines, remove short lines, etc..). result of canny image. i'd array of lines describing detected edges
i'm aware of famous hough line transform, result not good, that's why i'd manually process canny result. input:

output canny only:

output canny hough line transform

this hough line transform result(red lines) detecting edges of stairs. 4th line below not detected correctly, although canny edge detected edge.
any idea how extract edges canny image?
a few things can try improve results:
apply region of interest
your image looks have bordering window effects. removed them region of interest resulting in image looks (i tweaked until looked right, if you're using kind of kernel operator it's window size better defines roi):

use standard hough transform
it seems you're using probabilistic hough transform. so, you're getting line segments instead of interpolated line. consider using standard transform full theoretical line (rho, theta). doing got image shown below:

here code snippet used generate lines (from python interface):
(mu, sigma) = cv2.meanstddev(stairs8u) edges = cv2.canny(stairs8u, mu - sigma, mu + sigma) lines = cv2.houghlines(edges, 1, pi / 180, 70) filter lines based on angle
you can filter out poor lines taking occurring line angles, , throwing away outliers. should narrow down visible steps.
hope helps!
Comments
Post a Comment