How delete rows from pictures?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Posts: 2
Joined: 2019-10-08T04:17:21-07:00
Authentication code: 1152

How delete rows from pictures?

Post by maximlarin »


How to remove arrows from photos without losing quality photos?
The arrows always have the same appearance, but they are located in different ways.
Unfortunately, I could not find similar examples on Russian forums.
Thanks in advance for your help
User avatar
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How delete rows from pictures?

Post by fmw42 »

I am not sure there is a simple easy answer.

The line on the right can be chopped off by using -chop. Or use connected components to located the small lines and numbers and fill those regions with white.

The diagonal line is much harder. The only thing that comes to mind is changing the black color in the arrows to white using -fuzz XX% -fill white -opaque black.

(You can also look to OpenCV contours to find those objects and fill the contour's rotated bounding boxes with white.)
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How delete rows from pictures?

Post by snibgo »

For the examples given, connected components would work. Turn non-white into black, with a fuzz factor eg 5% because the input is JPG. Find the largest black object. Use that as a mask to get just the object.

Code: Select all

magick dimmed02.jpg ^
  ( +clone -fuzz 5% -fill Black +opaque white ^
    -define "connected-components:mean-color=true" ^
    -define connected-components:verbose=true ^
    -define connected-components:area-threshold=10000 ^
    -connected-components 4 -negate ^
  ) ^
  -alpha off -compose CopyOpacity -composite ^
  -background White -compose Over -layers Flatten ^
snibgo's IM pages:
Post Reply