subject distance: CAMERA_MIN_DIST & CAMERA_MAX_DIST - General Discussion and Assistance - CHDK Forum

subject distance: CAMERA_MIN_DIST & CAMERA_MAX_DIST

  • 16 Replies
  • 7453 Views
*

Offline msl

  • *****
  • 1280
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
subject distance: CAMERA_MIN_DIST & CAMERA_MAX_DIST
« on: 30 / November / 2014, 05:45:55 »
Advertisements
See also: http://chdk.setepontos.com/index.php?topic=12102.msg118725#msg118725

I do not understand why we define a minimum and maximum for the subject distance.

set_focus(0) returns the minimal subject distance und a too large value for set_focus() returns infinity (-1). There is no risk for wrong results without limits.

There are a lot of cameras whose subject distance range is greater than 65,535 - most of the SX series. But not all of these cameras have a special definition for CAMERA_MAX_DIST.

Also the setting of the hyperfocal distance is affected when the calculating a value greater than 65,535 gets. Probably all cameras, where the hyperfocal distance is greater than 65,535, have a larger range for the focus distance.

msl
CHDK-DE:  CHDK-DE links

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: subject distance: CAMERA_MIN_DIST & CAMERA_MAX_DIST
« Reply #1 on: 30 / November / 2014, 06:00:09 »
See also: http://chdk.setepontos.com/index.php?topic=12102.msg118725#msg118725

I do not understand why we define a minimum and maximum for the subject distance.

set_focus(0) returns the minimal subject distance und a too large value for set_focus() returns infinity (-1). There is no risk for wrong results without limits.

There are a lot of cameras whose subject distance range is greater than 65,535 - most of the SX series. But not all of these cameras have a special definition for CAMERA_MAX_DIST.

Also the setting of the hyperfocal distance is affected when the calculating a value greater than 65,535 gets. Probably all cameras, where the hyperfocal distance is greater than 65,535, have a larger range for the focus distance.

msl

In part, they allow the GUI to skip over invalid values when setting the SD override values in the menu or ALT mode.

I'm not convinced the code that calculates hyperfocal distance and near and far limits is correct; but I haven't had time to pull it apart.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

*

Offline msl

  • *****
  • 1280
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: subject distance: CAMERA_MIN_DIST & CAMERA_MAX_DIST
« Reply #2 on: 01 / December / 2014, 07:41:40 »
Would it make sense to set the minimum to zero and the maximum to the test result of the camera with the longest focal lenght?

Based on the formula (fl*fl)/(F*coc)+fl I have calculated the maximum of the hyperfocal lenght for all cameras of the SX series.
Code: [Select]
Cam            FL      F      COC        Hyp  CAM_MAX_DIST
SX1         100,0    5,7    0,005     350977      65535
SX10        100,0    5,7    0,005     350977      65535
SX20        100,0    5,7    0,005     350977      66490
SX30        150,5    5,8    0,005     781194    9090910
SX40        150,5    5,8    0,005     781194    9523810
SX50        215,0    6,5    0,005    1422523    9523810
SX60        247,0    6,5    0,005    1877447
SX100        60,0    4,3    0,005     167502      65535
SX110        60,0    4,3    0,005     167502      65535
SX120        60,0    4,3    0,005     167502      65535
SX130        60,0    5,6    0,005     128631      65535
SX150        60,0    5,6    0,005     128631      65535
SX160        80,0    5,9    0,005     217029      65535
SX170        80,0    5,9    0,006     180871      65535
SX200        60,0    5,3    0,005     135909      68447
SX210        70,0    5,9    0,005     166172      65535
SX220/230    70,0    5,9    0,005     166172    2000000
SX240/260    90,0    6,8    0,005     238325    1550000
SX270/280    90,0    6,8    0,005     238325      65535
SX400       129,0    5,8    0,005     573957
SX500       129,0    5,8    0,005     573957      65535
SX510       129,0    5,8    0,006     478319      65535
SX520       180,6    6,0    0,005    1087393
The table shows the problem with CAMERA_MAX_DIST. There are also cameras of the other series affected (fl max > 40).

I think the correct setting of the hyperfocal distance is especially important for good landscape shots.

msl
CHDK-DE:  CHDK-DE links

Re: subject distance: CAMERA_MIN_DIST & CAMERA_MAX_DIST
« Reply #3 on: 01 / December / 2014, 08:29:44 »
I think the correct setting of the hyperfocal distance is especially important for good landscape shots.
I agree.

Except that the last year of working with Canon's MF capability (especially in smaller cameras without built-in MF) has let me to believe this is an uncalibrated function. So supplying the set_focus() with a hyperfocal distance will not necessarily give you a shot focussed there.   Canon AF looks for the sharpest image - it doesn't care about the actual distance. And that's what people use 99% (or more) of the time.

This part of a post from yesterday kind of confirmed my suspicions
As regards the focussing, I have found that the focus override / subject distance varies from camera to camera (even new un-molested ones). To produce relevant Subject distance figures I simply produce a plank of wood with paper stickers at 25mm intervals to produce a chart of values that relate to focussed images at the 25mm intervals. Generally I have found that once the distance exceeds 500mm  its pretty accurate. Its the smaller distances that need the attention. every camera I own except the older models such as a530 are all inaccurate regarding subject distance so I produce a true subject distance chart for each. I recently purchased 2 A4000's both new and both are different, but produce identical pictures once used with the true subject distance from my charts.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: subject distance: CAMERA_MIN_DIST & CAMERA_MAX_DIST
« Reply #4 on: 05 / December / 2014, 17:57:28 »
...
Except that the last year of working with Canon's MF capability (especially in smaller cameras without built-in MF) has let me to believe this is an uncalibrated function. So supplying the set_focus() with a hyperfocal distance will not necessarily give you a shot focussed there.   Canon AF looks for the sharpest image - it doesn't care about the actual distance. And that's what people use 99% (or more) of the time.

Speaking of "uncalibrated" definitely you are right!
These last days i swapped the broken lens of a cheap ixus 117 (aka black 115) with a new lens unit bought on ebay.
Pictures of distant subjects with canon AF were OK.
Pictures of distant subjects setting focus to -1 (or 65535) were blurred  ???   With my first ixus 115 focus override is fine.
I dismantled the ixus 117 again, screwed in the 3 screws of the sensor (bringing the sensor plane nearer to the lens) and voilĂ , setting focus to infinity via script or menu now works fine on wide angle.
With lens on tele (where the out of focus was more accentuated) still there are some problems.
Surely it was a myopic (litterally) new lens unit ... beware of chinese sellers on ebay.

ciao WW

Re: subject distance: CAMERA_MIN_DIST & CAMERA_MAX_DIST
« Reply #5 on: 05 / December / 2014, 19:09:02 »
I dismantled the ixus 117 again, screwed in the 3 screws of the sensor (bringing the sensor plane nearer to the lens) and voilĂ , setting focus to infinity via script or menu now works fine on wide angle.
How much would you estimate this moved the sensor? Less than a mm? Or several mm's?
Ported :   A1200    SD940   G10    Powershot N    G16

Re: subject distance: CAMERA_MIN_DIST & CAMERA_MAX_DIST
« Reply #6 on: 05 / December / 2014, 19:35:34 »
Less then a mm. No too much room there. 
I'm wondering how to bring the sensor nearer to the lens.
Maybe i've to reduce the tickness of the small rubber gasket among the sensor and the lens plate.
BTW i've also tried few shoots without the IR filter (under that rubber gasket).
Not sure if i definitely will transform the ixus 117 into a cheap infrared camera  :xmas
« Last Edit: 05 / December / 2014, 19:40:18 by fabri22 »

Re: subject distance: CAMERA_MIN_DIST & CAMERA_MAX_DIST
« Reply #7 on: 05 / December / 2014, 19:54:08 »
Not sure if i definitely will transform the ixus 117 into a cheap infrared camera  :xmas
There's a post / website somewhere about replacements for the standard IR filter.

Update : Found it.  I was thinking about these guys : Infragram by Public Lab and this page DIY Infrared Photography.  A bit more specialized than general IR cameras.
« Last Edit: 05 / December / 2014, 21:24:44 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline msl

  • *****
  • 1280
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: subject distance: CAMERA_MIN_DIST & CAMERA_MAX_DIST
« Reply #8 on: 09 / October / 2015, 05:50:03 »
*bump*

Still I think that the general limitation of the maximum subject distance (65535) is not quite correct - see also the table above.

The hyperfocal distance is an independent variable, which is determined by the hardware. They should be set for each camera, also for cameras with a focal lenght > 40 mm.

Canon AF looks for the sharpest image - it doesn't care about the actual distance. And that's what people use 99% (or more) of the time.
That is true. But what if the camera can not focus? Then could help the hyperfocal distance, since it is a purely physical value.

msl
CHDK-DE:  CHDK-DE links

*

Offline srsa_4c

  • ******
  • 4451
Re: subject distance: CAMERA_MIN_DIST & CAMERA_MAX_DIST
« Reply #9 on: 10 / October / 2015, 08:56:11 »
Still I think that the general limitation of the maximum subject distance (65535) is not quite correct
That's true. I have compared the MoveFocusLensToDistance firmware routines of an early DryOS (a470) and a more recent DryOS (a3400) model. The low level MoveFocusLensToDistance (not the eventproc) treats the 'distance' parameter as follows.

Early cam: distance is limited to 16 bit (bit16..bit31 are thrown away), a zero value is treated the same as 'infinity' (0xffff).
New cam: distance is 32 bit, a zero value is treated the same as 'infinity' (0xffffffff).
I might be able to detect this (16 vs 32 bit) from the sigfinder. What kind of output would be useful in stubs_entry.S?

If we can identify cameras that expect 32bit distance value, couldn't we just increase the default CAMERA_MAX_DIST for all of them to a 'big' value such as 1500 meters? Would that cause any problems on cameras that have a much shorter max distance (the last value before infinity)?

 

Related Topics


SimplePortal © 2008-2014, SimplePortal