Hi, thanks for sharing this. However i tried with some real world images of id card where corners are distorted, i am not getting rectangle contour. And biggest contour is coming out to be empty for same reason, any ideas how to fix that? Tia
Hi, unfortunatelly in real world we have different situations and building generic model is very difficult. What we can do is to control the environment, if you taking the photos by yourself try to have the good and consistent lightning, no shadows. Also you can try experimenting with different background colors, contrasting colors may help for better contour detection.
i got an error when using getPerspectiveTransform. i cant used no.float32, so i change into np.uint. however whent i used getPerspectiveTransform the error popup : here my code width,height= 250, 350 pts1 = np.uint([[111,219],[287,188],[154,482],[352,440]]) pts2 = np.uint([[0,0],[width,0],[0,height],[width,height]]) #print(pts1,pts2) Matrix = cv2.getPerspectiveTransform(pts1,pts2) #cannot used this imgOutput = cv2.warpPerspective(img,Matrix,(width,height)) and i got error saying cv2.error: OpenCV(4.8.0) :-1: error: (-5:Bad argument) in function 'getPerspectiveTransform' > Overload resolution failed: > - src data type = 8 is not supported > - Expected Ptr for argument 'src' can anyone help me?
Hello! If you want to learn how to build a simple Document Scanner, check this video: ua-cam.com/video/W3DzSm8WI1g/v-deo.html
Great content! You have gained a subscriber!
thank you! thats first code i found which actually work
Thanks, god content!
subscribed sir
Hi, thanks for sharing this. However i tried with some real world images of id card where corners are distorted, i am not getting rectangle contour. And biggest contour is coming out to be empty for same reason, any ideas how to fix that? Tia
Hi, unfortunatelly in real world we have different situations and building generic model is very difficult. What we can do is to control the environment, if you taking the photos by yourself try to have the good and consistent lightning, no shadows. Also you can try experimenting with different background colors, contrasting colors may help for better contour detection.
I tried something like this , m getting black border.. why is it happening?
Hi, any errors?
Dislike: you should use your own voice. You are not Wojack!
i got an error when using getPerspectiveTransform.
i cant used no.float32, so i change into np.uint.
however whent i used getPerspectiveTransform the error popup :
here my code
width,height= 250, 350
pts1 = np.uint([[111,219],[287,188],[154,482],[352,440]])
pts2 = np.uint([[0,0],[width,0],[0,height],[width,height]])
#print(pts1,pts2)
Matrix = cv2.getPerspectiveTransform(pts1,pts2) #cannot used this
imgOutput = cv2.warpPerspective(img,Matrix,(width,height))
and i got error saying
cv2.error: OpenCV(4.8.0) :-1: error: (-5:Bad argument) in function 'getPerspectiveTransform'
> Overload resolution failed:
> - src data type = 8 is not supported
> - Expected Ptr for argument 'src'
can anyone help me?