+ All Categories
Home > Documents > CSC2014-Week3(1)

CSC2014-Week3(1)

Date post: 10-Feb-2016
Category:
Upload: holly-insanest
View: 217 times
Download: 0 times
Share this document with a friend
Description:
notes for CSC2014-does not belong to me, no monetary profit gained
Popular Tags:
53
Lecture 3: Histogram CSC2014 – Digital Image Processing
Transcript

Introduction to Digital Image Processing

Lecture 3: Histogram CSC2014 Digital Image Processing1OutlineImage HistogramHistogram Threshold SelectionAdaptive ThresholdingContrast StretchingHistogram EqualizationHistogram Matching

2Learning ObjectivesUnderstand what an image histogram represents.Understand the use of histogram manipulation techniques to perform image enhancement and segmentation.

3Image HistogramHistogram of a digital image with gray-levels in the range [0, L-1] is a discrete function h(rk) = nk where rk is the kth level and nk is the number of pixels having the gray-level rk.

Simplified version: The histogram of an image shows us the distribution of gray levels in the image. Plot of frequency vs intensity values.

44002232211133133150 1 2 3Gray LevelCount246Image Histogram6

Image Histogram

7

002232211133133180 1 2 3Gray LevelCount0.1250.250.375rkP(rk)r0 = 02/16r1 = 15/16r2 = 24/16r3 = 35/16Image Histogram ExampleSuppose that a 3-bit image (L=8) of size 64 64 pixels (MN = 4096) has the intensity distribution shown in following table.

9

Reason to normalise the historgram? To perform histogram equalization.9Histogram Threshold SelectionBy selecting a threshold value between the two peaks, we can separate the background/foreground of the image using the thresholding approach.

10s = 0.0 r threshold10Histogram Threshold Selection11

backgroundcoinsHistogram Threshold Selection12

More complex, hence the segmentation is not perfect.12Histogram Threshold SelectionIs that means we have to always select the threshold value manually?13Histogram Threshold SelectionThe Otsus method calculates the optimum threshold separating the two classes of pixels so that the intra-class variance is minimal.

14Otsus Method15Adaptive ThresholdingDesigned to overcome the limitations of conventional, global thresholding by using a different threshold at each pixel location in the image.

Threshold is determined by the values of the pixels in the neighbourhood of the pixel.

16Adaptive ThresholdingThreshold value, t, can be based on several statistics:t = mean + C;t = median + C;floor((max-min)/2) + C;17101010101020202020205050505050202020202010101010100000000000111110000000000s = 0.0 r thresholdAdaptive ThresholdingIllumination may differ over the image. Roughly uniform in a sufficiently small, local neighbourhood.

18

OriginalGlobal ThresholdingAdaptive ThresholdingHistogram (Different Types of Images)19

Contrast StretchingImprove contrast of an image by stretching the range of pixel intensities to occupy a larger dynamic range in the output image.

20Contrast Stretching

a upper pixel value limit (e.g.255)b lower pixel value limit (e.g. 0)c maximum pixel value of input imaged minimum pixel value of input image

Problem:New image output depends on choice of maximum and minimum pixel value which might not be an accurate representation of the general pixel range with the image.21

Contrast Stretching2250505080815005080815151802558151518081815151808181Contrast StretchingSolution:Ensure that the maximum and minimum pixel value truly represent image content and robust to statistical outliers.For example:Select c and d as the 5th percentile and 95th percentile points of the cumulative distribution.

2323Contrast Stretching245050508081500508081515180255815151808181515180818125 Pixels x 5% = 1.25 5050 5080815005080815151802558151518081815151808181Contrast Stretching25

Histogram EqualizationAn automatic transformation function that seeks to produce an output image with uniform histogram (better contrast).

26

26Histogram EqualizationCumulative Distribution Function (CDF)270022322111331331280 1 2 3Gray LevelCount0.1250.250.375rkP(rk)r0 = 02/16r1 = 15/16r2 = 24/16r3 = 35/160 1 2 3Gray LevelCDF(Prk)0.1250.510 1 2 3Gray LevelCount0.1250.250.3750.1250 1 2 3Gray LevelCDF(Prk)0.510 1 2 3Gray LevelCount0.250.3750 1 2 3Gray LevelCDF(Prk)0.51300 1 2 3Gray LevelCDF(Prk)0.51Cu = 0.375x = 0Cu = 0.5x = 1Cu = 0.675x = 2Cu = 1x = 30.375 * 3 = 1.125 0.5 * 3 = 1.5 0.675 * 3 = 2.025 1 * 3 = 3 0 1 2 3Gray LevelCount0.1250.250.3750 1 2 3Gray LevelCount0.1250.250.3750 1 2 3Gray LevelCDF(Prk)0.510 1 2 3Gray LevelCDF(Prk)0.51Histogram Equalization Example32

