3D SCANNER with multiple Cameras - page 3 - General Discussion and Assistance - CHDK Forum supplierdeeply

3D SCANNER with multiple Cameras

  • 42 Replies
  • 24811 Views
Re: 3D SCANNER with multiple Cameras
« Reply #20 on: 09 / February / 2015, 14:22:10 »
Advertisements
Just a question concerning this topic.

When using the following code sequence in CHDKPTP interactive CLI all images are downloaded as required.

Code: [Select]
exec mc=require('multicam') mc:connect() for i,lcon in ipairs(mc.cams) do con=lcon cli:print_status(cli:execute('mdl A/DCIM /MultiCam/' .. lcon.ptpdev.serial_number .. ' -fmatch=%.JPG$')) cli:print_status(cli:execute('rm A/DCIM ')) end
When putting it into a .BAT file it doesn't work anymore:

Code: [Select]
chdkptp  -e"exec mc=require('multicam') mc:connect() for i,lcon in ipairs(mc.cams) do con=lcon cli:print_status(cli:execute('mdl A/DCIM /MultiCam/' .. lcon.ptpdev.serial_number .. ' -fmatch=%.JPG$')) cli:print_status(cli:execute('rm A/DCIM ')) end"
This message is shown:
Code: [Select]
ERROR: compile failed:[string "mc=require('multicam') mc:connect() for i,lco..."
]:1: ')' expected near 'rm'

What should I do?

And I promise, when I get this managed, I will use !require'myfile'  :P

*

Offline reyalp

  • ******
  • 14080
Re: 3D SCANNER with multiple Cameras
« Reply #21 on: 09 / February / 2015, 17:19:42 »
from the error message, it looks like a quoting problem. I suspect the windows shell is doing something the % earlier. If I put
Code: [Select]
echo "exec mc=require('multicam') mc:connect() for i,lcon in ipairs(mc.cams) do con=lcon cli:print_status(cli:execute('mdl A/DCIM /MultiCam/' .. lcon.ptpdev.serial_number .. ' -fmatch=%.JPG$')) cli:print_status(cli:execute('rm A/DCIM ')) end"
in a batch file, the output after fmatch= is messed up. Using %%.JPG$ seems to do the right thing. You could also avoid the problem by putting your commands in a lua file, or a chdkptp command file using the source command.

That said, multicam now includes built in functions for downloading and deleting, see mc:download_images

Don't forget what the H stands for.

*

Offline cdg

  • **
  • 53
Re: 3D SCANNER with multiple Cameras
« Reply #22 on: 24 / June / 2015, 13:29:15 »
The big problem for us is to modify multicam.lua to download the photos to pc.
This shouldn't be too hard. You can use something like:
Code: [Select]
!mc=require'multicam'
... do your regular multicam shooting
!mc:cmd('exit')
 !for i,lcon in ipairs(mc.cams) do cli:print_status(lcon:mdownload({'A/DCIM'},'/some/path',{fmatch='%.JPG$'})) end
!mc:start()
...
If you want to the CLI mdownload command instead of figuring out the API parameters, you could do it like this
Code: [Select]
!for i,lcon in ipairs(mc.cams) do con=lcon cli:print_status(cli:execute('mdl A/DCIM /some/path -fmatch=%.JPG$')) end
Some day I'd like to integrate shoot and download into multicam, but I haven't got to it yet.
Hello! i am a beginner of CHDK,so here i have a very simple question about coding. what i should do is just add this code to the end of multicam.lua ? or somewhere in the multicam.lua .and what is the process to make this .lua work, sorry i really know nothing about this.

*

Offline reyalp

  • ******
  • 14080
Re: 3D SCANNER with multiple Cameras
« Reply #23 on: 24 / June / 2015, 16:11:34 »
Hello! i am a beginner of CHDK,so here i have a very simple question about coding. what i should do is just add this code to the end of multicam.lua ? or somewhere in the multicam.lua .and what is the process to make this .lua work, sorry i really know nothing about this.
The code listed above is meant to be run from the chdkptp command line, so you would enter it when you wanted to download files, or put it in a function in some lua file and call it.

However, since this thread was started, I added the mc:download_images function to multicam. I'd suggest using it instead. A description can be found in http://chdk.setepontos.com/index.php?topic=11667.msg114920#msg114920. There is also some documentation in the multicam.lua file.

