|
|
|
@ -7,7 +7,8 @@
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
#include "string.h"
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <math.h>
|
|
|
|
|
|
|
|
|
|
#include "../floatimg.h"
|
|
|
|
|
|
|
|
|
@ -19,6 +20,12 @@ float fimg_get_maxvalue(FloatImg *head)
|
|
|
|
|
float maxval;
|
|
|
|
|
int foo;
|
|
|
|
|
|
|
|
|
|
if (head->type != FIMG_TYPE_RGB) {
|
|
|
|
|
fprintf(stderr, "%s : type %d invalide\n",
|
|
|
|
|
__func__, head->type);
|
|
|
|
|
return nanf("wtf ?");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
maxval = 0.0; /* no negative values allowed */
|
|
|
|
|
|
|
|
|
|
for (foo=0; foo<(head->width*head->height); foo++) {
|
|
|
|
@ -57,6 +64,12 @@ int fimg_to_gray(FloatImg *head)
|
|
|
|
|
float add;
|
|
|
|
|
int foo;
|
|
|
|
|
|
|
|
|
|
if (head->type != FIMG_TYPE_RGB) {
|
|
|
|
|
fprintf(stderr, "%s : type %d invalide\n",
|
|
|
|
|
__func__, head->type);
|
|
|
|
|
return -3;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (foo=0; foo<(head->width*head->height); foo++) {
|
|
|
|
|
add = head->R[foo];
|
|
|
|
|
add += head->G[foo];
|
|
|
|
@ -70,6 +83,12 @@ void fimg_add_cste(FloatImg *fi, float value)
|
|
|
|
|
{
|
|
|
|
|
int nbre, idx;
|
|
|
|
|
|
|
|
|
|
if (fi->type != FIMG_TYPE_RGB) {
|
|
|
|
|
fprintf(stderr, "%s : type %d invalide\n",
|
|
|
|
|
__func__, fi->type);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nbre = fi->width * fi->height * fi->type;
|
|
|
|
|
#if DEBUG_LEVEL
|
|
|
|
|
fprintf(stderr, "%s, nbre is %d\n", __func__, nbre);
|
|
|
|
|