Sync Multi Cameras - 3d Modeling - page 6 - General Discussion and Assistance - CHDK Forum
supplierdeeply

Sync Multi Cameras - 3d Modeling

  • 63 Replies
  • 15185 Views
Re: Sync Multi Cameras - 3d Modeling
« Reply #50 on: 18 / November / 2014, 12:06:17 »
Advertisements
Thanks for that Andy - hadn't seen Mr Perry-Smyth's most recent work. The last time I heard he had 120 DSLR's in his full-body rig http://www.agisoft.com/community/showcase/ ...he really is an inspiration for the 3D point-cloud group.

Edit: the "info" button on the Guardian picture states:
"Making the sculpture begins with a scan of the model, with over 200 cameras shooting instantaneously"  8)
« Last Edit: 18 / November / 2014, 12:46:09 by andrew.stephens.754365 »

Re: Sync Multi Cameras - 3d Modeling
« Reply #51 on: 18 / November / 2014, 14:05:33 »
(a) because no trap is encountered it is the variability between cameras subsequently getting focus / exposure that causes the loss of "synch enabled" levels of synch between them ?
Yes
Quote
(b) with a missing  "wait_untill_remote_button_released" hook should both OnePush with either:
Synch enabled
or
Synch disabled
act in exactly the same fashion ?
Yes
Quote
(c) if the cameras had native Canon Manual Mode / Manual focus, and were in those modes, should the focus/exposure "period" of all cameras be approximately zero and thereby effectively re-instating "synch enabled" levels of synch (even in absence of the hook) ?
No.
Quote
or is there other "stuff", e.g in "shooting.c", i'm not thinking about yet ?
Yes there is other stuff.  But it's not in shooting.c - it's just the normal overhead in the camera shooting sequence.

Quote
I'm currently interested to identify a work around to the apparent lack of  "OnePush/Synch enabled" on the SX150IS first reported here http://chdk.setepontos.com/index.php?topic=11667.msg118374#msg118374
Fmi, a further description: http://chdk.setepontos.com/index.php?topic=7127.msg112154#msg112154
When I get a minute, I'll take another look at that.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Sync Multi Cameras - 3d Modeling
« Reply #52 on: 18 / November / 2014, 16:11:21 »
or is there other "stuff", e.g in "shooting.c", i'm not thinking about yet ?
Yes there is other stuff.  But it's not in shooting.c - it's just the normal overhead in the camera shooting sequence

Is this "normal overhead in the camera shooting sequence" exactly the same as that which, in Manual Mode / Manual Focus, would inhibit precision synch via  (stripping away shoot_half / ptp / timeout considerations i.e. just monitoring via get_usb_power then click("shoot_full_only")) your script here: http://chdk.setepontos.com/index.php?topic=10837.msg106581#msg106581 ?

If it is, it seems to me that with the imagined simplified script running, the cameras would be in a state similar to DSLR's in Manual Mode / Manual Focus, just waiting for the remote shutter release to trigger ?

but the variability referred to here:
The script I posted above will not do "precision" sync as written. Enabling the USB remote sync menu option makes no difference in this case.   Variations between cameras of as much as 100 mSec are quite possible.
seems large cf that of some other DSLR figures? e.g EOS400D, e.g. http://www.cfd.tu-berlin.de/~panek/foto/eos_remote/eos_remote.html with mirror lockup has variability approx 10ms, without = 50ms.
PS: I'm really just trying to use this as an example to see how much of this I really (sort of) understand. For info, I think SX150IS has a mechanical shutter but not 100% sure and don't know if that may be significant w.r.t variability anyhow.

.....
Fmi:
Okay - it looks like the scripting shoot() command is treated exactly the same was as a real shutter button press  (i.e. the sync delay code does nothing).
.....

I'm currently interested to identify a work around to the apparent lack of  "OnePush/Synch enabled" on the SX150IS first reported here http://chdk.setepontos.com/index.php?topic=11667.msg118374#msg118374
When I get a minute, I'll take another look at that.

Thanks.

Re: Sync Multi Cameras - 3d Modeling
« Reply #53 on: 18 / November / 2014, 19:18:04 »
PS: I'm really just trying to use this as an example to see how much of this I really (sort of) understand. For info, I think SX150IS has a mechanical shutter but not 100% sure and don't know if that may be significant w.r.t variability anyhow.
Okay then, I will make one last try to explain this. Bear in mind as you read this that really good sync for 3D stuff requires less than 1 mSec difference between cameras.

