Computer graphics & visualization Point-Based Computer Graphics.
CS324e - Elements of Graphics and Visualization
description
Transcript of CS324e - Elements of Graphics and Visualization
![Page 1: CS324e - Elements of Graphics and Visualization](https://reader035.fdocuments.us/reader035/viewer/2022062520/568164ae550346895dd6b8c6/html5/thumbnails/1.jpg)
CS324e - Elements of Graphics and Visualization
Color Histograms
![Page 2: CS324e - Elements of Graphics and Visualization](https://reader035.fdocuments.us/reader035/viewer/2022062520/568164ae550346895dd6b8c6/html5/thumbnails/2.jpg)
2
Color Histogram• Plot number of pixels with given intensity• horizontal axis: intensity (0 - 255)• Vertical axis:
– number of pixels with given intensity– or normalize to a percentage
![Page 3: CS324e - Elements of Graphics and Visualization](https://reader035.fdocuments.us/reader035/viewer/2022062520/568164ae550346895dd6b8c6/html5/thumbnails/3.jpg)
3
Sample Image
![Page 4: CS324e - Elements of Graphics and Visualization](https://reader035.fdocuments.us/reader035/viewer/2022062520/568164ae550346895dd6b8c6/html5/thumbnails/4.jpg)
4
Histogram Of Grayscale
![Page 5: CS324e - Elements of Graphics and Visualization](https://reader035.fdocuments.us/reader035/viewer/2022062520/568164ae550346895dd6b8c6/html5/thumbnails/5.jpg)
5
Histogram Equalization• Note the cluster in the middle• Not a lot of very bright or very dark pixels• Apply a Histogram Equalization filter to
the image
![Page 6: CS324e - Elements of Graphics and Visualization](https://reader035.fdocuments.us/reader035/viewer/2022062520/568164ae550346895dd6b8c6/html5/thumbnails/6.jpg)
6
Histogram Equalization• An algorithm to try and improve the local
contrast of an image without altering overall contrast to a significant degree
• Spread out the clumps of intensities to improve the contrast
![Page 7: CS324e - Elements of Graphics and Visualization](https://reader035.fdocuments.us/reader035/viewer/2022062520/568164ae550346895dd6b8c6/html5/thumbnails/7.jpg)
7
Histogram Equalization Example• Consider a color model with only 10
shades of gray 0 - 9• Consider a simple image with only 25
pixels
![Page 8: CS324e - Elements of Graphics and Visualization](https://reader035.fdocuments.us/reader035/viewer/2022062520/568164ae550346895dd6b8c6/html5/thumbnails/8.jpg)
8
Histogram Equalization Example• Step 1: count the number of pixels with each intensityintensity count
0 31 6 2 43 24 25 16 17 1 What must the sum of 8 1 counts be?9 4
![Page 9: CS324e - Elements of Graphics and Visualization](https://reader035.fdocuments.us/reader035/viewer/2022062520/568164ae550346895dd6b8c6/html5/thumbnails/9.jpg)
9
Histogram Equalization Example• Normalize the counts to fractions or percentagesintensity count fraction
0 3 3/251 6 6/252 4 4/253 2 2/254 2 2/255 1 1/256 1 1/257 1 1/258 1 1/259 4 4/25
Why divide by 25?
![Page 10: CS324e - Elements of Graphics and Visualization](https://reader035.fdocuments.us/reader035/viewer/2022062520/568164ae550346895dd6b8c6/html5/thumbnails/10.jpg)
10
Histogram Equalization Example• Step 3: compute the cumulative
distribution function CDF – probability a pixel's intensity is less than or
equal to the given intensity– just a running total of the fractions /
percentages from step 2
![Page 11: CS324e - Elements of Graphics and Visualization](https://reader035.fdocuments.us/reader035/viewer/2022062520/568164ae550346895dd6b8c6/html5/thumbnails/11.jpg)
11
Histogram Equalization Example• Step 3:intensity count fraction Cumulative Distribution
0 3 3/253/251 6 6/259/25 (3 + 6)2 4 4/2513/25 (3 + 6 + 4)3 2 2/2515/254 2 2/2517/255 1 1/2518/256 1 1/2519/257 1 1/2520/258 1 1/2521/259 4 4/2525/25
![Page 12: CS324e - Elements of Graphics and Visualization](https://reader035.fdocuments.us/reader035/viewer/2022062520/568164ae550346895dd6b8c6/html5/thumbnails/12.jpg)
12
Histogram Equalization ExampleStep 4: Scale Cumulative Distribution to intensity rangeintensity count fraction CDF Scaled Intensity
0 3 3/25 3/25 0 (10 * 3 / 25 = 1 - 1 = 0)
1 6 6/25 9/25 32 4 4/25 13/25 43 2 2/25 15/25 54 2 2/25 17/25 65 1 1/25 18/25 66 1 1/25 19/25 77 1 1/25 20/25 78 1 1/25 21/25 79 4 4/25 25/25 9
![Page 13: CS324e - Elements of Graphics and Visualization](https://reader035.fdocuments.us/reader035/viewer/2022062520/568164ae550346895dd6b8c6/html5/thumbnails/13.jpg)
13
Histogram Equalization Example• Step 5: The scaled intensities become a lookup table to
apply to original image intensity in original intensity in result
0 01 32 43 54 65 66 77 78 79 9
![Page 14: CS324e - Elements of Graphics and Visualization](https://reader035.fdocuments.us/reader035/viewer/2022062520/568164ae550346895dd6b8c6/html5/thumbnails/14.jpg)
14
Histogram Equalization Example• Step 6: apply lookup tableoriginal 0 1 2 3 4 5 6 7 8 9
result 0 3 4 5 6 6 7 7 7 9
original result
0s stay 01s become 32s become 4and so forth
![Page 15: CS324e - Elements of Graphics and Visualization](https://reader035.fdocuments.us/reader035/viewer/2022062520/568164ae550346895dd6b8c6/html5/thumbnails/15.jpg)
15
Recall Actual Image
![Page 16: CS324e - Elements of Graphics and Visualization](https://reader035.fdocuments.us/reader035/viewer/2022062520/568164ae550346895dd6b8c6/html5/thumbnails/16.jpg)
16
Resulting Histogram
![Page 17: CS324e - Elements of Graphics and Visualization](https://reader035.fdocuments.us/reader035/viewer/2022062520/568164ae550346895dd6b8c6/html5/thumbnails/17.jpg)
17
Resulting Image
![Page 18: CS324e - Elements of Graphics and Visualization](https://reader035.fdocuments.us/reader035/viewer/2022062520/568164ae550346895dd6b8c6/html5/thumbnails/18.jpg)
18
Comparison
![Page 19: CS324e - Elements of Graphics and Visualization](https://reader035.fdocuments.us/reader035/viewer/2022062520/568164ae550346895dd6b8c6/html5/thumbnails/19.jpg)
19
Example 2
![Page 20: CS324e - Elements of Graphics and Visualization](https://reader035.fdocuments.us/reader035/viewer/2022062520/568164ae550346895dd6b8c6/html5/thumbnails/20.jpg)
20
Original Histogram
![Page 21: CS324e - Elements of Graphics and Visualization](https://reader035.fdocuments.us/reader035/viewer/2022062520/568164ae550346895dd6b8c6/html5/thumbnails/21.jpg)
21
Resulting Histogram
![Page 22: CS324e - Elements of Graphics and Visualization](https://reader035.fdocuments.us/reader035/viewer/2022062520/568164ae550346895dd6b8c6/html5/thumbnails/22.jpg)
22
Resulting Image
![Page 23: CS324e - Elements of Graphics and Visualization](https://reader035.fdocuments.us/reader035/viewer/2022062520/568164ae550346895dd6b8c6/html5/thumbnails/23.jpg)
23
Comparison
![Page 24: CS324e - Elements of Graphics and Visualization](https://reader035.fdocuments.us/reader035/viewer/2022062520/568164ae550346895dd6b8c6/html5/thumbnails/24.jpg)
24
Histogram Equalization on Color Images
• apply to color images• each channel (red, green, blue) treated
as separate histogram• equalize each independently• can lead to radical color changes in result
![Page 25: CS324e - Elements of Graphics and Visualization](https://reader035.fdocuments.us/reader035/viewer/2022062520/568164ae550346895dd6b8c6/html5/thumbnails/25.jpg)
25
Histograms
![Page 26: CS324e - Elements of Graphics and Visualization](https://reader035.fdocuments.us/reader035/viewer/2022062520/568164ae550346895dd6b8c6/html5/thumbnails/26.jpg)
26
Example of Color Histogram Equalization
![Page 27: CS324e - Elements of Graphics and Visualization](https://reader035.fdocuments.us/reader035/viewer/2022062520/568164ae550346895dd6b8c6/html5/thumbnails/27.jpg)
Color as a low-level cue for Color Based Image Retreival
Blobworld systemCarson et al, 1999
Swain and Ballard, Color Indexing, IJCV 1991
Slides on CBIR from Kristen Grauman
![Page 28: CS324e - Elements of Graphics and Visualization](https://reader035.fdocuments.us/reader035/viewer/2022062520/568164ae550346895dd6b8c6/html5/thumbnails/28.jpg)
R G B• Color histograms:
Use distribution of colors to describe image
• No spatial info – invariant to translation, rotation, scale
Color intensity
Pixe
l cou
nts
Color as a low-level cue for CBIR
![Page 29: CS324e - Elements of Graphics and Visualization](https://reader035.fdocuments.us/reader035/viewer/2022062520/568164ae550346895dd6b8c6/html5/thumbnails/29.jpg)
Color-based image retrieval• Given collection (database) of images:
– Extract and store one color histogram per image
• Given new query image:– Extract its color histogram– For each database image:
• Compute intersection between query histogram and database histogram
– Sort intersection values (highest score = most similar)– Rank database items relative to query based on this sorted
order
![Page 30: CS324e - Elements of Graphics and Visualization](https://reader035.fdocuments.us/reader035/viewer/2022062520/568164ae550346895dd6b8c6/html5/thumbnails/30.jpg)
Color-based image retrieval
Example database
![Page 31: CS324e - Elements of Graphics and Visualization](https://reader035.fdocuments.us/reader035/viewer/2022062520/568164ae550346895dd6b8c6/html5/thumbnails/31.jpg)
Example retrievals
Color-based image retrieval
![Page 32: CS324e - Elements of Graphics and Visualization](https://reader035.fdocuments.us/reader035/viewer/2022062520/568164ae550346895dd6b8c6/html5/thumbnails/32.jpg)
Example retrievals
Color-based image retrieval
![Page 33: CS324e - Elements of Graphics and Visualization](https://reader035.fdocuments.us/reader035/viewer/2022062520/568164ae550346895dd6b8c6/html5/thumbnails/33.jpg)