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

Cheap local high framerate gadget

Thu Jan 04, 2018 9:24 pm

With this tweet
https://twitter.com/HermannSW/status/946893932402790400

referencing a youtube video showing all kinds of classic mouse trap triggerings (with 7500fps high speed camera for 120,000$) I learned that trigger-closed timeframe is 1/90th second only!

I ordered a pair of mouse traps for 4$ on amazon and received them today.
Yes, for raspivid this gadget would not be interesting, on one frame you see the trap closed, on the next frame all would be complete.

But for raspiraw based high speed modes (with 5$ Raspberry v1 camera)
https://github.com/Hermann-SW/raspiraw

this gadget is interesting.
I did not take that fastest mode, but 640x240_s stretched mode (every other line gets captured for top half of VGA format, and lines are doubled in post processing) is a good compromise between area (1/2 fov) while still giving 360fps!
Since I have two mouse traps, and I saw in the 7500fps videos that mouse traps fly themselves after triggering, I fixated one mouse trap with two skrews on workbench for (mouse trap) local high framerate experiments.

Below is a video (played at 25fps, 14.4 times slower than real) where trap gets triggered by a falling small Lego piece.
  • first the piece falls slowly (2.77ms between frames)
  • then it triggers
  • 4 frames later the trap is closed on front side
  • 1 fame later trap is closed on back side as well, and Lego piece gets hit and pushed to right side
  • 3 frames later Lego piece hits vertical part of trigger and gets redirected to left and upwards
  • finally lego piece flies slowly outside view, rotating
You can single step fore/back ('.'/',') youtube video after stopping it first for seeing all the details:
https://www.youtube.com/watch?v=0XNsXvb ... e=youtu.be

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

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

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

Re: Cheap local high framerate gadget

Fri Jan 05, 2018 9:11 am

I will not flood you with mouse trap videos now – there are better youtube videos with much higher framerate cameras (much more expensive).

I did capture below mouse trap chain reaction to show why skrewing mouse trap to workbench was a good idea. You can see 2nd mouse trap flying caused by spring energy. Nice is to see how 2nd mouse trap trajectory is enforced by caught trigger of 1st mouse trap.

This time I did a 640x128 capture (all 128 lines, 640 colums) at 350fps. Video is played at 25fps, 14 times slower than real. You can single step fore/back ('.'/',') youtube video after stopping it first for seeing all the details:
https://www.youtube.com/watch?v=gnrzH1n ... e=youtu.be

Image


P.S:
The 640x128 video was taken with v1 camera at 350fps. You can take 640x128 video at 667fps with v2 camera:
viewtopic.php?f=43&t=212518#p1311289
Last edited by HermannSW on Tue May 15, 2018 2:00 pm, edited 2 times in total.
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

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

Re: Cheap local high framerate gadget

Fri Jan 12, 2018 8:51 pm

In case snap shut is slowed down (here by fidget spinner) you can take lower frame rate videos with bigger resolution (here 640x480_s at 180fps):
https://www.youtube.com/watch?v=Cz0M81a ... e=youtu.be
Image
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

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

Re: Cheap local high framerate gadget

Tue Jan 30, 2018 8:59 pm

I took 640x128_s video of just the closing of classic mouse trap at 665fps:
https://www.youtube.com/watch?v=khFUlkh ... e=youtu.be

With raspiraw master branch after @6by9 did accept my branch's high framerate work:
viewtopic.php?f=43&t=109137&p=1266325#p1266319

Since mouse trap closing takes 1/90 second, the video has 7 frames until closing complete (if the Lego piece would not have interrupted that). This is (part of) frame before triggering and then the 7 following frames:
Image

As can be seen in videos of previous postings one of the screws did create a cut in mouse trap wooden plate. In the video you can see one half of mouse trap plate move up for 3 frames and then down again. After that a long wooden part broke away from the wooden plate. I added two screws to make plate firmly mounted again. You can see the broken wood part in front of mouse trap:
Image


P.S:
I did create the video with "tools/640x128_s":

Code: Select all

$ 640x128_s 2000
removing /dev/shm/out.*.raw
capturing frames for 2000ms with 659fps requested
1325 frames were captured at 665fps
frame delta time[us] distribution
      1 
    338 1502
    982 1503
      2 3005
      2 3006
