class TriangleSimilarityDistanceCalculator:
    knownSize = 0
    focalLength = 0;

    def __init__(self, knownSize, perceivedFocalLength = None):
        self.knownSize = knownSize
        self.focalLength = perceivedFocalLength

    # Call this to calibrate a camera and then use the calibrated focalLength value
    # when using this class to calculate real distances.
    def CalculatePerceivedFOVAtGivenDistance(self, perceivedSize, distance):
        focalLength = perceivedSize * distance / float(self.knownSize)
        return focalLength

    # This will return the real world distance of the known object.
    def CalcualteDistance(self, perceivedSize):
        if self.focalLength == None:
            raise ValueError("Did you forget to calibrate this camera and set the perceived focal length?")
        distance = self.knownSize * self.focalLength / float(perceivedSize)
        return distance


PFL_H_C920 = 622
PFL_V_C920 = 625
PFL_H_LC3000 = 652
PFL_V_LC3000 = 652

class TriangleSimilarityDistanceCalculator:
    knownSize = 0
    focalLength = 0;

    def __init__(self, knownSize, perceivedFocalLength = None):
        self.knownSize = knownSize
        self.focalLength = perceivedFocalLength

    # Call this to calibrate a camera and then use the calibrated focalLength value
    # when using this class to calculate real distances.
    def CalculatePerceivedFocalLengthAtGivenDistance(self, perceivedSize, knownDistance):
        focalLength = perceivedSize * knownDistance / float(self.knownSize)
        return focalLength

    # This will return the real world distance of the known object.
    def CalcualteDistance(self, perceivedSize):
        if self.focalLength == None:
            raise ValueError("Did you forget to calibrate this camera and set the perceived focal length?")
        distance = self.knownSize * self.focalLength / float(perceivedSize)
        return distance

Update measured Focal Lengths for C920.
Update measured Focal Lengths for C920.

+ 
+ PFL_H_C920 = 622
+ PFL_V_C920 = 625
+ PFL_H_LC3000 = 652
+ PFL_V_LC3000 = 652
+ 
  class TriangleSimilarityDistanceCalculator:
      knownSize = 0
      focalLength = 0;
  
      def __init__(self, knownSize, perceivedFocalLength = None):
          self.knownSize = knownSize
          self.focalLength = perceivedFocalLength
  
      # Call this to calibrate a camera and then use the calibrated focalLength value
      # when using this class to calculate real distances.
-     def CalculatePerceivedFOVAtGivenDistance(self, perceivedSize, distance):
+     def CalculatePerceivedFocalLengthAtGivenDistance(self, perceivedSize, knownDistance):
-         focalLength = perceivedSize * distance / float(self.knownSize)
+         focalLength = perceivedSize * knownDistance / float(self.knownSize)
          return focalLength
  
      # This will return the real world distance of the known object.
      def CalcualteDistance(self, perceivedSize):
          if self.focalLength == None:
              raise ValueError("Did you forget to calibrate this camera and set the perceived focal length?")
          distance = self.knownSize * self.focalLength / float(perceivedSize)
          return distance
  
Update measured Focal Lengths for C920.
## Code Before:
class TriangleSimilarityDistanceCalculator:
    knownSize = 0
    focalLength = 0;

    def __init__(self, knownSize, perceivedFocalLength = None):
        self.knownSize = knownSize
        self.focalLength = perceivedFocalLength

    # Call this to calibrate a camera and then use the calibrated focalLength value
    # when using this class to calculate real distances.
    def CalculatePerceivedFOVAtGivenDistance(self, perceivedSize, distance):
        focalLength = perceivedSize * distance / float(self.knownSize)
        return focalLength

    # This will return the real world distance of the known object.
    def CalcualteDistance(self, perceivedSize):
        if self.focalLength == None:
            raise ValueError("Did you forget to calibrate this camera and set the perceived focal length?")
        distance = self.knownSize * self.focalLength / float(perceivedSize)
        return distance

## Instruction:
Update measured Focal Lengths for C920.
## Code After:

PFL_H_C920 = 622
PFL_V_C920 = 625
PFL_H_LC3000 = 652
PFL_V_LC3000 = 652

class TriangleSimilarityDistanceCalculator:
    knownSize = 0
    focalLength = 0;

    def __init__(self, knownSize, perceivedFocalLength = None):
        self.knownSize = knownSize
        self.focalLength = perceivedFocalLength

    # Call this to calibrate a camera and then use the calibrated focalLength value
    # when using this class to calculate real distances.
    def CalculatePerceivedFocalLengthAtGivenDistance(self, perceivedSize, knownDistance):
        focalLength = perceivedSize * knownDistance / float(self.knownSize)
        return focalLength

    # This will return the real world distance of the known object.
    def CalcualteDistance(self, perceivedSize):
        if self.focalLength == None:
            raise ValueError("Did you forget to calibrate this camera and set the perceived focal length?")
        distance = self.knownSize * self.focalLength / float(perceivedSize)
        return distance
