Download presentation
Presentation is loading. Please wait.
Published byWilfred Bailey Modified over 9 years ago
1
Histograms- HPP
2
What is homogeneous? Homogeneous point process treats all pixels the same. p'=f(p); // homogeneous point processing does not care about pixel location. isomorphic pixel mapping.
3
Homogeneous Point Processing Every point is treated the same Input size of image is same as output size Good application of statistics! input image shape is the same as the output image shape.
4
Image processing An image processing operation typically defines a new image g in terms of an existing image f.
5
You need a function! A function has a single possible output value for any unique input value. A relation can have two outputs for a given input. For example x**2+y**2=r**2 is a relation. y=sqrt(x*x+r*r); //take only the + part and you have a function.
6
Mapping a pixel has many applications Brightening an image Improving the contrast Coloring the image. histogram equalization converting to a new color space.
7
How do we implements HPP? Standards for HPP base on an INTERFACE. The standardization of the filter into interface allows for polymorphism.
8
Point Processing The simplest kind of range transformations are these independent of position x,y: g = t(f)
9
How do we form such an interface? java.awt has RGBImageFilter interface It requires that you implement public int filterRGB(int x, int y, int rgb); 1. Unpack the rgb int 2. Do the HPP 3. repack the int and return the value.
10
How do we unpack our RGB ints? let RGB=0x7FDEAD50 int a = rgb &0xFF000000>>24; int r = rgb &0x00FF0000 >>16; int g = rgb &0x0000FF00 >> 8; int b = rgb &0x000000FF; int r1 = getRed(r,g,b);int g1=getGreen(r,g,b); int b1 = getBlue(r,g,b); return 0xFF000000 | (r1 << 16) | (g1<<8) | b1;
11
Adapter Pattern Adapter Pattern take one interface and maps to a new interface. public interface HppFilterInterface { public short getR(int r); public short getG(int g); public short getB(int b); }
12
InvertFilter public class InvertFilter implements HppFilterInterface { public short getR(int r) { return invert(r); } public short getG(int g) { return invert(g); } public short getB(int b) { return invert(b); }
13
Invert private short invert(int v) { if (v < 0) return 0; if (v > 255) return 255; return (short) (255 - v); }
14
Two kinds of methods for altering an image The direct methods The indirect methods. The direct methods employ a mapping function, Mapping functions are applied to the color planes.
15
Two kinds of methods for altering an image First we do the direct methods….
16
PMF Add the total number of pixels of a particular value Divide by the total number of pixels
17
Rules of Prob. Sum of all probs=1 CMF is sum of all values up to a point.
18
In Prob…Cont vs. Discrete PMF – discrete but PDF are Continuous CMF – discrete by CDF are continuous Example: Toss a coin – discrete Example: Temp. Time, space CMF uses a discrete summation (for-loop) CDF uses an integral discrete means quantized
19
Histogram Computations histArray = new double[256]; for (int i=0; i<width; i++) for (int j=0; j < height; j++) histArray[plane[i][j] & 0xFF]++; // what happens if you have 24 bit color images?
20
Normalization of PMF double max = 0.0; for(int i=0; i<256; i++) if (histArray[i] > max) max = histArray[i]; // Normalize for(int i=0; i<256; i++) histArray[i] = (histArray[i] / max);
21
The Histogram of the Image
22
Summary of Histogram package gui; public class Histogram extends ClosableFrame { public double[] getPMF() public double[] getCMF() public void printPMF() public void show() public Histogram(short plane[][], String title) public void paint(Graphics g) }
23
Linear Map and Sample Image
24
LUT implementation In theory, lut is easy: –outputColor = f(inputColor) –F(x) is an lut. –What happens if x ranges from 0 to 2**24?
25
Negating an Image
26
Implementation private short invert(int v) { if (v < 0) return 0; if (v > 255) return 255; return (short) (255 - v); }
27
HppFilterInterface public short getR(int r); public short getG(int g); public short getB(int b);
28
What is thresholding? Requanitze an image. for example: –given an image with 256 grays –find an image with only 2 grays How do I know which pixels are black and which are white? –if (v < thresh) v = 0, else v = 255;
29
Two kinds of methods for altering an image The direct methods The indirect methods. The direct methods employ a mapping function, Mapping functions are applied to the color planes.
30
Indirect Methods The indirect method use statistical properties Two Kinds of Indirect Methods: adaptive and nonadaptive
31
Basic Point Processing
32
Computing Averages
33
Image Enhancement
34
Contrast Streching
35
Power law and image processing
36
1.5 exponent=darkening
37
Power-law transformations
38
Gamma Correction
39
Washed out images can result
40
Changing Brightness and Contrast
41
Linear eq and histogram
42
Brightening and image
43
Computing parameters automatically
44
Darkening Image
45
Darkening and the Histogram
46
Implementing the power xform public void powImage(double p) { for (int x=0; x < width; x++) for (int y=0; y < height; y++) { r[x][y] = (short) (255 * Math.pow((r[x][y]/255.0),p)); g[x][y] = (short) (255 * Math.pow((g[x][y]/255.0),p)); b[x][y] = (short) (255 * Math.pow((b[x][y]/255.0),p)); } short2Image(); }
47
UNAHE
48
The CMF
49
Adaptive Equalization
50
Histogram an AUHE
51
LUT Implementation package gui; public class TransformTable { public TransformTable(int size) public short[] getLut() public void setLut(short lut[]) public void print() }
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.