Multi-camera setup project. - page 10 - Creative Uses of CHDK - CHDK Forum supplierdeeply

Multi-camera setup project.

  • 462 Replies
  • 207837 Views
*

Offline mphx

  • ***
  • 210
Re: Multi-camera setup project.
« Reply #90 on: 22 / July / 2014, 17:24:17 »
Advertisements
I did warn you that I hadn't tested this thoroughly. It was just casual observation with 3 cameras that might have provided a shortcut to getting them in order.

Not a big problem...power up the cameras..check what id each one is taking and then just start editing the file with ids to the desired physical order... :)

*

Offline mphx

  • ***
  • 210
Re: Multi-camera setup project.
« Reply #91 on: 24 / July / 2014, 05:57:35 »
UPDATE on the project :)

Studio is being getting ready , dummy batteries ordered , tripods bought and guess what... market ran out of cameras !!! pfff :)

We are like 36 cameras short..and i am trying to find the rest from ebay or any place...If we can't find the remaining cameras , we will have to switch to another model ... pathetic country...pathetic market...

*

Offline reyalp

  • ******
  • 14118
Re: Multi-camera setup project.
« Reply #92 on: 24 / July / 2014, 17:46:41 »
Not a big problem...power up the cameras..check what id each one is taking and then just start editing the file with ids to the desired physical order... :)
In changes through r624, I added a function set_id(old_id,new_id). If the script is running, the IDs on the camera will be updated immediately so you can see it on the ID display.

Once you are satisfied with the ID order, you can save the list.

If the new id is already in use they will be swapped. You can pass an optional third parameter 'error' to generate an error in this case instead.

Additionally, you can now select a range of cameras with mc:sel{min=number, max=number}

save_list works on the selected cameras, so this should make it easy to make subset lists.

I also fixed some bugs, see the svn log for details.
Don't forget what the H stands for.

*

Offline mphx

  • ***
  • 210
Re: Multi-camera setup project.
« Reply #93 on: 24 / July / 2014, 18:41:49 »
@reyalp

nice addition...will come in handy.


*

Offline reyalp

  • ******
  • 14118
Re: Multi-camera setup project.
« Reply #94 on: 24 / July / 2014, 23:14:09 »
I've added support for downloading and deleting images. I haven't tested this very thoroughly, so bugs are likely.

Dowloading is done with mc:download_images(), which takes an table of options.

Specifying the destination:
The destination is specified with the dst option. You can use substitution variables, specified like ${foo} to control the path for each iamge.
The default is
dst='${id}/${subdir}/${name}'
which means: The ID number of the camera, the DCIM subdirectory (e.g 100CANON) and the camera filename (e.g IMG_0123.JPG)

Available substitutions are
${id,strfmt} camera ID, default format %02d
${serial,strfmt} camera ID, default format %s
${ldate,datefmt} PC clock date when download was started, os.date format, default %Y%m%d_%H%M%S
${lts,strfmt} PC clock date as unix timestamp + microseconds when download was started, default format %f
${mdate,datefmt} Camera file modified date, converted to PC time, os.date format, default %Y%m%d_%H%M%S
${mts,strfmt}  Camera file modified date, as unix timestamp converted to PC time, default format %d
${name} Image full name, like IMG_1234.JPG
${basename} Image name without extension, like IMG_1234
${ext} Image extension, like .JPG
${subdir} Image DCIM subdirectory, like 100CANON or 100___01 or 100_0101
${imgnum} Image number, like 1234
${dirnum} Image directory number, like 101
${dirmonth} Image DCIM subdirectory month, like 01, date folder naming cameras only
${dirday} Image DCIM subdirectory day, like 01, date folder naming cameras only

the format arguments are all optional

General options:
pretend=bool -- doesn't actually download or delete, just print
delete=bool -- delete files after downloading. Use with caution
overwrite=bool -- overwrite existing files with the same name
verbose=bool -- print what it's doing. Implied with pretend

File options:
By default, it will download files matching the normal image name pattern (ccc_nnnn.ext) from all subdirectories of DCIM. You can pass start_dirs={'A/DCIM/101CANON'...} if you want, but unless your camera numbering is exactly in sync, this won't be very useful.

You can use fmatch to match certain files. For example fmatch='%.DNG$' will only download DNG files. The default fmatch is '%a%a%a_%d%d%d%d%.%w%w%w'

Other find_files options are also available, but may or may not make sense.

examples:
list all the image files on all the cameras, without actually downloading
!mc:download_images({pretend=true})

download DNG files to test/<camera name>, overwriting, delete when done
!mc:download_images({verbose=true,delete=true,overwrite=true,dst="test/${name}",fmatch='DNG$'})

You can also use mc:imglist() to get a list of images in lua. This returns table indexed by ID. Each ID points to an array of file information, which includes the path and stat information.

Note that IDs are not necessarily contiguous, so you shouldn't use ipairs to iterate over the outer table. The inner table is a proper array.
Don't forget what the H stands for.

*

Offline mphx

  • ***
  • 210
Re: Multi-camera setup project.
« Reply #95 on: 25 / July / 2014, 06:18:59 »
@reyalp

