Package trclib.vision
Class TrcHomographyMapper
java.lang.Object
trclib.vision.TrcHomographyMapper
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 ClassesModifier and TypeClassDescriptionstatic class
This class implements a homography rectangle with the four coordinate points. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTrcHomographyMapper
(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.TrcHomographyMapper
(TrcHomographyMapper.Rectangle srcRect, TrcHomographyMapper.Rectangle dstRect) Constructor: Create an instance of the object. -
Method Summary
-
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.
-