Skip to content

Instantly share code, notes, and snippets.

@Shrinks99
Created February 4, 2022 16:13
Show Gist options
  • Save Shrinks99/04ecc04da478ee6bd4a53c935971e3c5 to your computer and use it in GitHub Desktop.
Save Shrinks99/04ecc04da478ee6bd4a53c935971e3c5 to your computer and use it in GitHub Desktop.
A simple calculator to determine an image's focal length in pixels based on recorded camera data, lens info, and plate info
imgWidthPx = float(input("Image width in pixels: "))
sensorWidth = float(input("Sensor width in mm: "))
focalLen = float(input("Lens focal length in mm: "))
focalLenPx = str(float(float(focalLen / sensorWidth) * imgWidthPx))
print("The focal length in pixels is: " + focalLenPx)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment