Detect dotted (broken) lines only in an image using OpenCV

Souvik Dutta souvik.viksou at gmail.com
Wed Apr 15 22:27:00 EDT 2020


You cannot attach any image in this list.

Souvik flutter dev

On Thu, Apr 16, 2020, 5:10 AM Edu Py <haider.khalidy2 at gmail.com> wrote:

> I am trying to learn techniques on image feature detection.
>
> I have managed to detect horizontal line(unbroken/continuous), however I
> am having trouble detecting all the dotted/broken lines in an image.
>
> Here is my test image, as you can see there are dotted lines and some
> text/boxes etc.
>
>
> my code is below:
>
> import cv2
> import numpy as np
>
> img=cv2.imread('test.jpg')
> img=functions.image_resize(img,1000,1000) #function from a script to
> resize image to fit my screen
> imgGray=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
> imgEdges=cv2.Canny(imgGray,100,250)
> imgLines= cv2.HoughLinesP(imgEdges,2,np.pi/100,60, minLineLength = 10,
> maxLineGap = 100)
> for x1,y1,x2,y2 in imgLines[0]:
>     cv2.line(img,(x1,y1),(x2,y2),(0,255,0),2)
>
> cv2.imshow('Final Image with dotted Lines detected',img)
>
> My output image is below. As you can see I only managed to detect the last
> dotted line. I have played around with the parameters rho,theta,min/max
> line but no luck.
>
> Any advice is greatly appreciated :)
>
> For the original link - which has the images
>
> https://stackoverflow.com/questions/61239652/detect-dotted-broken-lines-only-in-an-image-using-opencv
> --
> https://mail.python.org/mailman/listinfo/python-list
>


More information about the Python-list mailing list