PTP and an ARM based linux computer

  • 8 Replies
  • 2162 Views
PTP and an ARM based linux computer
« on: 02 / October / 2013, 13:03:04 »
Advertisements
I plan on getting the Canon s95 or s100 in the near future and use it with the PTP extension.
I have a few questions I can't find the answers to on google/forum search.

I'd like to control the camera and transfer files with the PTP extension from a headless ARM based Linux computer (Command line only, like a Raspberry PI or the more powerful ODROID).
A) If a camera is supported, does it matter whether I'm using Linux/Windows/Arm/x86 ? Just want to make sure no special drivers that only work on Windows or anything similar are also required.
B) What kind of file transfer rate(Mb/sec) can I expect? Will be using top of the line Class 10 SD card.

I want to send a shoot command via the PTP extension, take a 10 Mega Pixel photo and transfer it back to the Linux computer. I want to run this sequence over and over.
C) What's the best rate I can get?
D) Would running a continuous shooting script instead of sending a command via PTP be faster?
I'm aiming for 1-2 pictures per seconds.

Much Obliged.

*

Offline reyalp

  • ******
  • 11084
Re: PTP and an ARM based linux computer
« Reply #1 on: 02 / October / 2013, 23:19:07 »
I'd like to control the camera and transfer files with the PTP extension from a headless ARM based Linux computer (Command line only, like a Raspberry PI or the more powerful ODROID).
I maintain builds of the chdkptp client (https://www.assembla.com/spaces/chdkptp/wiki) for raspberry pi. Building for other similar platforms should not be difficult if you don't need the GUI.

Quote
A) If a camera is supported, does it matter whether I'm using Linux/Windows/Arm/x86 ? Just want to make sure no special drivers that only work on Windows or anything similar are also required.
No, the opposite is true, on windows you need libusb, on linux it is built in.

Quote
B) What kind of file transfer rate(Mb/sec) can I expect? Will be using top of the line Class 10 SD card.
This depends on the host device, camera, and card. Newer cameras are generally faster. In this context, s95 and s100 are both "new"

On d10 (digic IV), the absolute max transfer rate I get is about 26 mbyte/s (transferring directly from uncached RAM in one transaction). On elph130 (also digic IV, but newer), it's about 35. On a540 (digic II) it's about 15.

Note the above numbers are direct from RAM, if you are reading files from the SD card, it will be slower (hmm, we could file IO happen in parallel with USB transfer, but we currently don't). If you use remote capture, it will be over RAM, but there is some overhead.

Quote
I want to send a shoot command via the PTP extension, take a 10 Mega Pixel photo and transfer it back to the Linux computer. I want to run this sequence over and over.
C) What's the best rate I can get?
This depends on a lot of factors. Are you planning to use jpeg only, or raw?

Camera settings can make a significant difference too, for example higher ISOs often involve extra processing, and if you need to autofocus between each shot that can slow things down.

From a CHDK point of view, the fastest option is cameras that have "remote capture" functionality implemented. See the "filewritetask" column in http://chdk.wikia.com/wiki/CameraFeatureTable
Note that if your camera isn't on that list, there is a fair chance someone will be willing to implement it for you.

There is some discussion of shooting speed in these threads
http://chdk.setepontos.com/index.php?topic=6231.msg98677#msg98677
http://chdk.setepontos.com/index.php?topic=10488.msg103780#msg103780
Quote
D) Would running a continuous shooting script instead of sending a command via PTP be faster?
I'm aiming for 1-2 pictures per seconds.
In general, the absolute maximum will be close to the values given in the Canon specs. Most will not do 2 FPS indefinitely at full resolution.

The remote capture system can be used in continuous mode, though some scripting would be required if you want any control while the sequence is in progress.

In my testing, remote capture in continuous mode gives fairly similar performance to shooting to SD card.
Don't forget what the H stands for.

Re: PTP and an ARM based linux computer
« Reply #2 on: 03 / October / 2013, 14:25:27 »
Thank you for your detailed reply!

