unsigned int histogram[256]={0};
for(int i=0;i<width*height;i++) //to iterate over pixels
++histogram[image[i]];
const float cutoffpercentage = 0.05; //To cut off lower and upper values
unsigned char lowerbound,upperbound;
unsigned int histAccu =0; //pixel entries < 5% =lower bound
const unsigned int lowerpercentile = cutoffpercentage * width*height;
const unsigned int upperpercentile = (1-cutoffpercentage)*width*height;
for(int h =0;h <256;h++){
histAccu += histogram[h];
if(histAccu <= lowerpercentile){
lowerbound = h;
continue;
}
if(histAccu >= upperpercentile){
upperbound = h;
break;
}
}
Then assign new gray values. Can I write this program to equalize the histogram of an image on a gpu shader memory and programs for image segmentation, blurring, sharpening etc...as a shader program using openGL ?? Can we write shader programs just like a normal application program in C ?? Kindly help me on this, as I'm new to shader programming.