For anyone wondering: the parameter epsilon in the method approxPolyDP represents the maximum distance between the shape and the approximation. If epsilon = 0 then the approximation will be really precise. But the bigger epsilon gets, the further you allow your approximation to be less rigorous, and an epsilon that's too big will simply not detect shapes properly. Trying the code as it is in the video on some random shapes image I found on google, I get that 0.01*cv2.arcLength(contour, closed=True) is actually an approximation that's "too good" (as in it'll try and draw more than 3 edges on a triangle). I put epsilon = 3 and it seems to do the job fine. Depending on what you're coding and how precisely you want to detect, play around with the epsilon value.
@BipinJethwani2 жыл бұрын
You're awesome. Your Github Gist works
@Its-Not-Funny4 жыл бұрын
We can also use width == height instead of using aspect ratio, it will work as same as the ratio and it is simple to understand. (If w == h: "square")
@theearthish4 жыл бұрын
I think aspect ratio is used so that it takes care of any error in the boundingRect method
@haastrupadebayoibukun68172 жыл бұрын
@@theearthish The aspect ratio was used because of the noise. Under normal situation, the width and height of a square is the same, in that situation the aspect ratio will be 1.
@lewlew212 Жыл бұрын
If with the above problem, I want to identify parallelogram, what should I do? Looking forward to your support. Thank!
@Ironslayer4234 ай бұрын
How can we detect something which is combination of two or more geometries, like an arrow?
@LaurinusPonpon5 жыл бұрын
Can't wait the next one!
@chapaalejandro905 жыл бұрын
where do I find the shapes.jpg file? I could not find it in OpenCV github
@JJVR105 жыл бұрын
I did it using paint. It took me 2 min. All the shapes are there.
@saipatil24623 жыл бұрын
Hello. Can you please tell how can we detect the same in live video.
@parthasaha41743 жыл бұрын
Can you help me with the "trackbar" to find the threshold values?
@JalalKhan-we1th3 жыл бұрын
Will this python program work in real time geometric shapes detection.??
@xueyuanye2 жыл бұрын
where could I download the shapes.jpg for testing? Thanks a lot
@memonaijaz54295 жыл бұрын
How to get there x,y coordinates values
@shivakumark42753 жыл бұрын
I'm getting error in line 5 .. Should I need to save the 'shapes.jpg' to a specific path?
@reealtech_xr3 жыл бұрын
you need to enter the full path with image name and extension. Example: "E:/saurabh/image/shape.jpg"
@shivakumark42753 жыл бұрын
@@reealtech_xr thanks bro ❤
@henokadisumebratu72684 жыл бұрын
do you have a live version of this which can detect from webcam , please
@heyawaltuh3 жыл бұрын
cap = cv2.VideoCapture(0)
@rio24145 жыл бұрын
can i use this for movement shapes
@memonaijaz54295 жыл бұрын
How can i get there x,y coordinates values?
@SigmaLiving4 жыл бұрын
Did you ever solve this?
@ndsingh23684 жыл бұрын
any luck in getting shapes x, y coordinates?
@gurakashsidhu82562 жыл бұрын
Hi guys I was just wondering if I could use this code for nuts shape classification and detection? any help is appreciated.
@danielmeireles13 жыл бұрын
Thanks for sharing!
@surajveertalreja94384 жыл бұрын
what if the object is a vehicle or plant? we can definitely identify them but how can we name it? like we used 3 sides for triangle and so on. What can be the logic to name car and say cactus?
@kumarabhishek56524 жыл бұрын
maybe car would fall in the category of trapezoid.
@theearthish4 жыл бұрын
That falls under object recognition
@jun27054 жыл бұрын
Thanks for this great video!
@fun-ih5sc4 жыл бұрын
Can anybody tell me why it is multiplied with "0.01" at 5:40 ,Line no: 10. I was liking his way of explaining things but totally disappointed now. Not explaining basic only -_- 👎
@shubhambagdare66004 жыл бұрын
Did u listen to the whole thing? The closer your epsilon value is to 0, the more precise is your approximation of the curve and so your shape will be detected more precisely. Learn to listen.
@adityaanand56864 жыл бұрын
@@shubhambagdare6600 Did u listen to the whole thing? Where it is mentioned "The closer your epsilon value is to 0, the more precise is your approximation"?? Btw thanks for clearing my doubt.
@rishabhkumar84153 жыл бұрын
@@adityaanand5686 You are fool someone is helping you and you are giving reply to him in negative way instead of Say Thanks
@பி.அம்ரித5 жыл бұрын
sir what is the aspect ratio for rectangle because i want do for trapozoids also...!
@venur81534 жыл бұрын
Can u know aspect ratio of rhombus?
@TrungNguyen-tm6fd4 жыл бұрын
great. Thank you for this video.It helped me a lot.
@kamathprajna3 жыл бұрын
Does it works
@dandavatisuhas54284 жыл бұрын
how to detect the color of a simple shape in opencv ? could you please give me any references?
@mihirsrivastava24604 жыл бұрын
You here for eyrc?
@hardikkamboj35283 жыл бұрын
@Dandavati You can change the image to HSV, and then use value of Hue to detect the color.
@saifaldeenal74515 жыл бұрын
Thanks a lot, wonderful!
@sethwhite41554 жыл бұрын
I can't find the shapes image. Help?
@btigenie4 жыл бұрын
No matter what I try, I get the error - "too many values to unpack (expected 2)" on the countours definition line. I am running directly from the repo and with the downloaded image file noted in comments.
@abdeldjalilettaharboucetta22384 жыл бұрын
i think you run it in python 2 not 3 or you didnt upgrade the version of opencv
@Its-Not-Funny4 жыл бұрын
It is because , the findContours will give 2 outputs. May be you are giving like (contours = cv2.findcontours(" ") ). You have to give like( contours, _ = cv2. ........).
@beatrizaubele3693 жыл бұрын
Try with "_, contours, _ = cv2.findContours(thresh, cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE)" Too late but it can probably help someone in the future.
@venur81534 жыл бұрын
How to find colour of the shapes? Can anyone help
@RiteshNEVERUNIFORM4 жыл бұрын
Are you from Nirikshuk bot ?
@venur81534 жыл бұрын
@@RiteshNEVERUNIFORM yeah
@venur81534 жыл бұрын
@@RiteshNEVERUNIFORM I sort out this one but I am struggling in task _b
@pranitham15864 жыл бұрын
Did this code help u to solve nirishuk task 1
@abdeldjalilettaharboucetta22384 жыл бұрын
hi thanks for the tutorial can you tell us how we can do it in real time ? not just for an image ,and thank you
@nikhilrizal37294 жыл бұрын
What does ravel does
@Its-Not-Funny4 жыл бұрын
As per my knowledge , ravel will give the starting point of contour draw in img pixel. So x will give x- coordinate Y- gives y coordinate.
@kamathprajna3 жыл бұрын
@@Its-Not-Funny do this code works
@RahulKumar-tl4dv5 жыл бұрын
Thanks for video
@pedramtehranchi96535 жыл бұрын
Thanks a lot
@shashanksharmadon42954 жыл бұрын
thanks bro......
@InfoPOLRES3 жыл бұрын
You saved me woahhhhh from pepe's fury
@puturoi4 жыл бұрын
неужели нельзя приложить файл с этой е.бучей картинкой?
@karishmatyagi35854 жыл бұрын
Instead of displaying the shape name once, it shows multiple times. Anyone faced the same issue?
@HK-ct1tg4 жыл бұрын
I faced the same issue. Did you find a solution for it ?
@rishi24054 жыл бұрын
I had that too, the reason for mine was i didn't use elif for the other if statements after the first one
@gauninha124 жыл бұрын
Im also facing this problema, and im using elif statements though
@kamathprajna3 жыл бұрын
@@gauninha12 help??how?
@sushrutkenkre105 Жыл бұрын
Reduce the threshold. It is working perfectly after reducing. I changed mine from 240 to 225.
@NiteshGupta-jr6ib5 жыл бұрын
there are way too many ads in between.
@austinyan16164 жыл бұрын
You're only reading through the code. Total waste of time.
@HM-cw8im4 жыл бұрын
Have you watched the previous videos? Most of the functions are explained there.