Package trclib.vision

Class TrcHomographyMapper

java.lang.Object
trclib.vision.TrcHomographyMapper

public class TrcHomographyMapper extends Object
This class implements a Homography Mapper. It can be used to map the vision camera's pixel coordinates to the robot's real world coordinates.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    This class implements a homography rectangle with the four coordinate points.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final org.opencv.core.Mat
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    TrcHomographyMapper(org.opencv.core.Point srcTopLeft, org.opencv.core.Point srcTopRight, org.opencv.core.Point srcBottomLeft, org.opencv.core.Point srcBottomRight, org.opencv.core.Point dstTopLeft, org.opencv.core.Point dstTopRight, org.opencv.core.Point dstBottomLeft, org.opencv.core.Point dstBottomRight)
    Constructor: Create an instance of the object.
    Constructor: Create an instance of the object.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.opencv.core.Point
    mapPoint(org.opencv.core.Point srcPoint)
    This method maps a source point to the destination point using the homography matrix.
    private double[][]
    multiply(double[][] firstMatrix, double[][] secondMatrix)
    This method multiplies two matrixes.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • homographyMatrix

      private final org.opencv.core.Mat homographyMatrix
  • Constructor Details

    • TrcHomographyMapper

      public TrcHomographyMapper(org.opencv.core.Point srcTopLeft, org.opencv.core.Point srcTopRight, org.opencv.core.Point srcBottomLeft, org.opencv.core.Point srcBottomRight, org.opencv.core.Point dstTopLeft, org.opencv.core.Point dstTopRight, org.opencv.core.Point dstBottomLeft, org.opencv.core.Point dstBottomRight)
      Constructor: Create an instance of the object.
      Parameters:
      srcTopLeft - specifies the source top left point (e.g. top left of camera pixel coordinate).
      srcTopRight - specifies the source top right point (e.g. top right of camera pixel coordinate).
      srcBottomLeft - specifies the source bottom left point (e.g. bottom left of camera pixel coordinate).
      srcBottomRight - specifies the source bottom right point (e.g. bottom right of camera pixel coordinate).
      dstTopLeft - specifies the destination top left point (e.g. top left of robot world coordinate).
      dstTopRight - specifies the destination top right point (e.g. top right of robot world coordinate).
      dstBottomLeft - specifies the destination bottom left point (e.g. bottom left of robot world coordinate).
      dstBottomRight - specifies the destination bottom right point (e.g. bottom right of robot world coordinate).
    • TrcHomographyMapper

      public TrcHomographyMapper(TrcHomographyMapper.Rectangle srcRect, TrcHomographyMapper.Rectangle dstRect)
      Constructor: Create an instance of the object.
      Parameters:
      srcRect - specifies the source rectangle (e.g. camera pixel coordinate).
      dstRect - specifies the destination rectangle (e.g. robot world coordinate).
  • Method Details

    • mapPoint

      public org.opencv.core.Point mapPoint(org.opencv.core.Point srcPoint)
      This method maps a source point to the destination point using the homography matrix.
      Parameters:
      srcPoint - specifies the source point.
      Returns:
      the mapped destination point.
    • multiply

      private double[][] multiply(double[][] firstMatrix, double[][] secondMatrix)
      This method multiplies two matrixes. The multiply in Core.gemm is not functioning correctly for the job.
      Parameters:
      firstMatrix - specifies the first matrix for the multiplication.
      secondMatrix - specifies the second matrix for the multiplication.
      Returns:
      product matrix.