|
OpenCV 2.4.2 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.opencv.features2d.GenericDescriptorMatcher
public class GenericDescriptorMatcher
Abstract interface for extracting and matching a keypoint descriptor. There
are also "DescriptorExtractor" and "DescriptorMatcher" for these purposes but
their interfaces are intended for descriptors represented as vectors in a
multidimensional space. GenericDescriptorMatcher
is a more
generic interface for descriptors. DescriptorMatcher
and
GenericDescriptorMatcher
have two groups of match methods: for
matching keypoints of an image with another image or with an image set.
Field Summary | |
---|---|
static int |
FERN
|
protected long |
nativeObj
|
static int |
ONEWAY
|
Constructor Summary | |
---|---|
protected |
GenericDescriptorMatcher(long addr)
|
Method Summary | |
---|---|
void |
add(java.util.List<Mat> images,
java.util.List<MatOfKeyPoint> keypoints)
Adds images and their keypoints to the training collection stored in the class instance. |
void |
classify(Mat queryImage,
MatOfKeyPoint queryKeypoints)
Classifies keypoints from a query set. |
void |
classify(Mat queryImage,
MatOfKeyPoint queryKeypoints,
Mat trainImage,
MatOfKeyPoint trainKeypoints)
Classifies keypoints from a query set. |
void |
clear()
Clears a train collection (images and keypoints). |
GenericDescriptorMatcher |
clone()
|
GenericDescriptorMatcher |
clone(boolean emptyTrainData)
|
static GenericDescriptorMatcher |
create(int matcherType)
|
boolean |
empty()
|
protected void |
finalize()
|
java.util.List<Mat> |
getTrainImages()
Returns a train image collection. |
java.util.List<MatOfKeyPoint> |
getTrainKeypoints()
Returns a train keypoints collection. |
boolean |
isMaskSupported()
Returns true if a generic descriptor matcher supports masking
permissible matches. |
void |
knnMatch(Mat queryImage,
MatOfKeyPoint queryKeypoints,
java.util.List<MatOfDMatch> matches,
int k)
Finds the k best matches for each query keypoint. |
void |
knnMatch(Mat queryImage,
MatOfKeyPoint queryKeypoints,
java.util.List<MatOfDMatch> matches,
int k,
java.util.List<Mat> masks,
boolean compactResult)
Finds the k best matches for each query keypoint. |
void |
knnMatch(Mat queryImage,
MatOfKeyPoint queryKeypoints,
Mat trainImage,
MatOfKeyPoint trainKeypoints,
java.util.List<MatOfDMatch> matches,
int k)
Finds the k best matches for each query keypoint. |
void |
knnMatch(Mat queryImage,
MatOfKeyPoint queryKeypoints,
Mat trainImage,
MatOfKeyPoint trainKeypoints,
java.util.List<MatOfDMatch> matches,
int k,
Mat mask,
boolean compactResult)
Finds the k best matches for each query keypoint. |
void |
match(Mat queryImage,
MatOfKeyPoint queryKeypoints,
Mat trainImage,
MatOfKeyPoint trainKeypoints,
MatOfDMatch matches)
Finds the best match in the training set for each keypoint from the query set. |
void |
match(Mat queryImage,
MatOfKeyPoint queryKeypoints,
Mat trainImage,
MatOfKeyPoint trainKeypoints,
MatOfDMatch matches,
Mat mask)
Finds the best match in the training set for each keypoint from the query set. |
void |
match(Mat queryImage,
MatOfKeyPoint queryKeypoints,
MatOfDMatch matches)
Finds the best match in the training set for each keypoint from the query set. |
void |
match(Mat queryImage,
MatOfKeyPoint queryKeypoints,
MatOfDMatch matches,
java.util.List<Mat> masks)
Finds the best match in the training set for each keypoint from the query set. |
void |
radiusMatch(Mat queryImage,
MatOfKeyPoint queryKeypoints,
java.util.List<MatOfDMatch> matches,
float maxDistance)
For each query keypoint, finds the training keypoints not farther than the specified distance. |
void |
radiusMatch(Mat queryImage,
MatOfKeyPoint queryKeypoints,
java.util.List<MatOfDMatch> matches,
float maxDistance,
java.util.List<Mat> masks,
boolean compactResult)
For each query keypoint, finds the training keypoints not farther than the specified distance. |
void |
radiusMatch(Mat queryImage,
MatOfKeyPoint queryKeypoints,
Mat trainImage,
MatOfKeyPoint trainKeypoints,
java.util.List<MatOfDMatch> matches,
float maxDistance)
For each query keypoint, finds the training keypoints not farther than the specified distance. |
void |
radiusMatch(Mat queryImage,
MatOfKeyPoint queryKeypoints,
Mat trainImage,
MatOfKeyPoint trainKeypoints,
java.util.List<MatOfDMatch> matches,
float maxDistance,
Mat mask,
boolean compactResult)
For each query keypoint, finds the training keypoints not farther than the specified distance. |
void |
read(java.lang.String fileName)
Reads a matcher object from a file node. |
void |
train()
Trains descriptor matcher Prepares descriptor matcher, for example, creates a tree-based structure, to extract descriptors or to optimize descriptors matching. |
void |
write(java.lang.String fileName)
Writes a match object to a file storage. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int FERN
protected final long nativeObj
public static final int ONEWAY
Constructor Detail |
---|
protected GenericDescriptorMatcher(long addr)
Method Detail |
---|
public void add(java.util.List<Mat> images, java.util.List<MatOfKeyPoint> keypoints)
Adds images and their keypoints to the training collection stored in the class instance.
images
- Image collection.keypoints
- Point collection. It is assumed that keypoints[i]
are keypoints detected in the image images[i]
.public void classify(Mat queryImage, MatOfKeyPoint queryKeypoints)
Classifies keypoints from a query set.
The method classifies each keypoint from a query set. The first variant of
the method takes a train image and its keypoints as an input argument. The
second variant uses the internally stored training collection that can be
built using the GenericDescriptorMatcher.add
method.
The methods do the following:
GenericDescriptorMatcher.match
method to find
correspondence between the query set and the training set.
class_id
field of each keypoint from the query
set to class_id
of the corresponding keypoint from the training
set.
queryImage
- Query image.queryKeypoints
- Keypoints from a query image.public void classify(Mat queryImage, MatOfKeyPoint queryKeypoints, Mat trainImage, MatOfKeyPoint trainKeypoints)
Classifies keypoints from a query set.
The method classifies each keypoint from a query set. The first variant of
the method takes a train image and its keypoints as an input argument. The
second variant uses the internally stored training collection that can be
built using the GenericDescriptorMatcher.add
method.
The methods do the following:
GenericDescriptorMatcher.match
method to find
correspondence between the query set and the training set.
class_id
field of each keypoint from the query
set to class_id
of the corresponding keypoint from the training
set.
queryImage
- Query image.queryKeypoints
- Keypoints from a query image.trainImage
- Train image.trainKeypoints
- Keypoints from a train image.public void clear()
Clears a train collection (images and keypoints).
public GenericDescriptorMatcher clone()
clone
in class java.lang.Object
public GenericDescriptorMatcher clone(boolean emptyTrainData)
public static GenericDescriptorMatcher create(int matcherType)
public boolean empty()
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public java.util.List<Mat> getTrainImages()
Returns a train image collection.
public java.util.List<MatOfKeyPoint> getTrainKeypoints()
Returns a train keypoints collection.
public boolean isMaskSupported()
Returns true
if a generic descriptor matcher supports masking
permissible matches.
public void knnMatch(Mat queryImage, MatOfKeyPoint queryKeypoints, java.util.List<MatOfDMatch> matches, int k)
Finds the k
best matches for each query keypoint.
The methods are extended variants of GenericDescriptorMatch.match
.
The parameters are similar, and the semantics is similar to DescriptorMatcher.knnMatch
.
But this class does not require explicitly computed keypoint descriptors.
queryImage
- a queryImagequeryKeypoints
- a queryKeypointsmatches
- a matchesk
- a kpublic void knnMatch(Mat queryImage, MatOfKeyPoint queryKeypoints, java.util.List<MatOfDMatch> matches, int k, java.util.List<Mat> masks, boolean compactResult)
Finds the k
best matches for each query keypoint.
The methods are extended variants of GenericDescriptorMatch.match
.
The parameters are similar, and the semantics is similar to DescriptorMatcher.knnMatch
.
But this class does not require explicitly computed keypoint descriptors.
queryImage
- a queryImagequeryKeypoints
- a queryKeypointsmatches
- a matchesk
- a kmasks
- a maskscompactResult
- a compactResultpublic void knnMatch(Mat queryImage, MatOfKeyPoint queryKeypoints, Mat trainImage, MatOfKeyPoint trainKeypoints, java.util.List<MatOfDMatch> matches, int k)
Finds the k
best matches for each query keypoint.
The methods are extended variants of GenericDescriptorMatch.match
.
The parameters are similar, and the semantics is similar to DescriptorMatcher.knnMatch
.
But this class does not require explicitly computed keypoint descriptors.
queryImage
- a queryImagequeryKeypoints
- a queryKeypointstrainImage
- a trainImagetrainKeypoints
- a trainKeypointsmatches
- a matchesk
- a kpublic void knnMatch(Mat queryImage, MatOfKeyPoint queryKeypoints, Mat trainImage, MatOfKeyPoint trainKeypoints, java.util.List<MatOfDMatch> matches, int k, Mat mask, boolean compactResult)
Finds the k
best matches for each query keypoint.
The methods are extended variants of GenericDescriptorMatch.match
.
The parameters are similar, and the semantics is similar to DescriptorMatcher.knnMatch
.
But this class does not require explicitly computed keypoint descriptors.
queryImage
- a queryImagequeryKeypoints
- a queryKeypointstrainImage
- a trainImagetrainKeypoints
- a trainKeypointsmatches
- a matchesk
- a kmask
- a maskcompactResult
- a compactResultpublic void match(Mat queryImage, MatOfKeyPoint queryKeypoints, Mat trainImage, MatOfKeyPoint trainKeypoints, MatOfDMatch matches)
Finds the best match in the training set for each keypoint from the query set.
The methods find the best match for each query keypoint. In the first variant
of the method, a train image and its keypoints are the input arguments. In
the second variant, query keypoints are matched to the internally stored
training collection that can be built using the GenericDescriptorMatcher.add
method. Optional mask (or masks) can be passed to specify which query and
training descriptors can be matched. Namely, queryKeypoints[i]
can be matched with trainKeypoints[j]
only if mask.at
is non-zero.
queryImage
- Query image.queryKeypoints
- Keypoints detected in queryImage
.trainImage
- Train image. It is not added to a train image collection
stored in the class object.trainKeypoints
- Keypoints detected in trainImage
. They are
not added to a train points collection stored in the class object.matches
- Matches. If a query descriptor (keypoint) is masked out in
mask
, match is added for this descriptor. So, matches
size may be smaller than the query keypoints count.public void match(Mat queryImage, MatOfKeyPoint queryKeypoints, Mat trainImage, MatOfKeyPoint trainKeypoints, MatOfDMatch matches, Mat mask)
Finds the best match in the training set for each keypoint from the query set.
The methods find the best match for each query keypoint. In the first variant
of the method, a train image and its keypoints are the input arguments. In
the second variant, query keypoints are matched to the internally stored
training collection that can be built using the GenericDescriptorMatcher.add
method. Optional mask (or masks) can be passed to specify which query and
training descriptors can be matched. Namely, queryKeypoints[i]
can be matched with trainKeypoints[j]
only if mask.at
is non-zero.
queryImage
- Query image.queryKeypoints
- Keypoints detected in queryImage
.trainImage
- Train image. It is not added to a train image collection
stored in the class object.trainKeypoints
- Keypoints detected in trainImage
. They are
not added to a train points collection stored in the class object.matches
- Matches. If a query descriptor (keypoint) is masked out in
mask
, match is added for this descriptor. So, matches
size may be smaller than the query keypoints count.mask
- Mask specifying permissible matches between an input query and
train keypoints.public void match(Mat queryImage, MatOfKeyPoint queryKeypoints, MatOfDMatch matches)
Finds the best match in the training set for each keypoint from the query set.
The methods find the best match for each query keypoint. In the first variant
of the method, a train image and its keypoints are the input arguments. In
the second variant, query keypoints are matched to the internally stored
training collection that can be built using the GenericDescriptorMatcher.add
method. Optional mask (or masks) can be passed to specify which query and
training descriptors can be matched. Namely, queryKeypoints[i]
can be matched with trainKeypoints[j]
only if mask.at
is non-zero.
queryImage
- Query image.queryKeypoints
- Keypoints detected in queryImage
.matches
- Matches. If a query descriptor (keypoint) is masked out in
mask
, match is added for this descriptor. So, matches
size may be smaller than the query keypoints count.public void match(Mat queryImage, MatOfKeyPoint queryKeypoints, MatOfDMatch matches, java.util.List<Mat> masks)
Finds the best match in the training set for each keypoint from the query set.
The methods find the best match for each query keypoint. In the first variant
of the method, a train image and its keypoints are the input arguments. In
the second variant, query keypoints are matched to the internally stored
training collection that can be built using the GenericDescriptorMatcher.add
method. Optional mask (or masks) can be passed to specify which query and
training descriptors can be matched. Namely, queryKeypoints[i]
can be matched with trainKeypoints[j]
only if mask.at
is non-zero.
queryImage
- Query image.queryKeypoints
- Keypoints detected in queryImage
.matches
- Matches. If a query descriptor (keypoint) is masked out in
mask
, match is added for this descriptor. So, matches
size may be smaller than the query keypoints count.masks
- Set of masks. Each masks[i]
specifies permissible
matches between input query keypoints and stored train keypoints from the
i-th image.public void radiusMatch(Mat queryImage, MatOfKeyPoint queryKeypoints, java.util.List<MatOfDMatch> matches, float maxDistance)
For each query keypoint, finds the training keypoints not farther than the specified distance.
The methods are similar to DescriptorMatcher.radius
. But this
class does not require explicitly computed keypoint descriptors.
queryImage
- a queryImagequeryKeypoints
- a queryKeypointsmatches
- a matchesmaxDistance
- a maxDistancepublic void radiusMatch(Mat queryImage, MatOfKeyPoint queryKeypoints, java.util.List<MatOfDMatch> matches, float maxDistance, java.util.List<Mat> masks, boolean compactResult)
For each query keypoint, finds the training keypoints not farther than the specified distance.
The methods are similar to DescriptorMatcher.radius
. But this
class does not require explicitly computed keypoint descriptors.
queryImage
- a queryImagequeryKeypoints
- a queryKeypointsmatches
- a matchesmaxDistance
- a maxDistancemasks
- a maskscompactResult
- a compactResultpublic void radiusMatch(Mat queryImage, MatOfKeyPoint queryKeypoints, Mat trainImage, MatOfKeyPoint trainKeypoints, java.util.List<MatOfDMatch> matches, float maxDistance)
For each query keypoint, finds the training keypoints not farther than the specified distance.
The methods are similar to DescriptorMatcher.radius
. But this
class does not require explicitly computed keypoint descriptors.
queryImage
- a queryImagequeryKeypoints
- a queryKeypointstrainImage
- a trainImagetrainKeypoints
- a trainKeypointsmatches
- a matchesmaxDistance
- a maxDistancepublic void radiusMatch(Mat queryImage, MatOfKeyPoint queryKeypoints, Mat trainImage, MatOfKeyPoint trainKeypoints, java.util.List<MatOfDMatch> matches, float maxDistance, Mat mask, boolean compactResult)
For each query keypoint, finds the training keypoints not farther than the specified distance.
The methods are similar to DescriptorMatcher.radius
. But this
class does not require explicitly computed keypoint descriptors.
queryImage
- a queryImagequeryKeypoints
- a queryKeypointstrainImage
- a trainImagetrainKeypoints
- a trainKeypointsmatches
- a matchesmaxDistance
- a maxDistancemask
- a maskcompactResult
- a compactResultpublic void read(java.lang.String fileName)
Reads a matcher object from a file node.
fileName
- a fileNamepublic void train()
Trains descriptor matcher
Prepares descriptor matcher, for example, creates a tree-based structure, to extract descriptors or to optimize descriptors matching.
public void write(java.lang.String fileName)
Writes a match object to a file storage.
fileName
- a fileName
|
Official OpenCV 2.4 Documentation | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |