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

Re: Raspberry v1 camera global (external) shutter videos

Thu Jul 04, 2019 1:57 pm

I am currently working on sub-project "ESP32-CAM ov2640 sensor global external shutter" and created a sub repo already:
https://github.com/Hermann-SW/Raspberry ... aWebServer

The most difficult part after hardware reverse engineering the ov2640 sensor
https://www.esp32.com/viewtopic.php?f=1 ... 4a48842dd5
Image

was to solder a thin cable to flat ribbon cable connector pin10 (those pins are 0.5mm spaced!), which was surprisingly easy to do with using v1 camera as big magnifying glass and look into HDMI monitor only while soldering:
Image

While with Raspberry v1 camera ov5647 sensor I have full control over when to trigger global reset frame and independently to control the shutter time, the ov5647 predecessor sensor ov2640 that I debugged and use has pins A2 and B2 connected. When setting pin10 to high, all lines get reset. When pin10 gets low, readout of image already starts?!?!? I am pretty sure that global external shutter frames can be captured by ov2640 sensor that way, only some lines at top of frame will be "lost" because they have already been read out and sent to ESP32 when the flash actually happens. This is work in progress.


Today I looked something up on aliexpress and unplanned realized that v1 camera clones (Raspberry v1 camera is not sold anymore after v2 appeared in 2016) do cost less than 4$ these days with free shipping(!):
https://www.aliexpress.com/wholesale?Se ... FreeShip=y
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://gitlab.freedesktop.org/HermannSW/gst-template
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

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

Re: Raspberry v1 camera global (external) shutter videos

Tue Jul 16, 2019 3:55 am

It turned out that soldering cable to ESP32-CAM flat ribbon cable connector was not necessary for taking global (external) shutter frames with ov2640 sensor. Instead ov2640 sensor allows for:
  • some kind of "implicit" global shutter mode
  • global shutter capturing at daylight without external shutter
  • mixed mode global+rolling shutter frames
I added new section "TODOs+ideas" to github repo, also related to Raspberry cameras; for now:
https://github.com/Hermann-SW/Raspberry ... todosideas
TODOs+ideas
  • fully understand how+why (implicit) global shutter capturing for ov2640 works without being triggered explicitely
  • Raspberry v1 camera ov5647 is successor of ov2640; does it have an implicit global shutter mode as well?
  • Raspberry v2 camera Sony imx219 sensor is different; does it allow for implicit global shutter capturing as well?

Image
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://gitlab.freedesktop.org/HermannSW/gst-template
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

mkirk
Posts: 44
Joined: Tue Mar 06, 2018 4:21 pm

Re: Raspberry v1 camera global (external) shutter videos

Wed Jul 31, 2019 3:55 pm

The datasheet for the OV5647 states that it supports both rolling and global shutter modes.
https://cdn.sparkfun.com/datasheets/Dev ... 7_full.pdf

Datasheet feature list on page 5: Shutter: rolling shutter / global shutter

Register SC_CMMN_MISC_CTRL has bit[0] defined as cen_global_o
Is that for global shutter mode?

Is it possible to enable global shutter mode on the Pi V1 camera? What parameter is used?

Or does global shutter require an mechanical shutter to control the light?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7315
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Raspberry v1 camera global (external) shutter videos

Wed Jul 31, 2019 4:03 pm

mkirk wrote:
Wed Jul 31, 2019 3:55 pm
The datasheet for the OV5647 states that it supports both rolling and global shutter modes.
https://cdn.sparkfun.com/datasheets/Dev ... 7_full.pdf

Datasheet feature list on page 5: Shutter: rolling shutter / global shutter

Register SC_CMMN_MISC_CTRL has bit[0] defined as cen_global_o
Is that for global shutter mode?

Is it possible to enable global shutter mode on the Pi V1 camera? What parameter is used?

Or does global shutter require an mechanical shutter to control the light?
There is no true global shutter mode.

A global shutter sensor has two image arrays in the silicon, the first exposed to the light, and the second to take the charge and allow readout. The OV5647 does not have this.
It does allow a global reset, and then readout is triggered the exposure time later. This will behave like a global shutter sensor if you either have a mechanical shutter, or disable any form of illumination at the end of the exposure time. This is the mode that HermannSW has been experimenting with.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

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

Re: Raspberry v1 camera global (external) shutter videos

Wed Jul 31, 2019 9:17 pm

