Hello there,
I was wondering if it is possible to remove a certain object from an image, for example a car, or a ball and save that output to an image?
For example, is it possible to extract just the car from this image: https://upload.wikimedia.org/wikipedia/ ... rvette.jpg
Usually people load the image in an image editing program like photoshop to outline the car and extract that way but I was wondering if this was possible with imagemagick.
Thank you in advance!
Is it possible to remove an object from image using IM
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Is it possible to remove an object from image using IM
You could get most of the red part of the car using
And then follow it with -connected-components to remove every red region that is not the largest in area. You could also get the black by similar means, but then you would need to remove the Corvette name and other black areas that are not part of the wheels. With a lot of work, I suppose you could get most of it.
But to get it all, you would most likely need to trace the outline by hand or use PS or GIMP outline tool to try snapping to the closest regions.
I do not know of any simple and reliable automatic means in IM to do that. For simpler, cleaner objects in consistent background color, the above command will typically work. But for complex images with lots of varying colors, this becomes much more difficult, especially since IM is mostly command line driven and has a very simple GUI. So there is no interactive snap-to tool.
Code: Select all
convert 2014_Chevrolet_Corvette.jpg -fuzz 20% -fill none +opaque "rgb(238,57,53" result.png
But to get it all, you would most likely need to trace the outline by hand or use PS or GIMP outline tool to try snapping to the closest regions.
I do not know of any simple and reliable automatic means in IM to do that. For simpler, cleaner objects in consistent background color, the above command will typically work. But for complex images with lots of varying colors, this becomes much more difficult, especially since IM is mostly command line driven and has a very simple GUI. So there is no interactive snap-to tool.