CuCDF (Prk)T (r)rksk7900.191.350118130.443.101326630.654.552533190.815.673636480.896.234638930.956.655740150.986.866740961.007.0077Histogram Equalization Example33

skPs(sk)00.0010.1920.0030.2540.0050.2160.2470.1133Histogram Equalization ExampleConsider the following 8-level gray image of size 88. Show the original histogram of the image. Compute the equalized histogram and display graphically.34

Histogram (Different Types of Images)35

Histogram Equalization 36

Histogram Equalization37

Histogram Equalization38

Comparison39

OriginalHistogram EqualizationContrast StretchingComparison40

OriginalHistogram EqualizationContrast StretchingHistogram Equalization SummaryIn general, it stretches/compresses an image such that:

Pixel values that occur frequently occupies a bigger dynamic range, i.e., get stretched and become more visible.

Pixel values that occur infrequently will occupy a smaller dynamic range, i.e., get compressed and become less visible.41All that histogram equalization does is remap histogram components on the intensity scale.

41Histogram MatchingAlso known as histogram specification.Enables us to match the grayscale distribution in one image to the grayscale distribution in another image.

42

OriginalTargetOutputHistogram Matching43CDFCDFHistogram Matching440 1 2 3 4 5 6 70 1 2 3 4 5 6 70 1 2 3 4 5 6 70 1 2 3 4 5 6 7Histogram Matching450 1 2 3 4 5 6 70 1 2 3 4 5 6 70 1 2 3 4 5 6 70 1 2 3 4 5 6 7Histogram Matching ExampleGet the histogram transformation function and make the output image with the specified histogram, listed in the table on the right.

46

Histogram Matching ExampleFind the smallest value of zq, so that G(zq) is closest to sk

47rkPrkCDF (Prk)skZqPz(zq)CDF(Pz(zq))G(zk)00.190.19100.000.000.0010.250.44310.000.000.0020.210.65520.000.000.0030.160.81630.150.151.0540.080.89640.200.352.4550.060.95750.300.654.5560.030.98760.200.855.9570.021.00770.151.007.0047Histogram Matching Example48rkPrkCDF (Prk)sk00.190.19110.250.44320.210.65530.160.81640.080.89650.060.95760.030.98770.021.007rkNew PrkCDF (New Prk)000.0010.190.19200.1930.250.44400.4450.210.6560.240.8970.111.00After Equalization:49rksk0113253646576777ZqPz(zq)CDF(Pz(zq))G(zk)New Pz(zq)CDF(New Pz(zq))00.000.000.000.000.0010.000.000.000.150.1520.000.000.000.200.3530.150.151.050.000.3540.200.352.450.000.3550.300.654.550.300.6560.200.855.950.200.8570.151.007.000.151.0050012345670 1 2 3 4 5 6 7ZqPz(zq)CDF(Pz(zq))G(zk)00.000.000.0010.000.000.0020.000.000.0030.150.151.0540.200.352.4550.300.654.5560.200.855.9570.151.007.00012345670 1 2 3 4 5 6 7rkPrkCDF (Prk)sk00.190.19110.250.44320.210.65530.160.81640.080.89650.060.95760.030.98770.021.00751012345670 1 2 3 4 5 6 7012345670 1 2 3 4 5 6 71 -> 3

3 - > 4

5 -> 5

6 -> 6

7 -> 7Histogram Matching Example52

52Histogram Matching ExampleMatch Pr(rk) to Pz(zq):53rkPr(rk)r0=00.05r1=10.25r2=20.20r3=30.15r4=40.10r5=50.10r6=60.10r7=70.05zqSpecified Pz(zq)z0=00.35z1=10.05z2=20.10z3=30.15z4=40.20z5=50.05z6=60.05z7=70.05


Recommended