0% found this document useful (0 votes)
3 views4 pages

05 - Chapter 5 Image Enhancement Part5

The document discusses various image enhancement techniques, including local contrast normalization, which improves the visibility of high-contrast objects in low-contrast environments. It provides a code example using Python libraries to apply local filtering on an image, resulting in enhanced detail. Additionally, it summarizes key image transformation methods and poses exercises for further exploration of image enhancement concepts.

Uploaded by

Choky Aconk
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views4 pages

05 - Chapter 5 Image Enhancement Part5

The document discusses various image enhancement techniques, including local contrast normalization, which improves the visibility of high-contrast objects in low-contrast environments. It provides a code example using Python libraries to apply local filtering on an image, resulting in enhanced detail. Additionally, it summarizes key image transformation methods and poses exercises for further exploration of image enhancement concepts.

Uploaded by

Choky Aconk
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Image Enhancement 119

by dividing the image ’d,’ which is similar to mean-corrected image and


the standard deviation image, ’max array’.

import pydicom
import numpy as np
import skimage.exposure as imexp
from matplotlib import pyplot as plt
from scipy.ndimage.filters import gaussian_filter
from PIL import Image

def localfilter(im, sigma=(10, 10,)):


im_gaussian = gaussian_filter(im, sigma=sigma[0])
d = im_gaussian-im
s = np.sqrt(gaussian_filter(d*d, sigma=sigma[1]))
# form an array where all elements have a value of
mean(s)
mean_array = np.ones(s.shape)*np.mean(s)
# find element by element maximum between mean_array
and s
max_array = np.maximum(mean_array, s)
y = d/(max_array+np.spacing(1.0))
return y

file_name = "../Figures/FluroWithDisplayShutter.dcm"
dfh = pydicom.read_file(file_name, force=True)
im = dfh.pixel_array
# convert to float and scale before applying filter
im = im.astype(np.float)
im1 = im/np.max(im)

sigma = (5, 5,)


im2 = localfilter(im, sigma)
# rescale to 8-bit
im3 = 255*(im2-im2.min())/(im2.max()-im2.min())
120 Image Processing and Acquisition using Python

im4 = Image.fromarray(im3).convert("L")
im4.save('../Figures/local_normalization_output.png')
im4.show()

The image in Figure 5.16(b) is a local contrast normalized image


produced from the input image in Figure 5.16(a). The details of the
bones are discernable in the output image as opposed to the original
image. In the bright regions outside the anatomy but inside the field
of view, the input image is smooth while the corresponding region in
the output image is noisy. This is due to the fact that we are forcing
regions with low variance (such as smooth regions) and also regions
with high variance to have equal variance. The choice of smoothing is
a hyper-parameter that needs to be chosen based on the image being
processed.

(a) Input (contrast adjusted man- (b) Output


ually to show details)

FIGURE 5.16: Example of local contrast normalization.

The authors have found that this filter works especially well for
highlighting high-contrast objects surrounded by low-contrast struc-
tures.
Image Enhancement 121

5.11 Summary
• Image inverse transformation is used to invert the pixel intensities
in an image. This process is similar to obtaining a negative of a
photograph.

• Power law transformation makes the image brighter for γ < 1


and darker for γ > 1.

• Log transformation makes the image brighter, while the inverse


log makes the image darker.

• Histogram equalization is used to enhance the contrast in an


image. In this transformation, a narrow range of intensity val-
ues will get mapped to a wide range of intensity values.

• Contrast stretching is used to increase the pixel value range by


rescaling the pixel values in the input image.

• Sigmoid correction provides a smooth continuous function for


enhancing images around a central cutoff.

• Local contrast normalization enhances the pixel value at a certain


location based only on its neighboring pixels and not the ones
farther away from it.

5.12 Exercises
1. Explain briefly the need for image enhancement with some exam-
ples.

2. Research a few other image enhancement techniques.


122 Image Processing and Acquisition using Python

3. Consider an image transformation where every pixel value is mul-


tiplied by a constant (K). What will be the effect on the image
assuming K < 1, K = 1 and K > 1? What will be the impact on
the histogram of the output image in relation to the input image?

4. All the transformations discussed in this chapter are scaled from


[0, 1]. Why?

5. The window or level operation allows us to modify the image,


so that all pixel values can be visualized. What is the difference
between window or level and image enhancement?
Clue: One makes a permanent change to the image while the other
does not.

6. An image has all pixel values clustered in the lower intensity.


The image needs to be enhanced, so that the small range of the
low-intensity maps to a larger range. What operation would you
use?

7. In sigmoid correction, the choice of the cutoff and gain will deter-
mine the quality of the output image. The readers are recom-
mended to try different settings for the hyper-parameter to under-
stand their effect.

8. In local contrast normalization, the choice of the σ1 and σ2 affect


the outcome. The readers are recommended to try different values
to understand their effect.

You might also like