When you use a CHDK USB remote with sync enabled to  take a shot,  the camera goes almost all the way through its shooting sequence - way past where it checks focus and exposure setting - until right before it releases the shutter. And then CHDK stops it there are holds, waiting for the USB voltage to go away.  If two or more cameras all wait at the same point, then they will all tend to release their shutters within 1 mSec of each other once the 5V is removed.   If they are not waiting at the same exact place when the trigger signal occurs, then even with focus and exposure locked, they will be off doing something else and will not releases their shutters within 100 mSec of each other (on average).

However, even that sync is not guaranteed as an interrupt could occur after the final sequence is released, causing one or more cameras to be delayed in releasing their shutter.  On many recent cameras, this occasional delay can be over 50 mSec and happens more often than not.  So some additional code (precision sync) is available on some cameras that attempts to work around any interrupt and give better sync. 

Give what I have just described, it's safe to say that cameras without sync enabled, even with focus and exposure locked, have no chance of being synced within 10 mSec (except by random chance) and will more likely see sync differences of more than 100 mSec based on my experience and testing.  Yes - locking focus and exposure helps. I get that.  But the little ARM processor in a Canon camera is a busy device in shooting mode.  If you tell it to randomly shoot (i.e. not sync'd) you will get a random response time.

Sorry,  you seem to want to keep quoting me and rephrasing my words to convince yourself that you will somehow get good sync without the sync (or precision sync) code working.  Go ahead then - try it.  Just because you read that DSLR's can lock their shutter and focus and get 10 mSec sync does meant that Canon P&S cameras can also do that.    Feel free to hookup an oscilloscope or other test instrument and test for yourself.  You asked the question and I answered it as best I can.

tl;dr : you will not get two Canon P&S cameras to consistently sync much closer than 100 mSec of you do not have CHDK's sync or precision sync mode enabled. 

EOM
« Last Edit: 18 / November / 2014, 19:58:38 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16


Re: Sync Multi Cameras - 3d Modeling
« Reply #54 on: 18 / November / 2014, 21:14:10 »
I'm currently interested to identify a work around to the apparent lack of  "OnePush/Synch enabled" on the SX150IS first reported here http://chdk.setepontos.com/index.php?topic=11667.msg118374#msg118374
When I get a minute, I'll take another look at that.
Thanks.
I found the hook location in the sx150is capt_seq.c file. The part where it says
Code: [Select]
"               BL      wait_until_remote_button_is_released\n" // Added (not tested) -------->was there in the first ALPHA commit from porter sgtrum and apparently nobody has looked at it since then.

So given that you've now shown that this doesn't work, it will take a couple of hours to find a better place based on looking at other ports (that hopefully do work) and trying to find similar code to what the sx150 has.

I assume you actually have this camera and can test an update file?

Ported :   A1200    SD940   G10    Powershot N    G16

Re: Sync Multi Cameras - 3d Modeling
« Reply #55 on: 19 / November / 2014, 08:53:40 »
Okay then, I will make one last try to explain this.
Of course the information I am now reading in this reply (and the further mention of SX150IS hook location identification in capt_seq.c) is appreciated but not at any price. I'd rather you had replied without mentioning that and then not further replied at all if you find re-explanation tedious. I am not a child.

Bear in mind as you read this that really good sync for 3D stuff requires less than 1 mSec difference between cameras.
Thanks. I know that. I plan my solution, whether ptp trigger or usb remote with / without synch enabled, will be accomplished by flash (or multi-stage flash) in a black room. For all situations, other than what follows, both ptp synch and usb remote (synch not available) would probably be sufficient.
 