To use multicam effectively, you will need a pretty good understanding of scripting. There is no simple, use friendly interface to control multiple cameras.
Don't forget what the H stands for.


*

Offline cdg

  • **
  • 53
Re: 3D SCANNER with multiple Cameras
« Reply #24 on: 26 / July / 2015, 04:55:55 »
Hello! i am a beginner of CHDK,so here i have a very simple question about coding. what i should do is just add this code to the end of multicam.lua ? or somewhere in the multicam.lua .and what is the process to make this .lua work, sorry i really know nothing about this.
The code listed above is meant to be run from the chdkptp command line, so you would enter it when you wanted to download files, or put it in a function in some lua file and call it.

However, since this thread was started, I added the mc:download_images function to multicam. I'd suggest using it instead. A description can be found in http://chdk.setepontos.com/index.php?topic=11667.msg114920#msg114920. There is also some documentation in the multicam.lua file.

To use multicam effectively, you will need a pretty good understanding of scripting. There is no simple, use friendly interface to control multiple cameras.

Thank you a lot!!
last week i just got two SX170is cameras to try this out,it was working,and i spent a week to read the posts about how to bulit a multi-cameras rig ,and most people prefer Remote triggering via USB remote with CHDK PTP,so i would like do the same.
now i just get one camera work well with CHDK PTP ,i could control the camera with my PC :) :),but when i tried to connect two cameras using a hub to my PC,the CHDK PTP not working anymore,i only could control one camera at once ,can not control them together at the same time,there should be something that i missed ,do you know why?

*

Offline cdg

  • **
  • 53
Re: 3D SCANNER with multiple Cameras
« Reply #25 on: 26 / July / 2015, 05:19:54 »
here is the printscreen of the software

*

Offline reyalp

  • ******
  • 14080
Re: 3D SCANNER with multiple Cameras
« Reply #26 on: 26 / July / 2015, 15:46:18 »
now i just get one camera work well with CHDK PTP ,i could control the camera with my PC :) :),but when i tried to connect two cameras using a hub to my PC,the CHDK PTP not working anymore,i only could control one camera at once ,can not control them together at the same time,there should be something that i missed
You need to explain more specifically what you did, and what the results were. The normal chdkptp UI (both the command line and GUI) are only designed to control one camera at a time. The multicam script lets you script control of multiple cameras, but it doesn't add multicam features to the normal UI.

Quote
,do you know why?
The screenshot shows what you see when the camera sends random memory instead of valid live view data. This can happen for many reasons. If you see it briefly while shooting, that's normal. If you see it all the time, then there's some bug in the port.
Don't forget what the H stands for.

*

Offline cdg

  • **
  • 53
Re: 3D SCANNER with multiple Cameras
« Reply #27 on: 27 / July / 2015, 22:56:43 »
Thank you!
    I read a lot of post about multicam script control,and also i test some scripts with my sx170is that is working.
   Is it possible to add in chdkptp a button for execute the script you give ?
Code: [Select]
!for i,lcon in ipairs(mc.cams) do con=lcon cli:print_status(cli:execute('mdl A/DCIM /some/path -fmatch=%.JPG$')) end
« Last Edit: 27 / July / 2015, 22:59:03 by cdg »


*

Offline reyalp

  • ******
  • 14080
Re: 3D SCANNER with multiple Cameras
« Reply #28 on: 30 / July / 2015, 01:04:53 »
Please don't post the same question in multiple threads.

You can add buttons in the gui.lua or gui_user.lua files.

As I suggested earlier, mc:download_images is probably a better choice than the code you posted.


edit:
something like this
Code: [Select]
iup.button{
title='mc download',
size='90x15',
action=function(self)
mc:download_images()
end,
},
around line 461 in gui.lua, just below the existing
Code: [Select]
iup.hbox{
gui.mode_dropdown,
},
iup.fill{},
« Last Edit: 30 / July / 2015, 01:36:23 by reyalp »
Don't forget what the H stands for.

*

Offline cdg

  • **
  • 53
Re: 3D SCANNER with multiple Cameras
« Reply #29 on: 30 / July / 2015, 01:40:33 »
sorry for that ,should i delete that one?  i have been search in CHDK forum for this problem,just found that thread ,
 and i tried to modify the gui live.lua you wrote for "onion" to get the function i need,but looks not working  because i can not run the CHDK PTP

 

Related Topics