I am having trouble working with OpenCV and Python, I am new to the technology. Just some questions, how to crop the image after applying Hough line transform?
Here is my image. I want to crop the image with the ones who are having the red lines.
Here is my code for cropping image, and I know there is something wrong.
minLineLength = 100
maxLineGap = 10
rho = 1
theta = np.pi/180
threshold = 190
lines = cv2.HoughLines(opened, 1, np.pi/180, threshold)
for line in lines:
for rho,theta in line:
a = np.cos(theta)
b = np.sin(theta)
x0 = a*rho
y0 = b*rho
x1 = int(x0 + 1000*(-b))
y1 = int(y0 + 1000*(a))
x2 = int(x0 - 1000*(-b))
y2 = int(y0 - 1000*(a))
cv2.line(image, (x1, y1), (x2, y2), (255, 0, 0), 2)
cropped = image[100:200, 500:640]
I really need your help guys