BTW, I took a deeper look at the values of DOF given by CHDK. I think I found what is the problem by playing with a SX30IS of one of my friend. The SX30IS shows exactly the same bug in DOF calculation as the S5IS, so this might be a bug affecting all cameras. I found that the DOF calculations are accurate until the value of the hyperfocal distance reaches about 65536 (2^16). This occurs only at focal length higher than about 50 mm for compact cameras. After that, the value returned by the function get_hyp_dist becomes negative (16 bit int overflow...). This is a problem because, in the source code (/trunk/core/gui_osd.c), the near and far limits of DOF are calculated from the value of the hyperfocal distance. This explains why the CHDK DOF calculation returns the value "inf" for near and far limits at a focal length higher than 50mm. Note that, as the focal length is increased further, the value of hyperfocal distance eventually goes back to positive again (around a focal length of about 65mm). The values of near and far limit of DOF are then not returned as "inf" anymore, but they are clearly not good anyway. For SX30IS, the hyperfocal distance goes back and forth from negative to positive 5 or 6 times when the camera is zoomed in from 4.3 mm to 150.5 mm.

For SX30IS, the hyperfocal distance goes back and forth from negative to positive 5 or 6 times when the camera is zoomed in from 4.3 mm to 150.5 mm.

On the SX30 set the 'Use EXIF Subj. Dist. (PC65)' option in the DOF calculator.

We don't actually have an FPU, but emulation seems to work so it should be OK for this.

dof.hyperfocal_distance=(fl*fl)/(10*circle_of_confusion*av);

dof.hyperfocal_distance=((fl/10)*(fl/10))/(10*circle_of_confusion*av)*100;

if(fl<16384) dof.hyperfocal_distance=(fl*fl)/(10*circle_of_confusion*av);else dof.hyperfocal_distance=fl*(fl/(10*circle_of_confusion*av));

av - maximum value is 10 (f/32), let assume possible (but impossible ) value of 16 (f/256)

m=dof.hyperfocal_distance*dof.subject_distance

Started by obsidian General Discussion and Assistance

Started by DBgit « 1 2 » Script Writing

Started by mary Feature Requests

Started by chdecker General Discussion and Assistance

Started by bhardin Feature Requests