jhdewitt / sltk

An OpenCV-based structured light processing toolkit.
MIT License
251 stars 63 forks source link

Is this supposed to show a date? #9

Open prahjister opened 6 years ago

prahjister commented 6 years ago
('1522413892.250540', '1522378145.697283 late', 'frame# 0743', '......', 'dT: 0.03377 (29.6fps)', 'ts.show_dt = 0.000000, ts.show_dtavg = 0.000000\\n')
('1522413892.285613', '1522378145.698957 late', 'frame# 0744', '......', 'dT: 0.03340 (29.9fps)', 'ts.show_dt = 0.000000, ts.show_dtavg = 0.000000\\n')
('1522413892.320582', '1522378145.700393 late', 'frame# 0745', '......', 'dT: 0.03353 (29.8fps)', 'ts.show_dt = 0.000000, ts.show_dtavg = 0.000000\\n')
('1522413892.355609', '1522378145.701665 late', 'frame# 0746', '......', 'dT: 0.03375 (29.6fps)', 'ts.show_dt = 0.000000, ts.show_dtavg = 0.000000\\n')
('1522413892.395481', '1522378145.708071 late', 'frame# 0747', '......', 'dT: 0.03347 (29.9fps)', 'ts.show_dt = 0.000000, ts.show_dtavg = 0.000000\\n')
('1522413892.432098', '1522378145.711195 late', 'frame# 0748', '......', 'dT: 0.03349 (29.9fps)', 'ts.show_dt = 0.000000, ts.show_dtavg = 0.000000\\n')
('1522413892.466803', '1522378145.712304 late', 'frame# 0749', '......', 'dT: 0.03360 (29.8fps)', 'ts.show_dt = 0.000000, ts.show_dtavg = 0.000000\\n')
('1522413892.501728', '1522378145.713616 late', 'frame# 0750', '......', 'dT: 0.03361 (29.8fps)', 'ts.show_dt = 0.000000, ts.show_dtavg = 0.000000\\n')
prahjister commented 6 years ago

fyi this is how i start the stream

sudo ./mjpg_streamer -i "./input_uvc.so" -o "./output_http.so"

jhdewitt commented 6 years ago

is this supposed to show a date?

Yes; first field is unix timestamp of local machine when the jpg image was fully downloaded. Second field is ts_late which is the amount of time between the JPG embedded timestamp and when the image was downloaded (two computer clock offset causes this to break). This relies on mjpg-streamer embedding a valid timestamp on outbound JPGs. Which it doesn't seem to be doing in your case

But we are in luck!

https://github.com/jacksonliam/mjpg-streamer/commit/1b22b2e2e4194d3145628e07659b7c848cd8ae1d

As of Aug 5, 2016, mjpg-streamer added a -timestamp option to enable this functionality :)

So, your second field is showing an exceptionally high value. This suggests to me that adding -timestamp to your mjpg_streamer invocation should make this second field go to an appropriate value (<<1 second). The program relies on this to estimate which image is safe to save based on how much time has elapsed since the pattern output was updated.

sudo ./mjpg_streamer -timestamp -i "./input_uvc.so" -o "./output_http.so"

jhdewitt commented 6 years ago

Just for reference, this is how I start it in a shell script:

mjpg_streamer -o "output_http.so -w ./www" -i "input_raspicam.so -quality 100 -x $X_RES -y $Y_RES -fps $FPS -ISO 100 -awb off -ex off --awbgainR $RED_GAIN --awbgainB $BLU_GAIN -timestamp -shutter $EXPOSURE_TIME"

The Software Setup Guide has been amended with two invocation examples.

prahjister commented 6 years ago

that is wierd...it is not liking the timestamp switch FYI before i compile i have to

sudo apt autoremove python-opencv libopencv-dev

compile then i install again or else i get