I maintain builds of the chdkptp client (https://www.assembla.com/spaces/chdkptp/wiki) for raspberry pi. Building for other similar platforms should not be difficult if you don't need the GUI.
I'll check it out on a Beaglebone Black soon enough.

Quote
No, the opposite is true, on windows you need libusb, on linux it is built in.
Just to make sure - if a camera model has CHDK & PTP support it would fully work with the PTP extension regardless of what computer I'm using to connect to it?

Quote
This depends on a lot of factors. Are you planning to use jpeg only, or raw?
Both would be okay.

Quote
From a CHDK point of view, the fastest option is cameras that have "remote capture" functionality implemented. See the "filewritetask" column in http://chdk.wikia.com/wiki/CameraFeatureTable
What exactly is the 'filewritetask' feature? Is that where you transfer the picture straight to the computer and skip the camera SD card?

Quote
Note that if your camera isn't on that list, there is a fair chance someone will be willing to implement it for you.
Show me where can I post requests  :D

Quote
In my testing, remote capture in continuous mode gives fairly similar performance to shooting to SD card.
Assuming I won't change settings very often (Focus, Zoom, ISO would be constant), going with continuous mode on a camera that doesn't support 'filewritetask' would give close to optimal results?

To shed more light about my needs,
I'm after a camera with 10MP resolution or higher, optical stabilization. Prefer a CCD 1/1.7' sensor but not mandatory, weight around 150-250 grams. Good CHDK support and the maximum FPS I can get (~1 FPS would be good, ~2 FPS would be excellent).

Thanks again!

*

Offline reyalp

  • ******
  • 11084
Re: PTP and an ARM based linux computer
« Reply #3 on: 03 / October / 2013, 17:23:45 »
Just to make sure - if a camera model has CHDK & PTP support it would fully work with the PTP extension regardless of what computer I'm using to connect to it?
Existing clients are available for windows and any reasonably normal flavor of linux (and probably OSX with some fiddling). The protocol itself can be implemented on any USB host.
Quote
Both would be okay.
jpeg only will be faster.
Quote
What exactly is the 'filewritetask' feature? Is that where you transfer the picture straight to the computer and skip the camera SD card?
Correct. The hooking the filewrite task allows us to intercept the date before it is written to the card, and retrieve it over USB instead.

Quote
Show me where can I post requests  :D
The porting thread for the specific camera would usually be a good place. Or here.

Quote
Assuming I won't change settings very often (Focus, Zoom, ISO would be constant), going with continuous mode on a camera that doesn't support 'filewritetask' would give close to optimal results?
In my limited testing, the shot to shot time is fairly similar. A fast SD card is likely to be slightly faster and more stable frame rate than remote capture. However, if the download time matters, then remote capture (filewrite) will take much less time overall.
Don't forget what the H stands for.


Re: PTP and an ARM based linux computer
« Reply #4 on: 05 / October / 2013, 13:54:09 »
Thanks!
(Out of questions for now, but I'll be back  :))

Re: PTP and an ARM based linux computer
« Reply #5 on: 08 / January / 2014, 12:09:17 »
I'm back, this time with a Cannon S110!
I was able to compile and use chdkptp pretty easily, works out of the box (Awesome tool reyalp!).
The remoteshoot option is supported on the Cannon S110 but each shot takes a lot of time since the camera has to adjust zoom/flash and others.

How can I pre-set all of the settings(And what are they?) so that the camera just shots without any delays?

Is it possible to get micro-seconds resolution timestamps on the photos(In EXIF or other method)? The exact time a photo was taken is very important to me, hoping to get 0.1 seconds accuracy or less.

When I try to use remoteshoot with the "-cont" flag I get the error: "ERROR: not in continuous mode", how can I put the camera in continuous mode from chdkptp? Only saw rec and play modes.

Edit: If I skip the remoteshoot feature and make a script to run on the camera and take a picture every 0.5 seconds, what would be the best way to retrieve the files? I'm guessing 'ls', finding the last picture and downloading it isn't the best idea.
« Last Edit: 08 / January / 2014, 12:16:33 by dinod »

*

Offline reyalp

  • ******
  • 11084
Re: PTP and an ARM based linux computer
« Reply #6 on: 08 / January / 2014, 23:02:02 »
I'm back, this time with a Cannon S110!
I was able to compile and use chdkptp pretty easily, works out of the box (Awesome tool reyalp!).
The remoteshoot option is supported on the Cannon S110 but each shot takes a lot of time since the camera has to adjust zoom/flash and others.

How can I pre-set all of the settings(And what are they?) so that the camera just shots without any delays?
This can be complicated. If you want to use the same settings and just shoot as fast as possible, continuous mode will be best.

Otherwise, I'd suggest looking at the canon firmware settings. If you don't need flash, turn it off in the canon menu. If you don't need autofocus, use manual or set AF Lock. Some of the discussion starting at http://chdk.setepontos.com/index.php?topic=6231.msg98677#msg98677 may be useful.

Quote
Is it possible to get micro-seconds resolution timestamps on the photos(In EXIF or other method)? The exact time a photo was taken is very important to me, hoping to get 0.1 seconds accuracy or less.
Not in the jpeg exif, chdk doesn't really have the capability to modify that.

The DNG exif does contain a sub-second timestamp which should be good for 0.1 second or better. The underlying tick counter has a precision of 10ms, but there is probably some additional error.
Shooting DNG is slow, but you can use -dnghdr remoteshoot option to get a file that is just the dng exif without the data. You'd have to extract the SubsecTime entry yourself.

You could probably also do something with script, but it would take some work to integrate with remoteshoot.

Quote
When I try to use remoteshoot with the "-cont" flag I get the error: "ERROR: not in continuous mode", how can I put the camera in continuous mode from chdkptp? Only saw rec and play modes.
You need to use the Canon FUNC menu to set the drive mode to continuous. This should be described in the Canon manual.

Quote
Edit: If I skip the remoteshoot feature and make a script to run on the camera and take a picture every 0.5 seconds, what would be the best way to retrieve the files? I'm guessing 'ls', finding the last picture and downloading it isn't the best idea.
If you have a script running on the camera that isn't synchronized with the downloading, you may run into problems because the camera can only have a limited number of files open at a given time. This means it could end up crashing if you happen to be doing a download while it's saving the next image.

Another problem would be not trying to download an image that the camera hasn't fully saved yet.

It would be better to have your script on the and chdkptp aware of each other. The best way to do this will depend on your needs. You can write Lua code that runs in chdkptp and talks to camera side Lua, see https://www.assembla.com/spaces/chdkptp/wiki/Scripting_Guide for an incomplete introduction.
Don't forget what the H stands for.

*

Offline nafraf

  • *****
  • 1296
Re: PTP and an ARM based linux computer
« Reply #7 on: 09 / January / 2014, 03:18:09 »
You need to use the Canon FUNC menu to set the drive mode to continuous. This should be described in the Canon manual.
Another alternative is to use UI properties (PTM functions)


*

Offline openuas

  • **
  • 57
  • OpenUAS
    • OpenUAS
Re: PTP and an ARM based linux computer
« Reply #8 on: 09 / January / 2014, 19:31:39 »
@dinod, you managed to crosscompile the chdkptp for BBB or did you compile on the BBB itself?. It would be nice if you shed some light on the chdkptp compile procedure you used.

 

Related Topics