focal length in pixels code example Example: how to calculate focal length in pixels F(mm) = F(pixels) * SensorWidth(mm) / ImageWidth (pixel).