void normalize( uint8_t array[],
unsigned int cols,
unsigned int rows )
{
uint8_t darkest = min(array, cols, rows);
uint8_t lightest = max(array, cols, rows);
uint8_t arr[lightest-darkest+1];
double scale_factor = (round) (256/(max-min+1));
for(int i=darkest; i<lightest-darkest+1; i++){
arr[i] = i;
}
for(int i=0; i<cols*rows; i++){
for(uint8_t k=0; k<lightest-darkest+1; i++){
if(arr[k] == array[i]){
double new = k*scale_factor;
array[i] = (uint8_t) new;
break;
}
}
}
}
No comments:
Post a Comment