note 28344 deleted from function.imagecopyresized by cece
| From: | cece@php.net | Date: | Sat, 16 Aug 2003 20:09:08 +0000 |
| Subject: | note 28344 deleted from function.imagecopyresized by cece | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-54450@lists.php.net to get a copy of this message | ||
Note Submitter: alaxweb@club-internet.fr
----
(i' am french so my english is not very good)
I have read 'imagecopyresized' notes, especialy on resampling algorythms (eg numeric
filtering). Honestly , I recommend the writers of this notes to read the state of art on numeric
filtering. Three remarks:
1/ The bicubic filter does not resume to a 4 Taps filter with each coefficient equal to 1/4 !!! this
is infantile !!!
2/ Using floating arythmetic is stupid too !!!
you must use Interger for all calculation else you loose a lot of precision.
3/ You must
a/ Have a table (interger values) which represent a sufficient set of samples of the SIN(x)/x
wellknow function (that is the impulse response).
b/ For each pixel, Find where the resized pixel is (on sin(t)/t in time space)
c/ In case of N taps, Maintains N previous computed pixels
d/ Make a sum of product (what you made directly !!!) with N coefficents ( in your case, all coeff
are equal, so it is the simple average !!! all your pixels have the same energy !!! it is stupid) In
fact, the values of N Coefficients must correspond to the sampled values of the response to the
Dirac of the filter you want (directly in time space). For information, to compute a pixel
(following the mathematic on numeric filtering) and AFTER correct resampling process is as follow:
In case of wellknow symetrical FIR filter class (N is even):
make => SIGMA for i=0..N of (Coeff[i]*Pixel[i+O]),
==>which output the filtered pixel @ position [i+O-N/2].
Finally:
1/ you use float (big mistake)
2/ your resize is ...I'm pulling my legs
3/ your output filter is ...I'm pulling my legs
Use internet to find theory on numerical filtering, please !!!
A php developper.