OpenCV Python Tutorial For Beginners 23 - Find and Draw Contours with OpenCV in Python

  Рет қаралды 96,992

ProgrammingKnowledge

ProgrammingKnowledge

5 жыл бұрын

In this video on OpenCV Python Tutorial For Beginners, I am going to show How to Find contours and draw contours using OpenCV in Python.
We will see what contours are. we will Learn to find contours, draw contours, we will see these functions : cv2.findContours(), cv2.drawContours().
The function retrieves contours from the binary image. The contours are a useful tool for shape analysis and object detection and recognition.
Gist of code I used in this video (Find and Draw Contours Tutorial ) - gist.github.com/pknowledge/af...
OpenCV is an image processing library created by Intel and later supported by Willow Garage and now maintained by Itseez. opencv is available on Mac, Windows, Linux. Works in C, C++, and Python.
it is Open Source and free. opencv is easy to use and install.
Starting with an overview of what the course will be covering, we move on to discussing morphological operations and practically learn how they work on images. We will then learn contrast enhancement using equalization and contrast limiting. Finally we will learn 3 methods to subtract the background from the video and implement them using OpenCV.
At the end of this course, you will have a firm grasp of Computer Vision techniques using OpenCV libraries. This course will be your gateway to the world of data science.
Feel the real power of Python and programming! The course offers you a unique approach of learning how to code by solving real world problems.
#ProgrammingKnowledge #ComputerVision #OpenCV
★★★Top Online Courses From ProgrammingKnowledge ★★★
Python Programming Course ➡️ bit.ly/2vsuMaS ⚫️ bit.ly/2GOaeQB
Java Programming Course ➡️ bit.ly/2GEfQMf ⚫️ bit.ly/2Vvjy4a
Bash Shell Scripting Course ➡️ bit.ly/2DBVF0C ⚫️ bit.ly/2UM06vF
Linux Command Line Tutorials ➡️ bit.ly/2IXuil0 ⚫️ bit.ly/2IXukt8
C Programming Course ➡️ bit.ly/2GQCiD1 ⚫️ bit.ly/2ZGN6ej
C++ Programming Course ➡️ bit.ly/2V4oEVJ ⚫️ bit.ly/2XMvqMs
PHP Programming Course ➡️ bit.ly/2XP71WH ⚫️ bit.ly/2vs3od6
Android Development Course ➡️ bit.ly/2UHih5H ⚫️ bit.ly/2IMhVci
C# Programming Course ➡️ bit.ly/2Vr7HEl ⚫️ bit.ly/2W6RXTU
JavaFx Programming Course ➡️ bit.ly/2XMvZWA ⚫️ bit.ly/2V2CoAi
NodeJs Programming Course ➡️ bit.ly/2GPg7gA ⚫️ bit.ly/2GQYTQ2
Jenkins Course For Developers and DevOps ➡️ bit.ly/2Wd4l4W ⚫️ bit.ly/2J1B1ug
Scala Programming Tutorial Course ➡️ bit.ly/2PysyA4 ⚫️ bit.ly/2PCaVj2
Bootstrap Responsive Web Design Tutorial ➡️ bit.ly/2DFQ2yC ⚫️ bit.ly/2VoJWwH
MongoDB Tutorial Course ➡️ bit.ly/2LaCJfP ⚫️ bit.ly/2WaI7Ap
QT C++ GUI Tutorial For Beginners ➡️ bit.ly/2vwqHSZ
★★★ Online Courses to learn ★★★
Get 2 FREE Months of Unlimited Classes from skillshare - skillshare.eqcm.net/r1KEj
Data Science - bit.ly/2lD9h5L | bit.ly/2lI8wIl
Machine Learning - bit.ly/2WGGQpb | bit.ly/2GghLXX
Artificial Intelligence - bit.ly/2lYqaYx | bit.ly/2NmaPya
MERN Stack E-Degree Program - bit.ly/2kx2NFe | bit.ly/2lWj4no
DevOps E-degree - bit.ly/2k1PwUQ | bit.ly/2k8Ypfy
Data Analytics with R - bit.ly/2lBKqz8 | bit.ly/2lAjos3
AWS Certification Training - bit.ly/2kmLtTu | bit.ly/2lAkQL1
Projects in Java - bit.ly/2kzn25d | bit.ly/2lBMffs
Machine Learning With TensorFlow - bit.ly/2m1z3AF | bit.ly/2lBMhnA
Angular 8 - Complete Essential Guide - bit.ly/2lYvYRP
Kotlin Android Development Masterclass - bit.ly/2GcblsI
Learn iOS Programming Building Advance Projects - bit.ly/2kyX7ue
★★★ Follow ★★★
My Website - www.codebind.com
DISCLAIMER: This video and description contains affiliate links, which means that if you click on one of the product links, I’ll receive a small commission. This help support the channel and allows us to continue to make videos like this. Thank you for the support!

