note 28344 added to function.imagecopyresized

From: Date: Fri, 10 Jan 2003 04:32:15 +0000
Subject: note 28344 added to function.imagecopyresized
Groups: php.notes 
Request: Send a blank email to php-notes+get-41938@lists.php.net to get a copy of this message
(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. -- http://www.php.net/manual/en/function.imagecopyresized.php http://master.php.net/manage/user-notes.php?action=edit+28344 http://master.php.net/manage/user-notes.php?action=delete+28344 http://master.php.net/manage/user-notes.php?action=reject+28344

« previous php.notes (#41938) next »