Having explained how contours work, Patrick now shows how to generate and display contours found in an image. This function call generates all the contours in an image and draws these outlines onto a displayed image—and even allows you to fill the areas. There are some additional settings and certain preprocessing you can do to improve or adjust the desired output of contours.
- [Instructor] Now that we have an understanding…of how contour works, let's see how to use them with…Python 3 and OpenCV3.…As a first step, let's convert this into a grayscale…image using gray…equals…cv2 dot…cvtcolor, where the C in color is capitalized.…We'll pass in our image then we'll type cv2 dot…color underscore…RGB 2 G-R-A-Y, noting that that is in capitalized…and then let's create a quick threshold using…thresh equals…cv2…dot…adaptive…threshold, noting the T in threshold is capitalized,…and then we'll pass in our gray image using…gray and then the maximum value of a pixel in that image,…255.…
Followed by cv2 dot and then in capitalized adaptive…underscore thresh underscore…gaussian,…g-a-u-s-s-i-a-n,…underscore c,…comma…and then we'll type cv2 dot…thresh…underscore binary…for the output threshold type…and then we'll type 115 which indicates the area…over which the adaptive thresholding will apply…and then a value of one.…Next, let's show our threshold using cv2 dot…imshow and then binary…and then pass in our thresh object.…
AuthorPatrick W. Crawford
- Installing and configuring OpenCV
- Data types and structures
- Image types
- Manipulating pixels
- Scaling and rotating images
- Using video inputs
- Creating custom interfaces
- Object detection
- Face and feature detection
- Template matching
Skill Level Intermediate
NumPy Data Science Essential Trainingwith Charles Kelly3h 54m Intermediate
Python: Programming Efficientlywith Michele Vallisneri2h 15m Intermediate
1. Install and Configure OpenCV
2. Basic Image Operations
3. Object Detection
4. Face and Feature Detection
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.