Image Processing in Python

breezebongΤεχνίτη Νοημοσύνη και Ρομποτική

6 Νοε 2013 (πριν από 3 χρόνια και 9 μήνες)

71 εμφανίσεις

Image Processing in Python

Please download the new image and the Python files that I have placed on the server and delete any previous
files of mine you downloaded.

space is an important paradigm for feature extraction in images. Scale
space allows
for multi
analysis with the guarantee that feature maximums do not migrate across scales. Our approach is to compute
spatial derivatives of the image and larger and larger scales. We do this by convolving the image with
derivatives of Gaussians with
successively larger widths. Integration across scales is usually done by taking the
maximum response across the scales at each pixel location.

Convolving an image with a Gaussian kernel is
equivalent to multiplying the Fourier spectrum by a Gaussian, as w
e did in class.

In the file I have written a routine (hw1) which implements a scale
space filtering
technique for vascular images introduced by Frangi et al. (Lecture Notes in Computer Science 1496).
The code
differentiates vascula
r (tubular) structures from background using the curvature (second derivative) of the pixel
The code provides examples of a variety of tools we looked at in class. I have also added some lines
which use Python Imaging Library objects.

The code

reads in an image, applies the filter and then thresholds the
image to get a binary mask of the vasculature. It also creates a binary mask of the vasculature in the
unprocessed image for comparison.

The homework consists of a simple exploration.

You will

have to do some modifications of the code, but they
are all minor. All the necessary documentation is in the Numpy manual and the PIL manual that come as PDF
files in the distribution.

Please do the following


Determine what the minimum (maximum?) number

of scales that should be used to get a good
enhancement of the vasculature. What happens to the image if you use very large scales?


As implemented the filter uses an exponential growth function for sigma. Change this to a linear
growth function and compar
e the results.


Reverse the grayscale of the image by subtracting the image from its maximum value.
MLab.max(img.flat) returns the maximum value of img. If you don’t use the flat option on img, it
won’t give you what you want.
What needs to be changed in
the filter to make it work on the reversed
image? Remember that the curvature

a ridge
and a valley have

a different sign.


Apply noise to the image. Generate Gaussian noise with zero mean and a standard deviation
specified by you. What level of noise degra
des the filter response? Would you say that the filter was
robust in the presence of noise


Generate and save images showing the intermediate steps of the filter (for example the kxx image
which is the second derivative computed in the x direction). Save th
e images as jpegs with a quality
factor of 80%.

space applications can eat up a lot of memory
, and I didn’t try to code it efficiently
. If you don’t have
sufficient memory to process the 512x512 image, subsample
the variable data

down to 256x256 imm
after generating
it with the img.get_all() command. You can do this with the slicing as we did in class. An
example can be seen in the file.

Feel free to email me (

with any questions you might have.