Log in

View Full Version : What is the blurriest image downscaler?


luquinhas0021
24th July 2017, 20:19
The blurriest image downscaler which doesn't produce other artifacts, like aliasing, Moiré, color/bright change, edge distortion (Unless blur) or new strange details, like lines or whatever that wasn't in image.

burfadel
24th July 2017, 20:36
Are you asking in regards to a specific purpose? Avoiding artifacts all together can be difficult for a resizer, simply because it is trying to keep the picture intact as much as possible whilst reducing the resolution. This can result in the artifacts you described. Probably the most ideal solution for your query is to use a simple pointresize, then apply a post resize blur using blur, or Gblur (gaussian blur) from Modplus.

luquinhas0021
24th July 2017, 20:46
Are you asking in regards to a specific purpose or application?

Yes. It's for image upscaling, which can de done by downscaling a n x n part of an image using the downscaler I asked for, two times in each dimension. Then, I upscale it, two times in each dimension, too, using a super preserve detail and sharpness upscaler. So, I will have the original n x n part and the upscaled n x n part. Comparing this two, I will estimate the point spread function of the upscaled n x n part, in relation with the original one. This will be done with many, many, many n x n parts of image, generates randomly, and it will be passed into a neural network, for it learned the psf of a upscaled n x n part of this multiple images and try deconvolve them.

burfadel
24th July 2017, 20:57
Unfortunately that won't work. If you downsize the image half vertical and half horizontal, you will be left with an image a quarter of the original resolution. You are reading four pixels and resulting with one, so any information in those pixels is either lost or combined to get to the one resultant. If you then blur there simply won't be the information to result a higher quality image than what you started with, or at least one with desirable results.

I do understand your concept though, but the resizing part doesn't make sense when you could just apply Gblur for a more accurate result. In some ways what you suggested sounds like an adaptive unsharp mask. There are other ways of going what you suggest, like creating advanced masks in MaskTools, but that would be better described by someone that knows how to manipulate those functions.

raffriff42
24th July 2017, 21:07
GaussResize (http://avisynth.nl/index.php/Resize#GaussResize)(width, height, p=19)
Lower p is blurrier but may have a slightly blocky look - see this related thread (https://forum.doom9.org/showthread.php?t=174597).

Katie Boundary
27th July 2017, 08:02
The most notable property of bilinear resizing is that it is very blurry, but produces no other artifacts. However, like almost every other resizer in existence, it will very slightly alter the color and brightness of the image (http://entropymine.com/imageworsener/filterfairness). The only known resizer that doesn't do this would be area-averaging, AKA pixel-mixing (http://entropymine.com/imageworsener/pixelmixing), which Chikuzen has implemented as Arearesize (https://github.com/chikuzen/AreaResize). Like bilinear, it produces a lot of blurring but no other artifacts.

raffriff42
27th July 2017, 14:28
The colors are perfect, but there are some edge artifacts. It's a gamma thing. Resizing should really be done in linear light.

I have remove_gamma and restore_gamma for this purpose. Requires AVS+ and high bit depth.
http://avisynth.nl/images/Utils-r41.avsi

1920x1080, bilinear resize /8, then point resized x2 for viewing. Left - normal. Right - linear light.
https://www.dropbox.com/s/7crjvrj4wrrjgub/downsize-gamma-test-2A-bilin.png?raw=1 https://www.dropbox.com/s/tb5j2zijqyz5zyp/downsize-gamma-test-2B-bilin%2Bgamma.png?raw=1

1920x1080, gauss resize (p=1) /8, point resized x2 for viewing. Left - normal. Right - linear light.
https://www.dropbox.com/s/2hq0jqzwn164yny/downsize-gamma-test-2E-gauss1.png?raw=1 https://www.dropbox.com/s/q6mgkpk5kxz0c8t/downsize-gamma-test-2F-gauss1%2Bgamma.png?raw=1

The color bars may look different, but they are identical. They look different because the transitions are darker. To see this, probe them with a tool such as ColorPic (http://www.iconico.com/colorpic/).

EDIT use GaussResize(..., p=1) for extreme blurring

EDIT better post muh script. :script:
Like I said, requires AVS+ and my Utils-r41.avsi (http://avisynth.nl/images/Utils-r41.avsi)ColorbarsHD2(1920, 1080, rgb_out=1>0, bits_out=16)
gamma=1>0
remove_gamma(gamma)
#[[
#BilinearResize(Width/8, Height/8)
GaussResize(Width/8, Height/8, p=1)
#]]
restore_gamma(gamma)
ToVdubFM

raffriff42
29th July 2017, 04:17
For those of you who like to look at things other than color bars (why??), here's a real world example

https://www.dropbox.com/s/1menpowfgqjqb5n/downsize-gamma-test-2x3%20%28bilin%2C%20org%2C%20bilin%2Bgamma%29.jpg?raw=1
Left=Bilinear; Right=Bilinear, linear light.
Center=cropped samples of the original: compare the detail of the white mortar and the dark ironwork -- you decide which is more accurate.
Make sure your browser is showing the image at 100% size!

(can't recall where the original came from, but this (http://safemen1992.com/image/923532798/) is basically the same image; University of Toronto, Soldier's Tower)

Katie Boundary
6th August 2017, 03:44
2C%20bilin%2Bgamma%29.jpg?raw=1[/img]
Left=Bilinear; Right=Bilinear, linear light.
Center=cropped samples of the original: compare the detail of the white mortar and the dark ironwork -- you decide which is more accurate.

They look identical to me.

poisondeathray
6th August 2017, 03:49
They look identical to me.

They are quite different - Pay attention to the boundaries, Ms. Boundary :D ;

Load them in tabs in something like avspmod, or a browser flip back & forth between tabs . Avspmod is nice because you can use the number keys to do this

Katie Boundary
6th August 2017, 04:02
They are quite different - Pay attention to the boundaries, Ms. Boundary :D ;

Load them in tabs in something like avspmod, or a browser flip back & forth between tabs . Avspmod is nice because you can use the number keys to do this

I opened it in MSpaint twice, hit select all, and dragged one copy of the image to the let of the screen so the two images would be in the same place. The image on the right is slightly brighter or paler than the one on the left, but not by enough of a margin for me to determine which one more closely resembles the images in the center.