more and more tools

This commit is contained in:
tth
2022-06-28 15:14:08 +02:00
parent 6ce9f49c55
commit 60409a050c
9 changed files with 456 additions and 10 deletions

View File

@@ -103,6 +103,7 @@ rgbmask.o: rgbmask.c $(DEPS)
scale.o: scale.c $(DEPS)
sobel4.o: sobel4.c $(DEPS)
stereo.o: stereo.c $(DEPS)
tamppool.o: tamppool.c $(DEPS)
tele_2.o: tele_2.c $(DEPS)
@@ -131,6 +132,7 @@ OBJECTS = 7seg.o \
calculs.o classif.o \
col4bits.o colors.o colors2.o col_reduc.o col_xyz.o \
combine.o combine2.o combine3.o combine4.o combine5.o \
combine6.o combine_rnd.o \
contrast.o \
detect.o distances.o \
dither.o dither2.o dither3.o dither4.o \
@@ -151,7 +153,7 @@ OBJECTS = 7seg.o \
pov_hf15e.o pov_hf15e.o pov_hf15f.o pov_synth.o \
ptlist.o \
recurse.o rgbmask.o \
scale.o sobel4.o \
scale.o sobel4.o stereo.o \
tamppool.o tele_2.o television.o \
text0.o text1.o text16x24.o \
tga.o tools.o \

View File

@@ -9,7 +9,7 @@
#include <stdio.h>
#include <stdlib.h>
#include "tthimage.h"
#include "../tthimage.h"
/*::------------------------------------------------------------------::*/
/*

View File

@@ -1314,7 +1314,7 @@ if (NULL == dst)
foo = Image_lissage_3x3(src, dst);
Image_TGA_save("Pictures/filtre-liss3x3.tga", dst, 0);
if (foo) { fprintf(stderr, "%s: liss3x3 -> %d\n", foo); }
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);
foo = Image_filtre_passe_haut(src, dst);

126
Lib/stereo.c Normal file
View File

@@ -0,0 +1,126 @@
/*
+[
S=T=R=E=R=E=O
]+
*/
#include <stdio.h>
#include <stdlib.h>
#include "../tthimage.h"
/*::------------------------------------------------------------------::*/
/*
* première fonction, assez primitive, mais qui marche.
*/
int
Image_combine_stereo_0(Image_Desc *gauche, Image_Desc *droite,
Image_Desc *stereo)
{
int x, y, foo;
int rouge, vert;
if ( (foo=Image_compare_desc(gauche, droite)) )
{
fprintf(stderr, "Combine Stereo 0: sources are differents (%d)\n", foo);
return foo;
}
if ( (foo=Image_compare_desc(gauche, stereo)) )
{
fprintf(stderr, "Combine Stereo 0: dest have a bad dim (%d)\n", foo);
return foo;
}
for (y=0; y<gauche->height; y++)
{
for (x=0; x<droite->width; x++)
{
rouge = ( Image_R_pixel(droite, x, y)+
Image_G_pixel(droite, x, y)+
Image_B_pixel(droite, x, y) ) / 3;
vert = ( Image_R_pixel(gauche, x, y)+
Image_G_pixel(gauche, x, y)+
Image_B_pixel(gauche, x, y) ) / 3;
Image_plotRGB(stereo, x, y, rouge, vert, 0);
}
}
stereo->modified = 1;
return OLL_KORRECT;
}
/*::------------------------------------------------------------------::*/
/*
* celui-ci semble le meme que le '_0', mais il va probablement
* evoluer... Et il serait vraiment bien que je trouve de la doc
* sur les differents parametres chromatiques.
* =============================================================
* En fait (30 janv 2008, ave StEx) au lieu de faire du Rouge/Vert
* il va faire du Rouge/Bleu. A la demande de Ker2x.
*/
int
Image_combine_stereo_1(Image_Desc *s1, Image_Desc *s2, Image_Desc *d,
int kr, int kg, int kb)
{
int x, y, foo, cumul;
int rouge, bleu;
if ( (foo=Image_compare_desc(s1, s2)) )
{
fprintf(stderr, "Combine Stereo 1: sources are differents (%d)\n", foo);
return foo;
}
if ( (foo=Image_compare_desc(s1, d)) )
{
fprintf(stderr, "Combine Stereo 1: dest have a bad dim (%d)\n", foo);
return foo;
}
cumul = kr + kg + kb;
#if DEBUG_LEVEL
fprintf(stderr, "Combine Stereo 1: coefs are %d %d %d\n", kr, kg, kb);
fprintf(stderr, "Combine Stereo 1: cumul is %d\n", cumul);
#endif
for (y=0; y<s1->height; y++)
{
for (x=0; x<s1->width; x++)
{
rouge = Image_R_pixel(s2, x, y) * kr +
Image_G_pixel(s2, x, y) * kg +
Image_B_pixel(s2, x, y) * kb;
rouge /= cumul;
bleu = Image_R_pixel(s1, x, y) * kr +
Image_G_pixel(s1, x, y) * kg +
Image_B_pixel(s1, x, y) * kb;
bleu /= cumul;
Image_plotRGB(d, x, y, rouge, 0, bleu);
}
}
d->modified = 1;
return FUNC_IS_BETA;
}
/*::------------------------------------------------------------------::*/
/*
* Et pour celui-ci, il faudrait trouver une façon de définir
* les composantes pour l'image destination, afin de tenir
* compte des filtres qui seront dans les lunettes...
*/
int
Image_combine_stereo_2(Image_Desc *s1, Image_Desc *s2, Image_Desc *d,
char cr, char cl)
{
/* XXX
int x, y, foo;
int rouge, vert, bleu;
XXX */
fprintf(stderr, "%s: %s missing, sorry.\n", __FILE__, __func__);
return FULL_NUCKED;
}
/*::------------------------------------------------------------------::*/