google-coral/project-posenet

Saving videos to a disc/to a Raspberry Pi

zain-altaf opened this issue · 3 comments

Description

Hi

I'm using the google coral mini dev board and a RPi 3. I got the basics to work, including the camera capture and real time anonymization of person with the stick figure and key points showing correctly, it worked flawlessly. I was wondering, now that I have that part figured out, how could I take video footage that is being captured by the camera and save it locally on my RPi or some sort of storage device? I need the videos to be able to begin training a model.

Click to expand!

Issue Type

Support

Operating System

Mendel Linux

Coral Device

Dev Board Mini

Other Devices

Raspberry Pi 3

Programming Language

Python 3.7

Relevant Log Output

No response

This would require changes to gstremaer pipeline.

For USB accelerator please update the pipeline as bleow at: https://github.com/google-coral/project-posenet/blob/master/gstreamer.py#L347


    PIPELINE += """ ! decodebin ! videoflip video-direction={direction} ! tee name=t
               t. ! {leaky_q} ! videoconvert ! freezer name=freezer ! rsvgoverlay name=overlay
                  ! videoconvert ! x264enc ! avimux ! filesink location=video.avi
               t. ! {leaky_q} ! videoconvert ! videoscale ! {scale_caps} ! videobox name=box autocrop=true
                  ! {sink_caps} ! {sink_element} 
            """

For some reasons above pipeline does not work with Dev Board and Dev Board Mini. For those boards below pipelne can be used, which save the images instead video file.

    PIPELINE += """ ! decodebin ! videoflip video-direction={direction} ! tee name=t
               t. ! {leaky_q} ! videoconvert ! freezer name=freezer ! rsvgoverlay name=overlay
                  ! videoconvert ! jpegenc ! multifilesink location=image_%06d.jpg
               t. ! {leaky_q} ! videoconvert ! videoscale ! {scale_caps} ! videobox name=box autocrop=true
                  ! {sink_caps} ! {sink_element} 
            """

You may see some error like AttributeError: 'NoneType' object has no attribute 'set_property'. I think, you can ignore this error or put a try and expect at: https://github.com/google-coral/project-posenet/blob/master/gstreamer.py#L74

Thank you! I was able to use the bottom code snippet to get images saved to my coral mini! I can now use mdt pull to access them on my raspberry pi.

Are you satisfied with the resolution of your issue?
Yes
No