Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void equalizacionHistograma(C_Image &imagen, C_Image &imagenSalida, int* histArray, int* histAcumArray) {
- int aux = 0;
- int i;
- int minAcum = LONG_MAX;
- int nEle;
- int referencia[256] = { 0 };
- C_Matrix::IndexT row, column;
- C_Image::IndexT fila, col;
- for (i = 1; i < 256; i++) {
- histAcumArray[i] = histArray[i] + histAcumArray[i - 1];
- }
- row = imagen.RowN();
- column = imagen.ColN();
- nEle = row * column; // nº de elementos de la imagen
- for (i = 0; i < 256; i++) {
- // Seleccionamos el mínimo valor del histograma acumulado
- if (minAcum > histAcumArray[i]) minAcum = histAcumArray[i];
- // Se calcula el valor a asignar para cada nivel de intensidad
- referencia[i] = floor((255 * (histAcumArray[i] - minAcum) / (nEle - minAcum)));
- }
- for (fila = imagen.FirstRow(); fila <= imagen.LastRow(); fila++)
- for (col = imagen.FirstCol(); col <= imagen.LastCol(); col++) {
- aux = imagen(fila, col);
- imagenSalida(fila, col) = referencia[aux];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement