tweaking...

This commit is contained in:
tTh 2024-08-16 13:10:58 +02:00
parent 5ffc94c17d
commit 24b3d4de11
2 changed files with 46 additions and 27 deletions

View File

@ -216,18 +216,17 @@ if (NULL==(src=Image_TGA_alloc_load(srcname))) {
}
/* on va creer le receptacle des horreurs */
if (NULL==(dst=Image_clone(src, 0))) {
fprintf(stderr, "%s: err clone\n", __func__);
exit(5);
}
/* ah bravo ! enfin un test unitaire appelable
* depuis le test unitaire */
for (idx=0; idx<20; idx++)
{
for (idx=0; idx<20; idx++) {
foo = Image_essai_col_reduce(src, dst, 133, idx);
printf("le retour de l'essai_col_reduce %d est %d\n", idx, foo);
if (OLL_KORRECT==foo)
{
sprintf(fname, "Pictures/aaaa-colredux-%02d.tga", idx);
if (OLL_KORRECT==foo) {
sprintf(fname, "aaaa-colredux-%02d.tga", idx);
Image_TGA_save(fname, dst, 0);
}
}
@ -582,32 +581,30 @@ int foo, ax, ay;
printf("====== essais Warping sur %s (k=%d) ====\n", srcname, k);
if (NULL == (src = Image_TGA_alloc_load(srcname)) )
{
if (NULL == (src = Image_TGA_alloc_load(srcname)) ) {
fprintf(stderr, "Err loading '%s'\n", srcname);
exit(5);
}
dst = Image_clone(src, 0);
foo = Image_warp_essai_0(src, dst, 33.5, 100, 100);
Image_TGA_save("Pictures/warp-essai-0.tga", dst, 0);
Image_TGA_save("warp-essai-0.tga", dst, 0);
foo = Image_center_rotate(src, dst, 21.5);
Image_TGA_save("Pictures/warp-center-rotate.tga", dst, 0);
Image_TGA_save("warp-center-rotate.tga", dst, 0);
ax = (src->width * 2) / 3;
ay = (src->height * 2) / 3;
foo = Image_shift_xy(src, dst, ax, ay);
Image_TGA_save("Pictures/warp-shift-xy.tga", dst, 0);
Image_TGA_save("warp-shift-xy.tga", dst, 0);
foo = Image_shift_x(src, dst, ax);
Image_TGA_save("Pictures/warp-shift-x.tga", dst, 0);
Image_TGA_save("warp-shift-x.tga", dst, 0);
foo = Image_shift_y(src, dst, ay);
Image_TGA_save("Pictures/warp-shift-y.tga", dst, 0);
Image_TGA_save("warp-shift-y.tga", dst, 0);
Image_DeAllocate(src); free(src);
Image_DeAllocate(dst); free(dst);
return 42;
}
/*::------------------------------------------------------------------::*/
@ -795,7 +792,7 @@ Image_DeAllocate(dst); free(dst);
return 42;
}
/*::------------------------------------------------------------------::*/
int Test_classif(char *srcname, int k)
int Test_Classif(char *srcname, int k)
{
Image_Desc *src, *dst;
int foo;
@ -812,8 +809,7 @@ static Une_Classe_Sph classs[] =
{ 0, 255, 0, DC, 0, 255, 0 }
};
if (NULL == (src = Image_TGA_alloc_load(srcname)) )
{
if (NULL == (src = Image_TGA_alloc_load(srcname)) ) {
fprintf(stderr, "Err loading '%s'\n", srcname);
exit(5);
}
@ -821,11 +817,11 @@ dst = Image_clone(src, 0);
foo = Image_classif_0(src, dst);
Image_print_error("essai classif 0", foo);
Image_TGA_save("Pictures/aaaa-classif0.tga", dst, 0);
Image_TGA_save("aaaa-classif0.tga", dst, 0);
foo = Image_classif_1(src, dst, classs, 5, 0);
Image_print_error("essai classif 1", foo);
Image_TGA_save("Pictures/aaaa-classif1.tga", dst, 0);
Image_TGA_save("aaaa-classif1.tga", dst, 0);
Image_DeAllocate(src); free(src);
Image_DeAllocate(dst); free(dst);
@ -1159,7 +1155,7 @@ Image_dump_descriptor(source, "just after load");
* est-ce bien necessaire ?
*/
/* Image_egalise_RGB(source, source, 0); */
wf = source->width; hf = (source->height) * 4;
wf = source->width; hf = (source->height) * 3;
x2 = source->width / 2; y2 = source->height / 2;
rect.w = x2; rect.h = y2;
rect.x = 0; rect.y = 0;
@ -1353,8 +1349,7 @@ Image_DeAllocate(finale); free(finale);
return 42;
}
/*::------------------------------------------------------------------::*/
int
Test_des_tamppools(char *imgname, int param)
int Test_des_tamppools(char *imgname, int param)
{
void *ptr;
int foo;
@ -1377,7 +1372,7 @@ int Test_des_filtres(char *srcname, int k)
Image_Desc *src, *dst;
int foo;
printf("=============== LES FILTRES =====[ %s ]====[ %d ]====\n", srcname, k);
printf("=============== Filtres =====[ %s ]====[ %d ]====\n", srcname, k);
src = Image_TGA_alloc_load(srcname);
if (NULL == src) {
@ -1397,8 +1392,11 @@ foo = Image_filtre_Prewitt(src, dst, 5);
Image_TGA_save("filtre-prewitt-5.tga", dst, 0);
foo = Image_filtre_passe_haut(src, dst);
Image_TGA_save("filtre-passe-haut.tga", dst, 0);
/*
foo = Image_filtre_Sobel_4(src, dst, 0);
Image_TGA_save("filtre-sobel-4.tga", dst, 0);
*/
Image_DeAllocate(src); free(src);
Image_DeAllocate(dst); free(dst);
@ -1494,3 +1492,17 @@ Image_DeAllocate(dst); free(dst);
return -1;
}
/*::------------------------------------------------------------------::*/
/* ============================== */
void essai_gradients(void)
{
int foo;
foo = Image_plot_H_gradient("foo.tga", 640, 200);
fprintf(stderr, "plot h gradient -> %d\n", foo);
foo = Image_plot_V_gradient("foo.tga", 900, 200);
fprintf(stderr, "plot v gradient -> %d\n", foo);
}
/* ============================== */
/*::------------------------------------------------------------------::*/

View File

@ -53,7 +53,7 @@ else
Image_start_chrono("Essai", 0);
for (idx=0; idx<1; idx++) {
for (idx=0; idx<3; idx++) {
foo = Test_Egalisations(fichier, 0);
fprintf(stderr, " essai egalisation -> %d\n", foo);
foo = Essai_Televisions(fichier, 10);
@ -64,17 +64,24 @@ for (idx=0; idx<1; idx++) {
fprintf(stderr, " essai filtres -> %d\n", foo);
foo = Test_RGBmask(fichier);
fprintf(stderr, " essai rgb mask -> %d\n", foo);
foo = Test_Classif(fichier, 0);
fprintf(stderr, " essai classif -> %d\n", foo);
foo = Test_des_warpings(fichier, 0);
fprintf(stderr, " essai warping -> %d\n", foo);
fprintf(stderr, "********* %s: fin passe %d\n", argv[0], idx);
fprintf(stderr, "\n*************** %s: fin passe %d ******\n\n",
argv[0], idx);
}
#if 0
foo = Essai_color_2_map(fichier, idx);
fprintf(stderr, " essai col2map -> %d\n", foo);
foo = test_du_jpeg_reader("in.jpeg");
fprintf(stderr, " essai lecture jpeg -> %d\n", foo);
foo = Test_Dithering(fichier, 17);
fprintf(stderr, "essai dithering -> %d\n", foo);
Test_des_patterns("/tmp/pattt", 0, 0);
foo = Essai_des_jauges(fichier, 17);