what is the meaning and use of class member class_id of class cv::KeyPoint in opencv?

孤街醉人 提交于 2019-12-06 11:58:31

问题


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...


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/17981126/what-is-the-meaning-and-use-of-class-member-class-id-of-class-cvkeypoint-in-op

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!