|
|
|
@ -6,7 +6,7 @@
|
|
|
|
|
#include "vidoiltank.h"
|
|
|
|
|
|
|
|
|
|
char conf_devname[LEN_FILENAME] = "/dev/video0";
|
|
|
|
|
char conf_debugout[LEN_FILENAME] = ".";
|
|
|
|
|
char conf_debugout[LEN_FILENAME] = "";
|
|
|
|
|
int conf_width = 1920;
|
|
|
|
|
int conf_height = 1080;
|
|
|
|
|
int conf_iomode = IOM_MMAP;
|
|
|
|
@ -102,7 +102,7 @@ int main(int argc, char **argv) {
|
|
|
|
|
//
|
|
|
|
|
// search for god brightness and contrast
|
|
|
|
|
printf ("check controls\n");
|
|
|
|
|
cont = 200; // just picked some random numbers
|
|
|
|
|
cont = 200; // just picked some random numbers
|
|
|
|
|
bright = 170; // just picked some random numbers
|
|
|
|
|
for (level = 0, c = 32; c <= 250; c += 64)
|
|
|
|
|
for (b = 32; b <= 250; b += 64) {
|
|
|
|
@ -143,7 +143,7 @@ int main(int argc, char **argv) {
|
|
|
|
|
if (i == 0) {
|
|
|
|
|
snprintf (fn, 3*LEN_FILENAME, "%s/%s-img-%02d-%02d.jpg", conf_debugout, outdate, bright, cont);
|
|
|
|
|
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;
|
|
|
|
@ -152,7 +152,7 @@ int main(int argc, char **argv) {
|
|
|
|
|
|
|
|
|
|
tmpimg = image_copyF(imgf);
|
|
|
|
|
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");
|
|
|
|
|
level = detect_level(imgf);
|
|
|
|
@ -161,7 +161,7 @@ int main(int argc, char **argv) {
|
|
|
|
|
Rect r = {.x = 0, .y = level, .w = 10, .h = 1};
|
|
|
|
|
image_draw_rect(tmpimg, &r, 0x0000FF00);
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|