Class VRLandMarkMethod

java.lang.Object
videoRangePanel.vrmethods.AbstractVRMethod
videoRangePanel.vrmethods.landMarkMethod.VRLandMarkMethod
All Implemented Interfaces:
VRMethod

public class VRLandMarkMethod extends AbstractVRMethod
The LandMark uses landmarks at known positions or at known angles from the position the image was taken to calculate an animal's position. Two Landmark's essentially give you the four out of the five vital bits of information required to get a true location (on the sea surface). Image bearing, pitch and tilt and degrees per pixel. The fifth bit of information , the height from which the image was taken, is defined by the user.

Angular convention for this module and method.

Bearing- 0==north, 90==east 180=south, 270==west

Pitch- 90=-g, 0=0g, -90=g

Tilt 0->180 -camera turning towards left to upside down 0->-180 camera turning right to upside down

Author:
Jamie Macaulay
  • Field Details

    • SET_LANDMARK

      public static final int SET_LANDMARK
      See Also:
    • SET_LANDMARK_READY

      public static final int SET_LANDMARK_READY
      See Also:
    • NEW_IMAGE_BEARING_CAL

      public static final int NEW_IMAGE_BEARING_CAL
      New image orientation measurement.
      See Also:
    • NEW_MESURMENT

      public static final int NEW_MESURMENT
      New measurement has been made.
      See Also:
  • Constructor Details

    • VRLandMarkMethod

      public VRLandMarkMethod(VRControl vrControl)
      VRLandMark method constructor
      Parameters:
      vrControl - - reference to the vrControl.
  • Method Details

    • getName

      public String getName()
      Description copied from interface: VRMethod
      The name of this type of analysis method.
      Returns:
      the name of the method
    • getSelectedLMGroup

      public LandMarkGroup getSelectedLMGroup()
      Get the currently selected landmark group. This contains a list of the landmarks which can be set on the image
      Returns:
      the current landmark group.
    • setImagePosVals

      public VRMeasurement setImagePosVals(VRMeasurement measurement)
      Calculate the image bearing, pitch and tilt.
      Parameters:
      measurement - - the measurement data unit.
      Returns:
      the updated measurment data unit.
    • wrap360

      public static double wrap360(double t)
      Make sure an angle falls between zero and 2pi(360 degrees)
      Returns:
      angle between 0 and 360;
    • measureAnimal

      public void measureAnimal(Point point)
      Measure the location of an animal for a certain location in the image.
      Parameters:
      point - - the location of the animal in pixels on the screen
    • calcVals

      public void calcVals()
      Calculate the mean pixels per degree and the tilt of the mean tilt of the image based on the set landmarks. Note there must be at least two landmarks but more is preferable.
    • isInList

      public boolean isInList(LandMark landMark)
      Check whether a landmark is in the current list of landmarks whihc have been set.
      Parameters:
      landMark - - the landmakr to check
      Returns:
      true if in the list.
    • setLandMark

      public void setLandMark(LandMark landMark, Point point)
      Set a landmark in the set landmarks list.
      Parameters:
      landMark - - the landmark on the screen.
      point - - the location of the landmark on the image.
    • removeLandMark

      public void removeLandMark(LandMark landMark)
      Remove a landmark from the landmark list.
      Parameters:
      landMark - - the landmark to remove.
    • isCalcReady

      public boolean isCalcReady()
      Check whether a landmark based calculation is ready. If there are two landmarks then the method is ready for an animal measurement.
      Returns:
      true if ready for measurement;
    • getRibbonPanel

      public PamPanel getRibbonPanel()
    • getSettingsPanel

      public PamPanel getSettingsPanel()
    • clearOverlay

      public void clearOverlay()
      Description copied from interface: VRMethod
      Clears all user interactions and resets overlay. Required for changes to settings, picture being changed and other interactions not directly associated with the VRMethod.
    • clearLandMarks

      public void clearLandMarks()
    • update

      public void update(int updateType)
      Description copied from interface: VRMethod
      Called from other parts of the module whenever a method panel may needed updated e.g. when new calibration data is manually added in the settings dialog.
      Specified by:
      update in interface VRMethod
      Overrides:
      update in class AbstractVRMethod
      Parameters:
      updateType - - the update flag.
    • printValues

      public void printValues()
      Print the current values.
    • calcAnimalBearing

      public static double calcAnimalBearing(double tilt, Point lndmrkPoint, Point animalPoint, double calValue)
      Calculates the bearing of the target animal based on a landmark point, the animal location and a calibration value;
      Parameters:
      tilt - - tilt of the image in radians.
      calValue - - calibration value in pixels per degree
      landmrkp1 - -landmark point.
      animal - -animal point.
      Returns:
      bearing relative to the landmark - radians.
    • calcAnimalPitch

      public static double calcAnimalPitch(double tilt, Point lndmrkPoint, Point animalPoint, double calValue)
      Calculates the pitch of the target animal based on a landmark point, the animal location and a calibration value;
      Parameters:
      tilt - - tilt of the image in radians.
      calValue - - calibration value in pixels per degree.
      landmrkp1 - -a point on the image for which we know the pitch and bearing.
      animal - -animal point.
      Returns:
      pitch relative to the landmark .radians.
    • calcBearingDiffAnimal

      public static double calcBearingDiffAnimal(double tilt, Point landmrkp1, Point animal)
      Calculates the bearing of the animal in pixels
      Parameters:
      tilt - - tilt of the image in radians.
      landmrkp1 - -a point on the image for which we know the pitch and bearing.
      animal - -animal point.
      Returns:
      bearing in pixels.
    • calcPitchDiffAnimal

      public static double calcPitchDiffAnimal(double tilt, Point landmrkp1, Point animal)
      Calculates the pitch of the animal in pixels
      Parameters:
      tilt - - tilt of the image in radians.
      landmrkp1 - -a point on the image for which we know the pitch and bearing.
      animal - -animal point.
      Returns:
      bearing in pixels.
    • calcPerpPoint

      public Point calcPerpPoint(double tilt, Point landmrkP1, Point landmrkP2, LandMark landmrk1, LandMark landmrk2, LatLong imagePos)
      Calculates location of the perpendicular vertex of the triangle defined by landmarks 1 and 2, with the side of the triangle following the tilt of the picture.
      Parameters:
      tilt - -tilt of image
      landmrkP1 - -landmark 1 point on image
      landmrkP2 - -landmark 2 point on image
      landmrk1 - -landmark 1
      landmrk2 - -landmark 2
      imagePos - -the from which the image was taken from. Note that this can be null if the landmarks are defined by bearings rathar than GPS co-ordinates.
      Returns:
      the perpindicular vertex of a tringle where the other two vertex have been defined by landmark points.
    • calcPerpPoint

      public static Point calcPerpPoint(double tilt, double bearingDiff, Point landMark2)
      Calculates the point at which the perpendicular corner of the pitch/bearing triangle resides.
      Parameters:
      tilt - -tilt in radians
      bearingDiff - -difference in bearing angle, in pixels.
    • calcTilt

      public static double calcTilt(Point landmrkP1, Point landmrkP2, LandMark landmrk1, LandMark landmrk2, LatLong imagePos)
    • calcPitch

      public static double calcPitch(LandMark landMrk, LatLong imagePos)
      Calculate the pitch between a landMark and image location.
      Parameters:
      landMrk - -current landmark
      imagePos - -image location
      Returns:
    • calcTilt

      public static double calcTilt(Point landmrkP1, Point landmrkP2, double bearingDiff, double pitchDiff)
      Calculates the tilt of the image based on two landmarks selected on that image and the known angles between those landmarks.
      Parameters:
      landmrkP1 - - the location on the image of landmark1-pixels
      landmrkP2 - - the location on the image of landmark2-pixels
      bearingDiff - - the difference in heading between landMark1 and landMark2
      pitchDiff - - the difference in pitch between landMark1 and landMark2
      Returns:
      tilt in radians
    • getImagePos

      public LatLong getImagePos(boolean tideHeight)
      Return the position the image was taken from. This is either the location from which bearings were determined for the current land mark group or uses the location manager to determine a position. Note that in the event any landmark is defined by bearings rather than a latlong then the position of the image has to be the location from which those bearings were calculated.
      Returns:
      the position of the image.
    • getTilt

      public Double getTilt()
      Get the current tilt
      Returns:
      the tilt
    • getVRControl

      public VRControl getVRControl()
      Get the controller for the module.
      Returns:
      the control
    • getCurrentStatus

      public int getCurrentStatus()
      Get the current status flag.
      Returns:
      the status flag.
    • setCurrentStatus

      public void setCurrentStatus(int flag)
      Set the current status flag.
      Parameters:
      flag - - the current status flag to set
    • getLandMarkPoints

      public ArrayList<Point> getLandMarkPoints()
      Get the current landmark points.
      Returns:
      the land mark points.
    • getTiltVals

      public ArrayList<Double> getTiltVals()
      Tilt measurment for all combinations of landmarks.
      Returns:
      array list of points.
    • getSetLandMarks

      public ArrayList<LandMark> getSetLandMarks()
      Get the currently set landmarks.
      Returns:
      the set landmarks
    • getOverlayAWT

      public VROverlayAWT getOverlayAWT()
      Description copied from interface: VRMethod
      The AWT overlay. This handles all graphical interactions within AWT
      Returns:
      the awt overlay
    • getOverlayFX

      public VROverlayFX getOverlayFX()
      Description copied from interface: VRMethod
      The FX overlay. This handles all graphical interactions within JavaFX
      Returns:
      the awt overlay