Wanna share something cool today. I've created a post-processing scripts that generates motion extraction footage in real-time.
This is inspired from Posy's Motion Extraction video (https://www.youtube.com/watch?v=NSS6yAMZF78)
Here's the result of the real-time motion extraction footage captured in Raspberry Pi 3B+ with Camera Module 3: https://www.youtube.com/watch?v=0aFgArVnlPs
Guide on installing rpicam-apps with custom post-processing script
Create a .json file that contains motion-extraction stage. Here's an example:Parameters for motion-extraction stage:Note that this post-processing script only works on rpicam-vid command.
Enjoy~~
This is inspired from Posy's Motion Extraction video (https://www.youtube.com/watch?v=NSS6yAMZF78)
Here's the result of the real-time motion extraction footage captured in Raspberry Pi 3B+ with Camera Module 3: https://www.youtube.com/watch?v=0aFgArVnlPs
Guide on installing rpicam-apps with custom post-processing script
- Clone my forked rpicam-apps with motion-extraction branch: https://github.com/shouta569/rpicam-app ... extraction
- Alternatively, you can also clone official rpicam-apps repo: https://github.com/raspberrypi/rpicam-apps
- Include these changes: https://github.com/raspberrypi/rpicam-a ... extraction
- Follow this link guide on building custom rpicam-apps
https://www.raspberrypi.com/documentati ... picam-apps
Note: I highly recommend "-Denable_libav=enabled" as using libav codec to create mp4 or avi video files that provide much smoother video playback
Create a .json file that contains motion-extraction stage. Here's an example:
Code:
{ "motion_extraction" : { "prerecord_frames": 90, "frame_offset": 1, "fixed_frame": false, "scale": 1.0, "skip_uv_diff": false }}
- prerecord_frames (int) - Set number of frames of normal footage captured before transition to motion extraction footage. If the value is more than 0, there will be about 20 frames of fade effect added in the transition (Default: 0)
- frame_offset (int) - Set number of frame offset when comparing with current frame for motion extraction. This value is ignored if fixed_frame = true (Default: 1)
- fixed_frame (bool) - If true, then only the first frame (the frame just before transitioning to motion extraction footage) will only be used to compare with current frame
- scale (float) - Multiply the difference between 2 frames (Default: 1.0)
- skip_uv_diff (bool) - If true, only output the difference of Y (luma) components of 2 frames. The difference between U and Y (chroma) components will not be calculated.
Code:
rpicam-vid --post-process-file <json file>
Enjoy~~
Statistics: Posted by ongeelim — Sat Jan 18, 2025 7:16 pm