DoF.calculate()

Calculate depth of field properties

Usage

Hover over inputs/exits for more info.

var DoF = require('machinepack-dof');


// Calculate depth of field properties

DoF.calculate({

coc: 0.032,

focalLength: 50,

aperture: 2.8,

focusDistance: 5000,

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// Invalid input on 1 or more parameters.

invalidInputParameter: function () {

 

},

// OK.

success: function (result) {

 

},

});

Inputs

coc required

Camera censor circle of confusion parameter in millimetres.

0.032
focalLength required

Lens focal length parameter in millimetres.

50
aperture required

Lens aperture parameter in f-stops.

2.8
focusDistance required

Distance between focus subject and the camera sensor, in millimetres.

5000

Exits

error

An unexpected error occurred.

invalidInputParameter

Invalid input on 1 or more parameters.

success

OK.

{ focusLimitNear: 4245.53,
  focusLimitFar: 6080.57,
  dof: 1835.04,
  hyperfocalDistance: 27904.59 }