after skip frame indices (middle column)
...

Only 4 frame skips in 1325 frames:

Code: Select all

...
after skip frame indices (middle column)
3006,2,1808972444
3006,418,1809599088
3005,946,1810394039
3005,1258,1810864398
$

After converting some single frames and viewing them I found the range of interest in video (frames 580-679, no frame skip in that range) and created t.ogg (which I uploaded to youtube) this way (25 is target framerate, the youtube default framerate -- "d" asks tool to double lines vertically to get 640x128 frames, only 64 lines (every other line) were captured in order to achieve 665fps). The whole conversion and generation of t.ogg and t.anim.gif took less than 1.5 minutes!

Code: Select all

$ time ( raw2ogg2anim t 580 679 25 d )
removing old auxiliary files
copying /dev/shm/out.????.raw files
679     
dcraw each .raw file (to .ppm)
out.0679.raw     
.ppm -> .ppm.d
out.0679.ppm     
.ppm.d -> .ppm.d.png
out.0679.ppm.d     
now creating t.ogg
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Got EOS from element "pipeline0".
Execution ended after 0:00:23.289449319
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
now creating t.anim.gif
[theora @ 0x12247a0] 7 bits left in packet 82
[ogg @ 0x1223570] Broken file, keyframe not correctly marked.
[theora @ 0x12c89b0] 7 bits left in packet 82
[ogg @ 0x1223570] Broken file, keyframe not correctly marked.
[theora @ 0x749830] 7 bits left in packet 82
[ogg @ 0x7486b0] Broken file, keyframe not correctly marked.
[theora @ 0x7ec090] 7 bits left in packet 82
[ogg @ 0x7486b0] Broken file, keyframe not correctly marked.
done

real	1m24.045s
user	1m19.080s
sys	0m3.180s
$
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

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

Re: Cheap local high framerate gadget

Fri Feb 23, 2018 9:54 am

Recently I was surprised that a snapping finger speed is 32km/h:
viewtopic.php?f=43&t=206047&p=1276501#p1276501

Now I did the math on how fast the mousetrap closing 4cm radius half circle speed is for the 1/90th second.
And it is (slightly) faster, 11.3m/s or 40.7km/h:

Code: Select all

$ echo "pi=4*a(1); d=2*0.04; (d*pi/2)/(1/90)" | bc -ql
11.30973355292325565883
$ echo "pi=4*a(1); d=2*0.04; (d*pi/2)/(1/90)*3.6" | bc -ql
40.71504079052372037178
$ 
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

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

Re: Cheap local high framerate gadget

Fri Feb 23, 2018 7:33 pm

I wanted to know whether there are other high framerate gadgets that can exceed classic mouse trap speed.

Of course weapons can, but I don't posses any. But I borrowed a "Strongarm Nerf Elite", a revolver Nerf blaster toy gun, from a colleague.

Both videos shown below were done with same "640x128_s" tool, capturing video at 665fps. But in the first video the bullet flew much slower than in second. Both animated .gifs shown contain exactly 100 frames from the complete videos taken, corresponding to 100/665=0.15s real time each. Animated .gifs play at 25fps, 26.6 times slower than real.

For the first video I recorded two seconds, and made it in time to shoot. Video does not capture the revolver reload after firing. This is again one of those 665fps videos where the quickly moving part (like my finger in a previous video) looks transparent, although it is not:
Image

In second video the dart has much higher speed, but video is longer and you can see the complete revolver rotation for next shot:
Image

Now lets compute the speeds. In both videos I measured the distance from dart head before shot to the point where it reached the dark vertical pole as 14cm. In first video it took 28 frames to travel that distance, in 2nd video only 5. In first video that is 3.3m/s or 12km/h, in second video it is 18.6m/s or 67km/h!

Code: Select all

0.14/(28/665)
3.32500000000000000016
0.14/(28/665)*3.6
11.97000000000000000057
0.14/(5/665)
18.62000000000000001862
0.14/(5/665)*3.6
67.03200000000000006703

In second video I captured 5303 frames in 8s, with 18 frame skips. The frames of measuring speed are 2381-2386, and there is no frame skip in that range:

Code: Select all

...
after skip frame indices (middle column)
3006,486,1595682383
3005,1021,1596487874
3005,1490,1597194182
3006,2026,1598001177
3005,2091,1598100360
3007,2626,1598905853
3010,3095,1599612164
...

This is frame from 1st video where dart nearly completely has left the Nerf:
Image


P.S:
Just found browser tab on how I did initial scene setup for v1 NoIR camera with lense:
Image
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

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

Re: Cheap local high framerate gadget

Sun Apr 08, 2018 10:05 am

Recently I found another really cheap high framerate gadget, a 5ct spinning coin passing in front of camera:
viewtopic.php?f=43&t=206047&p=1293730#p1293730


Sparks on the other hand are no high framerate gadget, although they really look nice:
viewtopic.php?f=43&t=207537&sid=7d34cb0 ... c#p1287358

The spark finally achieves 1/10 to 1/3 of speed of light, but initially the dart leader is done slowly comared to that with "only" 300km/s. But even that slow speed means it takes only 33ns to pass 1cm, which means a spark shows up in one (or two because of rolling shutter effect) frames only:
https://de.wikipedia.org/wiki/Blitz#Ent ... es_Donners


Yesterday I used classical mouse trap, piezo (spark) igniter and M12 lens mount and lens with v2 camera for a combined experiment. You can see two holes with a small cable allowing to trigger mouse trap without any falling parts (I used falling Lego bricks before):
Image


The circular trigger did not come out enough through the hole I drilled into mouse trap plate, so that I used my Dremmel to cut out an area allowing the square igniter part to move into the mouse trap wood plate enough to trigger:
Image


I took a 180fps raspivid video, with 1ms shutter time, and scene was lighted with 1000lm (bright) Ikea light.

Code: Select all

$ raspivid -md 7 -w 640 -h 480 -t 3000 -fps 180 -ss 1000 -o mt.3000.180.1000.h264

This is frame just after triggering mouse trap was successful:
Image


Next frame was a surprise to me. Although the moving parts (mouse trap bar moving quickly right and metal pin moving quickly left) show quite some rolling shutter effect due to high speed of movement (this is my first rolling shutter photo with effect into different directions), the fame would not have indicated to me that the piezo trigger was already triggered. But the spark is clear indication that exactly that happened:
Image


In next frame the piezo trigger kicked the mouse trap bar away into opposite direction (a bit):
Image


In next frame mouse trap bar landed on piezo trigger:
Image


More experiments to come, with timestamp overlay, shorter shutter times, 5000lm light with power line frequency issue, ...
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

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

Re: Cheap local high framerate gadget

Sun Apr 08, 2018 8:03 pm

I tried with different shutter times, and 0.25ms gave good videos, and the moving mouse trap bar was not blurred anymore. So I took ten videos.

This is from 1st of these videos, and I realized that no spark showed up. Seems that yesterday's last hit by mouse trap bar destroyed it. Will buy more 1$ lighters tomorrow and extract the piezo igniters:
Image


My theory was that doing many videos the trigger times would vary over the 5.6ms range it takes between two frames to capture different phases of the mouse trap bar closing. This is another phase from a different video:
Image


This frame is from a video where I triggered mouse trap nearly instantaneously after video start. The automatic white balancing was not complete at that time and therefore this shows too bright. Anyway it was the frame where the moving bar was captured at the rightmost position among the 8 videos taken at that time:
Image


With the tenth video I captured an even more right position, and the rolling shutter effect shows extremely here as well:
Image
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

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

Re: Cheap local high framerate gadget

Sun Apr 08, 2018 8:38 pm

I found a way to reduce the rolling shutter effect a bit -- just turn the camera by 90°.

Below you can see frames from different videos with 0.25ms shutter time sorted by position of mouse trap bar:
Image


Image


Image


Image


Image


Image


Image


One of the videos, rotated by 90° and with original time overlays uploaded to youtube, played 60 times slowed down:
https://youtu.be/p8VBorAxwSo
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

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

Re: Cheap local high framerate gadget

Mon Apr 09, 2018 6:12 pm

