python - Detect the green lines in this image and calculate their lengths -


enter image description heresample images

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:

green_channel

after should threshold image using desired way. prefer otsu's thresholding in case. output after thresholding is:

thresholded_image

it's obvious thresholded image extremley noisy. performing erosion reduce noise little bit. noise reduced image similar following:

erosion

i tried using closing instead of dilation, closing preserves unwanted noise. separately performed erosion followed dilation. after dilation output is:

dilation

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

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -