Sei sulla pagina 1di 2
6182015 Image processing - Pee cade for Blockase Non Lecal Means nese reduction algorithm - Stack Overtiow ‘Stack Overflow is a question and answer site for professional and enthusiast programmers. I's 100% free. Pseudo code for Blockwise Non Local Means noise reduction algorithm Cpa etd samt Mees een ead Ciel a kege aa [cprrneror] « | have implemented a rice algattm (Non Local Means") for reducing noise inimage. It's based on is Matlab implementation. ‘The problem with NLMeans is thatthe criginallgorthm is slow even on compiled languages lke clo++ and iam trying fun it using scripting language. (One of best solutions is to use improved Blockwise NLeans algorithm which is ~60-80 times faster. The problem is thatthe paper which descibes iis witten in a complex mathematical language and is realy hard for me to understand an idea and program it (es, | didt eam man at college). ‘Thats why i am desperately looking fora pseuto code ofthis algorithm. (cvodcaton of original Matiab implementation would be just perfect) oa Oct 31°11 a ae asked Aug 12°11 at 1454 Bi: “Temoe Mats is probably ane of the languages ha is closest othe material notation, | ub you al fd omecne fo tranaat frye, ut suggest you look up the symbols al you shod ted the Maia tats tobe vary goog maton - rs: Aug 121 at 1208 Felt am ot asking to translate Matis code. ts prety stalghormard jt cout Fe ary metab implementation of Blackwvse Nimears-~‘Tetos Aug 22°41 st 8.48 1 Answer | adit, Iwas intgued uni saw the result - 260+ seconds on a dual core, an that doesnt assume tne overhead ofa scripting language, ad that’s forthe Optimized Block Non Local Means ter. Let me break down the math for you~ My idea of pseudo-code fs writing in Ruby. Non Local Means Filtering ‘Assume an image thas 200. 100 pixels (20000 picts toa), which is a petty try image. Were {going to have to go trough 20,000 pxels and evaluate each one onthe weighted average of the other 19,988 pixels: [Sory about the spacing, but the equation sinlerpeted asa lnk without) NEMO =F mG pvO HE where 0 wi) $1 and 5 wy) Understandably, this last part canbe aie confusing, bu this is cealy nothing mare than a Convolution fiter the size ofthe whole image being applied to each px Blockwise Non Local Means Filtering ‘The blockwise implementation takes overlapping seis of voxels (volumetric pixels - the Implementation you ported us toi for 30 space). Presumably taking a similar approach, you outa apply ths to 20 space, taking sels of overlapping pies. Lets see f we can describe ths NL) = MAE wh D4) Where Aisa vector ofthe pels tobe estimated, and similar cicumstances as above are InipletackoverRow comiqustions/7041697Ipeeuto-code-fr-blockwise-nonlocal-meant-nase-reducn-slgortim we 6182015 Image processing - Pee cade for Blockase Non Lecal Means nese reduction algorithm - Stack Overtiow apoled. [NB: I may be sigitly of I's been a few years since Idd heavy image processing] Algorithm In al tkethood, we're talking about reducing complexty of the algo ata minal cost to reduction quay. The lager the sample vector, te higher the quality as well as the higner the complexity. By overlapping then averaging the sample vectors from the image then applying that ‘weighted average io each pixel were loping through the image far fewer times. + Loop through the image to collect the sample vectors and store their weighted average to an array. + Apply each welghted average (a number between 0 and 1) to each pxel times the leeks value. Prety simple, but the processing time is going tobe horrid with larger images. Final Thoughts Youte going o have to make some tough decisions. It youre gong o use a serpting language, ‘youre ateady dealing with significant interpretive overhead. It's far from optimal to use a sexpting language for heavy duty image processing. If youre not processing medical mages. in all Tketnood there are far beter algorithms fo use wih lesser O's, Hope this helpful. ™m not erly good at making @ point clearly and concisely, soi can clay anything, lt me know. newer Aug 19°11 at 740 ‘Thank you slaw. | have our way to we ockorse nner. is Sl vary slow bu am apizng tne code Hope have ame ests wihn a day ara. eros. Aug 22°11 a 853 Regarding your wos about types of images ard ho agorth | am not processing mesicalimagos, | 3m fargo el color mages, The reason wey ‘ve ehanen ths algo stats one of he Bost an ‘oud some preusa cade for. For exale ete we wher very ice algottins Ie OCT a SMSO {which s best) ut harato find Some wacing exarses. And ater algorthns dort prouce the rest fm epocing.— Tomes Aug z2 11 at 7-01 ‘The reason | ki that usuly that evel of processing I reseed for mesa, ha the pleasure of worn fa a conan back wound 2005 tet mage processing fr video, Medea, and esin secur. For vido, to empnasis was an compression and spec fr medial. lt and fr secuty bath ware ‘essential: Image processing rls heevly on he harvare and screting languaes tens toe sardbored from ton doap of harcware access, = sisi Aug 22-118 1607 (@eamos can you please tl wnae you ouns pseudo code. am searching ot forthe past 24 haus. — Krennathacra Dee 23°11 a 82 InipletackoverRow comiqustions/7041697Ipeeuto-code-fr-blockwise-nonlocal-meant-nase-reducn-slgortim

Potrebbero piacerti anche