new func: the max of max

This commit is contained in:
tTh
2023-10-07 19:19:49 +02:00
parent cfe9f8cdae
commit 2699476135
3 changed files with 71 additions and 8 deletions

View File

@@ -116,7 +116,37 @@ for (idx=0; idx<surface; idx++) {
else if (fval > mmvals[5]) mmvals[5] = fval;
}
return -0;
return 0;
}
/* ---------------------------------------------------------------- */
/* new: Fri Oct 6 19:51:28 UTC 2023
*
* can compute the maxima of a lot of pictures...
*/
fimg_max_of_max(FloatImg *img, float maxes[3])
{
float localmax[3];
int idx, surface;
float fval;
localmax[0] = localmax[1] = localmax[2] = -1e9;
surface = img->width * img->height;
for (idx=0; idx<surface; idx++) {
fval = img->R[idx];
if (fval > localmax[0]) localmax[0] = fval;
fval = img->G[idx];
if (fval > localmax[1]) localmax[1] = fval;
fval = img->B[idx];
if (fval > localmax[2]) localmax[2] = fval;
}
if (localmax[0] > maxes[0]) maxes[0] = localmax[0];
if (localmax[1] > maxes[1]) maxes[1] = localmax[1];
if (localmax[2] > maxes[2]) maxes[2] = localmax[2];
return 0;
}
/* ---------------------------------------------------------------- */
int fimg_meanvalues(FloatImg *head, float means[4])