Tensor Parzen?

Discuss digital image processing techniques and algorithms. We encourage its application to ImageMagick but you can discuss any software solutions here.
Post Reply
BryantMoore
Posts: 56
Joined: 2011-04-23T22:21:52-07:00
Authentication code: 8675308

Tensor Parzen?

Post by BryantMoore »

I was playing around and this seems to be a really good filter, particularly with sigmoidal contrast in linear RGB.

Standard Parzen
Image

Parzen with Linear RGB and Sigmoidal Contrast of 8 (Maybe this could be lower?)
Image

Mitchell for reference
Image

Generated using this script.

Code: Select all

#!/bin/sh
for f in blackman box catrom cubic gaussian hamming hann hermite kaiser lanczos mitchell parzen point quadratic sinc spline triangle;
do
	#magick rose: -sample 1000% -define filter:blur=10 -define filter:filter="$f" -resize 100% -quality 9 10xrose-"$f"-conv.png
	#magick rose: -define filter:filter="$f" -resize 1000% -quality 9 10xrose-"$f".png
	magick rose: -colorspace rgb +sigmoidal-contrast 8 -define filter:filter="$f" -resize 1000% -sigmoidal-contrast 8 -colorspace srgb -quality 9 10xrose-"$f"-lrgb-sig8.png
done
What I like is that it doesn't suffer from ringing like a lot of filters while also being free from aliasing. I'm not an expert on filters so maybe someone else could clue me in on why that is.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Tensor Parzen?

Post by anthony »

If you check the graph of the windowing functions...
Image
you will see that parzen has the largest roll off of all the filters, which is why its negative lobe is so minimal.

Remember windowed filters, (like lanczos) or a equivelent, (like mitchell) is better suited for reducing image size, rather than enlargement. For major enlargement what should be used really depends on what aspect you are waning from the enlargement.

For enlargement having a fast roll-off is good, but you may be better off using an interpolative filter instead. For example Hermite, a interpolative-Gaussian (smaller sigma). Neither of which has any negative lobe to them. Mitchell and other Keys Cubic filters will trade blurring (extreme is Spline) for Sharpness (extreme is Catrom).

I suggest you read the filter section and try to understand the various filters. Comments on the explanations are welcome. I tried hard to make it understandable without using any heavy mathematics and Fourier frequency analysis.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: Tensor Parzen?

Post by NicolasRobidoux »

I myself like Parzen windowing a lot. I considered including it in "The Recommendations" (used to window EWA Jinc 3-lobes, it actually appeared in an unpublished draft). But it did not quite make the cut.
Maybe I'll have a second look.
There is a mathematical basis for "liking" Parzen-windowed Sinc 4-lobe:
Windowing approximates pre-filtering. Windowing a 4-lobe Sinc with Parzen approximates pre-filtering with cubic-B spline smoothing with frequency response set so that it low passes at exactly half the usual soft cut-off.
Last edited by NicolasRobidoux on 2012-10-21T09:43:47-07:00, edited 3 times in total.
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: Tensor Parzen?

Post by NicolasRobidoux »

And yes, such pre-filtering would be a good fit with sigmoidization, and I myself would use a slightly lower contrast.
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: Tensor Parzen?

Post by NicolasRobidoux »

Second look: it's too blurry.
The above explanation actually says why: The pre-filtering is even more blurring than standard cubic B-spline smoothing.
Although I agree that sigmoidization makes up for it somewhat.
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: Tensor Parzen?

Post by NicolasRobidoux »

Third look:
Indeed almost good enough.
It's going on my list of schemes to test carefully.
-----
Thank you Bryant. Very much.
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: Tensor Parzen?

Post by NicolasRobidoux »

It's very nicely anti-aliased, and yet it is an interpolatory method.
I'll also have to have a look at tensor Quadratic-windowed Sinc 3-lobe, which follows the same mathematical logic.

Code: Select all

-define filter:window=Quadratic -define filter:lobes=3 -resize
Last edited by NicolasRobidoux on 2012-10-21T10:03:54-07:00, edited 1 time in total.
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: Tensor Parzen?

Post by NicolasRobidoux »

Of course, one test image does not a winner make. But this is promising.
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: Tensor Parzen?

Post by NicolasRobidoux »

Yes, definitely a good partner for sigmoidization.
No time for this now, but I'll have to do a "full check".
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: Tensor Parzen?

Post by NicolasRobidoux »

BryantMoore
Posts: 56
Joined: 2011-04-23T22:21:52-07:00
Authentication code: 8675308

Re: Tensor Parzen?

Post by BryantMoore »

Nicolas, it seems windowing Parzen with Sinc gives it a touch of added sharpness, a sigmoidal contrast of 6 seems to also tighten up the edges just enough to add some further definition.


Image

Code: Select all

magick rose: -colorspace rgb +sigmoidal-contrast 6 -define filter:window=sinc -define filter:filter=parzen -resize 1000% -sigmoidal-contrast 6 -colorspace srgb rose.png
Image

Code: Select all

magick rose: -colorspace rgb +sigmoidal-contrast 6 -define filter:filter=parzen -resize 1000% -sigmoidal-contrast 6 -colorspace srgb rose2.png
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: Tensor Parzen?

Post by NicolasRobidoux »

Bryant:
Remember: You can't judge a scheme from one single test image and enlargement ratio, and the "rose" is "special".
I did a quick compare, and at this point I still prefer other schemes.
But indeed it is a solid one, and for this reason I added to the next update of "The Recommendations" a written note that Parzen works well with 4-lobes. (And yes: It's better with tensor Sinc and EWA Jinc. My quick back of the envelope jottings don't always land right.)
Thank you.
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: Tensor Parzen?

Post by NicolasRobidoux »

Right now, I prefer tensor Quadratic-windowed Sinc 4 over tensor Parzen-windowed Sinc 4, for example.
This opinion may change, however.
Post Reply