I need to detect all the lines (edges) in an image an their positions in my xamarin application .
like in the image attached .
I have tried openCV in python but still I did not get all the lines , I only got boundary boxes around the objects and only straight lines , but I need to detect the sloping lines too .
here is the python code I used :`
blur = cv2.GaussianBlur(img, (3,3), 0)
canny = cv2.Canny(blur, l_th, u_th)
dilated = cv2.dilate(canny, None, iterations=3)
contours, hierarchy = cv2.findContours(dilated, cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE)
for contour in contours:
(x, y, w, h) = cv2.boundingRect(contour)
cv2.rectangle(coloured_img, (x, y), (x+w, y+h), (0, 255, 0), 2)
the original image :
the output that I want :
the output that I got :
any suggestions please ?