Skip to content
Advertisement

Is there a method for connecting the detected corners in python?

I want to connect the detected corners that belong to the same object draw like a triangle around that. the following is my code it works I just want to add this functionality.

image= cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)
test=im
    
image = np.float32(image)
dst = cv2.cornerHarris(image,2,3,0.04)
test[dst>0.01*dst.max()]=[0,0,255] 
cv2.imshow('dst',image)

Advertisement

Answer

You can use cv2.line() method to draw a line between two points. Here is the documentation shows you how to use this method: https://docs.opencv.org/master/d6/d6e/group__imgproc__draw.html

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement