Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- nBins = 256 ;
- getHistogram(values,counts,nBins) ;
- height = getHeight ;
- width = getWidth ;
- n = height*width ;
- valeurCumulees = newArray(nBins) ;
- valeurCumuleesDiv = newArray(nBins) ;
- val2 = 0;
- i = 0;
- for (i=0; i<nBins; i++)
- {
- val2 = val2 + counts[i] ;
- valeurCumulees[i] = val2 ;
- valeurCumuleesDiv[i] = valeurCumulees[i] / n ;
- }
- nvoPixel=0;
- q = 0;
- for (y = 0; y < getHeight; y = y + 1) // balayage hauteur
- {
- for (x = 0; x < getWidth; x = x + 1) //balayage largeur
- {
- for (q=0; q<nBins;q++)
- {
- if (getPixel(x,y) == q)
- {
- nvoPixel = (nBins-1)*valeurCumuleesDiv[q];
- setPixel(x,y,nvoPixel);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement