what is the meaning and use of class member class_

2019-04-12 15:20发布

In reference manual of OpenCV 2.4.3 KeyPoint::class_id is described as "object id that can be used to clustered keypoints by an object they belong to".

Due to lack of my adequate knowledge about 'keypoint' I can't understand whats the purpose of class_id.

My another question is, by using feature detector, descriptor and matcher we can detect matching keypoints of a query object in a training image. But how can segment out the query object in the training image. Can we use grabcut or watershed algorithm? if yes, how?

Answer of either question will be helpful.

Thanks in advance...

2条回答
倾城 Initia
2楼-- · 2019-04-12 16:02

The class_id member field can be used, in practice, to store any information that you find useful for each keypoint. As the documentation says, you can store, for example, the id of a detected object.

For example, you have an image, extract keypoints from it (e.g. with SURF), run some object detector with these features, and the result is that each input feature contains now in class_id the id of the corresponding object, or -1 if they are attached to no object. I don't actually know if this field is filled by some OpenCV function or it is just for your use.

Regarding your second question, matching features may not be enough to segment out your object, because features can be located inside the object, so that you don't get any information about the outline. This is a good starting point, though, if you have more information about the object. For example, if you know that your object is planar (a poster on the wall), you can use the feature matches to compute a homography between the input and the training images. This would give you an outline. Or, for example, a large collection of close matched features may be an indication of the presence of an object. From that, you may try some other color segmentation, edge matching, etc.

查看更多
仙女界的扛把子
3楼-- · 2019-04-12 16:03

I have found some short description about the class_id of a keypoint.

OpenCV says that:

class_id is object ID, that can be used to cluster keypoints by an object they belong to.

Here is the link.

Hope this will be somehow helpful.

查看更多
登录 后发表回答