Control mouse with fly swatter!
• Mouse control with fly...
How to separate object from background using Python and OpenCV:
cv2.findContours(), cv2.fillConvexPoly() and and cv2.bitwise_and()
Here I've used an images with already defined edges for
simplicity, clarity and with didactic purposes in mind, however
this exact technique can be used to separate objects from RGB images
and place them on whatever backgrounds - it's just a matter of a few
additional steps of creating edge map from the image. It may be applied
to either photos or videos. Next tutorials would cover this topic in greater
details while in this video I wanted to emphasize the contours and masks.
00:00 Intro
00:56 Coding starts here...
01:10 Loading original image
04:18 Converting image to gray scale
05:06 Converting image to black and white
09:40 Extracting all contours
11:43 Extracting most significant contours
14:13 Traversing contours in various ways
18:29 Masking background
25:09 Placing object onto a new background
25:35 END RESULT & SUMMARY
Source code:
github.com/maksimKorzh/open-c...
OpenCV Tutorials playlist:
• Convert An Image To Gr...
Support the channel:
/ code_monkey_king
Негізгі бет Contours & Masks using Python & OpenCV - How to separate object from image background?
Пікірлер: 28