Page 1 of 1

How delete rows from pictures?

Posted: 2019-10-16T19:36:05-07:00
by maximlarin
Image
Image

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

Re: How delete rows from pictures?

Posted: 2019-10-16T19:46:39-07:00
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.)

Re: How delete rows from pictures?

Posted: 2019-10-16T20:17:41-07:00
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 ^
  justGrog.jpg
Image