[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: color border in image, drop everything outside of it



On Thu, Nov 26, 2020 at 01:22:51AM +0100, Emanuel Berg wrote:
> tomas wrote:
> 
> >> BTW maybe the AI people already have a true and tested
> >> algorithm for this problem?
> >
> > I repeat myself. It is a variant of flood fill. AI not needed.
> > Classical raster computer graphics stuff.
> 
> Well, AI or not, I remember the old graphics program (e.g.,
> MacPaint) did this all the time. Filled inner and outer regions.
> But these regions were uniform, that's the difference...

You don't listen. You don't follow the links. This way, we'll
run in loops (pun intended) for the rests of our lives (luckily
mine is about 3/4 done).

If the regions were uniform, we are talking straight, classical
flood fill, something you would have found out yourself by a
short look at the Wikipedia article I referenced in my last
mail.

The non-uniform case is why I was talking about a "variation"
of the flood fill algorithm. When programming it yourself,
you'd to tweak your comparison operator appropriately. When
doing it as a ImageMagick pipeline, you'd have to make "your"
region uniform first, à la

  convert <yourfile> -fuzz 10% -fill white -opaque <yourloopcolour> <yourfile.out>

or something. Then flood fill. Then use that as mask for your
original.

I'm not going to fill in the details. Gotta cook now.

Cheers
 - t

Attachment: signature.asc
Description: Digital signature


Reply to: