Comparison: CHDKPTP vs Canon's RemoteCapture - page 4 - RAW Shooting and Processing - CHDK Forum

Comparison: CHDKPTP vs Canon's RemoteCapture

  • 129 Replies
  • 39884 Views
*

Offline SticK

  • *****
  • 779
Re: Comparison: CHDKPTP vs Canon's RemoteCapture
« Reply #30 on: 25 / August / 2012, 12:13:27 »
Advertisements
@waterwingz

Quote "Any hints on how you plan to handle humidity ?"

That is a never ending issue.  What is well known is that for CCD photodiodes thermal noise drops by a factor of 8-10 every 20C drop in temperature.  What I do much depends what improvements that can be had for the final objective of my imaging.  For example, the S50 right now is limited to 15s Tv, so I operate the CCD a few degrees above dew point which doesn't change much in my lab.  Therefore on the S50 not much improvement in SNR can be expected by lowering it below +15C.   With CHDK and the CCD enclosed in the SX110 camera I am reading +44C at RT.  I tested dark performance but only at 15s Tv only so far at RT, and it's at least as good as the S50, despite 10Mpx vs 5Mpx.  Some of that difference may be due to lower CCD temp in the original S50 in-camera test when I did many years ago.  So this is a very qualitative assessment for now. 

Also CCD edge-charge fringing (pink-violet glow near corners) has to be known to me at the long exposures you offer, and I still have to investigate that on the newer cameras I am evaluating, ie.  whether or not Canon has corrected the problem.  Perhaps you might offer some insight on this.

If all works well for the "upgrade" of my instrument and the selection of a camera, the best solution is to machine a small enclosure housed in the camera body (hence getting the lens out)  for the CCD & TEC that will have a quartz window, then extract the air with a vacuum pump.  This method has 2 benefits: a) CCD temp can be lowered below dew point, and b) counter-heating the CCD by air convection is eliminated, greatly reducing the current through the TEC needed to keep the sensor cold.  Hamamatsu does this in some of their line-scan sensors used in spectrometers.  This architecture also reduces the transfer requirements of the hot-side, ie heat sink size etc. 


*

Offline blackhole

  • *****
  • 937
  • A590IS 101b
    • Planetary astrophotography
Re: Comparison: CHDKPTP vs Canon's RemoteCapture
« Reply #31 on: 25 / August / 2012, 14:35:29 »
Humidity is a big problem, filling the empty space with silica gel partially helps, silica gel and a hermetically sealed housing filled with an inert gas like Argon gas might be a good solution, but there is still a problem of how to create a hermetically sealed housing. :haha
I know people who restated cameras for astrophotography and humidity problem was never resolved.

Re: Comparison: CHDKPTP vs Canon's RemoteCapture
« Reply #32 on: 25 / August / 2012, 14:42:28 »
Humidity is a big problem, filling the empty space with silica gel partially helps, silica gel and a hermetically sealed housing filled with an inert gas like Argon gas might be a good solution, but there is still a problem of how to create a hermetically sealed housing.
That's basically what we did - except we used about 2 cu.in. of molecular sieves to dry the air trapped in the hermetically sealed housing and didn't worry about the inert gas part.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline SticK

  • *****
  • 779
Re: Comparison: CHDKPTP vs Canon's RemoteCapture
« Reply #33 on: 25 / August / 2012, 15:43:40 »
@waterwingz  @blackhole
Yes what you did is effective and I have worked with these kinds of solutions too.  Some other sub-assemblies in my instrument have these implemented where heatsink size and power are not a big issue, but, these solutions only mitigate the humidity problems.  The convection problem, which translates into higher TEC power for the same cold-side temperature, remains.

For me all I can say is that these are the basics.  How I tackle and how much elbow grease I will put into the selected CCD cavity (if useful // the charge-fringing problem doesn't start dominating), including the hermetic seals (the flat cable is a bigger problem than the window for example), all depends on the results I will be getting with camera models driven by CHDK with its extended Tv, that is .... will it be worth going that route.  I am still trying to narrow down potential camera models before making a commitment to purchase some more to test.  The SX110 is good but the S90 or S95 are better in several important respects specific to my instrument, but they also have to be speedy .... the old sweet-spot on the tennis racquet.

Can anyone help me with beginner's code that address my psuedocode request a couple of posts ago?
What could this be in lua?  Perhaps I should hang-in for reyalp ... he may be gone for the weekend // that's OK.
    my_set_ISO(iso) // where iso could be integers 100, 200, 400 etc
       {
       // ?
       }
    my_set_Tv(Tv)  // where Tv could be strings "64", "32", "16" ... "1/128" etc
       {
       // ?
       }


*

Offline reyalp

  • ******
  • 14079
Re: Comparison: CHDKPTP vs Canon's RemoteCapture
« Reply #34 on: 25 / August / 2012, 15:47:28 »
Script execution speed.  In principle, let us say I write a 200 line script and want to operate strictly from the client (from the user-perspective fully flexible remote), for example, modifying a few parameters and then re-issuing the code on the fly.
200 lines is not much. Achieved bulk transfer rate with USB 2.0 is at least several megabytes a second. This varies depending on the camera, newer cameras are faster. In the live view, the "last xfer kb/s" is a pretty good indicator of bulk throughput. Each transaction has overhead, which is a few ms at the minimum. I see ~5ms average for d10 and ~10ms for a540, both vary by about +10/-3. Bottom line, in most cases, it shouldn't matter if your script is 10 bytes or 1kb. The number of transactions tends to matter more.

You can use
set cli_time=true
to see the execution time of a command. This is the total time for the command to complete on the client, so if you do something that waits (e.g. =return 1) all the waiting is included too.
Quote
  How do you handle this?  Do you execute each small chunk of a function on the client with handshaking?  Do you transfer the entire file to camera RAM (or SD temp file) and transparently execute from there?
The chdkptp CLI and GUI commands work by building the script on the fly and sending the entire thing over. This is done for simplicity. If you look at chdku.lua con_methods:exec you can see how it's done. rlibs.lua contains a bunch of utility code which is combined with the script to execute. So if you do something like
=return 1
It's actually loading prepending the 'serialize_msgs' code from rlib (76 lines, 1.6 kb) to whatever you enter, sending it to the camera, polling until script execution ends, fetching the return message. Many of the chdkptp cli commands load a lot more code.

Quote
How best should I handle this?
"Best" depends on your application. Does a few milliseconds matter ? How much code do you want to write ?
Quote
  Eg, will the operation execute faster if I write the file to SD and give CHDK the command to execute it, or is there really not much difference from sending the entire script file from CHDKPTP?
I haven't benchmarked loading from the card (would depend a lot on card speed), but I would guess with a modern camera and USB 2.0, there is very little reason not to send it over USB.
If you want the absolute minimum latency, then you should write a script that runs continuously on the camera and uses the message interface. The multicam.lua file is an example of this.
Quote
  How do I transmit a multi-line script to the camera from CHDKPTP?  Is there another way outside of CHDKPTP to do it?
I answer this before, see the end of this post http://chdk.setepontos.com/index.php?topic=8585.msg89772#msg89772

Quote
In your docs you have an example titled "Universal Tv Mode."  Very basically, how would I have to simplify the code for a remote scenario where I give it a Tv parameter in a function I wrote, from the client?
I haven't looked at this script, but to set the Tv value, you probably want to use set_tv96_direct. This must be called *before* you press half shoot to take the shot. Most of the exposure related functions and propcases work in APEX*96 values. The 96 in the name tells you this one does too. So to set a 1 second exposure, you would use
.set_tv96_direct(0)

Quote
Where/how do I find/extract the translation table of Tv index versus shooting speed (property case name?), for example?
I suggest using the APEX values rather than any of the functions that take indexes. APEX is your friend. On the off chance you aren't familiar with it, http://dougkerr.net/Pumpkin/#APEX is an excellent reference. The camera uses APEX*96 so it can work in all integer math.

If you want to use traditional (e.g. "1/250th") values, I'd suggest doing the conversion on the PC side, since PC side Lua has floating point math. Alternately, you could just make a lua table mapping the strings to the APEX*96 values.

A further wrinkle when dealing with ISO is the "real" vs. "market" values, discussed here: http://chdk.wikia.com/wiki/CHDK_User_Manual#Override_ISO_value - CHDK generally works with the "real" values.
Quote
Please don't dig for an answer if you don't have it at hand.  Question is related to image file transfer speed on a USB 2.0 port.  For example, the S50 is very slow, ~10s for a big 4 MB JPG.  The S70 which Canon promotes as sporting USB 2, is only marginally faster.  The SX110 on the other hand is super fast ... a split second for a 6 MB JPG.  Would you have an idea how the S90, S95, perform?
I would expect any new cameras to be as good or better than the sx110. My d10 (digic 4, newer than sx110) shows 10-20mb/sec for live view. My a540 (Digic 2, older than sx110) shows 5-10. The S90 and S95 should be as good or better than the D10.
Don't forget what the H stands for.

*

Offline SticK

  • *****
  • 779
Re: Comparison: CHDKPTP vs Canon's RemoteCapture
« Reply #35 on: 25 / August / 2012, 15:55:25 »
For those folks wishing to use silica gel for CCD cavities, Alfa Aesar -6+18 mesh granules is an excellent compromise all-around ... also has intrinsic indicator that is blue when dry, pink when soaked.  Desiccation time is 8 hrs at +120C.

Re: Comparison: CHDKPTP vs Canon's RemoteCapture
« Reply #36 on: 25 / August / 2012, 16:08:25 »
... he may be gone for the weekend
That would be a first ....  :o
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline SticK

  • *****
  • 779
Re: Comparison: CHDKPTP vs Canon's RemoteCapture
« Reply #37 on: 25 / August / 2012, 17:04:22 »
Quote "The number of transactions tends to matter more."

Is a transaction the equivalent of a camera operation?  If not, what is it?

@reyalp
Could you please give this noob (my son always called me that so I know I am) a kick-start?  A lua example of these would be really appreciated.

    my_set_ISO(iso) // where iso could be integers or strings  100, 200, 400 etc
       {
       // ?
       }
    my_set_Tv(Tv)  // where Tv could be strings "64", "32", "16" ... "1/128" etc
       {
       // ?
       }

I do continue to study your references and do read your posts at least 3 times, but, I feel that a bit of grade-school hand-holding will go a long way.

Thanks.


*

Offline reyalp

  • ******
  • 14079
Re: Comparison: CHDKPTP vs Canon's RemoteCapture
« Reply #38 on: 25 / August / 2012, 20:05:17 »
Is a transaction the equivalent of a camera operation?  If not, what is it?
PTP transaction, meaning an operation that sends or receives data from the camera. Executing a script is one transaction. Checking the status of the script (running or not, are there messages waiting) is one. Reading messages/results is one transaction.  In practice a
lua ...
command in chdkptp results in several transactions, because it first checks if there is a script already running or messages waiting, and then it runs the code. If you wait for results (luar command) then it polls waiting for the script to end or messages to appear.

But again, this probably doesn't matter unless you are worried about tens of milliseconds, and you can't do much about it unless you understand the details and are willing to write lua code for your specific application.
Quote
I feel that a bit of grade-school hand-holding will go a long way.
If you are going to successfully use chdkptp for camera control, you are going to have to understand the CHDK functions on the camera, and write some lua code.

Quick and dirty example for Tv follows
Code: [Select]
!log2=function(n) return math.log(n)/0.69314718055995 end
!function my_set_tv(n) local tv96=string.format('%d',96*-log2(n)) ; printf("set tv96 %s\n",tv96); con:exec('set_tv96_direct('..tv96..')') end
Now to set the tv, you could do something like
Code: [Select]
!my_set_tv(1/1000)
or
Code: [Select]
!my_set_tv(10)
Explanation:
! runs lua code locally in chdkptp. Any global variables you make in an ! command are available later.
con:exec... executes code on the currently connected camera, much like the 'lua' command.
1/1000 works because this is lua code, so the division happens right there. It's not a string.
The log expression may not exactly match what the Canon firmware does, but it should be reasonably close.
tv96 is truncated using string.format('%d') because the camera only works in integers. Rounding might be slightly more accurate.

You can put the above ! commands in the same file you put contextplus option in. However, if you are writing more complicated code, you probably don't want to put everything in one line. In that case, you can put it in a .lua file (in the same directory as the other chdkptp .lua files) and then put something like
!require('myfile')
in the settings file. 'myfile' is the name of the file without the .lua extension.

ISO is, as they say, left as an exercise to the reader ;)
Don't forget what the H stands for.

*

Offline SticK

  • *****
  • 779
Re: Comparison: CHDKPTP vs Canon's RemoteCapture
« Reply #39 on: 25 / August / 2012, 20:46:32 »
First of all, please accept my sincere gratitude for this.  I like the way you wrote the sample because I can "map" it to C code easily in my head, get a basis, and expand from there if needed.  That was very thoughtful.  Also that you volunteered extra relevant info will be very helpful.  You have to realize too, that you're getting me hooked on CHDK and I've only done some very basic things.  But right now I am very curious about hardware operation performance I will get when running the SX110 under chdkptp and comparing that with my existing instrument that uses an S50 with RemoteCapture, simulating an operative instance of my instrument.  Therefore I need to be as expeditious as possible, because if I'll be looking for more candidate cameras I have to turn my attention to that objective.  Recall that CHDKPTP has opened the field very wide for candidate selection and I am very content about that, even though it will cost me much more time.  As such I prefer to defer concentrating on learning lua and creating elegant code for my application till later.  That will come once the final bricked hardware will be installed and working on the instrument.

My questions are very simplistic (as opposed to simple) for now.  Kindly remember what noob stands for. 

So please don't laugh.  I want to put your sample code into one text file, and I want to send that text file to the camera while CHDKPTP is running, preferably from the CHDFPTP command line, or something equivalent.   How do I do it?





 

Related Topics