Archive for the ‘tutorials’ Category

Gaussian filtering with the Image Processing Toolbox

Tuesday, October 6th, 2009

If you don’t use DIPimage, you probably use MATLAB’s Image Processing Toolbox. This toolbox makes it really easy to do convolutions with a Gaussian in the wrong way. On three accounts. The function fspecial is used to create a convolution kernel for a Gaussian filter. This kernel is 2D. That’s the first problem. The other two problems are given by the default values of its parameters. The default value for the kernel size is [3 3]. The default value for the σ (sigma) is 0.5. (more…)

Lagrange polynomials

Friday, September 25th, 2009

I read a very nice article in the latest IEEE Signal Processing Magazine: Prandoni, P. and Vetterli, M., “From Lagrange to Shannon… and back: another look at sampling,” IEEE Signal Processing Magazine 26(5):138-144, September 2009. The authors make a case for teaching signal processing starting with discrete time, and then moving to continuous time. I don’t agree, but they expose their case very nicely. But I did learn something new from this paper, which is why I am writing this. It turns out that the Lagrange interpolation polynomials converge to the sinc function as the polynomial order goes to infinity.

(more…)

DIPimage issues that I can’t solve

Tuesday, August 25th, 2009

There are a few things in DIPimage that I’m annoyed with but can’t solve. Some of these are caused by the limitations of the MATLAB interpreter, and some are caused by my own poor design choices. DIPimage evolved over time to do things that I hadn’t at first even thought about, such as processing color images. Tensor and color images were “tagged on”, if you will, on top of the dip_image object, introducing some oddities and inconsistencies. To fix these up we would need to change existing behavior, which we don’t want to do because it would break too much existing code. This blog entry is about the few weird things with the dip_image object and how to work around them.

(more…)

Panoramic photograph stitching

Tuesday, July 14th, 2009

I found the article “Fast image blending using watersheds and graph cuts,” by N. Gracias, M. Mahoor, S. Negahdaripour and A. Gleason (Image and Vision Computing 27(5):597-607, 2009) quite clever, and decided to try it out myself. Here’s a little demo and the code I wrote.

(more…)

Gaussian filtering

Saturday, December 6th, 2008

In my recent lectures on filtering I was trying to convey only one thing to my students: do not use the uniform filter, use the Gaussian! The uniform (or “box”) filter is very easy to implement, and hence used often as a smoothing filter. But the uniform filter is a very poor choice for a smoothing filter, it simply does not suppress high frequencies strongly enough. And on top of that, it inverts some of the frequency bands that it is supposed to be suppressing (its Fourier transform has negative values). There really is no excuse ever to use a uniform filter, considering there is a very fine alternative that is very well behaved, perfectly isotropic, and separable: the Guassian. Sure, it’s not a perfect low-pass filter either, but it is as close as a spatial filter can get.

Because recently I found some (professionally written) code using Gaussian filtering in a rather awkward way, I realized even some seasoned image analysis professionals are not familiar and comfortable with Gaussian filtering. Hence this short tutorial.

(more…)