Browse Source

commit du soir, espoir

master
tth 5 months ago
parent
commit
daeb4c72a7
2 changed files with 26 additions and 9 deletions
  1. +9
    -2
      experiment/essai.sh
  2. +17
    -7
      experiment/extracteur.c

+ 9
- 2
experiment/essai.sh View File

@ -7,12 +7,19 @@ IMGS="foo.fimg"
for idx in $(seq 0 69)
do
outf=$(printf "%s/X%04d.png" "/tmp" $idx)
echo $outf
echo "work on "$outf
x=$(( idx * 4 ))
y=$(( idx + 80 ))
./extracteur $IMGS 320,200,${x},${y} $outf
./extracteur $IMGS 256,128,${x},${y} $outf
error=$?
if [ 0 -ne $error ] ; then
echo error $error
exit 1
fi
echo
done
convert -delay 10 /tmp/X????.png foo.gif


+ 17
- 7
experiment/extracteur.c View File

@ -24,7 +24,7 @@ float rgb[3];
if (verbosity) {
fimg_describe(in, "source");
fimg_describe(out, "destination");
print_rectangle(rect);
print_rectangle(__func__, rect);
}
count = 0;
@ -48,7 +48,6 @@ return 0;
void help(int k)
{
puts("Usage:\n\textracteur in.fimg w,h,x,y out.???");
exit(0);
}
/* ---------------------------------------------- ~~~~~~~~~~~~~~~~ */
@ -62,16 +61,23 @@ char *outfile = "out.fimg";
verbosity = 0;
#if 0
for (foo=0; foo<argc; foo++) {
fprintf(stderr, "%9d %s\n", foo, argv[foo]);
}
#endif
while ((opt = getopt(argc, argv, "hv")) != -1) {
switch(opt) {
case 'h': help(0); break;
case 'v': verbosity++; break;
default: break;
case 'h': help(0), exit(0); break;
case 'v': verbosity++; break;
default: break;
}
}
if (3 != argc-optind) {
fprintf(stderr, "---- %s errcli %d ----\n", argv[0], argc-optind);
fprintf(stderr, "---- %s errcli c=%d %d ----\n", argv[0],
argc, argc-optind);
help(1);
exit(1);
}
@ -100,9 +106,13 @@ if (4 != parse_rectangle( argv[optind+1], &zone, 0) ) {
// zone.w = src.width / 2; zone.h = src.height / 2;
// zone.x = src.width / 4 ; zone.y = src.height / 4;
if (verbosity) print_rectangle(&zone);
if (verbosity) print_rectangle(argv[0], &zone);
foo = fimg_create(&dst, zone.w, zone.h, FIMG_TYPE_RGB);
if (foo) {
fprintf(stderr, "NO PICZ EPIC FAIL %d\n", foo);
exit(1);
}
foo = fimg_extractor(&src, &dst, &zone);
if (foo) {


Loading…
Cancel
Save