|
|
|
|
Homework 1 |
|
|---|
|
bay
Figure 1. Digital elevation map of the San Francisco Bay Area. |
|
|
Figure 1.1 shows a digital elevation map of the San Francisco Bay Area. Start by reproducing this figure on your screen.
geo391/hw1/bay
scons bay.view
sfin byte.rsfto check the data size and format.
sfattr < byte,rsfto check data attributes. What is the maximum and minimum value? What is the mean value? For an explanation of different attributes, run sfattr without input.
Each image has a certain distribution of values (a histogram). The histogram for the San Francisco elevation map is shown in Figure 1.2. Notice the digitization artifacts. When different values in a histogram are not uniformly distributed, the image can have low contrast. One way of improving the contrast is histogram equalization.
|
hist
Figure 2. Normalized histogram (solid line) and cumulative histogram (dashed line) of the digital elevation data. |
|
|---|---|
|
|
Let
be the original image. The equalized image will be
. Let
be the histogram (probability distribution) of
the original image values. Let
be the histogram of the modified
image. The mapping of probabilities suggests
The algorithm of histogram equalization consists of the following three steps:
Your task is:
scons hist.viewto display the figure on your screen.`
from rsfproj import *
# Download data
Fetch('bay.h','bay')
# Window and taper
Flow('bay','bay.h',
'''
dd form=native |
window f2=500 n2=1600 f1=50 n1=1050 |
reverse which=1 |
costaper nw1=50 nw2=50
''')
# Convert to byte form
Flow('byte','bay','byte pclip=99.9 allpos=y')
# Display
Result('bay','byte',
'''
grey crowd=0.85 title="Elevation of San Francisco Bay"
''')
# Histogram
Flow('hist','byte',
'''
dd type=float |
histogram n1=256 o1=0 d1=1 |
dd type=float
''')
Plot('hist',
'graph label1=Value label2=Occurence title=Histogram')
# Cumulative histogram
Flow('cumu','hist','causint')
Result('hist','hist cumu',
'''
cat axis=2 ${SOURCES[1]} | scale axis=1 |
graph label1=Value label2="Normalized Occurence"
title=Histogram dash=0,1
''')
# ADD HISTOGRAM EQUALIZATION
End()
|
|
|
|
|
Homework 1 |