Compare commits
No commits in common. "2f3a8870c4a7dd090b10abed5588096993c3d57d" and "af9b912eb0c913d99ac35eadce8d4015c5f498b9" have entirely different histories.
2f3a8870c4
...
af9b912eb0
@ -131,7 +131,7 @@ approprié, par exemple
|
||||
\texttt{/usr/local/include} et \texttt{/usr/local/lib}.
|
||||
|
||||
% -------------------------------------------------------------------
|
||||
\section{Utilisation coté codeur}
|
||||
\section{Utilisation}
|
||||
|
||||
Classiquement, il y a un fichier à inclure, \texttt{floatimg.h},
|
||||
contenant un certain nombre de
|
||||
@ -296,7 +296,7 @@ Il reste plein de choses à faire pour que ce soit vraiment utilisable.
|
||||
\begin{itemize}
|
||||
|
||||
\item Import/export au format \textsc{tiff}\index{tiff}.
|
||||
\item Remplacer le « fait-maison » par \textsc{libnetpbm}.
|
||||
\item Remplacer le « fait-maison » par \textscq{libnetpbm}.
|
||||
\item Compléter les traitements mathémathiques (eg le gamma\index{gamma}).
|
||||
\
|
||||
\end{itemize}
|
||||
|
@ -46,9 +46,6 @@ int fimg_plot_rgb (FloatImg *head, int x, int y, float r, float g, float b);
|
||||
int fimg_clear(FloatImg *fimg);
|
||||
int fimg_add_rgb(FloatImg *head, int x, int y, float r, float g, float b);
|
||||
|
||||
|
||||
int fimg_interpolate(FloatImg *s1, FloatImg *s2, FloatImg *d, float coef);
|
||||
|
||||
/* 'operats' module */
|
||||
int fimg_add(FloatImg *a, FloatImg *b, FloatImg *d);
|
||||
int fimg_sub(FloatImg *a, FloatImg *b, FloatImg *d);
|
||||
|
@ -4,9 +4,7 @@
|
||||
|
||||
COPT = -Wall -fpic -g -no-pie -DDEBUG_LEVEL=0
|
||||
OBJS = fimg-core.o fimg-pnm.o fimg-file.o fimg-math.o \
|
||||
fimg-timers.o operators.o fimg-2gray.o \
|
||||
interpolate.o
|
||||
|
||||
fimg-timers.o operators.o fimg-2gray.o
|
||||
DEPS = Makefile ../floatimg.h
|
||||
|
||||
# modify it 'as you like'
|
||||
@ -15,7 +13,7 @@ AR=ar
|
||||
all: $(OBJS) ../libfloatimg.a
|
||||
|
||||
t: t.c ../libfloatimg.a $(DEPS)
|
||||
gcc $(COPT) $< ../libfloatimg.a -lpnglite -lm -o $@
|
||||
gcc $(COPT) $< ../libfloatimg.a -lm -o $@
|
||||
|
||||
# --------------------------------------------
|
||||
|
||||
@ -31,9 +29,6 @@ fimg-2gray.o: fimg-2gray.c $(DEPS)
|
||||
operators.o: operators.c $(DEPS)
|
||||
gcc $(COPT) -c $<
|
||||
|
||||
interpolate.o: interpolate.c $(DEPS)
|
||||
gcc $(COPT) -c $<
|
||||
|
||||
fimg-pnm.o: fimg-pnm.c $(DEPS)
|
||||
gcc $(COPT) -c $<
|
||||
|
||||
|
@ -1,44 +0,0 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "../floatimg.h"
|
||||
|
||||
int verbosity;
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
int fimg_interpolate(FloatImg *s1, FloatImg *s2, FloatImg *d, float coef)
|
||||
{
|
||||
int picsize, idx;
|
||||
|
||||
if (FIMG_TYPE_RGB != s1->type) {
|
||||
fprintf(stderr, "%s : bad src 1 type %d on %p\n", __func__,
|
||||
s1->type, s1);
|
||||
return -8;
|
||||
}
|
||||
|
||||
if (FIMG_TYPE_RGB != s2->type) {
|
||||
fprintf(stderr, "%s : bad src 2 type %d on %p\n", __func__,
|
||||
s2->type, s2);
|
||||
return -8;
|
||||
}
|
||||
if (FIMG_TYPE_RGB != d->type) {
|
||||
fprintf(stderr, "%s : bad dst type %d on %p\n", __func__,
|
||||
d->type, d);
|
||||
return -9;
|
||||
}
|
||||
|
||||
picsize = d->width * d->height * 2;
|
||||
|
||||
for (idx=0; idx<picsize; idx++) {
|
||||
|
||||
d->R[idx] = (coef * s1->R[idx]) + ((1.0-coef) * s2->R[idx]);
|
||||
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
/* ---------------------------------------------------------------- */
|
46
lib/t.c
46
lib/t.c
@ -1,8 +1,3 @@
|
||||
/*
|
||||
* programme de test pour
|
||||
* les fonctions de base.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
@ -67,48 +62,25 @@ fimg_destroy(&gray);
|
||||
return 0;
|
||||
}
|
||||
/* ---------------------------------------------------------------- */
|
||||
/****
|
||||
foo = fimg_create(&dessin, W, H, 3);
|
||||
petit_dessin(&dessin);
|
||||
foo = fimg_create(&noise, W, H, 3);
|
||||
fimg_drand48(&noise, 0.1);
|
||||
|
||||
****/
|
||||
/* ---------------------------------------------------------------- */
|
||||
#define W 320
|
||||
#define H 240
|
||||
#define W 2048
|
||||
#define H 2048
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int foo, idx;
|
||||
float coef;
|
||||
int foo;
|
||||
FloatImg dessin, noise, result;
|
||||
char outname[100];
|
||||
|
||||
verbosity = 1;
|
||||
|
||||
fimg_print_version(1);
|
||||
|
||||
foo = fimg_create_from_png("/home/tth/TMP/floatimg/s2.png", &dessin);
|
||||
foo = fimg_create_from_png("/home/tth/TMP/floatimg/s1.png", &noise);
|
||||
foo = fimg_create(&dessin, W, H, 3);
|
||||
petit_dessin(&dessin);
|
||||
foo = fimg_create(&noise, W, H, 3);
|
||||
fimg_drand48(&noise, 0.1);
|
||||
|
||||
foo = fimg_create(&result, W, H, 3);
|
||||
|
||||
#define NBRE 42
|
||||
|
||||
for (idx=0; idx<NBRE; idx++) {
|
||||
|
||||
coef = (float)idx / (float)NBRE;
|
||||
coef = (0.5-0.5*cos( 3.141592654*coef));
|
||||
|
||||
|
||||
|
||||
foo = fimg_interpolate(&dessin, &noise, &result, coef);
|
||||
printf("%6d %9.6f\n", idx, coef);
|
||||
fimg_to_gray(&result);
|
||||
sprintf(outname, "/home/tth/TMP/floatimg/%05d.pnm", idx);
|
||||
foo = fimg_save_as_pnm(&result, outname, 0);
|
||||
}
|
||||
// essai_2gray(&result, "gray.pnm");
|
||||
foo = fimg_mul(&dessin, &noise, &result);
|
||||
essai_2gray(&result, "gray.pnm");
|
||||
|
||||
fimg_destroy(&dessin), fimg_destroy(&noise), fimg_destroy(&result);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user