Answer the question
In order to leave comments, you need to log in
Python.Opencv and slider captcha solution, can't recognize the right one among the same shapes?
Good day. I've been trying for a month to write a script for recognizing the captcha of the slider, this is a captcha where there is a slider and the puzzle needs to be moved into its "shadow" the script that I made recognizes the puzzle and its "shadow" and I need it to recognize only the shadow, how to do this?
import cv2
import numpy as np
img = cv2.imread("captcha.png")
hsv= cv2.cvtColor(img,cv2.COLOR_BGR2HSV)
lower_range = np.array([0,0,0])
upper_range = np.array([0,0,0])
mask = cv2.inRange(hsv,lower_range,upper_range)
contours,hierarchy = cv2.findContours(mask,cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_SIMPLE)
if len(contours) !=0:
for contour in contours:
if cv2.contourArea((contour)) > 500:
x,y,w,h = cv2.boundingRect(contour)
cv2.rectangle(img,(x,y),(x+w,y+h),(0,255,),1)
print(x,':',y)
my_file = open("coordinates.txt", "w")
my_file.write(str(x)+":"+str(y))
my_file.close()
#cv2.imshow("Image",img)
#cv2.imshow("Mask",mask)
cv2.waitKey(0)
cv2.destroyAllWindows()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question