counting negative values
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user