Problem controlling PTPcam CHDK with Matlab - General Discussion and Assistance - CHDK Forum

Problem controlling PTPcam CHDK with Matlab

  • 1 Replies
  • 2601 Views
Problem controlling PTPcam CHDK with Matlab
« on: 27 / January / 2014, 08:59:47 »
Advertisements
Hello,

I'm using Matlab for an image acquisition oriented development and I control my A2500 Canon with PTPcam CHDK.
I manage to send instruction to CHDK via PTPcam by using DOS command in Matlab (ex: status=dos(sprintf('%s & ptpcam --chdk="reset" & exit"',ptp_Path) )
But I face a problem when trying to get parameters from the camera (ISO values, Tv, Av Ev,...). I don't know how to get the value transferred from PTP CHDK to the DOS shell, to get it and process it in Matlab.
 
You can see that this way of working is not very convenient and can even be blocking.
Is there a way to use dll (for instance ptpcam dll) in Matlab to control more easily the camera, and get the parameters value?
Does any one have an idea on how to do that?

thanks.

*

Offline reyalp

  • ******
  • 14121
Re: Problem controlling PTPcam CHDK with Matlab
« Reply #1 on: 29 / January / 2014, 00:26:44 »
Hello,

I'm using Matlab for an image acquisition oriented development and I control my A2500 Canon with PTPcam CHDK.
I manage to send instruction to CHDK via PTPcam by using DOS command in Matlab (ex: status=dos(sprintf('%s & ptpcam --chdk="reset" & exit"',ptp_Path) )
But I face a problem when trying to get parameters from the camera (ISO values, Tv, Av Ev,...). I don't know how to get the value transferred from PTP CHDK to the DOS shell, to get it and process it in Matlab.
I don't know anything about Matlab, but it seems like one approach would be to redirect the input and output.

To actually get the values, you can use the luar command.

The Matlab documentation suggests that dos() can return the program output, so you just need to run lua code return the values you are interested in, and then parse them out of the resulting string.

You might find chdkptp https://www.assembla.com/spaces/chdkptp/wiki more convenient than ptpcam, since it can be scripted to format the output. (as the author of chdkptp, I may be somewhat biased)
Quote
Is there a way to use dll (for instance ptpcam dll) in Matlab to control more easily the camera, and get the parameters value?

Does any one have an idea on how to do that?
ptpcam and chdkptp aren't set up to be dlls that other programs and call. They could be converted to dlls that exposed some kind of api with enough effort, but I don't know what kind of API it would need to expose to run within Matlab.
Don't forget what the H stands for.

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal