Compare commits
	
		
			13 Commits
		
	
	
		
			7e09d1b490
			...
			a01eebd240
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					a01eebd240 | ||
| 
						 | 
					65f396bedd | ||
| 
						 | 
					402c80962a | ||
| 
						 | 
					3a3311647b | ||
| 
						 | 
					d6632ade7e | ||
| 
						 | 
					38173616ba | ||
| 
						 | 
					ce04418ef1 | ||
| 
						 | 
					e2b830b537 | ||
| 
						 | 
					1762a35868 | ||
| 
						 | 
					acb36a45b3 | ||
| 
						 | 
					4a3f107263 | ||
| 
						 | 
					cd5f42b76e | ||
| 
						 | 
					0b094bf7b8 | 
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@ -3,6 +3,7 @@
 | 
			
		||||
 | 
			
		||||
libtthimage.a
 | 
			
		||||
cscope.out
 | 
			
		||||
gmon.out
 | 
			
		||||
 | 
			
		||||
Lib/foo
 | 
			
		||||
Lib/testtga
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										5
									
								
								Contribs/ExplodeVidz.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								Contribs/ExplodeVidz.md
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,5 @@
 | 
			
		||||
 | 
			
		||||
# Exploding Vidz for fun and profit.
 | 
			
		||||
 | 
			
		||||
But du jeu : traiter la séquence d'image complète d'une vidéo live,
 | 
			
		||||
sans devoir attendre 107 ans que le job soit fait.
 | 
			
		||||
							
								
								
									
										9
									
								
								Contribs/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								Contribs/README.md
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,9 @@
 | 
			
		||||
 | 
			
		||||
# Contributions
 | 
			
		||||
 | 
			
		||||
Voici une collection informelle de fonctions diverses et variées contribuées
 | 
			
		||||
par moi-même (et peut-être, un jour, d'autres gens...) et qui risquent
 | 
			
		||||
bien de n'être **pas très maintenues**, contrairement au reste du *kluge*.
 | 
			
		||||
 | 
			
		||||
Nous allons commencer par des fonctions inventées lors d'une *n*-ième session
 | 
			
		||||
du projet [ExplodeVidz](ExplodeVidz.md).
 | 
			
		||||
							
								
								
									
										1
									
								
								Lib/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								Lib/.gitignore
									
									
									
									
										vendored
									
									
								
							@ -1,3 +1,4 @@
 | 
			
		||||
 | 
			
		||||
*.png
 | 
			
		||||
cflow.txt
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -8,7 +8,7 @@ include ../Paramakes.mk
 | 
			
		||||
 | 
			
		||||
DEPS = ../tthimage.h ../Paramakes.mk Makefile
 | 
			
		||||
 | 
			
		||||
all:	foo testtga
 | 
			
		||||
all:	foo testtga t_png testbmp
 | 
			
		||||
 | 
			
		||||
#-----------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
@ -178,6 +178,7 @@ OBJECTS =	7seg.o							\
 | 
			
		||||
		warp0.o warp1.o warp2.o					\
 | 
			
		||||
		zoom.o
 | 
			
		||||
 | 
			
		||||
# build the static library
 | 
			
		||||
../libtthimage.a: 	$(OBJECTS)
 | 
			
		||||
	$(AR) 	rs $@ $?
 | 
			
		||||
	$(RANLIB)   $@
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# The tTh image processind library
 | 
			
		||||
# The tTh image processing library
 | 
			
		||||
 | 
			
		||||
Ugly software born around 1995 on a MS-Dos 286 computer.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -4,7 +4,7 @@
 | 
			
		||||
 | 
			
		||||
	made by Thierry Boudet, aka "Oulala", aka "Tonton Th".
 | 
			
		||||
 | 
			
		||||
	ces fonctions combinent de diverses façons deux images
 | 
			
		||||
	ces fonctions combinent de diverses facons deux images
 | 
			
		||||
	de memes dimensions. on pourra, par exemple, les utiliser
 | 
			
		||||
	pour comparer deux traitements.
 | 
			
		||||
*/
 | 
			
		||||
@ -22,7 +22,7 @@
 | 
			
		||||
 | 
			
		||||
/*::------------------------------------------------------------------::*/
 | 
			
		||||
/*
 | 
			
		||||
 *	le paramètre 'zak' n'est pas utilisé et doit être mis à 0
 | 
			
		||||
 *	le parametre 'zak' n'est pas utilise et doit etre mis a 0
 | 
			
		||||
 */
 | 
			
		||||
int Image_combine_lines(Image_Desc *s1, Image_Desc *s2, Image_Desc *d,
 | 
			
		||||
			int sy, int oy, int zak)
 | 
			
		||||
@ -30,11 +30,11 @@ int Image_combine_lines(Image_Desc *s1, Image_Desc *s2, Image_Desc *d,
 | 
			
		||||
int	foo, x, y, my, r, g, b;
 | 
			
		||||
 | 
			
		||||
if (sy == 0) {
 | 
			
		||||
	fprintf(stderr, "Combine Lines: sy is zer0 and zak is %d\n", zak);
 | 
			
		||||
	fprintf(stderr, "%s: sy is 0 and zak is %d\n", __func__, zak);
 | 
			
		||||
	return DIVISOR_IS_ZERO;
 | 
			
		||||
	}
 | 
			
		||||
if ( (foo=Image_compare_desc(s1, s2)) ) {
 | 
			
		||||
	fprintf(stderr, "Combine Lines: sources are differents (%d)\n", foo);
 | 
			
		||||
	fprintf(stderr, "%s: sources are differents (%d)\n", __func__, foo);
 | 
			
		||||
	return foo;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@ -65,7 +65,7 @@ return OLL_KORRECT;
 | 
			
		||||
}
 | 
			
		||||
/*::------------------------------------------------------------------::*/
 | 
			
		||||
/*
 | 
			
		||||
 *	le paramètre 'zak' n'est pas utilisé et doit être mis à 0
 | 
			
		||||
 *	le parametre 'zak' n'est pas utilise et doit etre mis a 0
 | 
			
		||||
 */
 | 
			
		||||
int Image_combine_columns(Image_Desc *s1, Image_Desc *s2, Image_Desc *d,
 | 
			
		||||
			int sx, int ox, int zak)
 | 
			
		||||
@ -241,8 +241,8 @@ return OLL_KORRECT;
 | 
			
		||||
}
 | 
			
		||||
/*::------------------------------------------------------------------::*/
 | 
			
		||||
/*
 | 
			
		||||
 *	le flag 'yo' decide quelle image sera en haut à droite.
 | 
			
		||||
 *	les paramètres p1 & p2 ne sont pas utilisés.
 | 
			
		||||
 *	le flag 'yo' decide quelle image sera en haut a droite.
 | 
			
		||||
 *	les parametres p1 & p2 ne sont pas utilises.
 | 
			
		||||
 */
 | 
			
		||||
int Image_combine_diagonale(Image_Desc *s1, Image_Desc *s2, Image_Desc *d,
 | 
			
		||||
				int yo, int p1, int p2)
 | 
			
		||||
@ -252,7 +252,7 @@ int	x, y, r, g, b;
 | 
			
		||||
int	vertical, offset;
 | 
			
		||||
 | 
			
		||||
if ( p1 || p2 ) {
 | 
			
		||||
	fprintf(stderr, "in %s bad p1 %d or bad p2 %d\n", __func__, p1, p2);
 | 
			
		||||
	fprintf(stderr, "%s: bad p1 %d or bad p2 %d\n", __func__, p1, p2);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
if ( (foo=Image_compare_desc(s1, s2)) ) {
 | 
			
		||||
@ -300,6 +300,7 @@ for (y=0; y<s1->height; y++) {
 | 
			
		||||
	}
 | 
			
		||||
/*
 | 
			
		||||
 * 30 sept 2008 : est-ce que cette fonction a subi un bon fuzzing ?
 | 
			
		||||
 *  9 aout 2024 : non, pas encore ;)
 | 
			
		||||
 */
 | 
			
		||||
return OLL_KORRECT;
 | 
			
		||||
}
 | 
			
		||||
@ -352,7 +353,7 @@ return OLL_KORRECT;
 | 
			
		||||
/*
 | 
			
		||||
 *   fonction faite pour le finisseur de DBvsEE
 | 
			
		||||
 *
 | 
			
		||||
 *	6 oct 2001: une version qui permettrait de spécifier les
 | 
			
		||||
 *	6 oct 2001: une version qui permettrait de specifier les
 | 
			
		||||
 *		seuils en r,g et b serait assez pratique aussi.
 | 
			
		||||
 */
 | 
			
		||||
int Image_combine_if_not_black(Image_Desc *s1, Image_Desc *s2, Image_Desc *d)
 | 
			
		||||
 | 
			
		||||
@ -13,42 +13,35 @@
 | 
			
		||||
/*
 | 
			
		||||
 *	un kludge en chantier. programmation à la 'Gruiik' en vue.
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
Image_combine_waou(Image_Desc *s1, Image_Desc *s2, Image_Desc *dst,
 | 
			
		||||
int Image_combine_waou(Image_Desc *s1, Image_Desc *s2, Image_Desc *dst,
 | 
			
		||||
					int a, int b, int c, int d)
 | 
			
		||||
{
 | 
			
		||||
int	x, y, foo;
 | 
			
		||||
 | 
			
		||||
#if DEBUG_LEVEL
 | 
			
		||||
fprintf(stderr, "%s ( %p %p %p %d : %d %d (%d) )\n",
 | 
			
		||||
fprintf(stderr, ">>> %s ( %p %p %p %d : %d %d (%d) )\n",
 | 
			
		||||
			 __func__, s1, s2, dst, a, b, c, d);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
if ( (foo=Image_compare_desc(s1, s2)) )
 | 
			
		||||
    {
 | 
			
		||||
if ( (foo=Image_compare_desc(s1, s2)) ) {
 | 
			
		||||
    fprintf(stderr, "%s : sources are differents %d\n", __func__, foo);
 | 
			
		||||
    return foo;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
if ( (foo=Image_compare_desc(s1, dst)) )
 | 
			
		||||
    {
 | 
			
		||||
if ( (foo=Image_compare_desc(s1, dst)) ) {
 | 
			
		||||
    fprintf(stderr, "%s : destination bad dims %d\n", __func__, foo);
 | 
			
		||||
    return foo;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
for (y=0; y<dst->height; y++)
 | 
			
		||||
	{
 | 
			
		||||
	for (x=0; x<dst->width; x++)
 | 
			
		||||
		{
 | 
			
		||||
		if (d)
 | 
			
		||||
			{
 | 
			
		||||
for (y=0; y<dst->height; y++) {
 | 
			
		||||
	for (x=0; x<dst->width; x++) {
 | 
			
		||||
		if (d)	{
 | 
			
		||||
			/* canonical function */
 | 
			
		||||
			(dst->Rpix[y])[x] = (x & (s1->Rpix[y])[x]) | a;
 | 
			
		||||
			(dst->Gpix[y])[x] = x | b;
 | 
			
		||||
			(dst->Bpix[y])[x] = (y & (s2->Rpix[y])[x]) | c;
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
			{
 | 
			
		||||
		else	{
 | 
			
		||||
			/* new 9 mars 2010 - ave St Ex */
 | 
			
		||||
			(dst->Rpix[y])[x] = (x & (s1->Rpix[y])[x]) ^ a;
 | 
			
		||||
			(dst->Gpix[y])[x] = x ^ b;
 | 
			
		||||
@ -63,8 +56,7 @@ return FUNC_IS_BETA;
 | 
			
		||||
/*
 | 
			
		||||
 *	un kludge en chantier. programmation à la 'Gruiik' en vue.
 | 
			
		||||
 */ 
 | 
			
		||||
int
 | 
			
		||||
Image_combine_wauo(Image_Desc *s1, Image_Desc *s2, Image_Desc *dst,
 | 
			
		||||
int Image_combine_wauo(Image_Desc *s1, Image_Desc *s2, Image_Desc *dst,
 | 
			
		||||
						int flag)
 | 
			
		||||
{
 | 
			
		||||
int	x, y, foo;
 | 
			
		||||
@ -72,31 +64,25 @@ int	x, y, foo;
 | 
			
		||||
if ( flag )
 | 
			
		||||
	fprintf(stderr, "Combine Wauo: flag = %d ?\n", flag);
 | 
			
		||||
 | 
			
		||||
if ( (foo=Image_compare_desc(s1, s2)) )
 | 
			
		||||
    {
 | 
			
		||||
if ( (foo=Image_compare_desc(s1, s2)) ) {
 | 
			
		||||
    fprintf(stderr, "Combine Wauo: sources are differents %d\n", foo);
 | 
			
		||||
    return foo;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
if ( (foo=Image_compare_desc(s1, dst)) )
 | 
			
		||||
    {
 | 
			
		||||
if ( (foo=Image_compare_desc(s1, dst)) ) {
 | 
			
		||||
    fprintf(stderr, "Combine Wauo: destination bad dims %d\n", foo);
 | 
			
		||||
    return foo;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
for (y=1; y<dst->height-1; y++)
 | 
			
		||||
	{
 | 
			
		||||
	for (x=1; x<dst->width-1; x++)
 | 
			
		||||
		{
 | 
			
		||||
for (y=1; y<dst->height-1; y++) {
 | 
			
		||||
	for (x=1; x<dst->width-1; x++) {
 | 
			
		||||
		(dst->Rpix[y])[x] = (s1->Rpix[y][x] + s2->Rpix[y][x])/2;
 | 
			
		||||
 | 
			
		||||
		if (s1->Rpix[y][x] > s2->Rpix[y][x])
 | 
			
		||||
			{	
 | 
			
		||||
		if (s1->Rpix[y][x] > s2->Rpix[y][x]) {	
 | 
			
		||||
			(dst->Gpix[y])[x] = (s1->Gpix[y])[x];
 | 
			
		||||
			(dst->Bpix[y])[x] = (s2->Bpix[y])[x];
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
			{	
 | 
			
		||||
		else	{	
 | 
			
		||||
			(dst->Gpix[y])[x] = (s2->Gpix[y])[x];
 | 
			
		||||
			(dst->Bpix[y])[x] = (s1->Bpix[y])[x];
 | 
			
		||||
			}
 | 
			
		||||
@ -109,31 +95,26 @@ return OLL_KORRECT;
 | 
			
		||||
/*
 | 
			
		||||
 *   threshold values (sr, sg, sb) are in the pix range [0..255]
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
Image_combine_seuils(Image_Desc *s1, Image_Desc *s2, Image_Desc *dst,
 | 
			
		||||
int Image_combine_seuils(Image_Desc *s1, Image_Desc *s2, Image_Desc *dst,
 | 
			
		||||
						int sr, int sb, int sg)
 | 
			
		||||
{
 | 
			
		||||
int	x, y, foo;
 | 
			
		||||
int	r, g, b;
 | 
			
		||||
 | 
			
		||||
if ( (foo=Image_compare_desc(s1, s2)) )
 | 
			
		||||
    {
 | 
			
		||||
if ( (foo=Image_compare_desc(s1, s2)) ) {
 | 
			
		||||
    fprintf(stderr, "Combine Seuils: sources are differents %d\n", foo);
 | 
			
		||||
    return foo;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
if ( (foo=Image_compare_desc(s1, dst)) )
 | 
			
		||||
    {
 | 
			
		||||
if ( (foo=Image_compare_desc(s1, dst)) ) {
 | 
			
		||||
    fprintf(stderr, "Combine Seuils: destination bad dims %d\n", foo);
 | 
			
		||||
    return foo;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
sr*=2;	sg*=2;	sb*=2;
 | 
			
		||||
 | 
			
		||||
for (y=0; y<dst->height; y++)
 | 
			
		||||
	{
 | 
			
		||||
	for (x=0; x<dst->width; x++)
 | 
			
		||||
		{
 | 
			
		||||
for (y=0; y<dst->height; y++) {
 | 
			
		||||
	for (x=0; x<dst->width; x++) {
 | 
			
		||||
		if ( (s1->Rpix[y][x] + s2->Rpix[y][x]) > sr )
 | 
			
		||||
			r = s1->Rpix[y][x];
 | 
			
		||||
		else
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										15
									
								
								Lib/equalhist.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								Lib/equalhist.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,15 @@
 | 
			
		||||
/*
 | 
			
		||||
 *	Egalisation par cumul d'histogramme
 | 
			
		||||
 *	===================================
 | 
			
		||||
 *
 | 
			
		||||
 * new: Sat Aug 10 14:38:01 UTC 2024, aux Bourtoulots
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#include  <stdio.h>
 | 
			
		||||
#include  <math.h>
 | 
			
		||||
#include  "../tthimage.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*::------------------------------------------------------------------::*/
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										143
									
								
								Lib/essais.c
									
									
									
									
									
								
							
							
						
						
									
										143
									
								
								Lib/essais.c
									
									
									
									
									
								
							@ -145,7 +145,7 @@ Image_TGA_save("Pictures/aaaa-luminance-128.tga", dst, 0);
 | 
			
		||||
foo = Image_luminance(src, dst, 200);
 | 
			
		||||
Image_TGA_save("Pictures/aaaa-luminance-200.tga", dst, 0);
 | 
			
		||||
foo = Image_luminance(src, dst, 500);
 | 
			
		||||
if (foo) Image_print_error(__func__, foo);
 | 
			
		||||
if (foo) Image_print_error((char *)__func__, foo);
 | 
			
		||||
 | 
			
		||||
Image_TGA_save("Pictures/aaaa-luminance-500.tga", dst, 0);
 | 
			
		||||
 | 
			
		||||
@ -471,7 +471,6 @@ int		rotule, foo;
 | 
			
		||||
Image_Desc	*origine, *imgtmp;
 | 
			
		||||
char		chaine[100];
 | 
			
		||||
int		filtre[11];
 | 
			
		||||
int		w3, h3;
 | 
			
		||||
Image_Rect      rect;
 | 
			
		||||
 | 
			
		||||
static	int	datas_sobel[] =
 | 
			
		||||
@ -513,9 +512,6 @@ printf("image originale @ %p\n", origine);
 | 
			
		||||
 | 
			
		||||
imgtmp = Image_clone(origine, 1);
 | 
			
		||||
 | 
			
		||||
w3 = origine->width * 3;
 | 
			
		||||
h3 = origine->height * 3;
 | 
			
		||||
 | 
			
		||||
if (flags)	memcpy(filtre, datas_prewitt, sizeof(filtre));
 | 
			
		||||
else		memcpy(filtre, datas_sobel, sizeof(filtre));
 | 
			
		||||
 | 
			
		||||
@ -838,23 +834,29 @@ return 42;
 | 
			
		||||
}
 | 
			
		||||
/*::------------------------------------------------------------------::*/
 | 
			
		||||
/* new 24 avril 2007, essais sur le module rgbmask.c			*/
 | 
			
		||||
int
 | 
			
		||||
Test_rgbmask(char *srcname)
 | 
			
		||||
int Test_RGBmask(char *srcname)
 | 
			
		||||
{
 | 
			
		||||
Image_Desc *source, *image ;
 | 
			
		||||
int		foo;
 | 
			
		||||
 | 
			
		||||
fprintf(stderr, "=============== %s on %s ==============\n", __func__, srcname);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
source = Image_TGA_alloc_load(srcname);
 | 
			
		||||
image = Image_clone(source, 0);
 | 
			
		||||
 | 
			
		||||
foo = Image_rgbmask_H(source, image, 0);
 | 
			
		||||
Image_TGA_save("Pictures/aaaa-rgbmaskH.tga", image, 0);
 | 
			
		||||
Image_TGA_save("aaaa-rgbmaskH.tga", image, 0);
 | 
			
		||||
foo = Image_rgbmask_V(source, image, 0);
 | 
			
		||||
Image_TGA_save("Pictures/aaaa-rgbmaskV.tga", image, 0);
 | 
			
		||||
Image_TGA_save("aaaa-rgbmaskV.tga", image, 0);
 | 
			
		||||
foo = Image_rgbmask_2(source, image, 0);
 | 
			
		||||
Image_TGA_save("Pictures/aaaa-rgbmask2.tga", image, 0);
 | 
			
		||||
Image_TGA_save("aaaa-rgbmask2.tga", image, 0);
 | 
			
		||||
foo = Image_rgbmask_R(source, image, 0);
 | 
			
		||||
Image_TGA_save("Pictures/aaaa-rgbmaskR.tga", image, 0);
 | 
			
		||||
Image_TGA_save("aaaa-rgbmaskR.tga", image, 0);
 | 
			
		||||
 | 
			
		||||
Image_DeAllocate(source);	free(source);
 | 
			
		||||
Image_DeAllocate(image);	free(image);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
return  42;
 | 
			
		||||
}
 | 
			
		||||
@ -1055,15 +1057,47 @@ Image_DeAllocate(finale);	free(finale);
 | 
			
		||||
return 0;
 | 
			
		||||
}
 | 
			
		||||
/*::------------------------------------------------------------------::*/
 | 
			
		||||
int
 | 
			
		||||
Test_Egalisations(char *nomsource, int k)
 | 
			
		||||
/* new: Sat Aug 10 15:32:01 UTC 2024 */
 | 
			
		||||
int Essai_Televisions(char *nomsource, int k)
 | 
			
		||||
{
 | 
			
		||||
Image_Desc	*image, *resultat;
 | 
			
		||||
int		foo;
 | 
			
		||||
 | 
			
		||||
fprintf(stderr, "================ Televisions %s %d ========\n", nomsource, k);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
image = Image_TGA_alloc_load(nomsource);
 | 
			
		||||
printf("%s : image loaded %p\n", __func__, image);
 | 
			
		||||
resultat = Image_clone(image, 0);
 | 
			
		||||
printf("%s : image cloned %p\n", __func__, resultat);
 | 
			
		||||
 | 
			
		||||
foo = Image_TV_old(image, resultat, 127, 127, 127);
 | 
			
		||||
printf("\tTV old -> %d\n", foo);
 | 
			
		||||
Image_TGA_save("aaaa_tv_old.tga", resultat, 0);
 | 
			
		||||
 | 
			
		||||
foo = Image_TV_pix_0(image, resultat, 7, 7, 0);
 | 
			
		||||
printf("\tTV pix 0 -> %d\n", foo);
 | 
			
		||||
Image_TGA_save("aaaa_tv_pix_0.tga", resultat, 0);
 | 
			
		||||
 | 
			
		||||
foo = Image_TV_cplus_v1(image, resultat, 7);
 | 
			
		||||
printf("\tTV cplus v1 -> %d\n", foo);
 | 
			
		||||
Image_TGA_save("aaaa_tv_cplusV1.tga", resultat, 0);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Image_DeAllocate(image);	free(image);
 | 
			
		||||
Image_DeAllocate(resultat);	free(resultat);
 | 
			
		||||
 | 
			
		||||
return FULL_NUCKED;
 | 
			
		||||
}
 | 
			
		||||
/*::------------------------------------------------------------------::*/
 | 
			
		||||
int Test_Egalisations(char *nomsource, int k)
 | 
			
		||||
{
 | 
			
		||||
Image_Desc *image, *deuxieme, *troisieme;
 | 
			
		||||
int     x, y;
 | 
			
		||||
 | 
			
		||||
fprintf(stderr, "============= Egalisations %s %d =====\n", nomsource, k);
 | 
			
		||||
fprintf(stderr, "================ Egalisations %s %d =====\n", nomsource, k);
 | 
			
		||||
 | 
			
		||||
image= Image_TGA_alloc_load(nomsource);
 | 
			
		||||
image = Image_TGA_alloc_load(nomsource);
 | 
			
		||||
printf("image loaded %p\n", image);
 | 
			
		||||
 | 
			
		||||
deuxieme = Image_clone(image, 0);
 | 
			
		||||
@ -1074,18 +1108,17 @@ troisieme = Image_clone(image, 0);
 | 
			
		||||
printf("image 3 cloned %p\n", troisieme);
 | 
			
		||||
Image_egalise_RGB(image, troisieme, 0);
 | 
			
		||||
 | 
			
		||||
for (x=0; x<image->width; x++)
 | 
			
		||||
	{
 | 
			
		||||
	if (x < image->width/3)
 | 
			
		||||
		{
 | 
			
		||||
		for (y=0; y<image->height; y++)
 | 
			
		||||
for (x=0; x<image->width; x++) {
 | 
			
		||||
	if (x < image->width/3) {
 | 
			
		||||
		for (y=0; y<image->height; y++) {
 | 
			
		||||
			Image_pixel_copy(image, x, y, troisieme, x, y);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
	if (x > image->width/3*2)
 | 
			
		||||
		{
 | 
			
		||||
		for (y=0; y<image->height; y++)
 | 
			
		||||
	if (x > image->width/3*2) {
 | 
			
		||||
		for (y=0; y<image->height; y++) {
 | 
			
		||||
			Image_pixel_copy(deuxieme, x, y, troisieme, x, y);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
#if DEBUG_LEVEL > 2
 | 
			
		||||
@ -1095,7 +1128,7 @@ for (x=0; x<image->width; x++)
 | 
			
		||||
 | 
			
		||||
printf("saving resultat...\n");
 | 
			
		||||
Image_marque_1(troisieme, "Egalisations", 0);
 | 
			
		||||
Image_TGA_save("Pictures/aaaa_egal.tga", troisieme, 0);
 | 
			
		||||
Image_TGA_save("aaaa_egal.tga", troisieme, 0);
 | 
			
		||||
Image_DeAllocate(image);	free(image);
 | 
			
		||||
Image_DeAllocate(deuxieme);	free(deuxieme);
 | 
			
		||||
Image_DeAllocate(troisieme);	free(troisieme);
 | 
			
		||||
@ -1103,30 +1136,30 @@ Image_DeAllocate(troisieme);	free(troisieme);
 | 
			
		||||
return 42;
 | 
			
		||||
}
 | 
			
		||||
/*::------------------------------------------------------------------::*/
 | 
			
		||||
int
 | 
			
		||||
Test_Dithering(char *nomsource, int k)
 | 
			
		||||
int Test_Dithering(char *nomsource, int k)
 | 
			
		||||
{
 | 
			
		||||
Image_Desc	*source, *image, *deuxieme, *finale;
 | 
			
		||||
Image_Rect	rect;
 | 
			
		||||
int		foo;
 | 
			
		||||
int		foo, wf, hf;
 | 
			
		||||
int		x2, y2;
 | 
			
		||||
RGBA		ink, pap;
 | 
			
		||||
 | 
			
		||||
fprintf(stderr, "========== Dithering on %s (%d) =======\n", nomsource, k);
 | 
			
		||||
fprintf(stderr, "============== Dithering on %s (%d) =======\n", nomsource, k);
 | 
			
		||||
 | 
			
		||||
source = Image_TGA_alloc_load(nomsource);
 | 
			
		||||
if (NULL == source)
 | 
			
		||||
	{
 | 
			
		||||
if (NULL == source) {
 | 
			
		||||
	fprintf(stderr, "%s:%s err load %s\n", __FILE__, __func__, nomsource);
 | 
			
		||||
	exit(5);
 | 
			
		||||
	}
 | 
			
		||||
#if DEBUG_LEVEL
 | 
			
		||||
Image_dump_descriptor(source, "just after load");
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * est-ce bien necessaire ?
 | 
			
		||||
 */
 | 
			
		||||
/* Image_egalise_RGB(source, source, 0); */
 | 
			
		||||
 | 
			
		||||
wf = source->width;		hf = (source->height) * 4;
 | 
			
		||||
x2 = source->width / 2;		y2 = source->height / 2;
 | 
			
		||||
rect.w = x2;			rect.h = y2;
 | 
			
		||||
rect.x = 0;			rect.y = 0;
 | 
			
		||||
@ -1134,24 +1167,22 @@ rect.x = 0;			rect.y = 0;
 | 
			
		||||
ink.r = 255, ink.g = 255, ink.b = 100;		ink.a = 255;
 | 
			
		||||
pap.r =  30, pap.g =  30, pap.b = 155;		pap.a = 255;
 | 
			
		||||
 | 
			
		||||
finale = Image_alloc(source->width, (source->height)*3, 3);
 | 
			
		||||
if (NULL == finale)
 | 
			
		||||
	{
 | 
			
		||||
finale = Image_alloc(wf, hf, 3);
 | 
			
		||||
if (NULL == finale) {
 | 
			
		||||
	fprintf(stderr, "%s:%s:%d err alloc image\n",
 | 
			
		||||
			__FILE__, __func__, __LINE__);
 | 
			
		||||
	exit(5);
 | 
			
		||||
	}
 | 
			
		||||
printf("image finale allocated %p\n", finale);
 | 
			
		||||
Image_clear(finale, 0, 200, 0);
 | 
			
		||||
printf("image finale %dx%d allocated at %p\n", wf, hf, finale);
 | 
			
		||||
 | 
			
		||||
image = Image_MakeHalfSize(source, 0);
 | 
			
		||||
if (NULL == image)
 | 
			
		||||
	{
 | 
			
		||||
if (NULL == image) {
 | 
			
		||||
	fprintf(stderr, "%s:%s:%d err halfsize image\n",
 | 
			
		||||
			__FILE__, __func__, __LINE__);
 | 
			
		||||
	exit(5);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
printf("image Half -> %p\n", image);
 | 
			
		||||
printf("%s: image Half at %p\n", __func__, image);
 | 
			
		||||
 | 
			
		||||
Image_DeAllocate(source);	free(source);
 | 
			
		||||
Image_copy_rect(image, &rect, finale, 0, 0);
 | 
			
		||||
@ -1197,17 +1228,20 @@ Image_txt1_box_0(finale, "3x3 2", x2, y2*3, 4, &pap, &ink, 0);
 | 
			
		||||
foo = Image_dither_bayer8x8rnd(image, deuxieme, 5000, 0);
 | 
			
		||||
printf("retour Dither bayer8x8rnd = %d\n", foo);
 | 
			
		||||
Image_copy_rect(deuxieme, &rect, finale, x2, y2*4);
 | 
			
		||||
Image_txt1_box_0(finale, "bayer 8x8 rnd rgb", x2, y2*4, 4, &pap, &ink, 0);
 | 
			
		||||
Image_txt1_box_0(finale, "bayer8xrnd rgb", x2, y2*4, 4, &pap, &ink, 0);
 | 
			
		||||
 | 
			
		||||
foo = Image_dither_bayer8x8rnd(image, deuxieme, 5000, 1);
 | 
			
		||||
printf("retour Dither bayer8x8rnd = %d\n", foo);
 | 
			
		||||
Image_copy_rect(deuxieme, &rect, finale, 0, y2*4);
 | 
			
		||||
Image_txt1_box_0(finale, "bayer 8x8 rnd grey", 0, y2*4, 4, &pap, &ink, 0);
 | 
			
		||||
Image_txt1_box_0(finale, "bayer8x8rndgrey", 0, y2*4, 4, &pap, &ink, 0);
 | 
			
		||||
 | 
			
		||||
Image_TGA_save("Pictures/aaaa_dithering.tga", finale, 0);
 | 
			
		||||
printf("++++++ test dither\n");
 | 
			
		||||
Image_dump_descriptor(finale, "just before save");
 | 
			
		||||
Image_TGA_save("aaaa_dithering.tga", finale, 0);
 | 
			
		||||
Image_DeAllocate(image);	free(image);
 | 
			
		||||
Image_DeAllocate(deuxieme);	free(deuxieme);
 | 
			
		||||
Image_DeAllocate(finale);	free(finale);
 | 
			
		||||
printf("++++++ fin essais dither\n");
 | 
			
		||||
 | 
			
		||||
return 0;
 | 
			
		||||
}
 | 
			
		||||
@ -1226,8 +1260,7 @@ return -1;
 | 
			
		||||
}
 | 
			
		||||
/*::------------------------------------------------------------------::*/
 | 
			
		||||
/* new 21 juillet 2007 - ave St Exupery */
 | 
			
		||||
int
 | 
			
		||||
Test_Effects_A(char *nomsource, int flag)
 | 
			
		||||
int Test_Effects_A(char *nomsource, int flag)
 | 
			
		||||
{
 | 
			
		||||
Image_Desc *source, *image, *deuxieme, *finale;
 | 
			
		||||
int	foo;
 | 
			
		||||
@ -1236,8 +1269,7 @@ RGBA		ink, pap;
 | 
			
		||||
 | 
			
		||||
printf("=== %s %s === %s === %d ===\n", __FILE__, __func__, nomsource, flag);
 | 
			
		||||
 | 
			
		||||
if (flag)
 | 
			
		||||
	{
 | 
			
		||||
if (flag) {
 | 
			
		||||
	fprintf(stderr, "%s: flag is %d ?\n", __func__, flag);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@ -1245,8 +1277,7 @@ ink.r = 255, ink.g = 255, ink.b = 100;		ink.a = 255;
 | 
			
		||||
pap.r =  30, pap.g =  30, pap.b = 155;		pap.a = 255;
 | 
			
		||||
 | 
			
		||||
source = Image_TGA_alloc_load(nomsource);
 | 
			
		||||
if (NULL==source)
 | 
			
		||||
	{
 | 
			
		||||
if (NULL==source) {
 | 
			
		||||
	fprintf(stderr, "%s : il manque '%s'\n", __func__, nomsource);
 | 
			
		||||
	exit(1);
 | 
			
		||||
	}
 | 
			
		||||
@ -1346,30 +1377,28 @@ int Test_des_filtres(char *srcname, int k)
 | 
			
		||||
Image_Desc	*src, *dst;
 | 
			
		||||
int		foo;
 | 
			
		||||
 | 
			
		||||
printf("======= LES FILTRES ===[ %s ]==[ %d ]====\n", srcname, k);
 | 
			
		||||
printf("=============== LES FILTRES =====[ %s ]====[ %d ]====\n", srcname, k);
 | 
			
		||||
 | 
			
		||||
src = Image_TGA_alloc_load(srcname);
 | 
			
		||||
if (NULL == src)
 | 
			
		||||
	{
 | 
			
		||||
if (NULL == src) {
 | 
			
		||||
	fprintf(stderr, "%s can't load %s\n", __func__, srcname);
 | 
			
		||||
	return 666;
 | 
			
		||||
	}
 | 
			
		||||
dst = Image_clone(src, 1);
 | 
			
		||||
if (NULL == dst)
 | 
			
		||||
	{
 | 
			
		||||
if (NULL == dst) {
 | 
			
		||||
	fprintf(stderr, "mem failure in %s\n", __func__);
 | 
			
		||||
	abort();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
foo = Image_lissage_3x3(src, dst);
 | 
			
		||||
Image_TGA_save("Pictures/filtre-liss3x3.tga", dst, 0);
 | 
			
		||||
Image_TGA_save("filtre-liss3x3.tga", dst, 0);
 | 
			
		||||
if (foo) { fprintf(stderr, "%s: liss3x3   -> %d\n", __func__, foo); }
 | 
			
		||||
foo = Image_filtre_Prewitt(src, dst, 5);
 | 
			
		||||
Image_TGA_save("Pictures/filtre-prewitt-5.tga", dst, 0);
 | 
			
		||||
Image_TGA_save("filtre-prewitt-5.tga", dst, 0);
 | 
			
		||||
foo = Image_filtre_passe_haut(src, dst);
 | 
			
		||||
Image_TGA_save("Pictures/filtre-passe-haut.tga", dst, 0);
 | 
			
		||||
Image_TGA_save("filtre-passe-haut.tga", dst, 0);
 | 
			
		||||
foo = Image_filtre_Sobel_4(src, dst, 0);
 | 
			
		||||
Image_TGA_save("Pictures/filtre-sobel-4.tga", dst, 0);
 | 
			
		||||
Image_TGA_save("filtre-sobel-4.tga", dst, 0);
 | 
			
		||||
 | 
			
		||||
Image_DeAllocate(src);	free(src);
 | 
			
		||||
Image_DeAllocate(dst);	free(dst);
 | 
			
		||||
 | 
			
		||||
@ -44,7 +44,7 @@ int Test_des_df3(char *txt, int k);
 | 
			
		||||
int Test_vignettes(char *srcname, int k);
 | 
			
		||||
 | 
			
		||||
int Test_classif(char *srcname, int k);
 | 
			
		||||
int Test_rgbmask(char *srcname);
 | 
			
		||||
int Test_RGBmask(char *srcname);
 | 
			
		||||
void Test_rgb2xyz(void);
 | 
			
		||||
 | 
			
		||||
int  Essai_des_marquages(char *srcname, int nombre, char *texte);
 | 
			
		||||
@ -68,7 +68,7 @@ int Test_des_pixeliz(char *srcname, int flags);
 | 
			
		||||
int Essai_des_bitblt(char *srcname, int k);
 | 
			
		||||
int Essai_des_gadgrect(char *srcname, int k);
 | 
			
		||||
 | 
			
		||||
int Essai_Television(char *source, int k);
 | 
			
		||||
int Essai_Televisions(char *source, int k);
 | 
			
		||||
 | 
			
		||||
/* dans essais2;c */
 | 
			
		||||
int Essai_des_big_chars(char *fname, int k);
 | 
			
		||||
 | 
			
		||||
@ -167,9 +167,9 @@ if ( (foo=Image_compare_desc(src, dst)) ) {
 | 
			
		||||
if((histr=(long *)alloca(256*sizeof(long))) == NULL) return BUFFER_NO_MEM;
 | 
			
		||||
if((histg=(long *)alloca(256*sizeof(long))) == NULL) return BUFFER_NO_MEM;
 | 
			
		||||
if((histb=(long *)alloca(256*sizeof(long))) == NULL) return BUFFER_NO_MEM;
 | 
			
		||||
if((cumlr=(int *)alloca(256*sizeof(int))) == NULL) return BUFFER_NO_MEM;
 | 
			
		||||
if((cumlg=(int *)alloca(256*sizeof(int))) == NULL) return BUFFER_NO_MEM;
 | 
			
		||||
if((cumlb=(int *)alloca(256*sizeof(int))) == NULL) return BUFFER_NO_MEM;
 | 
			
		||||
if((cumlr=(int  *)alloca(256*sizeof(int)))  == NULL) return BUFFER_NO_MEM;
 | 
			
		||||
if((cumlg=(int  *)alloca(256*sizeof(int)))  == NULL) return BUFFER_NO_MEM;
 | 
			
		||||
if((cumlb=(int  *)alloca(256*sizeof(int)))  == NULL) return BUFFER_NO_MEM;
 | 
			
		||||
 | 
			
		||||
Image_histo_RGB(src, histr, histg, histb);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -2,7 +2,7 @@
 | 
			
		||||
                pov_hf15e.c
 | 
			
		||||
                ===========
 | 
			
		||||
 | 
			
		||||
	opérations de morphologie mathématique appliquées
 | 
			
		||||
	operations de morphologie mathematique appliquees
 | 
			
		||||
	aux height-fields.
 | 
			
		||||
 | 
			
		||||
*/
 | 
			
		||||
@ -18,40 +18,30 @@ static struct
 | 
			
		||||
	int	x, y;
 | 
			
		||||
	} off[] = 
 | 
			
		||||
	{
 | 
			
		||||
	{ -1, -1 },
 | 
			
		||||
	{  0, -1 },
 | 
			
		||||
	{  1, -1 },
 | 
			
		||||
	{ -1,  0 },
 | 
			
		||||
	{  0,  0 },
 | 
			
		||||
	{  1,  0 },
 | 
			
		||||
	{ -1,  1 },
 | 
			
		||||
	{  0,  1 },
 | 
			
		||||
	{  1,  1 }
 | 
			
		||||
	{ -1, -1 },	{  0, -1 },	{  1, -1 },
 | 
			
		||||
	{ -1,  0 },	{  0,  0 },	{  1,  0 },
 | 
			
		||||
	{ -1,  1 },	{  0,  1 },	{  1,  1 }
 | 
			
		||||
	};
 | 
			
		||||
/*::------------------------------------------------------------------::*/
 | 
			
		||||
/*
 | 
			
		||||
 *	le paramètre 'coef' n'est pas utilisé. D'ailleurs, je ne vois
 | 
			
		||||
 *	le parametre 'coef' n'est pas utilise. D'ailleurs, je ne vois
 | 
			
		||||
 *	pas trop quoi y mettre ?
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
Image_hf15_dilate(Image_Desc *src, Image_Desc *dst, int coef)
 | 
			
		||||
int Image_hf15_dilate(Image_Desc *src, Image_Desc *dst, int coef)
 | 
			
		||||
{
 | 
			
		||||
(void)coef;		/* KILL WARNING */
 | 
			
		||||
int	foo;
 | 
			
		||||
int	x, y, h, hmax;
 | 
			
		||||
 | 
			
		||||
if ( (foo=Image_compare_desc(src, dst)) )
 | 
			
		||||
    {
 | 
			
		||||
if ( (foo=Image_compare_desc(src, dst)) ) {
 | 
			
		||||
    fprintf(stderr, "Image hf15 dilate: images differents %d\n", foo);
 | 
			
		||||
    return foo;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
for (y=1; y<dst->height-1; y++)
 | 
			
		||||
	{
 | 
			
		||||
	for (x=1; x<dst->width-1; x++)
 | 
			
		||||
		{
 | 
			
		||||
for (y=1; y<dst->height-1; y++) {
 | 
			
		||||
	for (x=1; x<dst->width-1; x++) {
 | 
			
		||||
		hmax = -1664;
 | 
			
		||||
		for (foo=0; foo<9; foo++)
 | 
			
		||||
			{
 | 
			
		||||
		for (foo=0; foo<9; foo++) {
 | 
			
		||||
			h = Image_hf15_height(src, x+off[foo].x, y+off[foo].y);
 | 
			
		||||
			if (h > hmax) hmax = h;
 | 
			
		||||
			}
 | 
			
		||||
@ -63,27 +53,23 @@ return FUNC_IS_BETA;
 | 
			
		||||
}
 | 
			
		||||
/*::------------------------------------------------------------------::*/
 | 
			
		||||
/*
 | 
			
		||||
 *	le paramètre 'coef' n'est pas utilisé.
 | 
			
		||||
 *	le parametre 'coef' n'est pas utilise.
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
Image_hf15_erode(Image_Desc *src, Image_Desc *dst, int coef)
 | 
			
		||||
int Image_hf15_erode(Image_Desc *src, Image_Desc *dst, int coef)
 | 
			
		||||
{
 | 
			
		||||
(void)coef;		/* KILL WARNING */
 | 
			
		||||
int	foo;
 | 
			
		||||
int	x, y, h, hmin;
 | 
			
		||||
 | 
			
		||||
if ( (foo=Image_compare_desc(src, dst)) )
 | 
			
		||||
    {
 | 
			
		||||
if ( (foo=Image_compare_desc(src, dst)) ) {
 | 
			
		||||
    fprintf(stderr, "Image hf15 erode: images differents %d\n", foo);
 | 
			
		||||
    return foo;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
for (y=1; y<dst->height-1; y++)
 | 
			
		||||
	{
 | 
			
		||||
	for (x=1; x<dst->width-1; x++)
 | 
			
		||||
		{
 | 
			
		||||
for (y=1; y<dst->height-1; y++) {
 | 
			
		||||
	for (x=1; x<dst->width-1; x++) {
 | 
			
		||||
		hmin = 42042;
 | 
			
		||||
		for (foo=0; foo<9; foo++)
 | 
			
		||||
			{
 | 
			
		||||
		for (foo=0; foo<9; foo++) {
 | 
			
		||||
			h = Image_hf15_height(src, x+off[foo].x, y+off[foo].y);
 | 
			
		||||
			if (h < hmin) hmin = h;
 | 
			
		||||
			}
 | 
			
		||||
@ -95,7 +81,7 @@ return FUNC_IS_BETA;
 | 
			
		||||
}
 | 
			
		||||
/*::------------------------------------------------------------------::*/
 | 
			
		||||
/*
 | 
			
		||||
 *		Et maintenant, il reste à coder le chapeau haut-de-forme
 | 
			
		||||
 *		Et maintenant, il reste a coder le chapeau haut-de-forme
 | 
			
		||||
 */
 | 
			
		||||
/*::------------------------------------------------------------------::*/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -27,7 +27,8 @@ Image_Rect 	rect;
 | 
			
		||||
int		h1, h2, w1, w2, xx, yy, foo;
 | 
			
		||||
int		mr, mg, mb, dr, dg, db, s;
 | 
			
		||||
 | 
			
		||||
level++;
 | 
			
		||||
level++;		/* pourquoi ? */
 | 
			
		||||
 | 
			
		||||
if (level > maxlevel)
 | 
			
		||||
	maxlevel = level;
 | 
			
		||||
 | 
			
		||||
@ -37,10 +38,16 @@ fprintf(stderr, "%5d  ->  %3d %3d    %3d %3d\n",
 | 
			
		||||
#endif 
 | 
			
		||||
 | 
			
		||||
foo = Image_stats_zone_0(S, pRect, &mr, &mg, &mb, &dr, &dg, &db);
 | 
			
		||||
if (foo) {
 | 
			
		||||
	fprintf(stderr, "%s: err stat zone %d\n", __func__, foo);
 | 
			
		||||
	exit(1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
s = (dr + dg + db) / 3;
 | 
			
		||||
#if DEBUG_LEVEL > 1
 | 
			
		||||
printf(" %7d  V %3d %3d %3d   D %3d %3d %3d   S %3d  (%d)\n",
 | 
			
		||||
			 pRect->w*pRect->h, mr, mg, mb, dr, dg, db, s, foo);
 | 
			
		||||
 | 
			
		||||
#if 1
 | 
			
		||||
printf(" %7d   V %3d %3d %3d    D %3d %3d %3d    S  %3d\n",
 | 
			
		||||
			 pRect->w*pRect->h, mr, mg, mb, dr, dg, db, s);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
if ( (s < seuil) || (pRect->w < 6) || (pRect->h < 6) ) {
 | 
			
		||||
@ -118,6 +125,10 @@ int Image_call_recursion_0(Image_Desc *image, Image_Desc *dest, int param)
 | 
			
		||||
Image_Rect 	rect;
 | 
			
		||||
int		foo;
 | 
			
		||||
 | 
			
		||||
#if 1
 | 
			
		||||
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, image, dest, param);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
rect.x = rect.y = 0;
 | 
			
		||||
rect.h = image->height;
 | 
			
		||||
rect.w = image->width;
 | 
			
		||||
@ -137,7 +148,7 @@ fprintf(stderr, "->  fin recursion: %d, maxlevel=%d\n", foo, maxlevel);
 | 
			
		||||
 | 
			
		||||
dest->modified = 1;
 | 
			
		||||
 | 
			
		||||
return FUNC_IS_ALPHA;
 | 
			
		||||
return FUNC_IS_BETA;
 | 
			
		||||
}
 | 
			
		||||
/*::------------------------------------------------------------------::*/
 | 
			
		||||
/*::------------------------------------------------------------------::*/
 | 
			
		||||
 | 
			
		||||
@ -16,25 +16,20 @@
 | 
			
		||||
/*
 | 
			
		||||
 *	horizontal lines
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
Image_rgbmask_H(Image_Desc *src, Image_Desc *dst, int gris)
 | 
			
		||||
int Image_rgbmask_H(Image_Desc *src, Image_Desc *dst, int gris)
 | 
			
		||||
{
 | 
			
		||||
int  foo, x, y;
 | 
			
		||||
 | 
			
		||||
if ( (foo=Image_compare_desc(src, dst)) )
 | 
			
		||||
    {
 | 
			
		||||
if ( (foo=Image_compare_desc(src, dst)) ) {
 | 
			
		||||
    fprintf(stderr, "%s : images are differents %d\n", __func__, foo);
 | 
			
		||||
    return foo;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
Image_copy(src, dst);		/* XXX pourquoi cette copie ? */
 | 
			
		||||
 | 
			
		||||
for (y=0; y<src->height; y++)
 | 
			
		||||
	{
 | 
			
		||||
	for (x=0; x<src->width; x++)
 | 
			
		||||
		{
 | 
			
		||||
		switch (y%3)
 | 
			
		||||
			{
 | 
			
		||||
for (y=0; y<src->height; y++) {
 | 
			
		||||
	for (x=0; x<src->width; x++) {
 | 
			
		||||
		switch (y%3) {
 | 
			
		||||
			case 0:
 | 
			
		||||
				Image_plot_channel(dst, 'r', x, y, gris);
 | 
			
		||||
				Image_plot_channel(dst, 'g', x, y, gris);
 | 
			
		||||
@ -57,25 +52,19 @@ return FUNC_IS_BETA;
 | 
			
		||||
/*
 | 
			
		||||
 *	vertical lines
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
Image_rgbmask_V(Image_Desc *src, Image_Desc *dst, int gris)
 | 
			
		||||
int Image_rgbmask_V(Image_Desc *src, Image_Desc *dst, int gris)
 | 
			
		||||
{
 | 
			
		||||
int  foo, x, y;
 | 
			
		||||
 | 
			
		||||
if ( (foo=Image_compare_desc(src, dst)) )
 | 
			
		||||
    {
 | 
			
		||||
if ( (foo=Image_compare_desc(src, dst)) ) {
 | 
			
		||||
    fprintf(stderr, "Image rgbmask V: images are differents %d\n", foo);
 | 
			
		||||
    return foo;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
Image_copy(src, dst);
 | 
			
		||||
 | 
			
		||||
for (y=0; y<src->height; y++)
 | 
			
		||||
	{
 | 
			
		||||
	for (x=0; x<src->width; x++)
 | 
			
		||||
		{
 | 
			
		||||
		switch (x%3)
 | 
			
		||||
			{
 | 
			
		||||
for (y=0; y<src->height; y++) {
 | 
			
		||||
	for (x=0; x<src->width; x++) {
 | 
			
		||||
		switch (x%3) {
 | 
			
		||||
			case 0:
 | 
			
		||||
				Image_plot_channel(dst, 'r', x, y, gris);
 | 
			
		||||
				Image_plot_channel(dst, 'g', x, y, gris);
 | 
			
		||||
@ -98,26 +87,21 @@ return FUNC_IS_BETA;
 | 
			
		||||
/*
 | 
			
		||||
 *	sequential dots - _very_ dependant on image dimensions.
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
Image_rgbmask_2(Image_Desc *src, Image_Desc *dst, int gris)
 | 
			
		||||
int Image_rgbmask_2(Image_Desc *src, Image_Desc *dst, int gris)
 | 
			
		||||
{
 | 
			
		||||
int  foo, x, y;
 | 
			
		||||
 | 
			
		||||
if ( (foo=Image_compare_desc(src, dst)) )
 | 
			
		||||
    {
 | 
			
		||||
if ( (foo=Image_compare_desc(src, dst)) ) {
 | 
			
		||||
    fprintf(stderr, "Image rgbmask 2: images are differents %d\n", foo);
 | 
			
		||||
    return foo;
 | 
			
		||||
    }
 | 
			
		||||
Image_copy(src, dst);
 | 
			
		||||
 | 
			
		||||
foo = 0;
 | 
			
		||||
for (y=0; y<src->height; y++)
 | 
			
		||||
	{
 | 
			
		||||
	for (x=0; x<src->width; x++)
 | 
			
		||||
		{
 | 
			
		||||
for (y=0; y<src->height; y++) {
 | 
			
		||||
	for (x=0; x<src->width; x++) {
 | 
			
		||||
		foo++;
 | 
			
		||||
		switch (foo%3)
 | 
			
		||||
			{
 | 
			
		||||
		switch (foo%3) {
 | 
			
		||||
			case 0:
 | 
			
		||||
				Image_plot_channel(dst, 'r', x, y, gris);
 | 
			
		||||
				Image_plot_channel(dst, 'g', x, y, gris);
 | 
			
		||||
@ -140,8 +124,7 @@ return FUNC_IS_BETA;
 | 
			
		||||
/*
 | 
			
		||||
 *	random dots - VERY BAD RESULTS :(
 | 
			
		||||
 */
 | 
			
		||||
int
 | 
			
		||||
Image_rgbmask_R(Image_Desc *src, Image_Desc *dst, int gris)
 | 
			
		||||
int Image_rgbmask_R(Image_Desc *src, Image_Desc *dst, int gris)
 | 
			
		||||
{
 | 
			
		||||
int  foo, x, y;
 | 
			
		||||
 | 
			
		||||
@ -149,20 +132,16 @@ int  foo, x, y;
 | 
			
		||||
fprintf(stderr, "this function, %s(%d), is very buggy...\n", __func__, gris);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
if ( (foo=Image_compare_desc(src, dst)) )
 | 
			
		||||
    {
 | 
			
		||||
if ( (foo=Image_compare_desc(src, dst)) ) {
 | 
			
		||||
    fprintf(stderr, "Image rgbmask R: images are differents %d\n", foo);
 | 
			
		||||
    return foo;
 | 
			
		||||
    }
 | 
			
		||||
Image_copy(src, dst);
 | 
			
		||||
 | 
			
		||||
for (y=0; y<src->height; y++)
 | 
			
		||||
	{
 | 
			
		||||
	for (x=0; x<src->width; x++)
 | 
			
		||||
		{
 | 
			
		||||
for (y=0; y<src->height; y++) {
 | 
			
		||||
	for (x=0; x<src->width; x++) {
 | 
			
		||||
		foo = rand() % 3;	/* mmmm pas tres bon :( */
 | 
			
		||||
		switch (foo)
 | 
			
		||||
			{
 | 
			
		||||
		switch (foo) {
 | 
			
		||||
			case 0:
 | 
			
		||||
				Image_plot_channel(dst, 'r', x, y, gris);
 | 
			
		||||
				Image_plot_channel(dst, 'g', x, y, gris);
 | 
			
		||||
 | 
			
		||||
@ -9,8 +9,7 @@
 | 
			
		||||
#include  "../tthimage.h"
 | 
			
		||||
 | 
			
		||||
/*::------------------------------------------------------------------::*/
 | 
			
		||||
int
 | 
			
		||||
Image_filtre_Sobel_4(Image_Desc *src, Image_Desc *dst, int rotation)
 | 
			
		||||
int Image_filtre_Sobel_4(Image_Desc *src, Image_Desc *dst, int rotation)
 | 
			
		||||
{
 | 
			
		||||
static	int	Sobel[] =
 | 
			
		||||
	{
 | 
			
		||||
@ -23,6 +22,8 @@ int	filtre[11], foo;
 | 
			
		||||
Image_Desc	*tmp[4];
 | 
			
		||||
int		x, y, r, g, b;
 | 
			
		||||
 | 
			
		||||
fprintf(stderr, ">>> %s ( %p %p  %d )\n", __func__, src, dst,rotation);
 | 
			
		||||
 | 
			
		||||
memcpy(filtre, Sobel, 11*sizeof(int));
 | 
			
		||||
 | 
			
		||||
for (foo=0; foo<4; foo++) {
 | 
			
		||||
@ -50,7 +51,6 @@ for (x=0; x<src->width; x++) {
 | 
			
		||||
		dst->Bpix[y][x] = b;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
dst->modified   = 1;
 | 
			
		||||
 | 
			
		||||
for (foo=0; foo<4; foo++) {
 | 
			
		||||
 | 
			
		||||
@ -123,13 +123,13 @@ xmax = src->width - w;		ymax = src->height - h;
 | 
			
		||||
ox = (src->width % w) / 2;
 | 
			
		||||
oy = (src->height % h) / 2;
 | 
			
		||||
#if DEBUG_LEVEL
 | 
			
		||||
fprintf(stderr, "%s : offsets = %d %d\n", __func__, ox, oy);
 | 
			
		||||
fprintf(stderr, "%s : offsets = %d & %d\n", __func__, ox, oy);
 | 
			
		||||
#endif
 | 
			
		||||
Image_clear(dst, grey, grey, grey);
 | 
			
		||||
 | 
			
		||||
for (x=ox; x<xmax; x+=w) {
 | 
			
		||||
for (x=ox; x<(xmax-ox); x+=w) {
 | 
			
		||||
	zone.x = x + (w/2);
 | 
			
		||||
	for (y=oy; y<ymax; y+=h) {
 | 
			
		||||
	for (y=oy; y<(ymax-oy); y+=h) {
 | 
			
		||||
		zone.y = y + (h/2);
 | 
			
		||||
		r = src->Rpix[y][x] & 0xfe;
 | 
			
		||||
		g = src->Gpix[y][x] & 0xfe;
 | 
			
		||||
 | 
			
		||||
@ -19,6 +19,8 @@ int		w;
 | 
			
		||||
Image_Desc 	*img;
 | 
			
		||||
char		filename[100], chaine[110];
 | 
			
		||||
 | 
			
		||||
fprintf(stderr, "k is %d in %s\n", k, __func__);
 | 
			
		||||
 | 
			
		||||
Image_load_fnt8x8("libimage.fonte", NULL, 0);
 | 
			
		||||
 | 
			
		||||
for (w=160; w<180; w++)
 | 
			
		||||
 | 
			
		||||
@ -22,7 +22,9 @@ int		foo;
 | 
			
		||||
 | 
			
		||||
fprintf(stderr, ">>> %s ( '%s' ) \n", __func__, filename);
 | 
			
		||||
 | 
			
		||||
#if 0
 | 
			
		||||
foo = try_to_read_a_jpeg_file(filename, &destimg);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
return FULL_NUCKED;
 | 
			
		||||
}
 | 
			
		||||
@ -30,7 +32,7 @@ return FULL_NUCKED;
 | 
			
		||||
int main(int argc, char *argv[])
 | 
			
		||||
{
 | 
			
		||||
char	*fichier;
 | 
			
		||||
int	foo;
 | 
			
		||||
int	foo, idx;
 | 
			
		||||
 | 
			
		||||
printf("\n==========  TestTga  %s  %s  ==========\n", __DATE__, __TIME__);
 | 
			
		||||
Image_print_version(2);
 | 
			
		||||
@ -39,8 +41,7 @@ Image_print_version(2);
 | 
			
		||||
Image_print_sizeof_structs("tth was here");
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
if (argc != 2)
 | 
			
		||||
	{
 | 
			
		||||
if (argc != 2) {
 | 
			
		||||
	printf("no args, using the testfile\n");
 | 
			
		||||
	fichier = "wou.tga";
 | 
			
		||||
	}
 | 
			
		||||
@ -52,11 +53,25 @@ else
 | 
			
		||||
 | 
			
		||||
Image_start_chrono("Essai", 0);
 | 
			
		||||
 | 
			
		||||
for (idx=0; idx<1; idx++) {
 | 
			
		||||
	foo = Test_Egalisations(fichier, 0);
 | 
			
		||||
	fprintf(stderr, "    essai egalisation -> %d\n", foo);
 | 
			
		||||
	foo = Essai_Televisions(fichier, 10); 
 | 
			
		||||
	fprintf(stderr, "    essai televisions -> %d\n", foo);
 | 
			
		||||
	foo = Test_Dithering(fichier, 0);
 | 
			
		||||
	fprintf(stderr, "    essai dithering   -> %d\n", foo);
 | 
			
		||||
	foo = Test_des_filtres(fichier, 0);
 | 
			
		||||
	fprintf(stderr, "    essai filtres     -> %d\n", foo);
 | 
			
		||||
	foo = Test_RGBmask(fichier);
 | 
			
		||||
	fprintf(stderr, "    essai rgb mask    -> %d\n", foo);
 | 
			
		||||
 | 
			
		||||
	fprintf(stderr, "********* %s: fin passe %d\n", argv[0], idx);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#if 0
 | 
			
		||||
foo = test_du_jpeg_reader("in.jpeg");
 | 
			
		||||
fprintf(stderr, "    essai lecture jpeg -> %d\n", foo);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#if 0
 | 
			
		||||
foo = Test_Dithering(fichier, 17);
 | 
			
		||||
fprintf(stderr, "essai dithering -> %d\n", foo);
 | 
			
		||||
 | 
			
		||||
@ -74,6 +89,7 @@ Test_des_warpings(fichier, 17);
 | 
			
		||||
 | 
			
		||||
foo = Essai_des_Combines(fichier, 17);
 | 
			
		||||
fprintf(stderr, "essai combine -> %d\n", foo);
 | 
			
		||||
 | 
			
		||||
foo = Test_Dithering(fichier, 17);
 | 
			
		||||
Essai_des_Contrastes(fichier, 0);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										13
									
								
								Lib/text0.c
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								Lib/text0.c
									
									
									
									
									
								
							@ -220,7 +220,8 @@ posx = x;	posy = y;
 | 
			
		||||
for (foo=0; foo<t_texte; foo++)	{
 | 
			
		||||
	octet = ptrtxt[foo];
 | 
			
		||||
	if (posx > (im->width-8)) {
 | 
			
		||||
		fprintf(stderr, "can't plot char '%c' at x=%d\n", octet, posx);
 | 
			
		||||
		fprintf(stderr, "%s: can't plot char '%c' at x=%d\n", 
 | 
			
		||||
					__func__, octet, posx);
 | 
			
		||||
		break;
 | 
			
		||||
		}
 | 
			
		||||
	Image_trace_caractere_2(im, priv_fonte, posx, posy, octet, paper, ink);
 | 
			
		||||
@ -259,23 +260,19 @@ if ( (code < 0) || (code > 255)) {
 | 
			
		||||
 | 
			
		||||
paper.r = paper.g = paper.b = 0;
 | 
			
		||||
ink.r = ink.g = ink.b       = 255;
 | 
			
		||||
 | 
			
		||||
rect.w = kx, rect.h = ky;
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 *			NEED BOUNDARY CHECK !
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
for (foo=0; foo<8; foo++)		/* 8 scan lines */
 | 
			
		||||
	{
 | 
			
		||||
for (foo=0; foo<8; foo++) {		/* 8 scan lines */
 | 
			
		||||
	octet = priv_fonte[(code*8)+foo];
 | 
			
		||||
	rect.y = (foo * ky) + y;
 | 
			
		||||
	for (bar=0; bar<8; bar++)
 | 
			
		||||
		{
 | 
			
		||||
	for (bar=0; bar<8; bar++) {
 | 
			
		||||
		rect.x = (bar * kx) + x;
 | 
			
		||||
		rect.x = ((8-bar)*kx) + x;
 | 
			
		||||
		if (octet & 1)
 | 
			
		||||
			{
 | 
			
		||||
		if (octet & 1) {
 | 
			
		||||
			Image_paint_rect(im, &rect, 255, 198, 0);
 | 
			
		||||
			Image_draw_rect(im, &rect, 0, 0, 80);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
@ -12,7 +12,7 @@
 | 
			
		||||
#include  "../tthimage.h"   
 | 
			
		||||
 | 
			
		||||
/*::------------------------------------------------------------------::*/
 | 
			
		||||
#define LIBTGA_VERSION   "0.2.42"
 | 
			
		||||
#define LIBTGA_VERSION   "0.2.43"
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
        uint8_t   text_size;
 | 
			
		||||
@ -27,6 +27,9 @@ typedef struct {
 | 
			
		||||
 | 
			
		||||
        } Tga_file_header;
 | 
			
		||||
/*::------------------------------------------------------------------::*/
 | 
			
		||||
/*
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
int Image_TGA_write_header(FILE *fp, Tga_file_header *head)
 | 
			
		||||
{
 | 
			
		||||
fwrite (&head->text_size, 1, 1, fp);
 | 
			
		||||
@ -423,6 +426,8 @@ return OLL_KORRECT;
 | 
			
		||||
/* new 1er mai 2007 (la france qui bosse tout le temps) */
 | 
			
		||||
int Image_TGA_show_header(char *filename, int flag)
 | 
			
		||||
{
 | 
			
		||||
(void)flag;				/* WARNING KILLER */
 | 
			
		||||
 | 
			
		||||
FILE			*fp;
 | 
			
		||||
Tga_file_header		header;
 | 
			
		||||
int			foo;
 | 
			
		||||
@ -443,7 +448,7 @@ if (foo) {
 | 
			
		||||
foo = Image_TGA_print_header(&header);
 | 
			
		||||
if (foo)
 | 
			
		||||
	{
 | 
			
		||||
	;
 | 
			
		||||
	fprintf(stderr, "%s: something is wrong\n", __func__);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
return FUNC_NOT_FINISH;
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										11
									
								
								Lib/tiff.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Lib/tiff.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,11 @@
 | 
			
		||||
/*
 | 
			
		||||
 *		TIFF
 | 
			
		||||
 *
 | 
			
		||||
 * new Sun Jul 28 10:57:00 UTC 2024
 | 
			
		||||
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include  <stdio.h>
 | 
			
		||||
 | 
			
		||||
/*::------------------------------------------------------------------::*/
 | 
			
		||||
/*::------------------------------------------------------------------::*/
 | 
			
		||||
							
								
								
									
										12
									
								
								Lib/utility.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										12
									
								
								Lib/utility.sh
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,12 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
set -e
 | 
			
		||||
 | 
			
		||||
SRC="testtga.c essais.c operat.c image.c effects.c tele_2.c calculs.c"
 | 
			
		||||
SRC="$SRC dither.c television.c"
 | 
			
		||||
 | 
			
		||||
FLOW="cflow.txt"
 | 
			
		||||
 | 
			
		||||
cflow --depth=5 -o $FLOW -m main --number $SRC
 | 
			
		||||
 | 
			
		||||
less $FLOW
 | 
			
		||||
@ -42,7 +42,7 @@ fprintf(stderr, "* TGA incrustator  v 0.1.3 [%s] %s \n",
 | 
			
		||||
				TGA_OUTILS_VERSION, TGA_OUTILS_COPYLEFT);
 | 
			
		||||
fprintf(stderr, "  compiled %s at %s\n", __DATE__, __TIME__);
 | 
			
		||||
 | 
			
		||||
fprintf(stderr, "usage:\n\ttga_incrust orig insert mode out\n");
 | 
			
		||||
fprintf(stderr, "usage:\n\ttga_incrust <orig.tga> <insert.tga> MODE <out.tga>\n");
 | 
			
		||||
 | 
			
		||||
if (flag) {
 | 
			
		||||
	Image_print_version(0);
 | 
			
		||||
 | 
			
		||||
@ -11,21 +11,27 @@
 | 
			
		||||
#include  "tga_outils.h"
 | 
			
		||||
 | 
			
		||||
/*::------------------------------------------------------------------::*/
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 *	Print a textual form of a picture, so you can read it
 | 
			
		||||
 *	with a software who can't read TGA files.
 | 
			
		||||
 *	Exemples: Fortran or Basic code, R, the statistic
 | 
			
		||||
 *	software. And maybe you cant write a shell script
 | 
			
		||||
 *	to convert from TGA to PNM :)
 | 
			
		||||
 */
 | 
			
		||||
int printf_this_picture(Image_Desc *pic, int flag)
 | 
			
		||||
{
 | 
			
		||||
int		x, y,	r, g, b;
 | 
			
		||||
 | 
			
		||||
if (flag) {
 | 
			
		||||
	/* needed for easy import in R */
 | 
			
		||||
	/* needed for easy import in Rstats */
 | 
			
		||||
	printf("    X     Y      R    G    B\n");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
for (y=0; y<pic->height; y++) {
 | 
			
		||||
	for (x=0; x<pic->width; x++) {
 | 
			
		||||
		printf("%5d %5d   ", x, y);
 | 
			
		||||
		printf("%5d %5d    ", x, y);
 | 
			
		||||
		Image_getRGB(pic, x, y, &r, &g, &b);
 | 
			
		||||
		printf("%4d %4d %4d\n", r, g, b);
 | 
			
		||||
		printf("%3d %3d %3d\n", r, g, b);
 | 
			
		||||
		}
 | 
			
		||||
	}		
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user