Fast DCT-based image convolution algoithms and application to image esampling and hologam econstuction Leonid Bilevich* a and Leonid Yaoslavsy** a a Depatment of Physical Electonics, Faculty of Engineeing, Tel Aviv Univesity, 69978, Tel Aviv, sael ABSTRACT Convolution and coelation ae vey basic image pocessing opeations with numeous applications anging fom image estoation to taget detection to image esampling and geometical tansfomation. n eal time applications, the cucial issue is the pocessing speed, which implies mandatoy use of algoithms with the lowest possible computational complexity. Fast image convolution and coelation with lage convolution enels ae taditionally caied out in the domain of Discete Fouie Tansfom computed using Fast Fouie Tansfom algoithms. Howeve standad DFT based convolution implements cyclic convolution athe than linea one and, because of this, suffes fom heavy bounday effects. We intoduce a fast DCT based convolution algoithm, which is vitually fee of bounday effects of the cyclic convolution. We show that this algoithm have the same o even lowe computational complexity as DFT-based algoithm and demonstate its advantages in application examples of image abitay tanslation and scaling with pefect discete sinc-intepolation and fo image scaled econstuction fom hologams digitally ecoded in nea and fa diffaction zones. n geometical esampling the scaling by abitay facto is implemented using the DFT domain scaling algoithm and DCT-based convolution. n scaled hologam econstuction in fa diffaction zones the Fouie econstuction method with simultaneous scaling is implemented using DCT-based convolution. n scaled hologam econstuction in nea diffaction zones the convolutional econstuction algoithm is implemented by the DCT-based convolution. A linea (apeiodic) convolution. TRODUCTO ~ a a h hna n (, K, ) n is a fundamental basic opeation in digital image pocessing. t is implemented by fast algoithms in tansfom domain, usually in DFT domain though FFT algoithms. Howeve, these algoithms compute a cyclic (cicula) convolution: athe than a linea one. a h n hna( n) mod (, K, Because in digital pocessing signals ae always given by a finite numbe of thei samples, any digital convolution algoithm equies one o anothe method fo detemination of signals and convolution enels outside thei boundaies. n ode to cope with this poblem, seveal DFT domain digital convolution methods wee suggested. n paticula, in Ref. [] zeo padding of both the signal and the enel is ecommended and in Ref. [] zeo padding of the signal and mio eflection of the enel is suggested. Howeve these methods, widely used in digital signal pocessing, suffe fom heavy bounday effects caused by discontinuities in signals due to zeo padding. A method of digital convolution that is vitually fee fom such bounday effects was suggested in [3-5]. Accoding to this method, signals ae extended to *bilevich@eng.tau.ac.il; http://www.eng.tau.ac.il/~bilevich/ **yao@eng.tau.ac.il; http://www.eng.tau.ac.il/~yao/ ) () ()
double length by thei mio eflection and the enel is zeo-padded to double length. This esults in the following convolution algoithm: [ DCT( DCT[ a ] R{ DFT[ SH( ZP ( h ))]}) + DcST( DCT[ a ] { DFT[ SH( ( h ))]} )] ~ a ZP whee DFT, DCT, DCT and DcST ae the Discete Fouie Tansfom, Discete Cosine Tansfom, nvese Discete Cosine Tansfom and nvese Discete Cosine-Sine Tansfom defined by: h a a, (3) DFT α DFT a a, (4) ( ) DCT + α DCT a a cos π, (5) ( DCT ) ( DCT ) ( DCT ) ( + ) α α + α cos π, (6) DCT ( DST ) ( DST ) ( DST ) ( + ) α α + α sin π ; (7) DcST ZP denotes a zeo-padding of { h to double length and SH denotes a shift by intege pat of the agument: R denotes a eal pat and factional tanslation algoithm [6]. SH } [ ZP ( h )] [ ZP ( h )] ( ) mod, whee denotes, (8) denotes an imaginay pat. The algoithm given by Eq. (3) was used to implement a p -. BOUDARY EFFECT SAFE DGTAL COVOLUTO DCT DOMA Algoithm given by Eq. (3) equies computing the nvese Discete Cosine-Sine Tansfom DcST which is not commonly available. Howeve DcST can be easily computed via DCT [7], and the Eq. (3) can be conveted into the following fom: + DCT( DCT[ a ] R{ DFT[ SH( ZP ( h ))]} ) ( ) { DcST( [ DCT[ a ] { DFT[ SH( ZP ( h ))]}] )}. This equation assumes computing DFT of the zeo-padded convolution enel of double length. Futhemoe, this equation can be conveted into the following fom that equies computing ove oiginal samples: DCT { [ ( ˆ DCT DCT a DCT )] DcST[ DCT DcST ( ˆ h + a h )]} [ [ ( ˆ DCT DCT a DCT )] { DCT[ ( DCT DcST ( ˆ h + a h ) ]} ], DcST whee and ae the type- Discete Cosine Tansfom and type- Discete Cosine-Sine Tansfom defined by: (9) ()
α K ( DCT ) DCT ( a ) a + ( ) a + a cos π (, K,,,, ), () α ( DST ) DcST ( a ) a sin π (, K,,, K, ) () and ĥ denotes a nomalized enel: hˆ h h if if if, K,. (3) Since the algoithm Eq. () opeates on signals of the oiginal length (and not double one) and fast FFT-type algoithms ae available fo computation of diffeent types of DCT/DcST tansfoms [8], the DCT convolution Eq. () can be computed in efficient way suited fo eal-time applications. 3. APPLCATOS The convolution algoithm Eq. () can be applied to vaious applications including esampling and hologam econstuction. As epesentative applications, we ll descibe a method of scaling and two methods of scaled hologaphic econstuction. 3. Scaling The input signal a has to be scaled by abitay scaling facto σ. n ode to map the cente of the input image into the cente of the scaled image, we have to intoduce the tanslational centeing facto : ( σ ) ( )σ (4) (the distance between the cente of the input image and the cente of the scaled image is equal to ). The scaled signal is computed in the following way [, 9]: ( σ ) ( )( ) SDFT (, ( ) ) ( a ) σ σ whee SDFT is the Shifted Discete Fouie Tansfom [4] defined by: ( ) σ, ( u)( v) ( u ) u, v, v uv α SDFT a a (5). (6) n the scaling method Eq. (5) the poblem of computation of scaled signal boils down to computation of convolution that is implemented in DCT domain using Eq. (). The peculia choice of phase factos in the Eq. (5) ensues that fo the eal input image the computed scaled image is eal and centeed coectly. Fo the case of zoom-out ( σ < ) the method Eq. (5) does not equie the low-pass pe-filteing of the input signal (because this pe-filteing is built-in in the DCT convolution Eq. (). The intepolation fomula of the scaling algoithm Eq. (5) is given by:
whee sincd σ n is a discete sinc function defined by: an sincd ; ; σ n, (7) Mx sin π sincd M ; ; x. (8) x sin π Examples of images obtained by the scaling method Eq. (5) with scaling facto σ implemented by the DFT convolution [] and by the DCT convolution Eq. () ae shown in Figue. As one can see, bounday effect in fom of heavy oscillations at the image bodes ae pesent in the esult of DFT convolution and ae absent in the esult of DCT convolution. Figue. Compaison of image scaling algoithms. Left: the oiginal image. Middle: the scaled image computed using DFT-domain convolution ( σ ). Right: the scaled image computed using DCT-domain convolution ( σ ). 3. Hologam econstuction with scaling n numeical econstuction of hologams it is fequently equied to econstuct images with diffeent scale facto commensuable with illumination wave length. The two most impotant methods of numeical econstuction of Fesnel hologams ae the Fouie econstuction algoithm (fo fa diffaction zones) and the convolutional econstuction algoithm (fo nea diffaction zones) [5, ]. The suggested above digital convolution algoithm can natually be employed fo solving this tas. Fo the Fouie econstuction algoithm, the econstuction and scaling can be pefomed simultaneously in one step while fo the convolutional econstuction algoithm the econstuction and scaling have to be pefomed in two steps. Fouie econstuction algoithm with scaling Fo Fouie econstuction algoithm, σ -scaled econstucted samples of the object wave font ae computed fom the α by the following fomula [5, ]: input hologam samples { }
[ σ ] σ ( µ σ + w) α ( µ σ ) w µ ( ) σ Theefoe the poblem of computation of scaled hologam econstuction boils down to the poblem of computation of convolution that can be implemented in DCT domain using Eq. (). Examples of Fouie hologam econstuction algoithm without scaling ( σ ) and with scaling ( σ ) ae shown in Figue.. (9) Figue. Fouie econstuction algoithm with scaling. Left: hologam econstuction without scaling ( ). Right: scaled hologam econstuction ( σ ). σ Convolutional econstuction algoithm with scaling Fo the convolutional algoithm, econstucted samples of the object wave ae computed fom the input hologam α by the following fomula [5, ]: samples { } whee fincd is a discete finc function defined by: a α fincd( ; µ ; w), () +
fincd ; q; x q x. () n this case, the poblem of hologam econstuction boils down to the poblem of computation of convolution that can be implemented in DCT domain using Eq. (). The function fincd is computed fom Eq. () using DFT. The scaled ( σ ) hologam econstuction a ~ is computed fom the hologam econstuction using scaling algoithm Eq. (5). Examples of convolutional hologam econstuction algoithm without scaling ( shown in Figue 3. a σ ) and with scaling ( σ ) ae Figue 3. Convolution econstuction algoithm with scaling. Left: hologam econstuction without scaling ( σ ). Right: scaled hologam econstuction ( σ ). 4. COCLUSOS The bounday effect safe DCT-domain convolution algoithm is pesented and applications of this algoithm to image escaling and scaled hologaphic econstuction ae povided. Thans to the availability of fast FFT-type algoithms fo computing tansfoms involved in the algoithm, the suggested DCT-domain convolution epesents a valuable altenative to DFT-domain convolution in eal-time video pocessing applications. REFERECES [] Stocham, T. G., High-speed convolution and coelation with applications to digital filteing, in [Digital Pocessing of Signals], Gold, B. and Rade, C. M., eds., 3 3, McGaw-Hill, nc. (969). [] Rabine, L. R., Schafe, R. W., and Rade, C. M., The chip z-tansfom algoithm and its application, Bell Syst. Tech. J. 48(5), 49 9 (May-June 969).
[3] Yaoslavsy, L., Bounday effect fee and adaptive discete signal sinc-intepolation algoithms fo signal and image esampling, Appl. Opt. 4(), 466 475 (July 3). [4] Yaoslavsy, L., [Digital Hologaphy and Digital mage Pocessing: Pinciples, Methods, Algoithms], Kluwe Academic Publishes (4). [5] Yaoslavsy, L., Discete tansfoms, fast algoithms, and point spead functions of numeical econstuction of digitally ecoded hologams, in [Advances in Signal Tansfoms: Theoy and Applications], Astola, J. and Yaoslavsy, L., eds., EURASP Boo Seies on Signal Pocessing and Communications 7, 93 4, Hindawi (7). [6] Yaoslavsy, L., Fast discete sinc-intepolation: A gold standad fo image esampling, in [Advances in Signal Tansfoms: Theoy and Applications], Astola, J. and Yaoslavsy, L., eds., EURASP Boo Seies on Signal Pocessing and Communications 7, 337 45, Hindawi (7). [7] Wang, Z., A fast algoithm fo the discete sine tansfom implemented by the fast cosine tansfom, EEE Tans. Acoust., Speech, Signal Pocessing 3(5), 84 85 (Oct. 98). [8] Bitana, V., Yip, P., and Rao, K. R., [Discete Cosine and Sine Tansfoms: Geneal Popeties, Fast Algoithms and ntege Appoximations], Elsevie Ltd. (7). [9] Deng, X., Bihai, B., Gan, J., Zhao, F., and Chen, R. T., Fast algoithm fo chip tansfoms with zooming-in ability and its applications, J. Opt. Soc. Am. A 7(4), 76 77 (Ap. ). [] Yaoslavsy, L., ntoduction to digital hologaphy, in [Digital Signal Pocessing in Expeimental Reseach], Yaoslavsy, L. and Astola, J., eds., Bentham E-boo Seies, 87 (9).