IS Programatic Control - Feature Requests - CHDK Forum
supplierdeeply

IS Programatic Control

  • 19 Replies
  • 4528 Views
IS Programatic Control
« on: 27 / November / 2012, 02:41:19 »
Advertisements
I've decided to start a new topic for development of a patch/idea I have.

Description
Simple, a script command shift(x,y) or shift (x1,x2,y1,y2,a,b,c,d,e,f,g,h,i) to control the lens stabilization in script (details to be worked out) a-i would be a polynomial of some type for movement.  The second version has to be linked to shutter speed somehow.

Use Cases
Shifting while exposing
The main use case is to track stars.  By my tests, in one case, a star moves 1 pixel every two seconds.  If the lens could shift the image 20 pixels, the exposure time could be increased by 10x. Longer exposures with stacking gives the best overall noise reduction.
You could also make enhanced star trails by going in the opposite direction; thus saving a lot of time (that would blur the foreground though)
-Purposeful known motion blur effect - the use of this can increase dynamic range, I won't go into the idea here. 
-Mini light-paintings : hold a small light far away and let the lens draw small patterns with it. 
-Special effects: Draw halos around your photo, make artificial star burst patterns, etc. with the controlled motion blur.

Shifting between shots
-You can restart trails between exposures; meaning to catch up with the star position between shoots.  You could only do this a few times before reaching max shift.  The result would be perfectly continuous trails despite pausing between shots.
-Superresolution stacking (9 shifts to double resolution)
-Mini-mosaic (4 images to increase picture size by say, 10% automatically, increasing FOV).
-3d pictures, though the shift may be too small to be much use with a single camera.  With two cameras, you can make them converge to one variable point, with the ease of keeping the cameras mounted perfectly parallel.  I think this may already be in SDM.

Shifting while not exposing
-To preview various effects in live view; for tweaking star tracking movement etc.

Requirements
-Programatic control of shift.  It has to work without touching the camera, for star tracking use
-Determination of maximum shift values
-Setting of the shift
-Able to change shift while exposing, for star tracking use.  Other uses can be set before the shot.  It can be linear, better yet a polynomial function with a specified update rate
-Speed of change : update rate of about 1 second for star tracking, as fast as possible for special effects uses.
-Add motion on top of normal stabilization, this could add special effects to stabilized shots.  Would trade off amount of effect for stabilization performance.

Benefits
This could replace a $200 tracking mount or barn door tracker setup and fancy tripod.  It could increase perfect exposure time 10x or more, easily.  Stars would still have to be stacked and aligned - the movement would be in big jumps, while each picture is micro-tracked.

The ultimate vision
A script that takes 3 pics, tracks some stars near the center (to avoid dealing with lens distortion), fits to a transformation matrix, calculates start and end shift values, then supplies the evaluation parameters, then calculate max exposure time. 

Limitations
While you can follow the stars you can't rotate the sensor; there could be a slight rotation during exposure, which would blur planets.  But since this is an exactly known blur, it could be decovolved.

Supporting Functions
-A way to read the image you just took, so you can track stars

Steps Needed
-Find rom routine for raw IS control, submit patch
-Test max range of values
-Think of some way to update while exposing; actually just starting one background task to do movement until it's done; and optional link to synchronize with starting an exposure
-Work out polynomial function for update
-Test update speed
-Is this a 2 axis tilt, or is it like rotating at the end of a sphere?

The rest is just putting the functions to use in a script.

Finally my idea about dynamic range increasing: by using purposeful motion blur, you can spread highlights across pixels, and deconvolve it out after to recover HDR.  This is done in about 1/20s so it's much faster than bracketing.  Would be ideal to add this on top of existing stabilization.

An initial build has already been made; see below.
« Last Edit: 27 / November / 2012, 03:46:37 by jmac698 »

Re: IS Programatic Control
« Reply #1 on: 27 / November / 2012, 03:25:47 »
Another idea, shine a laser into the lens: is there anything there to reflect it?  Could you put something there? Then you've got a cheap laser show but with 20Hz update rate and very small movements :)

Re: IS Programatic Control
« Reply #2 on: 27 / November / 2012, 06:51:56 »
It is not really usefull for star tracking, only the star(s) in the centre of the picture would remain stationary, the rest would still move (a lot) due to rotation...
Any aligned tracking mount (even a hand operated barndoor type) will do better.

Could you use this to make 3D pictures??
« Last Edit: 27 / November / 2012, 06:55:08 by casrap »

Re: IS Programatic Control
« Reply #3 on: 27 / November / 2012, 09:31:40 »
If you shoot a stars far away from the Polar this could be enough - if you mean a move of few pixels or not much more. Yes - possible, however you'd need to adjust the motion parameters and I'm not sure this is simpler than stacking in post-processing... Could be only worth if you want to make a lot of shoots of the same scene.
if (2*b || !2*b) {
    cout<<question
}

Compile error: poor Yorick


*

Offline srsa_4c

  • ******
  • 4285
Re: IS Programatic Control
« Reply #4 on: 27 / November / 2012, 11:10:53 »
Note that you can get away without modifying CHDK code. Lots of IS related functions are exported as event procedures. An example listing from a random camera's firmware:
00000040280D   ClearISZData
00000040281A   GetLoopGainCalcData
00000040282E   StopLoopGainCalc
00000040283F   StartLoopGainCalc
000000402851   ChangeParallelMode
000000402864   GetGyroFilterCharge
000000402878   GetLoopGainAdjValue
00000040288C   SetLoopGainAdjValue
0000004028A0   SetISHPFCutoff
0000004028AF   SetISTuningFlag
0000004028BF   GetGyro10BitDACPitch
0000004028D4   SetGyro10BitDACPitch
0000004028E9   GetGyroHPFINPitch
0000004028FB   GetGyroDataPitch
00000040290C   GetGyroHPFINOffsetPitch
000000402924   SetGyroHPFINOffsetPitch
00000040293C   SelectPositionSignal
000000402951   GetMechaDSPVersion
000000402964   GetISParamVersion
000000402976   GetISFirmVersion
000000402987   SetZoomPosition
000000402997   ISInitMotion
0000004029A4   GetISHallOut1Amp
0000004029B5   ISMDStop
0000004029BE   ISPanModeStop
0000004029CC   SetGyroFilterChargeStop
0000004029E4   ISControlStop
0000004029F2   ISAutoCenter
0000004029FF   StartISLocalAutoCenter
000000402A16   EnableISDriveError
000000402A29   DisableISDriveError
000000402A3D   SetISLPFAaxis
000000402A4B   GetISDriveAaxis
000000402A5B   SetISDriveAaxis
000000402A6B   GetISHallGainAaxis
000000402A7E   SetISHallGainAaxis
000000402A91   GetISGyroGainAaxis
000000402AA4   SetISGyroGainAaxis
000000402AB7   GetISPositionAaxis
000000402ACA   GetISHallOffsetAaxis
000000402ADF   SetISHallOffsetAaxis
000000402AF4   SetISLPFBaxis
000000402B02   GetISDriveBaxis
000000402B12   SetISDriveBaxis
000000402B22   GetISHallGainBaxis
000000402B35   SetISHallGainBaxis
000000402B48   GetISGyroGainBaxis
000000402B5B   SetISGyroGainBaxis
000000402B6E   GetISPositionBaxis
000000402B81   GetISHallOffsetBaxis
000000402B96   SetISHallOffsetBaxis
000000402BAB   SetISMovieStatus
000000402BBC   SetISStillStatus

A few problems:
- somebody will need to find out how to register these
- the only documentation is the eventproc's name and perhaps some debug messages in the firmware (and of course analysing the fw code to find out the number of expected params)
- using some of these event procedures might interfere with the IS related tasks of the firmware
- if you're unlucky, you may end up with a miscalibrated IS (for example SetISTuningFlag is suspicious)...
« Last Edit: 27 / November / 2012, 11:29:56 by srsa_4c »

Re: IS Programatic Control
« Reply #5 on: 27 / November / 2012, 11:30:14 »
Could you use this to make 3D pictures??

Not really, the shift is not great enough except for extremely close subjects.
Attached images taken with S95, that has larger shift than most cameras.

Re: IS Programatic Control
« Reply #6 on: 27 / November / 2012, 11:56:56 »
With two cameras, you can make them converge to one variable point, with the ease of keeping the cameras mounted perfectly parallel.  I think this may already be in SDM.

It was in a test version that a couple of users tried.
Even with two cameras, the divergence point was too far away.
I suppose you could say every little helps and it would reduce the amount of toe-in required.

Problem is, for an official release you would have to find the location of the firmware functions for all cameras.


David

Re: IS Programatic Control
« Reply #7 on: 27 / November / 2012, 13:41:49 »
Shift Amount
That's fantastic - I measured the movement of the monitor LED in the test pictures as 80 pixels. 

Application to Star Tracking
In my test case that would extend exposure from 2s to 2min 40s.  You still need to stack, but you must understand that stacking doesn't solve every problem, you need to wait long enough for the photons to collect in the first place.  You can use higher ISO's now.
But it's a good point - it's best pointing away from the poles, or tracking a specific object like a nebula; it still helps a bit otherwise, and I think you could perfect it with image processing of a perfectly known movement.  Still useful for a superzoom with reduced FOV.

Application to 3d pairs
I can understand the movement isn't enough to converge near, but what if you mounted the cameras with toe-in to the sweet spot, then adjust +- with tilt?

Supperresolution
This still seems possible

Mini-mosaic
Adding about 5% pixels to your frame is pointless.  Can't think of any use for this.  Sometimes I can't step back enough from something due to the crowd and my FOV isn't enough, but I probably need 50% more.

Special Effects
You can buy bokeh kits, just cutouts to put in front of your lens, but controlled motion blur would blur everything.  It could be done in software but I don't know exactly how.  For scientific research in image processing, it would be awesome to have a controlled real blur to test your algorithms.


Re: IS Programatic Control
« Reply #8 on: 27 / November / 2012, 13:48:05 »
OK, some more information for anyone who compiles CHDK.
For the S95 100H in Strings.txt (in the disassembly folder) there is :-

004893D1   004893D1      0   MoveISLensToBottomLimitPosition
004893F1   004893F1      0   MoveISLensToTopLimitPosition
0048940E   0048940E      0   MoveISLensToLeftLimitPosition
0048942C   0048942C      0   MoveISLensToRightLimitPosition

For MoveISLensToBottomLimitPosition that corresponds to address 0xFFC993D1.

Cannot remember how but that led me to add to stubs  :-

NHSTUB(MoveISLensToCentralPosition,     0xFFB668FC)
NHSTUB(MoveISLensToLeftLimitPosition,   0xFFB666F4)
NHSTUB(MoveISLensToRightLimitPosition,  0xFFB666E0)
NHSTUB(MoveISLensToBottomLimitPosition, 0xFFB66708)
NHSTUB(MoveISLensToTopLimitPosition,    0xFFB6671C)


Re: IS Programatic Control
« Reply #9 on: 27 / November / 2012, 13:49:26 »
Microfunguy,
Can you help me get this working on any of my cameras?  I could at least show one before/after pic of a star field to see if it's any use.
SD890IS 1.00F
SD1200IS 1.00C

 

Related Topics