Greetings,
I would like to remove the background automatically from photos. The object is a table that can move and can have some random objects on it. The background is a wooden floor that can have some random objects. I was wondering if I can mark the corners of the table with some special markers like QR codes or color dots and then remove everything outside the quadrilateral formed by the markers.
Cheers,
Vesa
Remove background using special markers
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Remove background using special markers
Measure the top left corner x,y and width and height of the region you want to keep and then use -crop WxH+X+Y +repage. See https://imagemagick.org/Usage/crop/#crop
_____________________
Please, always provide your IM version and platform when asking questions, since syntax may differ.
Also provide your exact command line and your images, if possible.
See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at http://www.imagemagick.org/discourse-se ... f=1&t=9620
If using Imagemagick 7, then see http://imagemagick.org/script/porting.php#cli
For novices, see
http://www.imagemagick.org/discourse-se ... f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
https://github.com/ImageMagick/usage-markdown
https://imagemagick.org/script/porting.php#cli
_____________________
Please, always provide your IM version and platform when asking questions, since syntax may differ.
Also provide your exact command line and your images, if possible.
See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at http://www.imagemagick.org/discourse-se ... f=1&t=9620
If using Imagemagick 7, then see http://imagemagick.org/script/porting.php#cli
For novices, see
http://www.imagemagick.org/discourse-se ... f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
https://github.com/ImageMagick/usage-markdown
https://imagemagick.org/script/porting.php#cli
Re: Remove background using special markers
That doesn't really help since there shouldn't be any manual interaction. Also the area is not a rectangle.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Remove background using special markers
You mentioned putting dots on the image. That means you have manual interaction. Please clarify or show an example image.
With 4 points, you can draw a polygon (quadrilateral) from the coordinates and then mask out the image.
If the dots are uniquely colored, then one could extract, in principle, the coordinates of the centers of the dots.
With 4 points, you can draw a polygon (quadrilateral) from the coordinates and then mask out the image.
If the dots are uniquely colored, then one could extract, in principle, the coordinates of the centers of the dots.
Re: Remove background using special markers
The dots would be physical dots, not marked afterwards to the image. The idea is that with some physical markers a software could automatically determine these positions and crop accordingly without any human interaction.
Re: Remove background using special markers
I think I got it. I'll put for example green dots on red background and use compare + maxima to determine the coordinates. Let's see how it works.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Remove background using special markers
This is like motion capture in the movies: targets are stuck to actors, the camera captures the actions, and computers replace the actors with animated figures.
The targets can be something like these (Windows syntax):
The circular target is better when you don't care about the orientation.
The targets can be something like these (Windows syntax):
Code: Select all
magick ^
-size 100x100 ^
xc:Black xc:White +append ^
( +clone -flop ) ^
-append +repage ^
mcTarget1.png
Code: Select all
magick ^
-size 200x200 xc:Black ^
-fill White -draw "circle 100,100 100,200" ^
-fill Black -draw "circle 100,100 100,180" ^
-fill White -draw "circle 100,100 100,160" ^
-fill Black -draw "circle 100,100 100,140" ^
-fill White -draw "circle 100,100 100,120" ^
mcTarget2.png
The circular target is better when you don't care about the orientation.
snibgo's IM pages: im.snibgo.com