Help setting a multicam 3D scanner - General Help and Assistance on using CHDK stable releases - CHDK Forum

Help setting a multicam 3D scanner

  • 13 Replies
  • 7533 Views
Help setting a multicam 3D scanner
« on: 22 / November / 2018, 18:26:10 »
Advertisements
It's been 5 years since i last got my photogrammetry 3D scanning rig working. I recently acquired a few more cameras to get the rig working again, but unfortunately the (very) little CHDK knowledge i managed to learn then has completely faded away. I'm a photographer with absolutely no programming skills, back in the day I had the invaluable help of the forums and specially waterwingz to get things working. I've just installed CHDK in two of the cameras (SX150is), and have hit a brick wall straight in the face... I canĀ“t remember anything!


Here's the situation: I'd like to be able to shoot the 20 cameras in relative sync (I don't mind a slight 50ms delay, i'm not scanning moving people/faces) and then download the files to my PC, serialized by camera number (CAM01, CAM02, etc...). Back in the day I had all cameras connected to one powered USB hub (I'll probably need two hubs this time around), and would switch the hub power on and off to trigger them. Thanks to the script waterwingz wrote for me (usbptp.lua), if there was no trigger for 10 secs, cameras would turn to transfer mode (is this PTP? can't even remember the terminology!), PC would see the cams and files would transfer to my HDD.


I remember i managed to set everything up so when the cameras were switched on, there was no fiddling to do... They already started in record mode with no key pressings and the script was waiting for the signal(ideal if they're hooked up on a rig). But right now I can't even manage to do this.


Here's the original thread dating from 2013.
https://chdk.setepontos.com/index.php?topic=10837.0


As I said, I'd like to rebuild that workflow from scratch now, since I lost the configurations and I'm completely unable to figure it out. I've heavily searched the forum for the last couple of days, but I'm having real trouble to find anything relevant, most threads are way over advanced. One of the few things I'd improve from the old workflow would be to have the ability to remotely (live-view) focus the cameras (if possible).


If you guys can think of more convenient ways to achieve this, I'll be more than happy to hear them out. But if you could at least help me out with the basic stuff I'll be really grateful. Thanks in advance! :)
« Last Edit: 27 / November / 2018, 17:41:44 by ikercito »

*

Offline reyalp

  • ******
  • 14080
Re: Help setting a multicam 3D scanner
« Reply #1 on: 26 / November / 2018, 16:25:05 »
Please don't use the report function for things that aren't spam, off topic, or otherwise in need of administrative attention.

There are only a few regulars on this forum, and we generally respond if we have something to add.

I haven't responded to this one up to now because I don't have a good answer. What you are trying to do is a complicated technical task, so there is no simple, non-technical answer. Several of us will be happy to answer questions about the specifics, but we can't just tell you what to do.

https://chdk.wikia.com/wiki/Multiple_Cameras_using_CHDK it may be a useful starting point.

Give your relatively modest sync requirement, I'd lean toward an all PTP approach using chdkptp multicam.lua for triggering and downloading, but I'm probably biased because I wrote it.

It is theoretically possible to mix live view (for a single camera at a time) and multicam, but it's definitely not straightforward and would require some hacking. You might find the resolution insufficient for focus checking anyway.
« Last Edit: 26 / November / 2018, 22:45:36 by reyalp »
Don't forget what the H stands for.

Re: Help setting a multicam 3D scanner
« Reply #2 on: 26 / November / 2018, 18:06:10 »
Hi reyalp!
First of all, sorry for reporting the topic, I realized it was in the wrong section and didn't know what to do.

Thanks for your answer, I had the system up and running years ago, it took some time to set it up and I had some invaluable help here in the forum. But as I said, I have no coding skills and all I learned in the past has been lost. I just wanted to get the ball rolling again, and given the time that has passed since, see if maybe there's a new approach to this task.

The easiest workflow I've found up to now would be something like this:
  • Each camera is connected to an individual power supply, mounted on the rig and connected through USB to a different number of USB hubs. OK
  • Hubs go to different USB ports on computer. Right now two or three 10-port hubs will be required. OK
  • Cameras are turned on manually. OK
  • Have CHDK set up so it starts in recording/shooting mode, and listening to a remote trigger through the USB port. Right now they're autoloading Usbptp.lua script by waterwingz (check code in the original topic linked on the first post). It should perform both tasks. OK
  • Have each camera set up so CHDK saves files with a distinct filename (CAM01-001.dng) OK and optionally set up to reset numbering between sessions. Maybe PTP?
  • Focus cameras by half pressing manually, check focus on display and have focus locked indefinitely so this step doesn't need to be repeated (we're assuming the subject won't move) Any better methods?
  • Optional: Measure exposure with handheld light meter, and set shooting parameters accordingly on cameras through PTP commands. This way exposure should be consistent on all cameras. Need help
  • Remotely shoot a first frame with color-chart in RAW mode to have a proper color calibration reference. I'm not sure whether to do this with PTP (need help) or by turning on and off the USB hubs. OK
  • Shoot the required frames with subject in position (same as above, don't know USB or PTP?)
  • Once shooting is finished leave USB power on until cameras enter PTP transfer mode. OK
  • Use PTP to upload files to separate folders in computer, sorted by camera number. Need Help
From what I've learned so far, that's the easiest dumb-proof method I could find. My biggest concern is having some method of locking focus reliably, I had some mishaps in the past with cameras that didn't lock properly and lost focus. Usbptp.lua is the core of the workflow right now, maybe it could be tweaked?

https://chdk.wikia.com/wiki/Multiple_Cameras_using_CHDK it may be a useful starting point. My original thread is referenced on that page, I've checked all the references :)

Give your relatively modest sync requirement, I'd lean toward an all PTP approach using chdkptp multicam.lua for triggering and downloading, but I'm probably biased because I wrote it. Sending commands frightens me quite a bit, will have to dig into it

It is theoretically possible to mix live view (for a single camera at a time) and multicam, but it's definitely not straightforward and would require some hacking. You might find the resolution insufficient for focus checking anyway. I think I'll forget about that option for now, maybe in the future...



If anyone wants to contribute with tips and some coding help, I'll be more than grateful. Thanks a lot for your time!

*

Offline reyalp

  • ******
  • 14080
Re: Help setting a multicam 3D scanner
« Reply #3 on: 27 / November / 2018, 00:18:40 »
Hi reyalp!
First of all, sorry for reporting the topic, I realized it was in the wrong section and didn't know what to do.
Oh, apologies. I somehow missed the message in the report, that's a totally fine reason to report. Topic moved.
Quote
Cameras are turned on manually.
FWIW, it is possible to make the cameras turn on when power is applied, by arranging for the the power button to be permanently held down or hard-wiring it. There are some quirks we can provide more details on if you decide to go that route.

Quote
Have each camera set up so CHDK saves files with a distinct filename (CAM01-001.dng) OK
I'm confused, you have this marked OK, but the following "Use PTP to upload files to separate folders in computer, sorted by camera number. Need Help" suggests otherwise?
chdkptp and multicam give you a bunch of options for renaming files in the download process. If you download with some other method, you could bulk rename after the fact as long as you get each cameras files in a different directory.

Quote
Focus cameras by half pressing manually, check focus on display and have focus locked indefinitely so this step doesn't need to be repeated (we're assuming the subject won't move)
Do you mean for a given session, or have the cameras always start up and focus at the same distance once you have it set?
In general, the ability lock and set focus depends on the camera. SX130 has native manual focus, so it should be possible to set focus to specific distance for one shooting session.
The MF setting may be lost in some cases, for example if the screen turns off, or the camera is switched to playback mode, or the lens retracts. The first two of these only apply to some models.

Quote
Measure exposure with handheld light meter, and set shooting parameters accordingly on cameras through PTP commands. This way exposure should be consistent on all cameras.
Using multicam.lua, it's easy to set the same parameters on all cameras. You could also get the exposure values from one of the cameras, rather than an external light meter.

Adding this to Usbptp.lua would require replicating a lot of the stuff that mutlicam does.

Quote
Remotely shoot a first frame with color-chart in RAW mode to have a proper color calibration reference. I'm not sure whether to do this with PTP  or by turning on and off the USB hubs.
How does this differ from the regular shots, you do one camera at a time?

Quote
Shoot the required frames with subject in position (same as above, don't know USB or PTP?
If you want to do things like setting exposure values, and don't need precision sync, I'd personally suggest sticking to PTP.
Don't forget what the H stands for.


Re: Help setting a multicam 3D scanner
« Reply #4 on: 27 / November / 2018, 05:44:13 »
Thx for your tips Reyalp!

Regarding the issues:
  • Once the system grows bigger I'll probably follow that hard-wiring route, as of now... I can deal with with turning 20 cameras on manually. But it's a possibility I'll surely be looking at in the future
  • The files are named correctly internally in the camera using a prefix. The PTP part to upload to folders is the one I haven't touched yet, as I said before... No coding skills, so will have to deal with this with a lot of patience or maybe use another method.
  • Focusing should be dealt with once per session, or as few times per session as possible. I don't trust much AF in these cameras, focus can hunt a lot. So my strategy would be to nail focus and keep/lock it. In this first stage i'm only planning to scan faces, so the rig can be stationary, but when it grows I might need another strategy. Oh, cameras should be set up so they don't go into sleep mode or retract lens (I think i have that sorted)
  • About exposure, you're right. I'm only using usbptp.lua to trigger them until i get comfortable with code. Multicam should be the way to go in the near future. Haven't had time to do much testing yet:(
  • There's no difference between shooting color chart and the subject. I just wrote it to explain the workflow, it should be the same. And I said before it will eventually be done with multicam, but until then, i'll stick to usbptp which I'm familiar with.
And now, to make things worse... There's four other cameras, the main ones, which are Nikon Dslrs. Not really expecting to sync them with Canons, since that will require some very advanced hacking. My plan is to shoot them manually (with a remote trigger) and hope for the best sync... Subject should be stationary, so I'm not too worried about sync time, but any ideas to improve this will be very welcome.


Thanks again!

Re: Help setting a multicam 3D scanner
« Reply #5 on: 27 / November / 2018, 13:02:35 »
And now, to make things worse... There's four other cameras, the main ones, which are Nikon Dslrs. Not really expecting to sync them with Canons, since that will require some very advanced hacking. My plan is to shoot them manually (with a remote trigger) and hope for the best sync... Subject should be stationary, so I'm not too worried about sync time, but any ideas to improve this will be very welcome.
I haven't tried anything on a camera (SX150IS) for many months and don't currently have a build environment but, in case an outline of current ideas could be of interest, the hardware usb remote precision sync code that philmoz posted here https://chdk.setepontos.com/index.php?topic=13363.msg136293#msg136293 led to sub 1ms sync in the vast majority of a 1000 stereo pair test. The period between the final hardware remote transition (negative edge from 5V to 0V) and the shutter "opening" was not measured but highly likely to have been 132ms (i.e. 4 "std periods").

Using a microcontroller to implement the usbremote function and provide the appropriate delay for (edit: in addition to) the DSLR remote shutter release lag (hoping the lag is fairly constant) seems best for very tight overall sync. Unfortunately (or otherwise) this would probably involve a fair bit of programing (e.g Arduino & potentially inline Assembler) and some non-trivial electronics (microcontoller operation / mosfets / optocouplers / ground loop consideration and even transmission line reflections come to mind if you ever consider using fast edges to sync multiple short xenon flash over long cables one day).

Some further, hopefully useful, links about ptp based sync:
https://chdk.setepontos.com/index.php?topic=11490.msg124541#msg124541
https://chdk.setepontos.com/index.php?topic=13273.msg135063#msg135063
Once the ptp based sync command is issued you could consider immediately interfacing a serial "message" from the Windows chdkptp machine to a microcontroller for that to manage the time delay and trigger of the DSLR's. While (chdk) precision sync is not available in this scheme a few tens of ms between all canon & Nikon might be achievable and having chdkptp manage the canon trigger would be much less challenging than designing a chdk remote usb trigger under microcontroller control (still some programing & electronics needed though).

There's nothing i'm aware of straight out of a box to do much of this.

Which DSLR ptp software do you use or plan on?
« Last Edit: 27 / November / 2018, 13:49:15 by andrew.stephens.754365 »

Re: Help setting a multicam 3D scanner
« Reply #6 on: 27 / November / 2018, 17:12:54 »
Hi Andrew!

You provided some very useful information in the original thread back in 2013, so thanks for coming back and bringing some useful info. Unfortunately I'm a complete noob with no coding and electronic skills so I believe your solutions are way beyond my skills (at least I've been a professional photographer for more than 10 years)

The options you sent are really interesting and certainly will be helpful in the future, but right now they are way beyond my scope. It would require to hire someone with the proper coding and electronics skills, which I would very gladly do if I could find anyone in my area (once i move to my new home and have a proper studio space here in Spain). In any case it's great to have these references posted here so I can use them in the near future, so thanks a lot.

My goal right now is to get a no-frills workflow properly set up and start improving it over time.

Regarding sync between Nikon DSLRs and Canon P&Ss... I just got the Nikons a few days ago, and need to test different methods, but i've been thinking of a couple of different ways. Again, I can't hope for a perfect sync since that's way over my skills and it's not really needed for stationary subjects (although it'd be ideal).
  • The most promising alternative was using DigicamControl to trigger both D7000s and D3300s, since it allows live view and complete controls over the PC, but I've read there's a lag when triggering multiple cameras that adds up, so i can end up with 2 to 3 seconds of total delay. Too bad.
  • So the next alternative is hacking a cabled remote trigger (or wireless), and manually trigger it at the same time i trigger the Canons. If I could couple it to shoot in sync with the USB hubs that'd be fantastic, but have no clue how to do it, needs more investigation.
  • And third would be to use flash, shut lights off, open all shutters, trigger the flashes and then close shutters. But I'm worried about the performance of SX150's in long shutter speeds, cause I see quite a lot of noise this way... Any info on this? Am I right to believe there's some important noise buildup with long shutter speeds?
Since I can't code nor build an Arduino controller, I believe these are the only options that can work. If you guys can think of any other methods I'll be very glad to hear them out. Thanks again :)
« Last Edit: 27 / November / 2018, 17:41:03 by ikercito »

*

Offline reyalp

  • ******
  • 14080
Re: Help setting a multicam 3D scanner
« Reply #7 on: 27 / November / 2018, 23:18:29 »
The files are named correctly internally in the camera using a prefix.
I don't understand. CHDK names files like the canon firmware does e.g. CRW_1234.DNG. You can choose from a limited number of prefixes and extensions, and choose from 3 different directory options, but not anything like CAM01-001.dng

Nothing the script at https://chdk.setepontos.com/index.php?topic=10837.msg106581#msg106581 does anything with file names either.

Are you using a current version of CHDK from the official autobuilds, or something else? That will have a big impact on whether advice we give you will be usable.
Quote
My plan is to shoot them manually (with a remote trigger) and hope for the best sync... Subject should be stationary, so I'm not too worried about sync time, but any ideas to improve this will be very welcome.
Your options are pretty limited if you've ruled both writing code and DIY electronics.

The most basic I can think of is to physically link the switches together, so you can press both the Nikon remote and USB hub switch (or however you control the CHDK USB power) at the same time.

You could try to do something triggering the CHDK cameras with motion detection (e.g. a flash triggered when the Nikons shoot) but false positives from other motion would probably be annoying.
Quote
And third would be to use flash, shut lights off, open all shutters
...
But I'm worried about the performance of SX150's in long shutter speeds, cause I see quite a lot of noise this way... Any info on this? Am I right to believe there's some important noise buildup with long shutter speeds?
There are, but depending how quickly you make it happen it could be OK. I would expect a second or two to be fine, thought that depends on the camera model and on how strict your requirements are.

The noise issues vary a lot between models, so I'd suggest manually taking exposure of various lengths to see how bad it is on the ones you have.
Don't forget what the H stands for.


Re: Help setting a multicam 3D scanner
« Reply #8 on: 28 / November / 2018, 04:22:11 »

I don't understand. CHDK names files like the canon firmware does e.g. CRW_1234.DNG. You can choose from a limited number of prefixes and extensions, and choose from 3 different directory options, but not anything like CAM01-001.dng

Sorry, my bad. I was mistaken, filenames are not saved with the prefix in camera. They were renamed  afterwards (I think through PTP). Sorry but I'm under a heavy load of work and have no studio space at the moment, I'll try to conduct some more proper testing during the weekend. :(
Quote

Your options are pretty limited if you've ruled both writing code and DIY electronics.

The most basic I can think of is to physically link the switches together, so you can press both the Nikon remote and USB hub switch (or however you control the CHDK USB power) at the same time.

Yes, it is a pretty awful situation. I haven't ruled out coding nor electronics, I know eventually I'll have to dig into those, for now I'm trying to keep it as simple as I can. Wiring all the switches together seems like the most viable option and even I can do it. I found this too, seems like a good reference:
http://www.doc-diy.net/photo/remote_pinout/

Nonetheless, once the first "no frills" rig is running I'll probably hire someone to help me improve things.
Quote
The noise issues vary a lot between models, so I'd suggest manually taking exposure of various lengths to see how bad it is on the ones you have.

That's number one on my to-do list. I'm a photographer, so that I can handle, it's right in my ballpark of expertise.. :)

Re: Help setting a multicam 3D scanner
« Reply #9 on: 28 / November / 2018, 09:26:14 »
Since I can't code nor build an Arduino controller, I believe these are the only options that can work. If you guys can think of any other methods I'll be very glad to hear them out. Thanks again :)
Following is, nearly certainly, a non-starter but ... apparently digiCamControl (http://digicamcontrol.com/) is open source - don't plan to look at source yet though. If the author (or someone) was able to emulate reyalp's splendid ptp sync you could perhaps use AutoIt https://www.youtube.com/watch?v=qClbO1DFgjs (or something like this https://www.youtube.com/watch?v=eiZy1q95Gxs) to press a chdkptp GUI button (or CLI enter) related to !mc:cmd('shoot',{syncat=???}) (no status provided with that) then wait "a bit" (to allow all chdkptp commands to be sent) before pressing a similar button in digicamcontrol GUI with its own syncat parameter reduced to account for the delay between the start time in the two systems.

Meanwhile, back on planet earth...   
« Last Edit: 28 / November / 2018, 09:51:42 by andrew.stephens.754365 »

 

Related Topics