If usb remote with synch is made available I envisage the extra possibility of multi-stage flash capture as follows.
Two banks of cameras:
The first bank to capture 3D Geometry with "normal" flash capture.
The second bank to, as soon as possible thereafter but certainly within tens of mSec, capture 3D Texture in presence of noise pattern projection flash (see some ref e.g's & fmi: http://www.agisoft.com/forum/index.php?topic=1373.msg10198#msg10198 & http://www.agisoft.com/forum/index.php?topic=1806.msg10695#msg10695 & http://www.agisoft.com/forum/index.php?topic=1798.msg9542#msg9542 & http://www.agisoft.com/forum/index.php?topic=1542.msg8981#msg8981 )

When you use a CHDK USB remote with sync enabled to  take a shot,  the camera goes almost all the way through its shooting sequence - way past where it checks focus and exposure setting - until right before it releases the shutter. And then CHDK stops it there are holds, waiting for the USB voltage to go away.  If two or more cameras all wait at the same point, then they will all tend to release their shutters within 1 mSec of each other once the 5V is removed.   If they are not waiting at the same exact place when the trigger signal occurs, then even with focus and exposure locked, they will be off doing something else and will not releases their shutters within 100 mSec of each other (on average).
Thanks, however I already understood this to be the case

However, even that sync is not guaranteed as an interrupt could occur after the final sequence is released, causing one or more cameras to be delayed in releasing their shutter.  On many recent cameras, this occasional delay can be over 50 mSec and happens more often than not.  So some additional code (precision sync) is available on some cameras that attempts to work around any interrupt and give better sync. 
Thanks, however I already understood this to be the case

Sorry,  you seem to want to keep quoting me and rephrasing my words to convince yourself that you will somehow get good sync without the sync (or precision sync) code working. 
Are you confused ?
My post refered to comparing the shoot command in conjunction with monitoring for a fall on the usb line, in script ( I said: i.e. just monitoring via get_usb_power then click("shoot_full_only")) to DSLR remote shutter release synchronisation timings in the EOS400D link I posted. Your script disabled usb remote before shooting.

Go ahead then - try it.
I already knew I couldn't get precision synch with DSLR's - so there's no point in doing that.

Just because you read that DSLR's can lock their shutter and focus and get 10 mSec sync does meant that Canon P&S cameras can also do that.
I'll restate the same question, differently:
If the SX150IScamera is in (i) Manual Mode (ii) Manual Focus (iii) chdk usb remote disabled (iv) running a script to (a) do nothing when USB +5V is applied then (b) shoot when USB drops to 0V -  why should variability of SX150IS be up to 100mSec in compare to EOS100D 10ms ?

Feel free to hookup an oscilloscope or other test instrument and test for yourself.  You asked the question and I answered it as best I can.
It would be foolish of me to buy a scope to do the wrong test, even if I knew which buttons to press on it - I could buy some SX150IS with the money saved.

In summary,

I think it's usually better not to jump to conclusions and be patient with people - my son is currently re-sitting some maths exams. It's hard going but, hopefully, worth the effort  :)

Re: Sync Multi Cameras - 3d Modeling
« Reply #56 on: 19 / November / 2014, 08:55:36 »
I assume you actually have this camera and can test an update file?

Yes.

Thanks.



Edit: related to earlier conversation-

So my conclusion from all of this is as follows. 

If you pound away at get_usb_power() in a tight loop in Lua,  it's possible to add so much processor load that the underlying code in the kbd.c task does not actually monitor the USB power status every 10 mSec.   Different cameras seem to run scripts at different speeds so the magnitude of the error will change.
---
If the loop actually yields every iteration (I haven't traced through Andre's code to make sure) then there's really no chance that the Lua script is causing too much load.
---
I assume that get_usb_power() does not explicitly yield. 
« Last Edit: 20 / November / 2014, 11:34:23 by andrew.stephens.754365 »

Re: Sync Multi Cameras - 3d Modeling
« Reply #57 on: 20 / November / 2014, 21:37:17 »
Edit: related to earlier conversation-

So my conclusion from all of this is as follows. 

If you pound away at get_usb_power() in a tight loop in Lua,  it's possible to add so much processor load that the underlying code in the kbd.c task does not actually monitor the USB power status every 10 mSec.   Different cameras seem to run scripts at different speeds so the magnitude of the error will change.
---
If the loop actually yields every iteration (I haven't traced through Andre's code to make sure) then there's really no chance that the Lua script is causing too much load.
---
I assume that get_usb_power() does not explicitly yield. 
Taken somewhat out of context ( i.e. there turned out to be more to this story)

