SHARE
TWEET

Untitled

a guest Apr 23rd, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void equalizacionHistograma(C_Image &imagen, C_Image &imagenSalida, int* histArray, int* histAcumArray) {
  2.     int aux = 0;
  3.     int i;
  4.     int minAcum = LONG_MAX;
  5.     int nEle;
  6.     int referencia[256] = { 0 };
  7.     C_Matrix::IndexT row, column;
  8.     C_Image::IndexT fila, col;
  9.  
  10.     for (i = 1; i < 256; i++) {
  11.         histAcumArray[i] = histArray[i] + histAcumArray[i - 1];
  12.     }
  13.  
  14.     row = imagen.RowN();
  15.     column = imagen.ColN();
  16.     nEle = row * column; // nº de elementos de la imagen
  17.  
  18.     for (i = 0; i < 256; i++) {
  19.         // Seleccionamos el mínimo valor del histograma acumulado
  20.         if (minAcum > histAcumArray[i]) minAcum = histAcumArray[i];
  21.         // Se calcula el valor a asignar para cada nivel de intensidad
  22.         referencia[i] = floor((255 * (histAcumArray[i] - minAcum) / (nEle - minAcum)));
  23.     }
  24.  
  25.     for (fila = imagen.FirstRow(); fila <= imagen.LastRow(); fila++)
  26.         for (col = imagen.FirstCol(); col <= imagen.LastCol(); col++) {
  27.             aux = imagen(fila, col);
  28.             imagenSalida(fila, col) = referencia[aux];
  29.         }
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top