6by9 wrote:
Wed Jul 31, 2019 4:03 pm
... or disable any form of illumination at the end of the exposure time. This is the mode that HermannSW has been experimenting with.
Exactly, and I am still surprised how well that worked.
See the images (especially the multiple exposure) frames in this thread or on github:
https://github.com/Hermann-SW/Raspberry ... al_shutter
mkirk wrote:
Wed Jul 31, 2019 3:55 pm
Is it possible to enable global shutter mode on the Pi V1 camera? What parameter is used?
See lines 22-23 in raspivid_ges tool, it was really surprising to me that two register settings sufficed to force gobal reset mode on ov5647 (v1) sensor:
https://github.com/Hermann-SW/Raspberry ... id_ges#L22


Besides the captured airgun pellets in flight, this is one of my favorite multiple exposure v1 frames (8000eps). The cardbox is not that dark because I took the frame with 1fps framerate video, so total light on cardbox was 8000*9us=72ms per frame:
Image


What is still mysterious to me is why I was able to do global shutter (yes, without external) with ov2640 sensor -- it seems to be some kind of overlay of global shutter frame and rolling shutter frame, but at daylight!?!?!
Image

6by9 wrote:
Wed Jul 31, 2019 4:03 pm
A global shutter sensor has two image arrays in the silicon, the first exposed to the light, and the second to take the charge and allow readout. The OV5647 does not have this.
There are two (0.3MP and 1.0MP) Arducam monochrome global shuuter cameras (<30$) that have the mechanism 6by9 stated. And both can be connected to the Pi CSI-2 connector like v1 and v2 camera:
https://www.raspberrypi.org/forums/view ... 3#p1485903
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://gitlab.freedesktop.org/HermannSW/gst-template
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

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

Re: Raspberry v1 camera global (external) shutter videos

Sat Aug 10, 2019 10:59 am

I just looked at the 5MP sample for rolling shutter effect I used in Information section of github repo:
https://github.com/Hermann-SW/Raspberry ... troduction

I realized that the image provides the propeller rotation direction.
Camera scans lines from top to bottom.
The inserted horizontal blue line shows that propeller blade moved from right to left above propeller center.
The red horizontal line shows that propeller blade moved from left to right below propeller center.
Therefore the rotation direction is counter clockwise (when looking at the image):
Image
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://gitlab.freedesktop.org/HermannSW/gst-template
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

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

Re: Raspberry v1 camera global (external) shutter videos

Mon Sep 02, 2019 9:42 pm

This posting is on work in progress, reporting on initial success with microphone sensor triggered global external shutter captures.

Yesterday I found a microphone sensor I bought 4 years ago in my http://aliexpress.com order list, after some search I found it in real as well. I tested that it works with 5V Arduino Uno (per product description) and experimentally found that it works with 3V3 too:
Image


