Hello all!
I have implemented a Lanczos8 kernel convolution to downsample images which works well for 30-40 iterations. After that ringing artifacts enter, even if I reduce a 1600x1200 image one pixel each iteration. Should this be occurring ? Is there a way around it ? Is there a better down sampling method for this type of problem ? thanks, aviva |
Hi Aviva,
you should try Gaussian downsampling: In Fiji, there is a Javascript in PLugins->Examples->downsample explained at http://pacific.mpi-cbg.de/wiki/index.php/Downsample the same Javascript is at the ImageJ website http://rsb.info.nih.gov/ij/macros/js/Downsample.js or, alternatively a public API method in the packages of mpicbg_.jar that are part of Fiji, such that you can call it for a nopen Image, say, from Plugins->Scripting->BeanshellInterpreter: import ij.*; import mpicbg.ij.util.Filter; new ImagePlus( "downsampled", Filter.scale( IJ.getImage().getProcessor(), 0.2f ) ).show(); Lanczos being just an approximation of a bandpass filter in the frequency domain, you could also try to do the downsampling directly through that bandpass-filter, ImageJ has the respective functions. Depends very much on what you want. For most cases, the Gaussian thing is just optimal. Best, Stephan On Mon, 2009-11-16 at 08:07 +0200, Aviva Vaknin wrote: > Hello all! > > I have implemented a Lanczos8 kernel convolution to downsample images > which works well for 30-40 iterations. > > After that ringing artifacts enter, even if I reduce a 1600x1200 image one > pixel > each iteration. > > Should this be occurring ? Is there a way around it ? > Is there a better down sampling method for this type of problem ? > > thanks, > aviva |
Thanks, Stephan.
I actually started with Gaussian resampling but it blurred the image after just iterations. I will read the sites you gave me, perhaps i missed something. aviva On Mon, Nov 16, 2009 at 10:46 AM, Stephan Saalfeld <[hidden email]>wrote: > Hi Aviva, > > you should try Gaussian downsampling: > > In Fiji, there is a Javascript in PLugins->Examples->downsample > explained at > > http://pacific.mpi-cbg.de/wiki/index.php/Downsample > > the same Javascript is at the ImageJ website > > http://rsb.info.nih.gov/ij/macros/js/Downsample.js > > or, alternatively a public API method in the packages of mpicbg_.jar > that are part of Fiji, such that you can call it for a nopen Image, say, > from Plugins->Scripting->BeanshellInterpreter: > > import ij.*; > import mpicbg.ij.util.Filter; > new ImagePlus( "downsampled", Filter.scale( IJ.getImage().getProcessor(), > 0.2f ) ).show(); > > Lanczos being just an approximation of a bandpass filter in the > frequency domain, you could also try to do the downsampling directly > through that bandpass-filter, ImageJ has the respective functions. > Depends very much on what you want. For most cases, the Gaussian thing > is just optimal. > > Best, > Stephan > > > > On Mon, 2009-11-16 at 08:07 +0200, Aviva Vaknin wrote: > > Hello all! > > > > I have implemented a Lanczos8 kernel convolution to downsample images > > which works well for 30-40 iterations. > > > > After that ringing artifacts enter, even if I reduce a 1600x1200 image > one > > pixel > > each iteration. > > > > Should this be occurring ? Is there a way around it ? > > Is there a better down sampling method for this type of problem ? > > > > thanks, > > aviva > |
In reply to this post by Aviva Vaknin
Hi Aviva,
Maybe you can try this plugin: http://bigwww.epfl.ch/algorithms/ijplugins/resize/ Also, please ´scuse mi ignorance, but why do you these many "iterations"? Why would you need to downsample a large image one pixel per iteration? Would you expect to give better results as a direct approach? So you go from 1600x1200 to 1599x1199 and so on??????? I certainly would expect that after say ~ 50 iterations, only/mostly errors remain! Joachim Aviva Vaknin <aviva.vaknin@GMA IL.COM> An Gesendet von: [hidden email] ImageJ Interest Kopie Group <[hidden email]. Thema GOV> downsampling methods 16.11.2009 07:07 Bitte antworten an ImageJ Interest Group <[hidden email]. GOV> Hello all! I have implemented a Lanczos8 kernel convolution to downsample images which works well for 30-40 iterations. After that ringing artifacts enter, even if I reduce a 1600x1200 image one pixel each iteration. Should this be occurring ? Is there a way around it ? Is there a better down sampling method for this type of problem ? thanks, aviva ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ |
In reply to this post by Stephan Saalfeld
Just a note:
Downsampling at least in theory definitely requires a _real_ bandlimit. That said, Gaussian lowpass filtering surely is not optimum because per definition it doesn't really zero frequency components above the Nyquist limit. >Hi Aviva, > >you should try Gaussian downsampling: > >In Fiji, there is a Javascript in PLugins->Examples->downsample >explained at > >http://pacific.mpi-cbg.de/wiki/index.php/Downsample > >the same Javascript is at the ImageJ website > >http://rsb.info.nih.gov/ij/macros/js/Downsample.js > >or, alternatively a public API method in the packages of mpicbg_.jar >that are part of Fiji, such that you can call it for a nopen Image, say, >from Plugins->Scripting->BeanshellInterpreter: > >import ij.*; >import mpicbg.ij.util.Filter; >new ImagePlus( "downsampled", Filter.scale( IJ.getImage().getProcessor(), >0.2f ) ).show(); > >Lanczos being just an approximation of a bandpass filter in the >frequency domain, you could also try to do the downsampling directly >through that bandpass-filter, ImageJ has the respective functions. >Depends very much on what you want. For most cases, the Gaussian thing >is just optimal. > >Best, >Stephan > > > >On Mon, 2009-11-16 at 08:07 +0200, Aviva Vaknin wrote: >> Hello all! >> >> I have implemented a Lanczos8 kernel convolution to downsample images >> which works well for 30-40 iterations. >> >> After that ringing artifacts enter, even if I reduce a 1600x1200 image one >> pixel >> each iteration. >> >> Should this be occurring ? Is there a way around it ? >> Is there a better down sampling method for this type of problem ? >> >> thanks, >> aviva Best -- Herbie ------------------------ <http://www.gluender.de> |
On Mon, 2009-11-16 at 11:52 +0100, Gluender wrote:
> Just a note: > > Downsampling at least in theory definitely requires a _real_ bandlimit. > > That said, Gaussian lowpass filtering surely is not optimum because > per definition it doesn't really zero frequency components above the > Nyquist limit. > This is correct for functions that are created through a spectral generator which we assume is the case for an image when transferring it to the frequency domain from it's intensity samples but in fact is not. For an image captured with a camera it is just better to re-sample by diffusion, that is through the focus of a Gaussian. Best, Stephan > >Hi Aviva, > > > >you should try Gaussian downsampling: > > > >In Fiji, there is a Javascript in PLugins->Examples->downsample > >explained at > > > >http://pacific.mpi-cbg.de/wiki/index.php/Downsample > > > >the same Javascript is at the ImageJ website > > > >http://rsb.info.nih.gov/ij/macros/js/Downsample.js > > > >or, alternatively a public API method in the packages of mpicbg_.jar > >that are part of Fiji, such that you can call it for a nopen Image, say, > >from Plugins->Scripting->BeanshellInterpreter: > > > >import ij.*; > >import mpicbg.ij.util.Filter; > >new ImagePlus( "downsampled", Filter.scale( IJ.getImage().getProcessor(), > >0.2f ) ).show(); > > > >Lanczos being just an approximation of a bandpass filter in the > >frequency domain, you could also try to do the downsampling directly > >through that bandpass-filter, ImageJ has the respective functions. > >Depends very much on what you want. For most cases, the Gaussian thing > >is just optimal. > > > >Best, > >Stephan > > > > > > > >On Mon, 2009-11-16 at 08:07 +0200, Aviva Vaknin wrote: > >> Hello all! > >> > >> I have implemented a Lanczos8 kernel convolution to downsample images > >> which works well for 30-40 iterations. > >> > >> After that ringing artifacts enter, even if I reduce a 1600x1200 image one > >> pixel > >> each iteration. > >> > >> Should this be occurring ? Is there a way around it ? > >> Is there a better down sampling method for this type of problem ? > >> > >> thanks, > >> aviva > > Best |
many thanks , this was very useful
aviva On Mon, Nov 16, 2009 at 1:56 PM, Stephan Saalfeld <[hidden email]>wrote: > On Mon, 2009-11-16 at 11:52 +0100, Gluender wrote: > > Just a note: > > > > Downsampling at least in theory definitely requires a _real_ bandlimit. > > > > That said, Gaussian lowpass filtering surely is not optimum because > > per definition it doesn't really zero frequency components above the > > Nyquist limit. > > > > This is correct for functions that are created through a spectral > generator which we assume is the case for an image when transferring it > to the frequency domain from it's intensity samples but in fact is not. > For an image captured with a camera it is just better to re-sample by > diffusion, that is through the focus of a Gaussian. > > Best, > Stephan > > > >Hi Aviva, > > > > > >you should try Gaussian downsampling: > > > > > >In Fiji, there is a Javascript in PLugins->Examples->downsample > > >explained at > > > > > >http://pacific.mpi-cbg.de/wiki/index.php/Downsample > > > > > >the same Javascript is at the ImageJ website > > > > > >http://rsb.info.nih.gov/ij/macros/js/Downsample.js > > > > > >or, alternatively a public API method in the packages of mpicbg_.jar > > >that are part of Fiji, such that you can call it for a nopen Image, say, > > >from Plugins->Scripting->BeanshellInterpreter: > > > > > >import ij.*; > > >import mpicbg.ij.util.Filter; > > >new ImagePlus( "downsampled", Filter.scale( > IJ.getImage().getProcessor(), > > >0.2f ) ).show(); > > > > > >Lanczos being just an approximation of a bandpass filter in the > > >frequency domain, you could also try to do the downsampling directly > > >through that bandpass-filter, ImageJ has the respective functions. > > >Depends very much on what you want. For most cases, the Gaussian thing > > >is just optimal. > > > > > >Best, > > >Stephan > > > > > > > > > > > >On Mon, 2009-11-16 at 08:07 +0200, Aviva Vaknin wrote: > > >> Hello all! > > >> > > >> I have implemented a Lanczos8 kernel convolution to downsample images > > >> which works well for 30-40 iterations. > > >> > > >> After that ringing artifacts enter, even if I reduce a 1600x1200 > image one > > >> pixel > > >> each iteration. > > >> > > >> Should this be occurring ? Is there a way around it ? > > >> Is there a better down sampling method for this type of problem ? > > >> > > >> thanks, > > >> aviva > > > > Best > |
In reply to this post by Stephan Saalfeld
Well, dear Stephan,
as far as I can see your statement appears unfounded with respect to signal theory. Perhaps you refer to the "finite signal" involved with the discrete Fourier-Transformation, however I didn't speak of Fourier-Transformation but of the kind of band-limiting that must precede any subsampling. >On Mon, 2009-11-16 at 11:52 +0100, Gluender wrote: >> Just a note: >> >> Downsampling at least in theory definitely requires a _real_ bandlimit. >> >> That said, Gaussian lowpass filtering surely is not optimum because >> per definition it doesn't really zero frequency components above the >> Nyquist limit. >> > >This is correct for functions that are created through a spectral >generator which we assume is the case for an image when transferring it >to the frequency domain from it's intensity samples but in fact is not. >For an image captured with a camera it is just better to re-sample by >diffusion, that is through the focus of a Gaussian. > >Best, >Stephan > >> >Hi Aviva, >> > >> >you should try Gaussian downsampling: >> > >> >In Fiji, there is a Javascript in PLugins->Examples->downsample >> >explained at >> > >> >http://pacific.mpi-cbg.de/wiki/index.php/Downsample >> > >> >the same Javascript is at the ImageJ website >> > >> >http://rsb.info.nih.gov/ij/macros/js/Downsample.js >> > >> >or, alternatively a public API method in the packages of mpicbg_.jar >> >that are part of Fiji, such that you can call it for a nopen Image, say, >> >from Plugins->Scripting->BeanshellInterpreter: >> > >> >import ij.*; >> >import mpicbg.ij.util.Filter; >> >new ImagePlus( "downsampled", Filter.scale( IJ.getImage().getProcessor(), >> >0.2f ) ).show(); >> > >> >Lanczos being just an approximation of a bandpass filter in the >> >frequency domain, you could also try to do the downsampling directly >> >through that bandpass-filter, ImageJ has the respective functions. >> >Depends very much on what you want. For most cases, the Gaussian thing >> >is just optimal. >> > >> >Best, >> >Stephan >> > >> > >> > >> >On Mon, 2009-11-16 at 08:07 +0200, Aviva Vaknin wrote: >> >> Hello all! >> >> >> >> I have implemented a Lanczos8 kernel convolution to downsample images >> >> which works well for 30-40 iterations. >> >> >> >> After that ringing artifacts enter, even if I reduce a >>1600x1200 image one >> >> pixel >> >> each iteration. >> >> >> >> Should this be occurring ? Is there a way around it ? >> >> Is there a better down sampling method for this type of problem ? >> >> >> >> thanks, >> >> aviva >> > > Best Best -- Herbie ------------------------ <http://www.gluender.de> |
Dear Gluender,
> as far as I can see your statement appears unfounded with respect to > signal theory. > > Perhaps you refer to the "finite signal" involved with the discrete > Fourier-Transformation, however I didn't speak of > Fourier-Transformation but of the kind of band-limiting that must > precede any subsampling. > The term downsampling is may be ambiguous. If you understand downsampling as subsampling, that is picking a single value from some function, then, sure, the respective frequencies from that function have to be removed to make Nyquist happy (or in more correct terms: to not collect bogus values). In the context of image processing, downsampling usually refers to collecting the integral of that function which is in any case a Gaussian. Best, Stephan > >On Mon, 2009-11-16 at 11:52 +0100, Gluender wrote: > >> Just a note: > >> > >> Downsampling at least in theory definitely requires a _real_ bandlimit. > >> > >> That said, Gaussian lowpass filtering surely is not optimum because > >> per definition it doesn't really zero frequency components above the > >> Nyquist limit. > >> > > > >This is correct for functions that are created through a spectral > >generator which we assume is the case for an image when transferring it > >to the frequency domain from it's intensity samples but in fact is not. > >For an image captured with a camera it is just better to re-sample by > >diffusion, that is through the focus of a Gaussian. > > > >Best, > >Stephan > > > >> >Hi Aviva, > >> > > >> >you should try Gaussian downsampling: > >> > > >> >In Fiji, there is a Javascript in PLugins->Examples->downsample > >> >explained at > >> > > >> >http://pacific.mpi-cbg.de/wiki/index.php/Downsample > >> > > >> >the same Javascript is at the ImageJ website > >> > > >> >http://rsb.info.nih.gov/ij/macros/js/Downsample.js > >> > > >> >or, alternatively a public API method in the packages of mpicbg_.jar > >> >that are part of Fiji, such that you can call it for a nopen Image, say, > >> >from Plugins->Scripting->BeanshellInterpreter: > >> > > >> >import ij.*; > >> >import mpicbg.ij.util.Filter; > >> >new ImagePlus( "downsampled", Filter.scale( IJ.getImage().getProcessor(), > >> >0.2f ) ).show(); > >> > > >> >Lanczos being just an approximation of a bandpass filter in the > >> >frequency domain, you could also try to do the downsampling directly > >> >through that bandpass-filter, ImageJ has the respective functions. > >> >Depends very much on what you want. For most cases, the Gaussian thing > >> >is just optimal. > >> > > >> >Best, > >> >Stephan > >> > > >> > > >> > > >> >On Mon, 2009-11-16 at 08:07 +0200, Aviva Vaknin wrote: > >> >> Hello all! > >> >> > >> >> I have implemented a Lanczos8 kernel convolution to downsample images > >> >> which works well for 30-40 iterations. > >> >> > >> >> After that ringing artifacts enter, even if I reduce a > >>1600x1200 image one > >> >> pixel > >> >> each iteration. > >> >> > >> >> Should this be occurring ? Is there a way around it ? > >> >> Is there a better down sampling method for this type of problem ? > >> >> > >> >> thanks, > >> >> aviva > >> > > > Best > > Best |
>In the context of image processing, downsampling usually refers to
>collecting the integral of that function which is in any case a >Gaussian. Honestly I do not see this point, why it has to be a gaussian "in any case"! To be exact, even in theory, a Gaussian is not bandlimited at all, because it extends ti +/- inf both in real space and FT (whis is also a gaussian, as we all know) However, to unite all the arguments in this discussion a bit, clearly any "reasonable" downsampling does not mean to sample the input data in coarse steps and try to generate a "best approximation" from those limited data alone (in some cases this might even be the task, too), but should try to take ALL ("high-res") input data into account to come up with a "best" low-res equivalent. This approach has to assume that the input data are no longer aliased wrt their resolution (which might also not be the cases in some circumstances, but even more "downsampling" cannot really solve this), but the aliasing wrt the new sample spacing has to be taken into account. This might (in principle) happen within an extra "prefiltering step", but can be combined with the "downsampling" itself, be it in real space ("true", limited comvolution) or in fourier space. Joachim Wesner ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ |
Free forum by Nabble | Edit this page |