Control mouse with fly swatter! th-cam.com/video/VcnqoXxiz00/w-d-xo.html 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
Thanks man) Now I'm trying to do the same but with the video stream frames sourced from my webcam... it's more complicated and needs to take into a count some additional details.
Trully excellent...the only working solution One big question ...suppose the image had a little more info.... like 2 little birds flying near the face (NOT on the face) ...how could I have them removed ?
Contours are being detected and enumerated in this method so you just need to pick up relevant and drop those you don't need, I mean like birds near the face should also be detected just like the face ones but less significant in terms of weight/order, so I believe after a bit of tinkering it should finally work.
@@monkey_see_monkey_do Hi. I am able to convert image background to red,green or blue color but facing issue when I am trying to add white in the background. If I use (255,255,255) in the fill polygon and later perform the and operation, background does not change to white color, instead it gives the original image. Can you please help me with this.
@@heenagirdher6443 If clearly got what you've meant then the reason of such behavior is following: 255 in decimal is 0xFF in hex and 1111 1111 in binary so if you bitwise AND with the original image it would remain the same. However I'm not claiming that this is the case because I don't know how fill polygon works internally. A possible workaround might be the following: 1. Fill polygon with say green 2. Create a new mask and overlay the copy of this painted green shape onto it, then replace the background with white and the green with white manually 3. Use the mask to distinguish the pixels on the original image and turn them to 255 manually in a loop. This might not be the best ever idea if you need to it fast, for instance in a video.
@@monkey_see_monkey_do This approach isn't working. If I fill polygon with green and after that when I perform bitwise operation, value of every pixel color got change. As the color is dark so it is not recognized but after checking I come to know that value of pixels got changed.
Great tutorial! I have a question though.. how would I be able to segment an image from the background? Like if there was an object and behind it a blue background. How would I be able to just get the object without the blue background?
Face elements recognition makes sense on real photos. Here the black and white image serves the only purpose of having a small amount of contours to work with.
Hi great tutorial. I have one query, in my image what I have, I'm not getting the mask at the background. It is happening on the object. So could u plz provide me ur email id or Linkdin so that I can able to tackle this issue...?
Control mouse with fly swatter!
th-cam.com/video/VcnqoXxiz00/w-d-xo.html
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
Great video, chapter titles and intro all spot on man!!
Thanks man) Now I'm trying to do the same but with the video stream frames sourced from my webcam... it's more complicated and needs to take into a count some additional details.
Trully excellent...the only working solution
One big question ...suppose the image had a little more info.... like 2 little birds flying near the face (NOT on the face) ...how could I have them removed ?
Contours are being detected and enumerated in this method so you just need to pick up relevant and drop those you don't need, I mean like birds near the face should also be detected just like the face ones but less significant in terms of weight/order, so I believe after a bit of tinkering it should finally work.
Great video, thanks!
thanks
Very useful. Thanks a bunch.
You're welcome)
@@monkey_see_monkey_do Hi. I am able to convert image background to red,green or blue color but facing issue when I am trying to add white in the background. If I use (255,255,255) in the fill polygon and later perform the and operation, background does not change to white color, instead it gives the original image. Can you please help me with this.
@@heenagirdher6443 If clearly got what you've meant then the reason of such behavior is following: 255 in decimal is 0xFF in hex and 1111 1111 in binary so if you bitwise AND with the original image it would remain the same. However I'm not claiming that this is the case because I don't know how fill polygon works internally. A possible workaround might be the following:
1. Fill polygon with say green
2. Create a new mask and overlay the copy of this painted green shape onto it, then replace the background with white and the green with white manually
3. Use the mask to distinguish the pixels on the original image and turn them to 255 manually in a loop.
This might not be the best ever idea if you need to it fast, for instance in a video.
@@monkey_see_monkey_do This approach isn't working. If I fill polygon with green and after that when I perform bitwise operation, value of every pixel color got change. As the color is dark so it is not recognized but after checking I come to know that value of pixels got changed.
@@heenagirdher6443 and what if swap the values in mask?
Love it
🤘
Great tutorial! I have a question though.. how would I be able to segment an image from the background? Like if there was an object and behind it a blue background. How would I be able to just get the object without the blue background?
since this method is based on finding contours background color doesn't matter.
There is a video here in TH-cam in which someone explains how to remove the background, although I think it is not necessary
Any ideas about counting the number of times the same countur appears in the image?
How about getting binary image by canny instead of threshold and using a complicated picture! you may find it will be difficult to deal with.
Identify the eyes nose mouth hair in a black & white image and give it a color
Face elements recognition makes sense on real photos. Here the black and white image serves the only purpose of having a small amount of contours to work with.
Hi great tutorial.
I have one query, in my image what I have, I'm not getting the mask at the background. It is happening on the object. So could u plz provide me ur email id or Linkdin so that I can able to tackle this issue...?
See the email in about section