Image for setting the reference In the image shown, i need to detect the edge and draw a straight line through the points connecting the edges on both the sides and set this line as the origin for measuring the position of the indents on the key. I am using opencv python for image processing.
What i have tried: I tried it edge detection using canny edge function in OpenCV Python. This is my python code for edge detection:
import cv2
import numpy as np
from matplotlib import pyplot as plt
img = cv2.imread('edge.png',0)
img = cv2.medianBlur(img,5)
cv2.imshow("image",img)
edges = cv2.Canny(img,100,200)
print(edges)
plt.imshow(edges)
plt.show()
This is the output from the above code:
from here how do i extract the vertical edges on both the sides? I need to access the coordinates of just the vertical edges as shown in the first image.