Compare commits

...

2 Commits

Author SHA1 Message Date
b8e5bbf3cc on verra demain 2020-12-29 00:54:15 +01:00
e7ad5188ca shootgun debugging 2020-12-27 02:50:41 +01:00
9 changed files with 63 additions and 14 deletions

View File

@ -196,6 +196,10 @@ switch (idFx) {
/* hipass filter */ /* hipass filter */
retval = insitu_filtre3x3(image, 1); retval = insitu_filtre3x3(image, 1);
break; break;
case 20:
retval = octotree_classif(image, 0);
break;
/* here are the glitches */ /* here are the glitches */
case 24: /* experiment ! */ case 24: /* experiment ! */
@ -237,8 +241,6 @@ typedef struct {
int flags; int flags;
} Crapulor; } Crapulor;
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
char * crap_name_from_number(int num) char * crap_name_from_number(int num)
{ {
@ -252,10 +254,14 @@ switch (num) {
case 9: return "classif0"; case 9: return "classif0";
case 10: return "binariz"; case 10: return "binariz";
case 11: return "trinariz"; case 11: return "trinariz";
case 12: return "smoo2x2";
case 13: return "fltr3x3"; case 13: return "fltr3x3";
case 14: return "desatur"; case 14: return "desatur";
case 15: return "killines";
case 18: return "updown"; case 18: return "updown";
case 20: return "octoclass";
} }
return "???"; return "???";

View File

@ -15,7 +15,7 @@ extern int verbosity;
*/ */
int get_float_metric_a(FloatImg *pimg, float *where) int get_float_metric_a(FloatImg *pimg, float *where)
{ {
float means[4]; float means[4]; /* four values : R G B A */
int foo; int foo;
#if DEBUG_LEVEL #if DEBUG_LEVEL

4
Fonderie/notes.md Normal file
View File

@ -0,0 +1,4 @@
pipeliner le graber et le fondeur par la SHM ?

View File

@ -18,6 +18,37 @@
*/ */
extern int verbosity; extern int verbosity;
/* -------------------------------------------------------------- */
/* nouveau du 27 decembre 2020, un soir de grand froid... */
int octotree_classif(FloatImg *pimg, int notused)
{
int foo;
float mm[6], means[4];
fprintf(stderr, ">>> %s ( %p %d )\n", __func__, pimg, notused);
foo = fimg_meanvalues(pimg, means);
if (foo) {
fprintf(stderr, "oups %d in meanvalues\n", foo);
return foo;
}
fprintf(stderr, "means: %11f %11f %11f\n", means[0], means[1], means[2]);
foo = fimg_get_minmax_rgb(pimg, mm);
if (foo) {
fprintf(stderr, "oups %d in get minmax\n", foo);
return foo;
}
fimg_print_minmax(mm, __func__);
/*
* compute the height center points */
return -1;
}
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
/* nouveau du 19 decembre 2020, pour le grand ecran de da Scritch */ /* nouveau du 19 decembre 2020, pour le grand ecran de da Scritch */

View File

@ -4,6 +4,7 @@
int bouger_les_pixels(FloatImg *pimg, int kaboo); int bouger_les_pixels(FloatImg *pimg, int kaboo);
int octotree_classif(FloatImg *pimg, int notused);
int mirror_split(FloatImg *pimg, int kaboo); int mirror_split(FloatImg *pimg, int kaboo);
int upside_down(FloatImg *pimg); int upside_down(FloatImg *pimg);

View File

@ -3,7 +3,7 @@
* ugly code from tTh * ugly code from tTh
*/ */
#define FIMG_VERSION 115 #define FIMG_VERSION 116
/* /*
* in memory descriptor * in memory descriptor

View File

@ -24,7 +24,9 @@ if (foo) {
return foo; return foo;
} }
if (verbosity) fprintf(stderr, "%-20s %d x %d\n",path, numbers[0], numbers[1]); if (verbosity) {
fprintf(stderr, "%-20s %dx%d\n", path, numbers[0], numbers[1]);
}
if (FIMG_TYPE_RGB != numbers[2]) { if (FIMG_TYPE_RGB != numbers[2]) {
fprintf(stderr, "file %s, %d : bad type\n", path, numbers[2]); fprintf(stderr, "file %s, %d : bad type\n", path, numbers[2]);
@ -51,6 +53,7 @@ int main(int argc, char *argv[])
{ {
int foo, idx; int foo, idx;
int opt; int opt;
int compte = 0;
int to_gray = 0; int to_gray = 0;
char *output_file = "out.fimg"; char *output_file = "out.fimg";
@ -97,6 +100,7 @@ for (idx=optind; idx<argc; idx++) {
} }
fimg_add_2(&temp, &accu); fimg_add_2(&temp, &accu);
} }
compte++;
} }
if (to_gray) { if (to_gray) {
@ -119,6 +123,7 @@ if (verbosity) {
fprintf(stderr, "err %d on fimg_get_minmax_rgb\n", foo); fprintf(stderr, "err %d on fimg_get_minmax_rgb\n", foo);
return foo; return foo;
} }
printf("Count %d\n", compte);
printf("Rmin %12.4g Rmax %12.4g delta %12g\n", printf("Rmin %12.4g Rmax %12.4g delta %12g\n",
vals[0], vals[1], vals[1]-vals[0]); vals[0], vals[1], vals[1]-vals[0]);
printf("Gmin %12.4g Gmax %12.4g %12g\n", printf("Gmin %12.4g Gmax %12.4g %12g\n",

View File

@ -35,6 +35,8 @@
#define SAVE_AS_CUMUL 1 #define SAVE_AS_CUMUL 1
#define SAVE_AS_FIMG 0 #define SAVE_AS_FIMG 0
#define NBR_BUFFERS 4
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
#define CLEAR(x) memset(&(x), 0, sizeof(x)) #define CLEAR(x) memset(&(x), 0, sizeof(x))
@ -189,10 +191,10 @@ if ((fmt.fmt.pix.width != width) || (fmt.fmt.pix.height != height)) {
fmt.fmt.pix.width, fmt.fmt.pix.height); fmt.fmt.pix.width, fmt.fmt.pix.height);
} }
fprintf(stderr,"--- Ok 1\n"); // fprintf(stderr,"--- Ok 1\n");
CLEAR(req); CLEAR(req);
req.count = 2; req.count = NBR_BUFFERS;
req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
req.memory = V4L2_MEMORY_MMAP; req.memory = V4L2_MEMORY_MMAP;
xioctl(fd, VIDIOC_REQBUFS, &req); xioctl(fd, VIDIOC_REQBUFS, &req);
@ -220,7 +222,7 @@ for (n_buffers = 0; n_buffers < req.count; ++n_buffers) {
(void)fimg_timer_set(0); (void)fimg_timer_set(0);
for (i = 0; i < n_buffers; ++i) { for (i = 0; i < NBR_BUFFERS; ++i) {
CLEAR(buf); CLEAR(buf);
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
buf.memory = V4L2_MEMORY_MMAP; buf.memory = V4L2_MEMORY_MMAP;
@ -239,7 +241,6 @@ else {
fmt.fmt.pix.width, fmt.fmt.pix.height, fmt.fmt.pix.width, fmt.fmt.pix.height,
FIMG_TYPE_RGB); FIMG_TYPE_RGB);
} }
fimg_clear(&cumul); fimg_clear(&cumul);
cumul.fval = 255.0; /* must be read from camera XXX */ cumul.fval = 255.0; /* must be read from camera XXX */
cumul.count = 0; cumul.count = 0;
@ -280,13 +281,14 @@ for (i = 0; i < nbre_capt; i++) {
fimg_timer_get(0)); fimg_timer_get(0));
fflush(stderr); fflush(stderr);
} }
CLEAR(buf); CLEAR(buf);
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
buf.memory = V4L2_MEMORY_MMAP; buf.memory = V4L2_MEMORY_MMAP;
xioctl(fd, VIDIOC_DQBUF, &buf); xioctl(fd, VIDIOC_DQBUF, &buf);
if(verbosity > 2) {
fprintf(stderr, "xioctl VIDIOC_DQBUF done\n"); fflush(stderr); fprintf(stderr, "xioctl VIDIOC_DQBUF done\n");
fflush(stderr);
}
#if SAVE_AS_CUMUL #if SAVE_AS_CUMUL
if (upscaling) { if (upscaling) {
@ -403,7 +405,7 @@ fimg_destroy(&cumul);
type = V4L2_BUF_TYPE_VIDEO_CAPTURE; type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
xioctl(fd, VIDIOC_STREAMOFF, &type); xioctl(fd, VIDIOC_STREAMOFF, &type);
for (i = 0; i < n_buffers; ++i) { for (i = 0; i < NBR_BUFFERS; ++i) {
v4l2_munmap(buffers[i].start, buffers[i].length); v4l2_munmap(buffers[i].start, buffers[i].length);
} }

View File

@ -15,7 +15,7 @@ de capture des images, précisément dans cet appel système :
buf.memory = V4L2_MEMORY_MMAP; buf.memory = V4L2_MEMORY_MMAP;
xioctl(fd, VIDIOC_DQBUF, &buf); xioctl(fd, VIDIOC_DQBUF, &buf);
Quand le programme semble figé, un strace -p <pi> sort le même Quand le programme semble figé, un strace -p <pid> sort le même
message en rafale _très_ féroce : message en rafale _très_ féroce :
ioctl(3, VIDIOC_DQBUF, {type=V4L2_BUF_TYPE_VIDEO_CAPTURE}) = -1 EAGAIN (Resource temporarily unavailable) ioctl(3, VIDIOC_DQBUF, {type=V4L2_BUF_TYPE_VIDEO_CAPTURE}) = -1 EAGAIN (Resource temporarily unavailable)