The resolution of all these questions & mysteries about accuracy of USB pulse width measurements turned out to be the difference between measuring in shooting mode vs measuring in playback mode.  I had done my detailed testing in playback mode and the jitter and variation in pulse width measurement proved to be minimal.   Once I finally realized that camera CPU loading goes through the roof in shooting mode,  it was clear that the CHDK hooked tasks do not reliably run at 10 mSec intervals in shooting mode - it is frequently much longer.  Which explained why the pulse width measurement accuracy on some cameras was so bad (in shooting mode).

And incidentally, it also explains why there is no hope of getting under 10 mSec sync without USB sync enabled, regardless of what the processors on Canon DSLR's are purported to do.


Ported :   A1200    SD940   G10    Powershot N    G16


Re: Sync Multi Cameras - 3d Modeling
« Reply #58 on: 21 / November / 2014, 02:24:02 »
Taken somewhat out of context ( i.e. there turned out to be more to this story)

Whose context? I was reading / cross referencing / making notes in my post as I went along in an effort to eventually, perhaps, answer my own question. Based on my earlier request, I had no idea if you would further respond.

The resolution of all these questions & mysteries about accuracy of USB pulse width measurements turned out to be the difference between measuring in shooting mode vs measuring in playback mode.  I had done my detailed testing in playback mode and the jitter and variation in pulse width measurement proved to be minimal.   Once I finally realized that camera CPU loading goes through the roof in shooting mode,  it was clear that the CHDK hooked tasks do not reliably run at 10 mSec intervals in shooting mode - it is frequently much longer.  Which explained why the pulse width measurement accuracy on some cameras was so bad (in shooting mode).

Interesting stuff. If this is on the same thread as my 3 links it saves me reading the rest of it.

And incidentally, it also explains why there is no hope of getting under 10 mSec sync without USB sync enabled, regardless of what the processors on Canon DSLR's are purported to do.

Taken together, I think your last two comments do adequately explain, to the level of understanding that I was initially looking for, why an SX15IS (DigicIV in M mode / M focus) with a script running looking at USB then shoot on USB transistion could have "shutter" variation of about 100ms compared to EOS400D (DigicII) of seemingly 10ms.

Thanks.

------
Edit:

For all situations, other than what follows, both ptp synch and usb remote (synch not available) would probably be sufficient.

Fmi: ptp synch also dependent on the hook:http://chdk.wikia.com/wiki/Script_Shooting_Hooks
"...A few ports may be missing wait_until_remote_button_is_released. On these ports, hook_shutter will not be reached."

I'm not sure what you are refering to when mentionning the 'shoot hooks', could you point me to some documentation?
http://chdk.wikia.com/wiki/Script_Shooting_Hooks

Basically a way to have a script start a shooting sequence and then halt it just before the actual shutter opens while it waits for some event ( like a PTP "complete the shoot" command).

I'm not sure what you are refering to when mentionning the 'shoot hooks', could you point me to some documentation?
See the link waterwingz posted. Not that just using the message system to trigger a shoot_full should be within a few tens of ms of physically clicking the shutter, shoot hooks would only be required if you need to do better than that.

The rsint command and multicam modules in chdkptp both have examples of using shoot hooks and the message system.

Using the CLI shoot command or sending shoot() is much slower, since it does the whole focus / preshoot process. If you start and connect a chdkptp process for each shot that adds further delay.

https://www.assembla.com/code/chdkptp/subversion/nodes/658/trunk/lua/multicam.lua

"shoot_hook_sync [ms]: as above, except using chdk 1.3 shoot hook"
« Last Edit: 21 / November / 2014, 11:07:40 by andrew.stephens.754365 »

Re: Sync Multi Cameras - 3d Modeling
« Reply #59 on: 07 / December / 2014, 06:44:10 »
(a) because no trap is encountered it is the variability between cameras subsequently getting focus / exposure that causes the loss of "synch enabled" levels of synch between them ?
Yes
Quote
(b) with a missing  "wait_untill_remote_button_released" hook should both OnePush with either:
Synch enabled
or
Synch disabled
act in exactly the same fashion ?
Yes

In my test it doesn't.

I received a 7 port usb (switchable power per port) hub yesterday. Test conditions (One & Two push) and results are included in attachment.

What could explain this?

Edit:
the attachment here has an error in the two-push sequence - the corrected version is attached here http://chdk.setepontos.com/index.php?topic=8810.msg118914#msg118914
« Last Edit: 07 / December / 2014, 10:52:35 by andrew.stephens.754365 »

 

Related Topics