I switched to v1 camera for really high framerate video. I did a 665fps video with raspiraw 640x128_s tool. In order to move the mouse trap into the top 128 rows (vertically as in last video in order to reduce rolling shutter effect) I moved the camera further back, and exchanged the 65° lens by a 130° lens.This is first taspiraw video where I used "--ss 250" option to set shutter time to 0.25ms. Scene is again lighted by 1000lm lamp.

Below you can see frames 581 (before trigger) until 588 (mouse trap closed). Here are the recorded timestamps and deltas for those:

Code: Select all

1503,581,17006249184
1500,582,17006250684
1502,583,17006252186
1503,584,17006253689
1507,585,17006255196
1499,586,17006256695
1503,587,17006258198
1502,588,17006259700

1503μs is the mean frame delta time of the recorded 1962 frames for 3s, corresponding to 665.3fps.
You can right click the frame collection image to see full width of 640 pixel.
The mouse bar can be seen 5 times in lower half and the final 2 times in upper half.
250ms shutter time is OK, will try to get sharper mouse trap bar images with even shorted shutter time.
Image
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

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

Re: Cheap local high framerate gadget

Mon Apr 09, 2018 7:02 pm

The frames were NOT taken with 0.25ms shutter time, I have problems to get shutter time working with raspiraw.
So shutter time for the frames shown is frame delta time which is 1.5ms.
This explains the slightly blurry frames.
I asked in raspiraw thread for help:
viewtopic.php?f=43&t=109137&p=1299788#p1299788
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

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

Re: Cheap local high framerate gadget

Tue Apr 10, 2018 8:03 am

"665fps mouse trap closing played at 1fps"
https://www.youtube.com/watch?v=5TuBjqj ... e=youtu.be
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

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

Re: Cheap local high framerate gadget

Wed Apr 11, 2018 5:34 pm

Shutter time option is really needed for raspivid, 1.5ms is too blurry for closing mouse trap.
Youtube video played a 1fps gives a better feeling for where the mouse bar is compared to single frame:
https://www.youtube.com/watch?v=jMjWJ89 ... e=youtu.be

The spark shows that piezo trigger got already hit, but the mouse bar cannot be seen clearly without 0.25ms shutter time:
Image

In none of the frames the piezo trigger shows hit -- it nearly has to disappear in wood before spark gets emitted.

Anyway doing horizontal video does not suffer that much from rolling shutter effect as the extrem 180fps frame shown before. In that frame the mouse bar spans roughly half of the 480 rows. That means rolling shutter effect time from top to middle of frame is 1000/180*(1/2)=2.7ms.

This posting's video was taken with 640x128_s tool, that only captures 64 rows (every other for 640x128 area). So here the rolling shutter effect goes from top to roughly 2/3 of the frame, and video is taken at 665fps. That makes 1000/665*(2/3)=1ms, much less than the 2.7ms before.
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

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

Re: Cheap local high framerate gadget

Tue May 01, 2018 10:10 pm

v2 camera can do 1000fps videos, 1/90th second mouse trap closing takes 11 frames with that.
viewtopic.php?f=43&t=212518#p1310442

First time image with piezo igniter pushed down:
Image
Frame before:
Image

With 640x75 tool (instead of 640x150_s tool) crystal clear frames, piezo igniter hit as well, spark between cables in front:
Image
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

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

Re: Cheap local high framerate gadget

Sun Jul 22, 2018 7:00 pm

I have 8 or 10 classical mouse traps -- only as high framerate gadgets. All looked the same sofar.
Yesterday I saw a plastic mouse trap looking different and bought it (for less than 1$).
Today I did a raspiraw 640x240_B tool v1 camera 180fps video from trap closing.
It turned out that higher framerate is not needed, it takes 6 frames for closing at 180fps, that is 1/30th second.
This is much slower than 1/100th second for complete closing of classical mouse trap.
Although that has to traverse 180° compared to only 45° of plastic mouse trap.
Here is the animated .gif generated with raw2ogg2anim played at 1fps (slowed down 180 times):
Image


The video looks not that nice because I used "only" a 1000lm lamp.

This is the plastic mouse trap:
Image
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

Return to “Camera board”