Advertisement
Guest User

qsdqsd

a guest
Jan 28th, 2015
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.68 KB | None | 0 0
  1. nBins = 256 ;
  2. getHistogram(values,counts,nBins) ;
  3. height = getHeight ;
  4. width = getWidth ;
  5. n = height*width ;
  6. valeurCumulees = newArray(nBins) ;
  7. valeurCumuleesDiv = newArray(nBins) ;
  8. val2 = 0;
  9. i = 0;
  10.  
  11. for (i=0; i<nBins; i++)
  12. {
  13.     val2 = val2 + counts[i] ;
  14.     valeurCumulees[i] = val2 ;
  15.     valeurCumuleesDiv[i] = valeurCumulees[i] / n ;
  16. }
  17.  
  18.  
  19. nvoPixel=0;
  20. q = 0;
  21.  
  22. for (y = 0; y < getHeight; y = y + 1)    // balayage hauteur
  23. {   
  24.     for (x = 0; x < getWidth; x = x + 1)   //balayage largeur
  25.     {    
  26.          
  27.         for (q=0; q<nBins;q++)
  28.         {
  29.             if (getPixel(x,y) == q)
  30.             {
  31.                 nvoPixel = (nBins-1)*valeurCumuleesDiv[q];
  32.                 setPixel(x,y,nvoPixel);
  33.  
  34.                 }
  35.             }
  36.         }
  37.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement