Infra Red corrected Diffraction Aware Depth of Field

Started by garry23, May 10, 2016, 11:08:44 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

garry23

The standard ML diffraction aware Depth of Field feedback assumes the camera is shooting in the optical bands and uses a centre frequency of 550nm.

But what if you have an IR converted camera, like I do?

You could recompile ML and change the frequency, as suggested in focus.c; or you could use the attached script to help you 'fool' ML into giving you the correct near and far depths of field.

To use the script, simply set your optical (sic) Circle of Confusion in the ML menu and run the script (which you will find under the Focus menu).

The script tells you the CoC value to use for IR. The script uses a frequency of 850nm, but you can change this as you please.

Note the CoC to use changes with aperture, hence this approach will only be useful for those that tend to shoot at 'fixed' apertures, eg landscape photographers; or those prepared to reset the CoC to the optical baseline and rerun the script at the new aperture.

Hint: a better solution would be to code frequency as a user variable in the ML menu. Until then, this little script may help some out.

function IR()
local CoC_op = (lens.focal_length * lens.focal_length)/(camera.aperture.value * (lens.hyperfocal - lens.focal_length))*1000
local CoC_menu = menu.get("DOF Settings","Circle of Confusion")
local freq = 850  -- change this to the frequency of your choice, eg for different IR bands or even UV shooting
local k2 = (CoC_menu * CoC_menu - CoC_op*CoC_op)/(550*550)
local CoC_menu_ir = math.floor(math.sqrt((CoC_menu * CoC_menu) + k2 * (550 * 550 - freq * freq)))
display.notify_box("Adjust ML Circle of Confusion to "..CoC_menu_ir, 5000)
end

keymenu = menu.new
{
    parent = "Focus",
    name = "IR",
    help = "Adjust ML Circle of Confusion to this value for IR",
    submenu =
{
{
name = "Run Script",
help = "Does what it says after pressing SET",
select = function(this) task.create(IR) end,
}
}
}