Downsampling of binary images

The spy-style printing of sparse matrices that landed in v1.6 is awesome, but it turns out that the downsampling used for very large matrices has some aliasing issues, see Spy printing of sparse matrices is inaccurate · Issue #40799 · JuliaLang/julia · GitHub. It is well known that aliasing can be avoided if the image is blurred before downsampling, but this simple trick does not apply here because we only have binary black/white rather than grayscale pixels. I was therefore wondering whether downsampling of such “binary” pictures is a known problem in the image processing community and whether there are any known solutions to this problem.

I believe the above is a good starting point for the discussion, but for completeness I would like to also point out that binary pixels is in fact only one of several issues which separate spy plot compression from image compression. Other issues include:

  • The “pixels” in a unicode spy plot are much larger than your typical image pixel.
  • Unlike in a real picture, we probably want some preservation of information here in the sense that if we have an isolated nonzero entry, then we want that entry to be visible even in the downsampled picture.
1 Like