Page 1 of 1

Auto Filter Expert setting do not match Keys Filter

Posted: 2009-06-21T02:17:40-07:00
by Carlos82
Setting C = 0.5 results in B = 0.25, when it should be 0.0 as the Catrom filter.

So:
convert rings_lg_orig.png -filter Cubic -set option:filter:c 0.5 -resize 600x rings_lg_orig_im_cubic_c05.png

gives the same result as:
convert rings_lg_orig.png -filter Cubic -set option:filter:b 0.25 -set option:filter:c 0.5 -resize 600x rings_lg_orig_im_cubic_b025_c05.png

As reported by compare.exe.

Regards.

Re: Auto Filter Expert setting do not match Keys Filter

Posted: 2009-06-21T21:20:40-07:00
by anthony
Could your IM be older than version 6.3.7-1 whcih was when I did ten re-programming o fthe filters with the addition of the Expert Controls.

If it is older than the settings would not work and all you would get is the default cubic filter which uses the values B=0 C=1

As such on an IM that is too old you would get the same result.


I checked the source code, and added a debugging print to the handling of B and C
-set option:filter:b 0.0 -set option:filter:c 0.746
sets B=0.000000 C=0.746000

-set option:filter:b 0.25 -set option:filter:c 0.5
sets B=0.250000 C=0.500000

A flicker comparison using
http://www.imagemagick.org/Usage/scripts/flicker_cmp
of the two images rings_lg_orig_im_cubic_c05.png and rings_lg_orig_im_cubic_b025_c05.png
shows a definite difference in results with a less blurred (more aliased) result for the first image (b=0).

Code: Select all

compare -metric PAE rings_lg_orig_im_cubic_b025_c05.png \
         rings_lg_orig_im_cubic_c05.png null:
6425 (0.0980392)
A peak difference of about 10% so I would definably not say they were the same.

Re: Auto Filter Expert setting do not match Keys Filter

Posted: 2009-06-22T02:48:35-07:00
by Carlos82
Sorry the first command was wrong, I have edited the first post to fix it.

The version is 6.5.3-0 as reported by convert -version.

Re: Auto Filter Expert setting do not match Keys Filter

Posted: 2009-06-22T08:54:14-07:00
by Carlos82
Do you get the same result now?

Regards.

Re: Auto Filter Expert setting do not match Keys Filter

Posted: 2009-06-22T17:17:35-07:00
by anthony
Hmm yes they appear the same now... Checking with a debug statement...

Re: Auto Filter Expert setting do not match Keys Filter

Posted: 2009-06-22T17:59:01-07:00
by anthony
Hmmm...

Code: Select all

convert rings_lg_orig.png -filter Cubic -set option:filter:c 0.5 -resize 600x rings_lg_orig_im_cubic_c05.png
when C=0.5 but B is undefined , so IM set B to 0.25

that is definitely not correct... For a Keys filter B should be set to 0 to
create a Catmull-Rom Filter (equivelent to -filter catrom)

The opposite also does not seem to be right.. B=0.25 causes C to be 0.5

I think my formula is wrong...

Hmm going back to basics, a Keys filter is when... 2*C + B = 1
So B = 1-2*C or C = (1-B)/2
yes that checks out

Hmmm In my code I have
C=1.0-2.0*B and B=(1.0-C)/2.0
Damn I had the right formulas but with B and C swapped!! Fixing.

thank you for the pickup. This has been fixed, and will be release in IM v6.5.4-1

I will also note that automatic selection of the keys filter was broken in IM examples up until that version.

Thank you for the bug report.