On Sun, Nov 22, 2020 at 03:11:21AM +0100, Emanuel Berg wrote: [...]
> start at (0, 0) - this is the top-left pixel, as you know - is > this color gray? answer: no. go to (1, 0) etc until you get to > a grey pixel. at that point, discard all pixels until then. > and don't look any further to the right on that row! > > do this for all rows from left to right, top to bottom. > > after that, do the same but search top down instead, so after (0, > 0), go to (0, 1). discard pixels vertically upon gray. and stop. > > do the same from right to left and bottom to top! > > Encirclement! You are (nearly) describing flood fill. Except that the operator is ≠ instead of = or, perhaps you have two phases, one with "≠ grey" and then one with "= grey" to also eliminate the doodle. I really, strongly suggest you play around with ImageMagick and "connected component labeling". Here[1]'s the ref, in case it got lost in the intratubes. Cheers [1] https://imagemagick.org/script/connected-components.php - t
signature.asc
Description: Digital signature