/home/prahjister/mjpg-streamer/mjpg-streamer-experimental/plugins/input_opencv/input_opencv.cpp: In function ‘int input_init(input_parameter*, int)’:
/home/prahjister/mjpg-streamer/mjpg-streamer-experimental/plugins/input_opencv/input_opencv.cpp:275:23: error: ‘CAP_PROP_FRAME_WIDTH’ was not declared in this scope
     pctx->capture.set(CAP_PROP_FRAME_WIDTH, width);
                       ^
/home/prahjister/mjpg-streamer/mjpg-streamer-experimental/plugins/input_opencv/input_opencv.cpp:276:23: error: ‘CAP_PROP_FRAME_HEIGHT’ was not declared in this scope
     pctx->capture.set(CAP_PROP_FRAME_HEIGHT, height);
                       ^
/home/prahjister/mjpg-streamer/mjpg-streamer-experimental/plugins/input_opencv/input_opencv.cpp:279:27: error: ‘CAP_PROP_FPS’ was not declared in this scope
         pctx->capture.set(CAP_PROP_FPS, settings->fps);
                           ^
/home/prahjister/mjpg-streamer/mjpg-streamer-experimental/plugins/input_opencv/input_opencv.cpp: In function ‘void* worker_thread(void*)’:
/home/prahjister/mjpg-streamer/mjpg-streamer-experimental/plugins/input_opencv/input_opencv.cpp:399:15: error: ‘CAP_PROP_FPS’ was not declared in this scope
     CVOPT_SET(CAP_PROP_FPS, fps, "frames per second")
               ^
