Skip to main content

piecewise histogram equalization

1 reply [Last post]
Joined: 2010-06-08

Salam Alukom
Please Could You Help me Soon, Please

I try to enhance image using Generalized Histogram equalization algorithm

5-Calculate the histogram H(p) based on the values G(x, y).
6. Since the histogram H(p) is very noisy, we need to remove the noise, and we smooth the histogram.
7. Computing the local minimums, {pi , i = 1, . . .,m ? 1}, and let p0 = Gmin, pm =
8. Equalize the histogram H(p) piecewise and independently according to the segments
between pi and pi+1 {i = 0, 1, . . . ,m? 1}. Finally, output the enhanced image.

I do rightly all steps before those

now to do these step i do the following

//Change Image to planarImage
ParameterBlockJAI pb = new ParameterBlockJAI("AWTImage");
pb.setParameter("AWTImage", Image);
PlanarImage planarSource = PlanarImage.wrapRenderedImage(Image);

//Histogram Parameter Block
ParameterBlock pbhist = new ParameterBlock();
RenderedOp op = JAI.create("histogram", pbhist, null);
Histogram histogram = (Histogram) op.getProperty("histogram");
//Gaussian Smooth
Histogram GauHistogram = histogram.getGaussianSmoothed(sigma);

// Get Local Minima
int Araysize = GauHistogram.getNumBins(0);
int MinimaIndex = 0;
double LocalMin[] = new double[Araysize];
//LocalMin0=Minimum Gray value for the image
LocalMin[0] = Gmin;
//temp have the size+2 of histogram array to get minima from thae histarray
double temp[] = new double[Araysize + 2];
temp[0] = 0;//As i-1
temp[Araysize + 1] = 0;//As i+1
//Copy HistArray to temp
for (int i = 0; i < GauHistogram.getNumBins(0); i++) {
temp[i + 1] = GauHistogram.getBinSize(0, i);

//Get Local Minima from temp As the minma between two grater value than it befor and after it.
for (int i = 1; i < temp.length - 1; i++) {
if (temp[i - 1] > temp[i] && temp[i + 1] > temp[i]) {
LocalMin[++MinimaIndex] = temp[i];
LocalMin[MinimaIndex++] = Gmax;//to have the maximum gray value for the image

//Equalize GauHistogram piecewise and independantly according to the segmants between LocalMin0 to LocalMin MinimaIndex
//I try to use piecewise equalaization
// So I go to define the BreakPoint Array
float[][] BreakPoint = new float[1/* as I use gray Image*/][];
for (int b = 0; b < 1; b++) {
BreakPoint[b] = new float[MinimaIndex];
for (int i = 0; i < MinimaIndex; i++) {
BreakPoint[b][i] = (float) LocalMin[i];
RenderedOp pw = JAI.create("piecewise", Image, BreakPoint);

I understand that piecewise operator enhance histogram according breakpoint.Is it true?

Please Help me soon

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2010-06-08

any help is appreciated. I couldn't find any information in Internet.