Skip to content

Improve LocalAverage binarizer by introducing the concept of 'background' #711

Closed
@axxel

Description

@axxel

Issues like #709 and #575 show a deficiency of the LocalAverage binarizer to make a sound decision if the local area does not contain both fore- and background. It then simply assumes it is looking at background (white). This leads to issues like the above mentioned where a greyscale inversion before the binarization leads to a different result. This is also the basic problem with images that are too high in resolution, where the 'local area' could end up being completely inside a black module and the binarizer ends up introducing white pixels inside black QRCode finder patterns, thereby destroying the pattern for later recognition. The tryDownscale feature was a means to cope with that.

Now I have another idea that might be able to fix both issues (writing it down here so I don't forget about it): Have the binarizer work in 2 stages where the first outputs one of 3 states for each pixel: black, white and void. Void meaning basically "no idea". Then in a second stage the void pixels are replaced by a hopefully performant version of "copy from the nearest non-void neighbor".

Thinking about it, this second stage would not be required to be repeated after the inversion, which makes it even more attractive. The biggest issue potentially killing it completely is the "performant" part.

In case someone happens to know the best algorithm for doing this, please let me know. To rephrase the problem: given an image which is all 'void' except one pixel white in the center of the left half and one pixel black in the center of the right half, what is the fastest way to fill the whole image such that the left half of it is white and the right half is black?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy