@Name(value="chilitags::Chilitags3D_<float>") @NoOffset @Properties(inherit=chilitags.class) public class Chilitags3D extends Pointer
Pointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator, Pointer.ReferenceCounter
Constructor and Description |
---|
Chilitags3D() |
Chilitags3D(long size)
Native array allocator.
|
Chilitags3D(Pointer p)
Pointer cast constructor.
|
Chilitags3D(org.bytedeco.opencv.opencv_core.Size cameraResolution)
Creates an object ready to find the 3D pose of chilitags.
|
Modifier and Type | Method and Description |
---|---|
void |
enableFilter(boolean enabled)
\brief Enables/disables Kalman filtering on tag pose (enabled by default)
|
TagPoseMap |
estimate(org.bytedeco.opencv.opencv_core.Mat inputImage)
This is a convenience variant of estimate() which also takes care of the
detection.
|
TagPoseMap |
estimate(TagCornerMap tags) |
org.bytedeco.opencv.opencv_core.Mat |
getCameraMatrix()
Returns the camera matrix used for the pose estimation.
|
Chilitags |
getChilitags()
Accessor to the underlying (2D) Chilitags detection.
|
org.bytedeco.opencv.opencv_core.Mat |
getDistortionCoeffs()
Returns the distortion coefficients used for the pose estimation.
|
Chilitags3D |
getPointer(long i) |
Chilitags3D |
position(long position) |
org.bytedeco.opencv.opencv_core.Size |
readCalibration(BytePointer filename)
For accurate results, Chilitags3D can be provided the calibration data of
the camera detecting the chilitags.
|
org.bytedeco.opencv.opencv_core.Size |
readCalibration(String filename) |
boolean |
readTagConfiguration(BytePointer filenameOrString) |
boolean |
readTagConfiguration(BytePointer filenameOrString,
boolean omitOtherTags,
boolean readFromString)
Chilitags3D can also detect rigid assemblies of tags.
|
boolean |
readTagConfiguration(String filenameOrString) |
boolean |
readTagConfiguration(String filenameOrString,
boolean omitOtherTags,
boolean readFromString) |
void |
setCalibration(org.bytedeco.opencv.opencv_core.GpuMat newCameraMatrix,
org.bytedeco.opencv.opencv_core.GpuMat newDistCoeffs) |
void |
setCalibration(org.bytedeco.opencv.opencv_core.Mat newCameraMatrix,
org.bytedeco.opencv.opencv_core.Mat newDistCoeffs)
For accurate results, Chilitags3D can be provided the calibration data of
the camera detecting the chilitags.
|
void |
setCalibration(org.bytedeco.opencv.opencv_core.UMat newCameraMatrix,
org.bytedeco.opencv.opencv_core.UMat newDistCoeffs) |
void |
setDefaultTagSize(float defaultSize)
Sets the default size of tags (used to compute their 3D pose) when not
explicitly specified with read3DConfiguration().
|
void |
setFilterObservationNoiseCovariance(org.bytedeco.opencv.opencv_core.Mat covariance)
\brief Sets the observation noise covariance matrix a.k.a R for the Kalman filter
The observation (done by image processing on the camera image) is described
by (x,y,z,qw,qx,qy,qz) where x,y,z is the tag position and qw,qx,qy,qz is
the tag orientation in quaternion representation.
|
void |
setFilterProcessNoiseCovariance(org.bytedeco.opencv.opencv_core.Mat covariance)
\brief Sets the process noise covariance matrix a.k.a Q for the Kalman filter
The state is described by (x,y,z,qw,qx,qy,qz) where x,y,z is the tag
position and qw,qx,qy,qz is the tag orientation in quaternion
representation.
|
void |
setPersistence(float persistence)
\brief Sets the persistence of tags against being discarded when not
observed (10 by default)
|
address, asBuffer, asByteBuffer, availablePhysicalBytes, calloc, capacity, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, formatBytes, free, getDirectBufferAddress, getPointer, getPointer, getPointer, hashCode, interruptDeallocatorThread, isNull, isNull, limit, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetAddress, offsetof, offsetof, parseBytes, physicalBytes, physicalBytesInaccurate, position, put, realloc, referenceCount, releaseReference, retainReference, setNull, sizeof, sizeof, toString, totalBytes, totalCount, totalPhysicalBytes, withDeallocator, zero
public Chilitags3D(Pointer p)
Pointer(Pointer)
.public Chilitags3D(long size)
Pointer.position(long)
.public Chilitags3D(@ByVal(nullValue="cv::Size(640, 480)") org.bytedeco.opencv.opencv_core.Size cameraResolution)
By default, Chilitags3D assumes an arbitrary, but reasonnable focal length (700), and expects the dimensions of the captured images. In this configuration, the depth estimation makes sense, but it is not accurate. In order to correctly estimate the 3D pose, the intrinsic calibration parameters of your camera needs to be provided. To do so, use the readCalibration() or setCalibration() methods.
Chilitags3D also assumes by default that the 3D pose of every detected tag is expected, and that every tag is independent from the others, and that they are 20 millimetres wide. The method read3DConfiguration() can be used to specify which tags are of interest, and how they are arranged on a rigid object, and how big they are.
To first detect th tags in the image, Chilitags3D creates a Chilitags instance, which can be accessed through the getChilitags() accessors. This Chilitags instance is set to have a persistence of 0, because Chilitags3D uses a more advanced Kalman filter. See enableFilter() and setPersistence() for more details.
You can also create yourself a separate instance of Chilitagsfor the 2D detection of tags and use it by calling Chilitags3D::estimate(const TagCornerMap &tags) with the output of Chilitags::find(const cv::Mat &inputImage) instead of calling directly Chilitags3D::estimate(const cv::Mat &inputImage).
cameraResolution
- Resolution of the camera used as input (640x480 by
default). This parameter is only used to provide meaningful pose
estimation. Input images of different resolution can be provided to the
detection anyway. This parameter is overridden by readCalibration() or
setCalibration().public Chilitags3D()
public Chilitags3D position(long position)
public Chilitags3D getPointer(long i)
getPointer
in class Pointer
@ByRef public Chilitags getChilitags()
@ByVal public TagPoseMap estimate(@Const @ByRef TagCornerMap tags)
tags
- a list of tags, as returned by Chilitags::find().
camDeltaR
- Rotation from the previous camera frame to
the current camera frame, i.e rotation of the current camera frame in the
last camera frame. Quaternion format (scalar, vx, vy, vz).
camDeltaX
- Translation from the previous camera frame
to the current camera frame, i.e position of the current camera frame in
the last camera frame.{ r11 , r12 , r13 , tx r21 , r22 , r23 , ty r31 , r32 , r33 , tz 0 , 0 , 0 , 1 }
@ByVal public TagPoseMap estimate(@Const @ByRef org.bytedeco.opencv.opencv_core.Mat inputImage)
inputImage
- the image to feed to Chilitags::find().
detectionTrigger
- specifies how to combine tracking and
full detection. Tracking is drastically faster, but it can at
best return tags previously found; it won't find new ones, but
can lose some. See Chilitags::DetectionTrigger for a description of the
possible values.
camDeltaR
- Rotation from the previous camera frame to
the current camera frame, i.e rotation of the current camera frame in the
last camera frame. Quaternion format (scalar, vx, vy, vz).
camDeltaX
- Translation from the previous camera frame
to the current camera frame, i.e position of the current camera frame in
the last camera frame.{ r11 , r12 , r13 , tx r21 , r22 , r23 , ty r31 , r32 , r33 , tz 0 , 0 , 0 , 1 }
@Cast(value="bool") public boolean readTagConfiguration(@StdString BytePointer filenameOrString, @Cast(value="bool") boolean omitOtherTags, @Cast(value="bool") boolean readFromString)
filenameOrString
- The name of the YAML configuration file (or the whole
file itself as a string) describing rigid clusters of tags. The library is
distributed with a sample configuration file documenting the expected format.
omitOtherTags
- If true, ignore the tags that are not explicitly
listed in the configuration file. If false (default),
Chilitags3D::estimate() estimates the 3D pose of all the detected tags. You
can set the size of tags not described in the configuration file with
setDefaultTagSize().
readFromString
- If true, will read tag configuration directly from the
given string. If false (default) will open the file with the given name and
try to read the configuration from there.
@Cast(value="bool") public boolean readTagConfiguration(@StdString BytePointer filenameOrString)
@Cast(value="bool") public boolean readTagConfiguration(@StdString String filenameOrString, @Cast(value="bool") boolean omitOtherTags, @Cast(value="bool") boolean readFromString)
@Cast(value="bool") public boolean readTagConfiguration(@StdString String filenameOrString)
public void setDefaultTagSize(float defaultSize)
Note that is assumes all the tags have the same size. If tags have different size, you may want to list them in the configuration file (see read3DConfiguration()).
The default value of the default tag size is 20 millimetres.
public void enableFilter(@Cast(value="bool") boolean enabled)
enabled
- Whether to enable Kalman filteringpublic void setPersistence(float persistence)
persistence
- Persistence value, roughly correponds to number of framespublic void setFilterProcessNoiseCovariance(@Const @ByRef org.bytedeco.opencv.opencv_core.Mat covariance)
covariance
- 7x7 covariance matrixpublic void setFilterObservationNoiseCovariance(@Const @ByRef org.bytedeco.opencv.opencv_core.Mat covariance)
covariance
- 7x7 covariance matrixpublic void setCalibration(@ByVal org.bytedeco.opencv.opencv_core.Mat newCameraMatrix, @ByVal org.bytedeco.opencv.opencv_core.Mat newDistCoeffs)
Note that this method can be called as often as needed with a new calibration configuration (for instance if the user switched to another camera).
newCameraMatrix
- the 3x3 matrix of the camera intrinsics (see
https://en.wikipedia.org/wiki/Camera_resectioning#Intrinsic_parameters).newDistCoeffs
- a vector containing the distortion coefficients.public void setCalibration(@ByVal org.bytedeco.opencv.opencv_core.UMat newCameraMatrix, @ByVal org.bytedeco.opencv.opencv_core.UMat newDistCoeffs)
public void setCalibration(@ByVal org.bytedeco.opencv.opencv_core.GpuMat newCameraMatrix, @ByVal org.bytedeco.opencv.opencv_core.GpuMat newDistCoeffs)
@ByVal public org.bytedeco.opencv.opencv_core.Size readCalibration(@StdString BytePointer filename)
Note that this method can be called as often as needed with a new calibration configuration (for instance if the user switched to another camera).
This method is similar to setCalibration, but reads the camera calibration information directly from a file, as generated by OpenCV's 'calibration' sample.
filename
- the path to a file containing the calibration data@ByVal public org.bytedeco.opencv.opencv_core.Size readCalibration(@StdString String filename)
@Const @ByRef public org.bytedeco.opencv.opencv_core.Mat getCameraMatrix()
Copyright © 2022. All rights reserved.