save data files only if debug output dir is set

master
Steffen Pohle 3 years ago
parent bfb2bd5349
commit 2966ac1ffe

@ -131,12 +131,12 @@ void image_draw_rect (ImageRaw *img, Rect *r, int col) {
int x, y; int x, y;
for (x = 0; x < r->w && x + r->x < img->w; x++) { for (x = 0; x < r->w && x + r->x < img->w; x++) {
image_draw_pixel (img, x, r->y, col); image_draw_pixel (img, x + r->x, r->y, col);
image_draw_pixel (img, x, r->y+r->h-1, col); image_draw_pixel (img, x + r->x, r->y+r->h-1, col);
} }
for (y = 0; y < r->h && y + r->y < img->h; y++) { for (y = 0; y < r->h && y + r->y < img->h; y++) {
image_draw_pixel (img, r->x, y, col); image_draw_pixel (img, r->x, r->y + y, col);
image_draw_pixel (img, r->x + r->w - 1, y, col); image_draw_pixel (img, r->x + r->w - 1,r->y + y, col);
} }
} }

@ -6,7 +6,7 @@
#include "vidoiltank.h" #include "vidoiltank.h"
char conf_devname[LEN_FILENAME] = "/dev/video0"; char conf_devname[LEN_FILENAME] = "/dev/video0";
char conf_debugout[LEN_FILENAME] = "."; char conf_debugout[LEN_FILENAME] = "";
int conf_width = 1920; int conf_width = 1920;
int conf_height = 1080; int conf_height = 1080;
int conf_iomode = IOM_MMAP; int conf_iomode = IOM_MMAP;
@ -143,7 +143,7 @@ int main(int argc, char **argv) {
if (i == 0) { if (i == 0) {
snprintf (fn, 3*LEN_FILENAME, "%s/%s-img-%02d-%02d.jpg", conf_debugout, outdate, bright, cont); snprintf (fn, 3*LEN_FILENAME, "%s/%s-img-%02d-%02d.jpg", conf_debugout, outdate, bright, cont);
image_draw_rect(img, &conf_rect, 0x00FFFF); image_draw_rect(img, &conf_rect, 0x00FFFF);
image_save(img, fn, 98); if (strlen(conf_debugout) > 0) image_save(img, fn, 98);
} }
} }
if (vid_stop(video) == -1) return -1; if (vid_stop(video) == -1) return -1;
@ -152,7 +152,7 @@ int main(int argc, char **argv) {
tmpimg = image_copyF(imgf); tmpimg = image_copyF(imgf);
snprintf (fn, 3*LEN_FILENAME, "%s/%s-imgf-%03d.jpg", conf_debugout, outdate, conf_samples); snprintf (fn, 3*LEN_FILENAME, "%s/%s-imgf-%03d.jpg", conf_debugout, outdate, conf_samples);
image_save(tmpimg, fn, 98); if (strlen(conf_debugout) > 0) image_save(tmpimg, fn, 98);
printf ("detect level\n"); printf ("detect level\n");
level = detect_level(imgf); level = detect_level(imgf);
@ -161,7 +161,7 @@ int main(int argc, char **argv) {
Rect r = {.x = 0, .y = level, .w = 10, .h = 1}; Rect r = {.x = 0, .y = level, .w = 10, .h = 1};
image_draw_rect(tmpimg, &r, 0x0000FF00); image_draw_rect(tmpimg, &r, 0x0000FF00);
snprintf (fn, 3*LEN_FILENAME, "%s/%s-img-data.jpg", conf_debugout, outdate); snprintf (fn, 3*LEN_FILENAME, "%s/%s-img-data.jpg", conf_debugout, outdate);
image_save(tmpimg, fn, 98); if (strlen(conf_debugout) > 0) image_save(tmpimg, fn, 98);
printf ("%s Found Level: %5.2f Y-Pos: %d\n", outdate, 100.0 * (1.0-(float)level/(float)imgf->h), level); printf ("%s Found Level: %5.2f Y-Pos: %d\n", outdate, 100.0 * (1.0-(float)level/(float)imgf->h), level);

Loading…
Cancel
Save