Пікірлер: 56
@Iknowpython
@Iknowpython 5 жыл бұрын
Great content mean opencv is really a powerful library of python ...... It makes image recognition soo simple
@GseichtsG
@GseichtsG 4 жыл бұрын
Thanks for the Wonderful tutorial!
@asjadkhan854
@asjadkhan854 24 күн бұрын
Amazing video , concise and to the point.
@joao-tinti
@joao-tinti 4 жыл бұрын
I am from Brazil and the subtitles on your videos helps a lot to understand what you are saying
@tanmaykhandelwal901
@tanmaykhandelwal901 3 жыл бұрын
what do you do to understand him when he doesn't make sense or don't explain a topic
@pedramtehranchi9653
@pedramtehranchi9653 5 жыл бұрын
thank you so much
@davudsuleymanov1622
@davudsuleymanov1622 Жыл бұрын
Hi, thanks for video. The thresh value should be 200 because of getting green object contour and number of contours will be 10.
@nayakal5679
@nayakal5679 2 жыл бұрын
Awesome video 👏 this video is really helpful for us but I have a question how we can detect a particular word from text?
@shashanksharmadon4295
@shashanksharmadon4295 4 жыл бұрын
thanks bro.......
@ItsAdrish
@ItsAdrish 5 жыл бұрын
Nice. I want to be a programmer like you. I'm from India and I'm 16.
@maciejwozniak94
@maciejwozniak94 4 жыл бұрын
Hi, thanks for the videos, really useful. However total number of conturs is 10 (the thresh val has to be higher than 127, eg 150, otherwise the green object is made as a background)
@qh03nix
@qh03nix 4 жыл бұрын
maciej wozniak thank you! Do you know why it’s exactly at 150?
@maciejwozniak94
@maciejwozniak94 4 жыл бұрын
@@qh03nix doesn't have to be exactly 150, just try different values and see which one it s working better ;)
@novinnouri764
@novinnouri764 Жыл бұрын
thanks
@jeepjr
@jeepjr 2 жыл бұрын
Teacher, first congratulations for the channel. I need your help, I have a simple image with a range of 5 placements where the quantity is identified, how do I identify the biggest color type red and say where the X,Y is, and if you can help me, and only for create an alert.
@jinchengau4225
@jinchengau4225 2 жыл бұрын
Hi, can we rename the contours, hierarchy into contours1, hierarchy?
@rohitdoyal8226
@rohitdoyal8226 3 жыл бұрын
Sir can you please explain why green circle is not bound with boundary , I use different color for that but answer is same
@KKMaity
@KKMaity 3 жыл бұрын
any way to find center coordinates of a circle?
@_ishraqaldagamseh7664
@_ishraqaldagamseh7664 4 жыл бұрын
Thank you for video, but i have error in imgrey line
@anefuoche1053
@anefuoche1053 2 жыл бұрын
Please how can I make it 4 channels after adding edges? Assuming I did not make my image Gray
@loektenbosch8110
@loektenbosch8110 3 жыл бұрын
After line 7 (@3:49), I get the following error: "ValueError: too many values to unpack (expected 2). Who can help me / point me in the right direction (yes, I already used Google).
@Kennerdoll
@Kennerdoll 2 жыл бұрын
Is it possible that the number of contours can be different for the same image? have downloaded 3 OpenCV logo images and am getting different number of contours on each image 5, 12, 7 respectively
@emirgundogan6623
@emirgundogan6623 4 ай бұрын
I also getting same result I think it is normal and it changes images to images
@md.imrulhasan8757
@md.imrulhasan8757 4 жыл бұрын
Thanks for your important video SIr. But why the Green object is not rounded by lines? please have a look,
@tanmaykhandelwal901
@tanmaykhandelwal901 3 жыл бұрын
green part is also bordered but you can't see it since both the border and object are green, if you make border of some other color you can differentiate easily.
@julianmartinez6729
@julianmartinez6729 4 жыл бұрын
Zorry, this how is possible , if the number of contours really is 12? by the contour into the words, your conut is 9, I made the same example and my result was 12. Thank you
@barlospalos3780
@barlospalos3780 4 жыл бұрын
do you guys know where i can get that sample video (vtest.avi)? please help
@tanmaykhandelwal901
@tanmaykhandelwal901 3 жыл бұрын
it is in the github repo of opencv i.e. github.com/opencv/opencv -> samples -> data
@urvishmahajan
@urvishmahajan 3 жыл бұрын
2:29 What do you mean by type = 0 ?
@govinwithflow
@govinwithflow 4 жыл бұрын
Code to find largest contour for the same ?
@HM-cw8im
@HM-cw8im 3 жыл бұрын
Thank you for this video. For the logo image, I am getting the count of contours as 19. And, whenever I am trying to draw the contours over the original image with the index value as -1, only the border of the green circle is being drawn over. For the other circles, a few points on the border is being highlighted, but the curve is not being drawn. Could you please help me out with this?
@sergioorozco7331
@sergioorozco7331 3 жыл бұрын
I had the same issue. the problem is that the threshold specified in the video is too high for the image you have. change the following code: ret,thresh = cv.threshold(imgray,127,255,0) to: ret,thresh = cv.threshold(imgray,20,255,0)
@shawnarmstrong3339
@shawnarmstrong3339 3 жыл бұрын
@@sergioorozco7331 Helpful, thanks. In addition, the image he is using within the video isn't the same image in the current repository. The "opencv-logo.png" was modified in July 2020; the image was made transparent.
@CodingAhead
@CodingAhead 6 ай бұрын
replace "thresh" with "imgray" on line 7
@rohannayak5971
@rohannayak5971 3 жыл бұрын
why is threshold value required for finding Contour
@abdultaufiq2237
@abdultaufiq2237 3 жыл бұрын
Hi all, if anyone is getting error while calling the contour method and using HSV colorspace for matplotlib then remove the HSV color space. This method doesn't work with hsv color space
@RECORDETO
@RECORDETO 4 жыл бұрын
how to print number of contour in the image, not in the cmd panel and select it by type the keyboat sir,,,????
@abdultaufiq2237
@abdultaufiq2237 3 жыл бұрын
use cv2.putText ( ) method
@harsh_dn
@harsh_dn 3 жыл бұрын
Why the opencv logo background is black? The texts written are also not visible.
@s.m.rizwanurrahman6605
@s.m.rizwanurrahman6605 3 жыл бұрын
because you are using a black background image, try to download a white background image
@komalthakur9812
@komalthakur9812 3 жыл бұрын
why am i getting this error: projects\opencv-python\opencv\modules\imgproc\src\contours.cpp:197: error: (-210:Unsupported format or combination of formats) [Start]FindContours supports only CV_8UC1 images when mode != CV_RETR_FLOODFILL otherwise supports CV_32SC1 images only in function 'cvStartFindContours_Impl'
@theshishir24
@theshishir24 2 жыл бұрын
The input image is not loaded.
@rustamtemirov3156
@rustamtemirov3156 4 жыл бұрын
Can anybody help me? contours, hierarchy = cv2.findContours(thresh, cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE) cv2.error: OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\imgproc\src\contours.cpp:197: error: (-210:Unsupported format or combination of formats) [Start]FindContours supports only CV_8UC1 images when mode != CV_RETR_FLOODFILL otherwise supports CV_32SC1 images only in function 'cvStartFindContours_Impl'
@medchaoukiayadi9997
@medchaoukiayadi9997 4 жыл бұрын
me too i get the same probleme
@ansylpinto2301
@ansylpinto2301 3 жыл бұрын
canny edge was not used at all
@hoangnamnguyencao7004
@hoangnamnguyencao7004 4 жыл бұрын
In this line: contours,hierachy = cv2.findContours(thres,cv2.RETR_TREE,cv2.CHAIN_APPROX_NONE). I have a probem ValueError: too many values to unpack (expected 2). Anybody can help me to solve this problem :( Thanks anyway.
@sayaleepethe
@sayaleepethe 4 жыл бұрын
thres image should be binary
@hoangnamnguyencao7004
@hoangnamnguyencao7004 4 жыл бұрын
I solved this problem
@StevenEwaldGFX
@StevenEwaldGFX 3 жыл бұрын
@@hoangnamnguyencao7004 then say how!! why would you say you solved the problem without explaining how??
@_pawan.11
@_pawan.11 3 жыл бұрын
@@hoangnamnguyencao7004 can you explain plz???
@agamya8949
@agamya8949 3 жыл бұрын
contours = cv2.findContours(thresh.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE) use this
@dharampal8061
@dharampal8061 5 жыл бұрын
Sir is your throat not well?
@artem_nih
@artem_nih 2 жыл бұрын
No python 🥴 c++
@wahidullah85
@wahidullah85 4 жыл бұрын
Dear sir, please Reply to me to email that I sent to you through (contact) email.
Image Processing with OpenCV and Python
20:38
Rob Mulla
Рет қаралды 126 М.
Pray For Palestine 😢🇵🇸|
00:23
Ak Ultra
Рет қаралды 34 МЛН
ELE QUEBROU A TAÇA DE FUTEBOL
00:45
Matheus Kriwat
Рет қаралды 28 МЛН
Can you beat this impossible game?
00:13
LOL
Рет қаралды 49 МЛН
28 - Thresholding and morphological operations using openCV in Python
20:31
find and draw contours in open CV شرح عربي
11:18
Ahmed ibrahim
Рет қаралды 3,9 М.
Contour Detection with CV2 python | CV2 object detection | computer vision
13:23
When Maths Meet Coding
Рет қаралды 27 М.
Real time Shape Detection using Contours [9] | OpenCV Python Tutorials for Beginners 2020
20:24
Murtaza's Workshop - Robotics and AI
Рет қаралды 153 М.
Detect Edges with OpenCV and Python | Computer Vision Tutorial
20:47
Nicholas Renotte
Рет қаралды 28 М.
5 Useful Dunder Methods In Python
16:10
Indently
Рет қаралды 50 М.
26 - Denoising and edge detection using opencv in Python
20:59
DigitalSreeni
Рет қаралды 33 М.