I wanted to trigger global external shutter especially for non-repeating scenes like airsoft pistol/airgun pellet flights in order to capture images like this, a single µs range flash duration exposure (from this thread: https://www.raspberrypi.org/forums/view ... 3&t=240442):
Image


For all the global external shutter captures sofar I used long free space behind the scene to get black background. Today I wanted to get short distance black background and painted a piece of cardboard with with "Black 3.0" I got from kickstarter campain. This is the cardboard I painted two times:
Image


On the left you see the black cardboard. Left of the big wooden bar you can see the 5000lm led with heatsink, the first time standing vertically and lighting direction of the flying pellet (before the leds lighted the scene from bottom and/or top). In front you can see the microphone sensor connected to the Pi 3A+. It had GND, VCC, A0 and D0 lines. I used the D0 digital line and relied on the microphone sensor electronics to determine when a loud noise happens (there is a small screw to adjust). Last but not least I had to make sure that the flat ribbon camera cable did not get close to the 38V/1.5A cables powering the 5000lm led, in order to not get bad frames:
Image


As I said, this is work in progress, just checked in initial version of audio_shots.c with this commit:
https://github.com/Hermann-SW/Raspberry ... 5aede4f054

I started "raspivid_ges" as before in one console, and after the bright led lights turned off after 2 seconds, I did "sudo killall pigpiod" to be able to execute this command:

Code: Select all

$ sudo ./audio_shots 100 9 3000 10

It just waits for being triggered via microphone sensor digital D0, then waits for 10µs offset, then does 100 flashes of 9µs length, at a frequency of 3000Hz. This frame is my first global external shutter frame capture triggered by sound:
Image


Why 100 flashes? This is in order to have flashes over 100/3000=0.0333s. During that time the 36m/s pellet moves 0.0333*36m=1.2m. Next I can reduce 100 to lower values, that will result in darker background, and far less than 1.2m will be sufficient to determine the correct offset via interval bisection (the right pellet was flashed between 33.343ms and 3.3s). Then I will be able to see whether the sound triggering is accurate enough to capture at same location for same offset.

Another option is to increase frequency 3 times, that will result in captured frame with overlapping pellets, allowing easier to not miss the pellets (from previous 3KHz airsoft pistol pellet captures we know that shortest distance between the two 6mm diameter pellets in frame above is 6.7mm).


P.S:
The black background does not look that black, but it gets hit by 100×9µs=0.9ms of 5000lm led light in total (raspivid_ges captures with 1fps by default). That is 100 times as long as the yellow pellet gets hit by 9µs led light at a single location ...
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://gitlab.freedesktop.org/HermannSW/gst-template
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

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

Re: Raspberry v1 camera global (external) shutter videos

Tue Sep 03, 2019 5:06 pm

I made progress, in determining the offset needed.

Unlike yesterday where I used a v1 camera with manually added M12 lens mount and lens, I used this time the last v1 camera clone I received as is.

I reduced N to 50 shots, and doubled frequency to 6000Hz, and captured frames like this:
Image


Next I reduced N to 40, 30 and 20. With N=20 the first time a diffence to PWM capturing can be seen, after some point no flashes happened, and the pellet passing did not get captured on the right side:
Image


I wanted to see 5 successive pellets, so removed the right 3 by N=17, calculated the offset needed as 12/6000Hz=0.002s=2000µs, and reduced number of shots to N=5:
Image


Second shot was nearly outside of the frame:
Image


Third shot was in frame again completely:
Image


So why are the pellets not captured at same location?

From the 2nd frame above we know the view length (for that shot) is 13/6000Hz*36m/s=7.8cm.
For doing the brightness initialization at start of "raspivid_ges" the room needs to be completely dark, no light (beside monitor I type commands in).
Then I killall pigpiod and start the audio_shots command:

Code: Select all

$ sudo ./audio_shots 5 9 6000 2000
Finally I stand up, move to the capturing area, aim and shoot (in near darkness).

The pellet did even pass at different distances to the camera as the different pellet sizes in the last three frames show.
As long as I do not have some mechanism that fixates the airsoft pistol, no better results are possible.
(like clamping airgun to desk: https://github.com/Hermann-SW/Raspberry ... setup2leds)

The background brightness seems to be determined by the distance the pellet passes the camera as well.

For now I find the last three frames impressive:
The pellet passes whole view horizontally in 13/6000Hz=2.166ms, the offset is 2ms, so pellet leaves frame after 4.166ms.
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://gitlab.freedesktop.org/HermannSW/gst-template
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

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

Re: Raspberry v1 camera global (external) shutter videos

Thu Sep 05, 2019 8:27 pm

I wanted to know whether flying pellet spins during flight (it spins fast!).
I added small blue dot with permanent marker to north and south pole of some pellets.
One pole is visible at least, that should allow to "see" whether there is spin or not.

Yesterday I wanted to repeatedly capture shots and saw a massive stability issue of audio_shots.c tool.
When I did 9 shots in a row then the Pi froze completely, power cycling was needed.
Sometimes after 2 shots, sometimes after 8.

It turned out that sending a wave from inside a pigpio library alert function was responsible.
Then it turned out that alert function triggering was done only 1000 times per second.
That is not the frequency needed for µs precision timing.

So I removed the alert function at all and just did active waiting for GPIO17 rising edge in order to minimize latency:
https://github.com/Hermann-SW/Raspberry ... 6fa5128e96

Code: Select all

...
   while (! gpioRead(gpioDaudio)) { }
   gpioWaveTxSend(wave_id, PI_WAVE_MODE_ONE_SHOT);
...

This is a capture of a marked pellet, and in fact it rotates. From one exposure to next at 6KHz time increased by 166µs. Looking at the 9 full in view pellet exposures, time passed from left to right is 8*166µs. Lets say the dot does roughly 1/8 of a full rotation. Then a full rotation of the pellet takes 8*8/6000Hz=0.01066s, rotation speed therefore is 93.75rps or 5625rpm!
Image


Later I did 8 shots in a row, captured by raspivid_ges at 1fps. I selected the part of the video that contains the 8 pellet captures and created a 35s animated .gif from it (scaled down from 1920x1080 to 640*360). I used command with a different offset, because the microphone sensor had issues and after fixing them so that I could take the videos at least, the offset values were much different to before. I just ordered a new microphone sensor that will arrive here on Saturday:

Code: Select all

$ sudo killall pigpiod; while true; do sudo ./audio_shots 8 9 6000 6334; done
Only 3/8 multiple exposures show 8 full pellet captures for the reason stated at end of last posting:
Image
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://gitlab.freedesktop.org/HermannSW/gst-template
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

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

Re: Raspberry v1 camera global (external) shutter videos

Fri Sep 06, 2019 6:12 pm

I did some more shots, intentionally a bit upwards, and with 5KHz in order to get a bit distance between successive pellet exposures.

I created a shell script that uses netpbm tools and ffmpeg again to create 5000fps animation from the 5000eps frame.
That script is mak.640.5, contained among other stuff in this .zip (14MB is too big for attachment):
https://stamm-wilbrandt.de/en/forum/pellets_anim.zip

The difference for creating animation from multiple exposure frame this time is, that the pellet exposures do not get overwritten with black. Instead this time two images are provided, full.pnm with all pellet exposures, and empty.pnm with no pellet exposure. empty.pnm can easily be created with a shot with no pellet (empty magazine), the flashes happen and light dark background.

This is sample animation I created with the script from full.pnm and empty.pnm, the animation is scaled down again from 1920x1080 to 640x360, and 5fps playback framerate, 1000 times slower than real:
Image


For the shell script I did determine the x coordinates in center between successive pellets "by hand" with gimp.
I went a step further and laid the basis for automatic determination.
Yellow pellet pixels have larger r and g than b color components.
This command creates blue where "yellow" is detrmined by threshhold greater than 10:

Code: Select all

./pellets thumb.0067.pnm empty.pnm 10 > thumb.0067.blue.pnm
This is the blue coloring:

Code: Select all

    if ((p[0][0]+p[0][1])/2 - p[0][2] > thr)
    {
      p[0][0] = 0;
      p[0][1] = 0;
      p[0][2] = 255;
    }
Here you can see that just scanning all columns for presence of at least one blue pixel will reveal the x coordinates between successive pellet exposures:
Image


P.S:
Just brought github repo documentation up to date.
Added Sound trigger section, as well as new method for creation of kFPS videos from empty and full frames.
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://gitlab.freedesktop.org/HermannSW/gst-template
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

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

Re: Raspberry v1 camera global (external) shutter videos

Sat Sep 07, 2019 2:14 pm

I went back to the frame that proved fast spinning of airsoft pistol pellet during flight, and created a "fast camera panning" tool to highlight that:

https://github.com/Hermann-SW/Raspberry ... ra_panning
In Sound trigger section the pellet capture with blue dots on pellet north and south pole did show that pellet is spinning fast (5625rpm). Since an animation tells more than 1000 words, tool mak.210.6.sh creates a 6000fps animation for that 6000eps frame, this time with a very fast camera panning. The animation shows the spinnining with moving blue dot clearly; played at 6fps, 1000× slower than real:
Image
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://gitlab.freedesktop.org/HermannSW/gst-template
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

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

Re: Raspberry v1 camera global (external) shutter videos

Sat Sep 07, 2019 9:10 pm

I wanted to see pellet multiple exposures with two speeds in a frame. Pellet needs to collide with something, in order to remove energy and speed. I used a long slightly slated lath for that. I determined where the pellet would need to hit the lath to be in middle of horizontal camera view and marked it with a cross:
Image


I run one monitor for the Pi HDMI camera preview, and a 2nd above that for laptop command shells with ssh sessions into the Pi. I could have turned off the top monitor (1.5m away from scene), but then it would be too dark to target the airsoft pellet shot at the cross. I did run this command to capture 4000eps video with raspivid_ges in 2nd ssh session:

Code: Select all

$ sudo killall pigpiod; while true; do sudo ./audio_shots 20 9 4000 4010; done
I created a slow (0.5fps) playing 2MP animated .gif from the 4 frames with pellet exposures:
  1. frame hit near cross
  2. frame hit not near cross
  3. frame hit near cross agian
  4. frame hit near cross again, different shooting angle
The pellet from 3rd shot seems to have hit the camera, because in 4th frame the FoV is different, a small area above black cardboard can be seen.

In 1st, 3rd and 4th frame you can see that the distance between pellet exposures is bigger left of hitting the lath than right of hitting the lath:
Image
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://gitlab.freedesktop.org/HermannSW/gst-template
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

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

Re: Raspberry v1 camera global (external) shutter videos

Sun Sep 08, 2019 4:39 pm

Combining spin and two speeds investigation, I did only put one blue dot onto three pellets. I filled the magazine with 2 normal pellets, then the three pellets with a single blue dot, and finally a normal pellet. After starting raspivid_ges in one console, I started this command in another console:

Code: Select all

$ sudo killall pigpiod; while true; do sudo ./audio_shots 20 18 2500 2510; done
I reduced frequency to 2500Hz and doubled exposure to 18µs (OK for "slowly moving" 36m/s pellet). In shooting position, I removed magzine first and did two empty shots, in order to retrieve two candidates for empty.pnm. Then I inserted magazine, aimed at the cross on lath, fired and immediately looked onto the HDMI monitor 1.5m distant. Because raspivid_ges recording is done with 1fps by default, I was able to verify that the first shot was good on HDMI monitor directly. Then I did three more shots the same way with the pellets with 1 single blue dot. Before shooting I had moved the camera view up a little. The bright area above black cardboard does not hurt, and the lath part with cross where the pellet hits was moved out of camera view. This resulted in frame where all pellet exposures happened against black background. On side left of the cross the blue dot shows "slow" rotation as seen before. Interesting is the part after hitting the lath, a completely different rotation of the blue dot:
Image


To see the new kind of spin better, I did another very fast camera panning animation. Here you can see the different kind of pellet spin wrt blue dot:
Image


P.S:
As can be seen in the animation, this time a rotation of the blue dot is complete in roughly 5 frames. With capturing frequency of 2500Hz that is 500rps or 30000rpm rotation speed.

P.P.S:
The spin is a normal rotation, around line through center of circle described by blue dots and center of the pellet.
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://gitlab.freedesktop.org/HermannSW/gst-template
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

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

Re: Raspberry v1 camera global (external) shutter videos

Mon Sep 09, 2019 4:32 pm

Raspberry v1 camera (clone) can do global shutter capturing at DAYLIGHT!
No "external" shutter needed, but better to use external shutter for better frame quality.

I have seen it before with another camera.
ov2640 sensor was able to do global shutter capturing of mini drone propeller at daylight:
Image
But I thought that was because of some kind of overlap of two images.
I realized for ov2640 sensor that daylight was an option by just removing the cardboard box used as external shutter:
https://www.esp32.com/viewtopic.php?f=1 ... =20#p46226


Today I did the same for Raspberry v1 camera, I did similar global shutter capturings as on the weekend of airsoft pistol pellet colliding with a lath. But this time I intentionally did NOT close the window shutter. To give you an idea, this is view out of window, cloudy, no sun, but daylight (photo taken with smartphone camera):
Image


So again, after adjusting camera FoV to the scene, I started in one Pi console window "raspivid_ges" comand, and this command (from weekend) in a 2nd console:

Code: Select all

sudo killall pigpiod; while true; do sudo ./audio_shots 20 18 2500 2510; done

I was totally surprised that I got this result. Yes, a little bit pale, especially the pellet exposure in front of black cardboard:
Image


So I moved the 5000lm much closer to the scene, you can see it in left bottom. Now the pellet exposures before black cardboard look nearly as good as those taken on weekend in dark room. What you can see in addition is, that the pellet just reflected from lath cannot be seen at all, because lath is too bright. What you can see as well is that the wooden side of chest of drawers shines through leftmost pellet exposure:
Image


Next I came back to my other favorite object for capturing with global exposure mode, a fast rotating mini drone propeller. I did cut a circular disk out of cardboard, did cut a small whole into the center, and then paint one side with black, two times. I used Black 3.0 which absorbs 98% of light, but any other dark black will probably do as well. Then I removed blade from mini drone propeller, did put minimal amount of superglue on the motor around motor shaft (avoiding superglue to reach motor shaft), and did put circular disk over motor shaft. Finally I did put the blade onto motor shaft again. On the left you can see the circular black disk glued onto the motor, and on the right you can see v1 camera as well as 5000lm led nearby:
Image


The first capture I did was with running "raspivid_ges" with default settings. But as you can see framerate 1fps is just too long exposure, too bright image:
Image


I used that trick before in this thread, since capturing 2MP mode 1, framerate 30fps is the better choice. I did capture with this command in one console:

Code: Select all

./raspivid_ges -md 1 -p 10,10,960,540 -fps 30 -awb flash -o tst.h264 -t 0
And this command in the other console, executed a few times for being able to select best frame:

Code: Select all

./shots 5 9 116

This frame is the result, sharp blade exposures caught in 5 locations, daylight scene around circular disk, colors! From 1st to 5th blade exposure time passed is 4×(9µs+116µs)=500µs, and the covered part of black circular disk is roughly 1/3rd. The rotational speed of blade is therefore 2000/3=666.66rps or 40000rpm! Blade diameter is 34mm, so rotational speed at blade tip is 0.034×π×40000/60=71.20m/s or 256.32km/h:
Image
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://gitlab.freedesktop.org/HermannSW/gst-template
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

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

Re: Raspberry v1 camera global (external) shutter videos

Tue Sep 10, 2019 4:10 pm

Today's posting is on first 20000eps frame captured (exposures per second). The frame with most exposures per second sofar was 9000eps frame of airgun pellet. Because pellet length is 8mm, and distance between pellet exposure points is 10.77mm, flash PWM frequency cannot be increased much without getting pellet overlays.

I used the mini drone propeller with black cardboard circular disk behind propeller from yesterday again. But in addition I painted the blade black as well, besides just the tip of one of the blades. That way only the small area at blade tip seems to move, as you can see in left image. In right image you can see the structure (I used Black 3.0 again, absorbing 98% of light):
Image

Command in 1st console records 2MP video at 30fps framerate:

Code: Select all

$ ./raspivid_ges -md 1 -p 10,10,960,540 -fps 30 -awb flash -o tst.h264 -t 0
This command is executed in second console:

Code: Select all

$ ./shots 34 9 41
I tested with lower number of flashes first and then increased until N=34 did fill circle.
This is a 1000000/(9+41)=20000eps frame.
Rotational speed is 1000000/(33.5*50)=597rps or 35820rpm (33.5 because first and last exposure in left bottom of circular disk are a bit too close together, so 34 is too big).
With 34mm blade diameter, speed of the visible dot is 0.034×π×597=63.8m/s or 230km/h:
Image
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://gitlab.freedesktop.org/HermannSW/gst-template
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

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

Re: Raspberry v1 camera global (external) shutter videos

Sun Sep 15, 2019 8:08 pm

This posting is on how 20000fps videos got created based on the black propeller on black circular disk cardboard setup. I did update github repo README.md with all the details:
https://github.com/Hermann-SW/Raspberry ... al_shutter

First I painted another (this time white) propeller black, with a narrower marker:
Image

This was new 20000eps frame that got created:
Image

Next empty frame was needed, created with gimp's heal selection tool from full frame. For the why see here:
https://github.com/Hermann-SW/Raspberry ... -selection
Image

In order to not have to determine the 43 marker coordinates tool circle.c was created. Since frame markers are not a perfect circle due to perspective, 4 circle commands were needed to cover all white narrow markers:
https://github.com/Hermann-SW/Raspberry ... ircle-tool
Image

Finally shell script 20000eps.43.7.43.a.sh generated the 20000fps video, played at 20fps, 1000× slower than real:
Image

With new techniques it was easy to create 20000fps video for frame from previous posting as well:
Image
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://gitlab.freedesktop.org/HermannSW/gst-template
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

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

Re: Raspberry v1 camera global (external) shutter videos

Tue Oct 01, 2019 6:47 pm

In previous postings of this thread I did show many global (external) shutter captures of airsoft pistol pellets flying with 36m/s. I did not have a good pellet catcher for the 6mm diameter airsoft pellets (I do have a good catcher for airgun pellets, a cardboard box filled with 10 complete, folded daily newspapers). That is the reason you can find these yellow pellets everywhere in my room, where I have not picked them up.

Today I found a perfect pellet catcher for airsoft pellets, a fluffy cushion!
I did shoot 7 pellets from distance 20cm into cushion, so they did hit with rougyly 36m/s as well.
None of the pellets did leave cushion, all stayed inside.
Three of the 7 yellow pellets shot are easy to spot (for me), getting all back is done by touching with hand:
Image
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://gitlab.freedesktop.org/HermannSW/gst-template
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

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

Re: Raspberry v1 camera global (external) shutter videos

Sat Oct 05, 2019 8:45 pm

In thread "Airsoft pistol pellets" I made good progress on capturing sphere bought and non-sphere 3D printed pellets.
Latest was shooting 3 pellets together and get clear double exposure of the three pellets in flight:
https://www.raspberrypi.org/forums/view ... 7#p1547107

Until now most objects captured with global external shutter technique were more or less far away from the camera (lens), and therefore did only occupy a small area of 2MP frame.

Today I wanted to capture a single yellow 6mm diameter sphere pellet inflight and have it take a big area of the 2MP frame. I replaced the v1 camera used sofar with one where I had added an M12 lens mount and a M12 lens. That camera allows to change the focus easily by turning lens in or out. This is a clear and big capture of 6mm pellet, measured horizontal diameter is 736 pixels. You can see the 2MP frame sharp by right clicking, viewing in another bowser tab and zooming in. On the left you see the setup that helped to take the frame:
Image


I placed the 5000lm led diagonally below the camera lens in order to get maximal lux per lumen hitting the flying pellet:
Image


I had to do many shots and see they were too near or far way from the lens to be sharp. This frame is not ideal (it misses the bottom part of the exposures, they did show up on the frame before), and it is not as sharp as the previous image of the pellet. But the diameter of left pellet is the same as for the previous image, so it should be the same distance the previous image pellet got captured. There are less details on the pellet than in previous image. On the other hand there is less blur on left and right than I would have expected. Image was taken with 9µs flashes at 5000Hz ("./pwm_ges 5000 45000 3"). The 6mm diameter pellet flies with 812/736*6*5000/1000=33m/s, that is 0.033mm per 1µs. So in 9µs it should fly 0.3mm, and that is 736/6*0.3=36.8 pixels. I need to do shots with less than 9µs flash duration to see whether pellet becomes sharper on borders and perhaps overall:
Image
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://gitlab.freedesktop.org/HermannSW/gst-template
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

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

Re: Raspberry v1 camera global (external) shutter videos

Wed Oct 09, 2019 11:51 am

3 postings before I did describe how to create 20000fps slowmo from a 20000eps (exposures per second) multiple exposure frame.

It is time to bring this to the next level -- not 40000 or 50000fps, but up a digit to 100,000fps.
Since weeks I am working on getting faster and faster edge speeds for disks mounted on a fast rotating outrunner motor:
https://forum.arduino.cc/index.php?topic=636736.0
I get reliable/recreatable disk edge speed of 154.5m/s with 12V/8.87A on the KV2700 outrunner motor for 88mm diameter cardboard disk. That is 559rps (rotations per second). Yesterday even new edge speed record of 165.9m/s or 597km/h was achieved with 24.2V/12.0A:
https://forum.arduino.cc/index.php?topi ... msg4330424
That record was done with 36036rpm or 600 rotations per second.

If I want the markers as 3 postings before being 2mm apart, then a single disk rotation can take 138 markers:
For 100,000eps therefore 724 rps are needed:

Code: Select all

$ echo "pi=4*a(1); scale=2; 0.088*pi/0.002" | bc -ql
138.23
$ echo "pi=4*a(1); scale=2; 100000/(0.088*pi/0.002)" | bc -ql
723.43
$ 
Given the fact that I saw 600rps already yesterday with 24.2V/12.0A, and that I will receive a 2nd 12V/240W transformer tomorrow for in series 24V/20A experiments, 724rps seem likely to be achievable (as long as the 88mm cardboard disk can stand the forces, 123mm and 100mm diameter cardboard disks got teared to tatters -- I learned on Arduino forum that "cardboard" can be named as "advanced lightweight biopolymer aligned-fibre composite material").

The rotating disk sits just below top plexiglass cover of motor test station (there is only 5mm space between outrunner motor bullet top and plexiglass). Aluminum U-profile superglued under plexiglass avoids plexiglass sag (not my idea, a friend told me to do so). Next steps after motor will have gone above 724rps with 88-disk would be to place v1 camera global external shutter capturing setup on top of plexiglass with 1-3 5000lm leds and try for 6 digit fps framerate capturing:
Image
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://gitlab.freedesktop.org/HermannSW/gst-template
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

Return to “Camera board”