cnn/export:write_image:Increase brightness

This commit is contained in:
augustin64 2023-05-25 10:37:33 +02:00
parent 10a9714db9
commit 46aa64da01

View File

@ -94,9 +94,16 @@ void write_image(float** data, int width, int height, char* base_filename, int l
image->height = height;
image->lpData = (unsigned char*)malloc(sizeof(unsigned char)*width*height*3);
float maxi = 1e-7;
for (int i=0; i < height; i++) {
for (int j=0; j < width; j++) {
float color = fmax(fmin(data[i][j], 1.), 0.)*255;
maxi = fmax(maxi ,data[i][j]);
}
}
for (int i=0; i < height; i++) {
for (int j=0; j < width; j++) {
float color = fmax(data[i][j]/maxi, 0.)*255;
image->lpData[(i*width+j)*3] = color;
image->lpData[(i*width+j)*3 + 1] = color;