/home/prahjister/mjpg-streamer/mjpg-streamer-experimental/plugins/input_opencv/input_opencv.cpp:388:32: note: in definition of macro ‘CVOPT_OPT’
         if (!pctx->capture.set(prop, settings->var)) {\
                                ^
/home/prahjister/mjpg-streamer/mjpg-streamer-experimental/plugins/input_opencv/input_opencv.cpp:399:5: note: in expansion of macro ‘CVOPT_SET’
     CVOPT_SET(CAP_PROP_FPS, fps, "frames per second")
     ^
/home/prahjister/mjpg-streamer/mjpg-streamer-experimental/plugins/input_opencv/input_opencv.cpp:400:15: error: ‘CAP_PROP_BRIGHTNES ’ was not declared in this scope
     CVOPT_SET(CAP_PROP_BRIGHTNESS, co, "contrast")
               ^
/home/prahjister/mjpg-streamer/mjpg-streamer-experimental/plugins/input_opencv/input_opencv.cpp:388:32: note: in definition of macro ‘CVOPT_OPT’
         if (!pctx->capture.set(prop, settings->var)) {\
                                ^
/home/prahjister/mjpg-streamer/mjpg-streamer-experimental/plugins/input_opencv/input_opencv.cpp:400:5: note: in expansion of macro ‘CVOPT_SET’
     CVOPT_SET(CAP_PROP_BRIGHTNESS, co, "contrast")
     ^
/home/prahjister/mjpg-streamer/mjpg-streamer-experimental/plugins/input_opencv/input_opencv.cpp:401:15: error: ‘CAP_PROP_CONTRAST’ was not declared in this scope
     CVOPT_SET(CAP_PROP_CONTRAST, br, "brightness")
               ^
/home/prahjister/mjpg-streamer/mjpg-streamer-experimental/plugins/input_opencv/input_opencv.cpp:388:32: note: in definition of macro ‘CVOPT_OPT’
         if (!pctx->capture.set(prop, settings->var)) {\
                                ^
/home/prahjister/mjpg-streamer/mjpg-streamer-experimental/plugins/input_opencv/input_opencv.cpp:401:5: note: in expansion of macro ‘CVOPT_SET’
     CVOPT_SET(CAP_PROP_CONTRAST, br, "brightness")
     ^
/home/prahjister/mjpg-streamer/mjpg-streamer-experimental/plugins/input_opencv/input_opencv.cpp:402:15: error: ‘CAP_PROP_SATURATIO ’ was not declared in this scope
     CVOPT_SET(CAP_PROP_SATURATION, sa, "saturation")
               ^
/home/prahjister/mjpg-streamer/mjpg-streamer-experimental/plugins/input_opencv/input_opencv.cpp:388:32: note: in definition of macro ‘CVOPT_OPT’
         if (!pctx->capture.set(prop, settings->var)) {\
                                ^
/home/prahjister/mjpg-streamer/mjpg-streamer-experimental/plugins/input_opencv/input_opencv.cpp:402:5: note: in expansion of macro ‘CVOPT_SET’
     CVOPT_SET(CAP_PROP_SATURATION, sa, "saturation")
     ^
/home/prahjister/mjpg-streamer/mjpg-streamer-experimental/plugins/input_opencv/input_opencv.cpp:403:15: error: ‘CAP_PROP_GAIN’ was not declared in this scope
     CVOPT_SET(CAP_PROP_GAIN, gain, "gain")
               ^
/home/prahjister/mjpg-streamer/mjpg-streamer-experimental/plugins/input_opencv/input_opencv.cpp:388:32: note: in definition of macro ‘CVOPT_OPT’
         if (!pctx->capture.set(prop, settings->var)) {\
                                ^
/home/prahjister/mjpg-streamer/mjpg-streamer-experimental/plugins/input_opencv/input_opencv.cpp:403:5: note: in expansion of macro ‘CVOPT_SET’
     CVOPT_SET(CAP_PROP_GAIN, gain, "gain")
     ^
/home/prahjister/mjpg-streamer/mjpg-streamer-experimental/plugins/input_opencv/input_opencv.cpp:404:15: error: ‘CAP_PROP_EXPOSURE’ was not declared in this scope
     CVOPT_SET(CAP_PROP_EXPOSURE, ex, "exposure")
               ^
/home/prahjister/mjpg-streamer/mjpg-streamer-experimental/plugins/input_opencv/input_opencv.cpp:388:32: note: in definition of macro ‘CVOPT_OPT’
         if (!pctx->capture.set(prop, settings->var)) {\
                                ^
/home/prahjister/mjpg-streamer/mjpg-streamer-experimental/plugins/input_opencv/input_opencv.cpp:404:5: note: in expansion of macro ‘CVOPT_SET’
     CVOPT_SET(CAP_PROP_EXPOSURE, ex, "exposure")
     ^
plugins/input_opencv/CMakeFiles/input_opencv.dir/build.make:62: recipe for target 'plugins/input_opencv/CMakeFiles/input_opencv.dir/input_opencv.cpp.o' failed
make[3]: *** [plugins/input_opencv/CMakeFiles/input_opencv.dir/input_opencv.cpp.o] Error 1
make[3]: Leaving directory '/home/prahjister/mjpg-streamer/mjpg-streamer-experimental/_build'
CMakeFiles/Makefile2:237: recipe for target 'plugins/input_opencv/CMakeFiles/input_opencv.dir/all' failed
make[2]: *** [plugins/input_opencv/CMakeFiles/input_opencv.dir/all] Error 2
make[2]: Leaving directory '/home/prahjister/mjpg-streamer/mjpg-streamer-experimental/_build'
Makefile:127: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/prahjister/mjpg-streamer/mjpg-streamer-experimental/_build'
Makefile:17: recipe for target 'all' failed
make: *** [all] Error 2
prahjister commented 6 years ago

ugh looks like i need opencv 3.1...trying to compile now following this

http://xfloyd.net/blog/?p=987

prahjister commented 6 years ago

Even after compiling 3.1 no timestamp swtich available

prahjister commented 6 years ago

after looking...it looks like input_raspicam.so is doing the timestamp and input_uvc.so doesnt support it.

It looks like the correct command is below if it supported it

sudo ./mjpg_streamer -i "./input_uvc.so -timestamp" -o "./output_http.so"

prahjister commented 6 years ago

Is the timestamp somehow encoded in the stream? How does it read it?

prahjister commented 6 years ago

https://github.com/jacksonliam/mjpg-streamer/issues/124

Can you reply to this...asking Exif or http header?