counting negative values

This commit is contained in:
2019-09-25 09:21:00 +02:00
parent d294102ca4
commit 54269cc007
3 changed files with 28 additions and 1 deletions

View File

@@ -108,6 +108,27 @@ for (idx=0; idx<nbre; idx++) {
}
}
/* ---------------------------------------------------------------- */
int fimg_count_negativ(FloatImg *fi)
{
int nbre, idx;
int count;
if (fi->type != FIMG_TYPE_RGB) {
fprintf(stderr, "%s : type %d invalide\n",
__func__, fi->type);
return -1;
}
nbre = fi->width * fi->height * fi->type;
count = 0;
for (idx=0; idx<nbre; idx++) {
if (fi->R[idx] < 0.0) count++;
}
return count;
}
/* ---------------------------------------------------------------- */
void fimg_mul_cste(FloatImg *fi, float value)
{
int nbre, idx;