I have small problem with cv in Python and rhombus. I can read frame from the camera and create contours...

img_BW = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)

ret, thresh = cv2.threshold(img_BW, TR, 200, cv2.THRESH_BINARY)
cv2.imshow("ThreshPaint", thresh)

contours, hierarchy = cv2.findContours(image=thresh, mode=cv2.RETR_TREE,method=cv2.CHAIN_APPROX_SIMPLE)

#edged = cv2.Canny(img_BW, 30, 200)
#cv2.imshow("Canny", edged)

cv2.drawContours(image=frame, contours=contours, contourIdx=0, color=(0, 0, 255), thickness=2, lineType=cv2.LINE_AA)
cv2.imshow("Contours", frame)

and I see rhombus with contours. I know how to get coordinates of the points A,B,C,D measure distance between them but how to check distance between point A and X which is on the contour? the measure-line must be perpendicular to the point A.enter image description here



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.