Class BackgroundSub

java.lang.Object
tritechgemini.detect.BackgroundSub

public class BackgroundSub extends Object
Really simple background subtraction class
Author:
Doug Gillespie
  • Constructor Details

    • BackgroundSub

      public BackgroundSub()
  • Method Details

    • removeBackground

      public SonarImageRecordI removeBackground(SonarImageRecordI geminiRecord, boolean updateFirst)
      Remove background from an image record.
      Parameters:
      geminiRecord - Image record
      updateFirst - update the background measurement before subtraction
      Returns:
      clone of the input record with updated background.
    • removeBackground

      public byte[] removeBackground(byte[] data, int nBearing, int nRange, boolean updateFirst)
      Remove background from raw image data
      Parameters:
      data - raw image data
      updateFirst - update the background measurement before subtraction
      Returns:
      new array of data with background subtracted.
    • calcBackground

      public int[] calcBackground(byte[] data, int nBearing, int nRange)
    • getBackground

      public byte[] getBackground()
      Get the current background.
      Note that this may be greater in dimension than the current image size, but should never be smaller
      Returns:
      background converted to byte.
    • getVariance

      public int[] getVariance()
      Get the variance of the data.
      Note that this may be greater in dimension than the current image size, but should never be smaller
      Returns:
      variance
    • getSTDI

      public short[] getSTDI()
      Get the standard deviation of the data in short integers.
      Note that this may be greater in dimension than the current image size, but should never be smaller
      Returns:
      the standard deviation of the data.
    • getSTD

      public byte[] getSTD()
      Get the standard deviation of the data.
      Note that this may be greater in dimension than the current image size, but should never be smaller
      Returns:
      the standard deviation of the data.
    • getTimeConstant

      public int getTimeConstant()
      Background scale is 1/the update fraction, i.e. a big number updates slowly.
      Returns:
      the backgroundScale
    • setTimeConstant

      public void setTimeConstant(int timeConstant)
      Background scale is 1/the update fraction, i.e. a big number updates slowly.
      Parameters:
      backgroundScale - the backgroundScale to set
    • setRemovalScale

      public void setRemovalScale(double removalScale)
      Set a scaling factor for background removal. 1. is remove the background as is, 1.1 would remove a bit more than the background, etc.
      Parameters:
      removalScale -
    • setRemovalScale

      public void setRemovalScale(double backgroundScale, double backgroundSTDs)
    • getRemovalScale

      public double getRemovalScale()
      Get the scaling factor for background removal. 1. is remove the background as is, 1.1 would remove a bit more than the background, etc.
      Returns:
      removal scale
    • isCalculateVariance

      public boolean isCalculateVariance()
      Check whether or not calculating the variance (and STD) in the levels as the means. Only worth doing this if you want these stats for your detector
      Returns:
      the calculateVariance
    • setCalculateVariance

      public void setCalculateVariance(boolean calculateVariance)
      Say whether or not to calculate the variance (and STD) in the levels as the means. Only worth doing this if you want these stats for your detector
      Parameters:
      calculateVariance - the calculateVariance to set
    • getUpdateCount

      public int getUpdateCount()
      Count of background updates. Can be used to prevent detection for a while as the background settles.
      Returns:
      the updateCount
    • resetUpdateCount

      public void resetUpdateCount()
      Rest the updatecount to zero. this gets called after an OOW has finished, which can cause a lot of false dets when it goes back in the water. This will cause anything using the data to know the background isn't stable and to wait a bit before trying to detect.
    • getLastBackgroundRecord

      public SonarImageRecordI getLastBackgroundRecord()
      Get the last record used for a background subtraction.
      Returns:
      last record used in background subtraction.