This is a DoF (photography depth of field) calculator implemented as a web service. The input and output are arranged in JSON format. The input parameters are:
- m : sensor resolution. Number of pixels in which the sensor is divided along its longer side. In terms of the circle of confusion (CoC) this would be: m = (Length of sensor) / (Circle of Confusion). (We choose 1250 as default value, which corresponds to a CoC of 0.028 mm)
- S : length of the (longer side of the) sensor in milimeters
- f : f-number of the lense ( f = (Focal length in mm) / (Aperture of the lense in mm)
- F : focal length in mm
- x0 : focused distance in meters
The output parameters:
- x_near : focused region’s near limit (meters)
- x_far : focused region’s far limit (meters)
- DOF : depth of field (meters). DOF = x_far – x_near
- H : hyperfocal distance (meters)
The calculator receives the queries in JSON format through a POST request (triggered by the form in the app page). The two sliders are meant to smoothly modify the focused distance and the f-number through websockets. However, the web service is hosted in Heroku, which does not support websockets on his current cedar stack. Xhr-polling is used instead, so the final outcome is that the sliders behave sort of sluggishly.
Updated (23-October-2013) – Heroku: WebSockets now in public beta
Following the guidelines in the Heroku dev center, we have activated them for the DoF JSON online calculator. The sliders behave now quite smoothly.