forked from tTh/FloatImg
big refactoring step 1, expect more bugs
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
# Images en virgule flottante, les outils.
|
||||
|
||||
Dans tous les cas, vous pouvez utiliser l'option `-h` pour avoir des
|
||||
explications sur ce que vous pouvez faire.
|
||||
|
||||
## mkfimg
|
||||
|
||||
## fimgops
|
||||
@@ -9,3 +12,9 @@
|
||||
## fimgstats
|
||||
|
||||
## fimg2pnm - fimg2png
|
||||
|
||||
## fimg2text
|
||||
|
||||
Nouveau de l'année 2020+1 : exfiltrer toutes des données d'une image flottante
|
||||
afin de les rendre machinables.
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
int verbosity;
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* --------------------------------------------------------------------- */
|
||||
int export_as_machinable(FloatImg *src, char *fname, int steps, int flags)
|
||||
{
|
||||
FILE *fp;
|
||||
@@ -44,7 +44,7 @@ for (y=0; y<src->height; y+=steps) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* --------------------------------------------------------------------- */
|
||||
static int normalize(FloatImg *pimg, float vmax)
|
||||
{
|
||||
float mmv[6], maxi, coef;
|
||||
@@ -79,7 +79,7 @@ for (idx=0; idx<sz; idx++) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* --------------------------------------------------------------------- */
|
||||
int convertir_fimg_en_machinable(char *srcname, char *dstname,
|
||||
int steps, float norm)
|
||||
{
|
||||
@@ -125,18 +125,18 @@ fimg_destroy(&fimg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* --------------------------------------------------------------------- */
|
||||
void help(int k)
|
||||
{
|
||||
puts("usage:\n\tfimg2text [options] foo.fimg > bar.csv");
|
||||
puts("options:");
|
||||
puts("\t-v\tincrease verbosity");
|
||||
puts("\t-n 3.14\tnormalize picture");
|
||||
puts("\t-s N\nsteps on x & y");
|
||||
puts("\t-v\t\tincrease verbosity");
|
||||
puts("\t-n 3.14\t\tnormalize picture");
|
||||
puts("\t-s N\t\tsteps on x & y");
|
||||
if (verbosity) fimg_print_version(1);
|
||||
exit(0);
|
||||
}
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@@ -154,7 +154,7 @@ while ((opt = getopt(argc, argv, "hn:s:v")) != -1) {
|
||||
}
|
||||
|
||||
if (1 != argc-optind) {
|
||||
fprintf(stderr, "error: %s need one filename\n", argv[0]);
|
||||
fprintf(stderr, "error: %s need one intput filename\n", argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -165,5 +165,5 @@ if (foo) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ static void help(int lj)
|
||||
|
||||
puts("usage:\n\tfimgops [options] A.fimg B.fimg operator D.fimg");
|
||||
puts("options:");
|
||||
puts("\t-g convert output to gray");
|
||||
// puts("\t-g convert output to gray");
|
||||
puts("\t-k N.N set float value");
|
||||
puts("\t-v increase verbosity");
|
||||
pr_opcodes();
|
||||
@@ -112,6 +112,7 @@ FloatImg srcA, srcB, dest;
|
||||
|
||||
while ((opt = getopt(argc, argv, "hk:v")) != -1) {
|
||||
switch(opt) {
|
||||
case 'g': break;
|
||||
case 'h': help(0); break;
|
||||
case 'k': global_fvalue = atof(optarg); break;
|
||||
case 'v': verbosity++; break;
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*
|
||||
* making a floatimg with some random datas
|
||||
* an ugly software from tTh - february 2021
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
@@ -137,7 +142,7 @@ switch(type) {
|
||||
|
||||
foo = fimg_dump_to_file(&fimg, fname, 0);
|
||||
if (foo) {
|
||||
fprintf(stderr, "dump fimg -> %d\n", foo);
|
||||
fprintf(stderr, "dump fimg to %s -> %d\n", fname, foo);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user