Nice stuff !!

But let me see if i get some things right....

Command is , mc:download_images() right ? i mean it can be run as it is ? and it takes the default values for dst?

Something else , in the example you provide  "!mc:download_images({verbose=true,delete=true,overwrite=true,dst="test/${name}",fmatch='DNG$'})"

if someone wanted dst with default parameters..he should simply exclude it at all from the command?

something like this ?

!mc:download_images({verbose=true,delete=true,overwrite=true})


And one last thing ...i understand that delete function is somehow connected (as a parameter) to the downloading ALL files process.So i guess deletion cannot be combined with other commands ...? let's say download_last?
Of course its a bit redundant , since downloading all images include LAST images...but just asking :)

Also , is it possible delete function to be used alone somehow?Picture this.
Lets say i shoot 5-6 times a client , and the last shot is the good one...so i only want the last images and i use download_last to get them.
I don't care for the rest of the images , so since i downloaded the last ones , i want to delete all images to start a possible new shooting process...

Thanks for your work man , and will do some testing when i get home later this afternoon...

*

Offline reyalp

  • ******
  • 14118
Re: Multi-camera setup project.
« Reply #96 on: 25 / July / 2014, 14:55:58 »
Command is , mc:download_images() right ? i mean it can be run as it is ? and it takes the default values for dst?

Something else , in the example you provide  "!mc:download_images({verbose=true,delete=true,overwrite=true,dst="test/${name}",fmatch='DNG$'})"

if someone wanted dst with default parameters..he should simply exclude it at all from the command?
Yes, most complicated functions in chdkptp take a table of options, and anything not specified uses the default.

Quote
And one last thing ...i understand that delete function is somehow connected (as a parameter) to the downloading ALL files process.So i guess deletion cannot be combined with other commands ...? let's say download_last?
There is a function mc:delete_images_list() which you could call directly. It expects a list in the same format produced by mc:imglist(), so you can use that to generate a list without downloading. imglist takes the same file selection options as download_images.

Note that mc:download_images() does not have affect all files, it has various options to control which are selected. But there is not currently an easy way to just get the "last" image, or the last N images.

download_last is kind currently it's own thing, it uses a completely different method. It was really just something I threw together as an example. I'll look into making "last" an option for download_images and imglist.

This is all still a work in progress.
Don't forget what the H stands for.

*

Offline mphx

  • ***
  • 210
Re: Multi-camera setup project.
« Reply #97 on: 25 / July / 2014, 16:09:52 »
@reyalp

ok i missed something... i dont get how imglist() and delete_images_list() work.I mean what they take as a parameter.

And a last thing.. what do you mean "mc:download_images() does not affect all files" ?

Doesn't download EVERYTHING? i did 3-4 tests , did 3-4 shoots and used download_images().Found and downloaded correctly all images...with default parameters of course.
I believe that "download LAST image" and "download ALL images" kinda covers everything .At least for my kind of project.

Anyways putting "last" as an option is a good idea...to make everything run from the same command..although download_lasdt() works as expected as it is.


*

Offline reyalp

  • ******
  • 14118
Re: Multi-camera setup project.
« Reply #98 on: 25 / July / 2014, 17:16:17 »
@reyalp

ok i missed something... i dont get how imglist() and delete_images_list() work.I mean what they take as a parameter.
imglist takes a table of options, which are passed to rlibs.lua find_files. This is the same thing used for chdkptp's mdownload command. It returns a Lua table, which I described earlier.

That table could be passed directly to delete_images_list()
Quote
And a last thing.. what do you mean "mc:download_images() does not affect all files" ?

Doesn't download EVERYTHING? i did 3-4 tests , did 3-4 shoots and used download_images().Found and downloaded correctly all images...with default parameters of course.
Right, the default is everything, but what I meant is you can modify the criteria used by find_files. If you just wanted to match image numbers 1-3, you could use fmatch='_000[1-3]%.JPG' or something like that. But for multicam this is not useful unless you can keep the image counters exactly in sync.

I'm working on some improvements to this now. As I've said before, the stuff in svn is very much work in progress.
Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 14118
Re: Multi-camera setup project.
« Reply #99 on: 25 / July / 2014, 18:00:05 »
In rev 634, I added an option called lastimg to imglist (also passed through by download_images). It takes a number specifying how many images to return, starting with the current image counter.

So
!return mc:imglist{lastimg=1}
will show a list of the most recent images on each camera.
!return mc:imglist{lastimg=5}
will show the 5 most recent images.

Note that this does NOT handle folder changes or image counter wrap. If the requested range goes below 1, it will just start at 1, and it will only look in the current image folder.

It can be combined with the standard options, except start_paths, which it sets to the current image folder. So !mc:download_images({lastimg=2,fmatch='DNG$'}) would download the last 2 DNG images.

The start_dirs option was renamed to start_paths.

You can also pass imgnum_min and imgnum_max directly, but again this is unlikely to be useful with multiple cams.
« Last Edit: 25 / July / 2014, 18:04:46 by reyalp »
Don't forget what the H stands for.

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal