Você queria a matemática, então aqui vai:
Você precisa conhecer o CoC da sua câmera. Os sensores Canon tamanho APS-C esse número é 0,018, para a Nikon APS-C 0,019, para sensores full frame e filmes de 35 mm o número é 0,029.
A fórmula é completa:
CoC (mm) = viewing distance (cm) / desired final-image resolution (lp/mm) for a 25 cm viewing distance / enlargement / 25
Outra maneira de fazer isso é a fórmula de Zeiss :
c = d/1730
Onde d é o tamanho diagonal do sensor ec é o CoC máximo aceitável. Isso produz números ligeiramente diferentes.
Você precisa calcular primeiro a distância hiperfocal para a lente e a câmera (esta fórmula é imprecisa com distâncias próximas à distância focal, por exemplo, macro extrema):
HyperFocal[mm] = (FocalLength * FocalLength) / (Aperture * CoC)
por exemplo:
50mm lens @ f/1.4 on a full frame: 61576mm (201.7 feet)
50mm lens @ f/2.8 on a full frame: 30788mm (101 feet)
50mm lens @ f/1.4 on a Canon APS frame: 99206mm (325.4 feet)
50mm lens @ f/2.8 on a Canon APS frame: 49600mm (162.7 feet)
Em seguida, você precisa calcular o ponto próximo, que é a distância mais próxima que estará em foco, dada a distância entre a câmera e o objeto:
NearPoint[mm] = (HyperFocal * distance) / (HyperFocal + (distance – focal))
por exemplo:
50mm lens @ f/1.4 on a full frame with a subject at 1m distance: 0.984m (~16mm in front of target)
50mm lens @ f/1.4 on a full frame with a subject at 3m distance: 2.862m (~137mm in front of target)
50mm lens @ f/2.8 on a full frame with a subject at 1m distance: 0.970m (~30mm in front of target)
50mm lens @ f/2.8 on a full frame with a subject at 3m distance: 2.737m (~263mm in front of target)
50mm lens @ f/1.4 on a Canon APS frame with a subject at 1m distance: 0.990m (~10mm in front of target)
50mm lens @ f/1.4 on a Canon APS frame with a subject at 3m distance: 2.913m (~86mm in front of target)
50mm lens @ f/2.8 on a Canon APS frame with a subject at 1m distance: 0.981m (~19mm in front of target)
50mm lens @ f/2.8 on a Canon APS frame with a subject at 3m distance: 2.831m (~168mm in front of target)
Em seguida, você precisa calcular o ponto distante, que é a maior distância que estará em foco, dada a distância entre a câmera e o objeto:
FarPoint[mm] = (HyperFocal * distance) / (HyperFocal – (distance – focal))
por exemplo:
50mm lens @ f/1.4 on a full frame with a subject at 1m distance: 1.015m (~15mm behind of target)
50mm lens @ f/1.4 on a full frame with a subject at 3m distance: 3.150m (~150mm behind of target)
50mm lens @ f/2.8 on a full frame with a subject at 1m distance: 1.031m (~31mm behind of target)
50mm lens @ f/2.8 on a full frame with a subject at 3m distance: 3.317m (~317mm behind of target)
50mm lens @ f/1.4 on a Canon APS frame with a subject at 1m distance: 1.009m (~9mm behind of target)
50mm lens @ f/1.4 on a Canon APS frame with a subject at 3m distance: 3.091m (~91mm behind of target)
50mm lens @ f/2.8 on a Canon APS frame with a subject at 1m distance: 1.019m (~19mm behind of target)
50mm lens @ f/2.8 on a Canon APS frame with a subject at 3m distance: 3.189m (~189mm behind of target)
Agora você pode calcular a distância focal total:
TotalDoF = FarPoint - NearPoint
por exemplo:
50mm lens @ f/1.4 on a full frame with a subject at 1m distance: 31mm
50mm lens @ f/1.4 on a full frame with a subject at 3m distance: 228mm
50mm lens @ f/2.8 on a full frame with a subject at 1m distance: 61mm
50mm lens @ f/2.8 on a full frame with a subject at 3m distance: 580mm
50mm lens @ f/1.4 on a Canon APS frame with a subject at 1m distance: 19mm
50mm lens @ f/1.4 on a Canon APS frame with a subject at 3m distance: 178mm
50mm lens @ f/2.8 on a Canon APS frame with a subject at 1m distance: 38mm
50mm lens @ f/2.8 on a Canon APS frame with a subject at 3m distance: 358mm
Portanto, a fórmula completa com CoC e HyperFocal pré-calculada:
TotalDoF[mm] = ((HyperFocal * distance) / (HyperFocal – (distance – focal))) -(HyperFocal * distance) / (HyperFocal + (distance – focal))
Ou simplificado:
TotalDoF[mm] = (2 * HyperFocal * distance * (distance - focal)) / (( HyperFocal + distance - focal) * (HyperFocal + focal - distance))
Com o CoC pré-calculado: fiz uma tentativa de simplificar as seguintes equações com as seguintes substituições: a = distância de visualização (cm) b = resolução desejada da imagem final (lp / mm) para uma distância de visualização de 25 cm c = ampliação d = Distância focal e = Abertura f = distância X = CoC
TotalDoF = ((((d * d) / (e * X)) * f) / (((d * d) / (e * X)) – (f – d))) - ((((d * d) / (e * X)) * f) / (((d * d) / (e * X)) + (f – d)))
Simplificado:
TotalDoF = (2*X*d^2*f*e(d-f))/((d^2 - X*d*e + X*f*e)*(d^2 + X*d*e - X*f*e))
Ainda mais simplificado com o WolframAlpha:
TotalDoF = (2 * d^2 * e * (d - f) * f * X)/(d^4 - e^2 * (d - f)^2 * X^2)
Ou se nada for pré-calculado, você recebe esse monstro, que não pode ser usado:
TotalDoF = ((FocalLength * FocalLength) / (Aperture * (viewing distance (cm) / desired final-image resolution (lp/mm) for a 25 cm viewing distance / enlargement / 25)) * distance) / ((FocalLength * FocalLength) / (Aperture * (viewing distance (cm) / desired final-image resolution (lp/mm) for a 25 cm viewing distance / enlargement / 25)) – (distance – focal)) - ((FocalLength * FocalLength) / (Aperture * (viewing distance (cm) / desired final-image resolution (lp/mm) for a 25 cm viewing distance / enlargement / 25)) * distance) / ((FocalLength * FocalLength) / (Aperture * (viewing distance (cm) / desired final-image resolution (lp/mm) for a 25 cm viewing distance / enlargement / 25)) + (distance – focal))
Simplificado:
(50*a*b*c*d^2*f*e*(d-f))/((25*b*c*d^2 - a*d*e + a*f*e)*(25*b*c*d^2 + a*d*e - a*f*e)
Então, basicamente, use CoC recalculado e HyperFocal :)