dustobub
Posts: 32
Joined: Fri Oct 30, 2020 12:07 pm

Re: Raw sensor access / CSI-2 receiver peripheral

Thu Nov 05, 2020 7:36 pm

Would it be possible with the current raspiraw code to manually trigger still frames (at arbitrary times) while keeping all of frames in ram until I want to save them to disk in another thread? This is for a stopmotion use-case where the frame timing is controlled externally. I'm unable to use raspistill or picamera due to the long and somewhat unpredictable (200-3000ms) latency from when the shot is triggered to when the capture is actually started. I've tried using picamera's continuous capture + burst mode, but there's still too much latency to be reliable integrated into our motion system. It seems as though raspiraw might be optimized for this type of shooting. Any help would be greatly appreciated. Thanks!

User avatar
HermannSW
Posts: 3427
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Raw sensor access / CSI-2 receiver peripheral

Thu Nov 05, 2020 11:38 pm

dustobub wrote:
Thu Nov 05, 2020 7:36 pm
Would it be possible with the current raspiraw code to manually trigger still frames (at arbitrary times) while keeping all of frames in ram until I want to save them to disk in another thread? This is for a stopmotion use-case where the frame timing is controlled externally. I'm unable to use raspistill or picamera due to the long and somewhat unpredictable (200-3000ms) latency from when the shot is triggered to when the capture is actually started.
You can do what you want with HQ camera, using raspivid. You will have to extract the frames later from created .h264 video. Or better YUV stream, that does not change the captured frames.

HQ camera allows to sync multiple HQ cameras, one is source and the others are sink cameras, via XVS pin.
I (mis)used that pin with a single HQ camera in sink mode, and did send a 40ns low pulse to XVS to trigger a frame capture.

First I used that to create arbitrary(!) long exposures, longest sofar 60(!) minutes:
Image


Later I described how to start capture frame at specific point in time (a, 0 latency) with the exposure needed (b):
viewtopic.php?f=43&t=281913&start=50#p1746481

You need a 74HC04N IC and 0/200/250 voltage devider to go vom Pi 3.3V to HQ XVS 1.8V, connection diagram here:
viewtopic.php?f=43&t=281913&start=50#p1742159

where the frame timing is controlled externally
You need to generate 40ns low signal on HQ camera in sink mode XVS pin.
Last edited by HermannSW on Thu Nov 05, 2020 11:49 pm, edited 1 time in total.
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/working_with_FPGAs

dustobub
Posts: 32
Joined: Fri Oct 30, 2020 12:07 pm

Re: Raw sensor access / CSI-2 receiver peripheral

Thu Nov 05, 2020 11:46 pm

Sorry, I should have specified that I am looking for the raw bayer data (converted eventually to dng). I looked into using the YUV data but upon comparing the results, it was clear the raw data debayered offline was better quality than YUV. Is that not in sync with what you've seen?

User avatar
HermannSW
Posts: 3427
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Raw sensor access / CSI-2 receiver peripheral

Thu Nov 05, 2020 11:52 pm

I have not tested wether HQ camera syncing works with raspiraw as well -- 6by9 should know.
In case it works, the method I described will give you raw Bayer frames at arbitrary point in time.
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/working_with_FPGAs

dustobub
Posts: 32
Joined: Fri Oct 30, 2020 12:07 pm

Re: Raw sensor access / CSI-2 receiver peripheral

Fri Nov 06, 2020 12:03 am

HermannSW wrote:
Thu Nov 05, 2020 11:52 pm
I have not tested wether HQ camera syncing works with raspiraw as well -- 6by9 should know.
In case it works, the method I described will give you raw Bayer frames at arbitrary point in time.
K, cool. I'll look into that.

As for raspiraw, do you know what the typical latency from the initial call to capture start is? And is it possible to keep ad-hoc still frames in ram until an arbitrary time? Ie. One script that receives network requests to trigger a single raw frame capture stored in ramdisk, and another script which continually offloads frames from ramdisk to SD card.

Thanks for your help.

User avatar
RichShumaker
Posts: 356
Joined: Tue Jul 31, 2012 4:16 pm
Location: Sunny Southern CA near downtown LA
Contact: Website Facebook Twitter YouTube

Re: Raw sensor access / CSI-2 receiver peripheral

Fri Nov 06, 2020 2:19 am

dustobub wrote:
Fri Nov 06, 2020 12:03 am
One script that receives network requests to trigger a single raw frame capture stored in ramdisk, and another script which continually offloads frames from ramdisk to SD card.
I can't recommend enough switching to a Pi4B with High Speed M.2 USB 3.1 drive. This will allow many more frames to be captured. Currently you can get up to 11.38fps or 9fps sustained viewtopic.php?f=43&t=284937
Rich Shumaker
http://www.instructables.com/id/Pi-Zero-W-NoIR-8MP-Camera-Build-Overview-Introduct/

Return to “Camera board”