Pixels
Last updated 2015. 03. 22
Heejune Ahn, SeoulTech
Outline What is Pixel-level processing? Pixel level Operations Transform
Histogram HE (Histogram Equalization) HA (histogram Matching)
Trhesholding
1. Pixel Processing in pixel level
Not using information of neighbor pixels
Information of pixel level visual color/intensity : camera data IR (infrared) : emission from heat object, night-vision,
surveillance Medical image : density of tissue, CT (computed
tomography), MRI (magnetic resonance imaging), 3D (stack of 2Ds)
Ladar/sonar 3-D imaging: 3D scanning, depth map Scientific image
2. Operations upon pixels Individual, pixel-by-pixel
Iout (n,m) = f (Iin(n,m))
E.g. Iin(n,m) + IB(n,m) or Iin(n,m) + C
Arithmetic operation contrast adjustment : imadd(I, const)
Blending(mixing): imadd(I1, I2)
Substraction: imsubstract(I1, I2) Difference : imabsdiff(I1, I2)
Multiplication, division : immultiply(I, const), imdivide(I, const)
Saturation issue Overflow & underflow problem in range [0, 255] matlab “im” functions handle the saturation
Logical operations Mostly for binary image NOT: imcomplement(I) OR, XOR, AND, NAND, NOR, NXOR
Thresholding Gray scale to binary image : im2bw(I, thres) Io = 1 if Iin > T or 0 o.w. Used for extract fg from bg variations
Thresholding for simple and complex image
4. transform Mostly for improving the contrast of images
(dynamic range) Logarithmic transform
Increase the contrast in “low” values
Exponential transform Increase contrast in high values
Gamma (power)
flexible r < 1 : log-style r > 1 : exp-style
4. Histograms Histogram
h(x) = # of pixels whose value is x. pmf (x) = h(x) / # of pixels
Thresholding Global Threshold selection
Bi-modal distribution (F3.12, previous slide) : easy to select
Multi-modal/complicated (F3.13) : not easy
Otsu’s Method: global optimal algorithm Threshold that minimizes the intra class standard
variance (a clustering algorithm)
level =graythresth(Img) in MATLAB
Intra-class variances
Inter-class variances
Minimizing
Maximizing
Adaptive thresholding Reason: Illumination is not uniform, multiple objects T(n, m) = f ( W[n,m] )
Threashold value “adapts” neighbors of pixel (n,m), W. E.g of function
mean, median, floor((max – min/2) +C
orignal
f
median
T
+ margin
still noise
Contrast Control To enhance visual perception Linear contrast stretching
Tips: outlier problem Use c at 5%, d at 95%
[c, d] [b= 0, a = 255] (value – c) (a-b)/(c-d) + a
Histogram equalization Equalization
Resultant histogram is flat/equal Nonlinear & dependent image histogram
Global method proof: Iout ~ py(y)Iin ~ px(x)
y = f(x)
Example Not exactly flat (in discrete values)
Histogram Matching Generalization of histogram equalization map output image’s histogram to a specific
function.
Iout ~ py(y) ~ Cy(y)
Iin ~ px(x) ~ Cx(x) y = f(x)
f(x) = C-1z[Cx(x)]
Adaptive histogram equalizer Similar reason as adaptive thresholding Local histogram generation
Sliding windows method Tile-based method
Low computation Blocking effects
inner window
outter window
Pizer’s approach Weighted histogram
Contrast limiting Not to over-amplificate noise pixels Concept
MATLAB J = adapthisteq
(I, [param1,val1]...) Params
ClipLimit : [0:1] (0.01) NumTiles: (8) Distribution
Target distist. (uniform)
Rayleigh
exponential uniform
A Real Application Budapest Castle (Hungary)
Taken by Galaxy S5 in the evening
gray/hsv
GHE
AHE
rgb