python - Detect the green lines in this image and calculate their lengths -
the image can more noisy @ times more objects intervene background. right using various techniques using rgb colour space detect lines fails when there change in colour due intervening obstacles background. using opencv , python. have read hsv better colour detection , used haven't been successful yet. not able find generic solution problem. hints or clues in direction of great help.
still in progress
first of all, rgb image consists of 3 grayscale images. since need green color deal 1 channel. green one. so, can split image, can use b,g,r = cv2.split('your image')
. output if showing green channel:
after should threshold image using desired way. prefer otsu's thresholding
in case. output after thresholding is:
it's obvious thresholded image extremley noisy. performing erosion
reduce noise little bit. noise reduced image similar following:
i tried using closing
instead of dilation
, closing
preserves unwanted noise. separately performed erosion
followed dilation
. after dilation
output is:
note that: you can own way in morphological operation. can use opening
instead of did. results subjective 1 person another.
now can try 1 these 2 methods:
1. blob detection. 2. houghline transform.
todo
try out these 2 methods , choose best.
Comments
Post a Comment