Re: [PATCH] Improve computation of filter scale factors

Bill Spitzak <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
I have had much better results using the values called alpha_x and 
alpha_y as the scale factors.

This preserves the *area* of the parallelogram. Using the bounding box 
produces excessive blur (though this appears to be using the bounding 
box of an ellipse inscribed in the parallelogram, which is better).

These are calculated from the inverse matrix (ie they get larger as the 
image is scaled smaller). I am unsure if hypot produces the inverse 
values from the forward matrix. In general I recommend using the inverse 
matrix for all calculations.

[email protected] wrote:

> +	alpha_x = hypot (pattern->matrix.xx, pattern->matrix.xy);
> +	alpha_y = hypot (pattern->matrix.yx, pattern->matrix.yy);
> +	det = pattern->matrix.xx * pattern->matrix.yy - pattern->matrix.xy * pattern->matrix.yx;
> +
> +	/* αx, αy are non-zero, since they can only be zero if Axx=Axy=0 or Ayx=Ayy=0,
> +	 * assuming quality implementation of hypot(), and then D would be zero,
> +	 * which is not allowed for a pattern matrix. */
> +	scale_x = sqrt (fabs (det) * alpha_x / alpha_y);
> +	scale_y = sqrt (fabs (det) * alpha_y / alpha_x);
-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.