袋视觉词在Opencv [英] Bag of Visual Words in Opencv

查看:247
本文介绍了袋视觉词在Opencv的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在opencv中使用BOW来聚类可变大小的特征。然而有一件事从opencv的文档不清楚,也无法找到这个问题的原因:



假设:字典大小= 100.



我使用surf来计算特征,每个图像都有可变大小的描述符,例如:128 x 34,128 x 63等等。现在在BOW中,每个都是聚集的,用于图像的固定描述符大小为128×100。我知道100是使用kmeans聚类创建的集群中心。



但我困惑的是,如果图像有128 x 63个描述符,比如何将它集群到100个集群,这是不可能使用kmeans UNLESS我将描述符矩阵转换1D。不会转换为1D将失去一个关键点的有效的128维信息?



我需要知道如何描述符矩阵操作,从只有63个特征获得100个诽谤中心。

解决方案

有这样的想法。



表示当前图像的总和6个特征。那些特征中的前3个最接近第5平均值,其余3个分别最接近第7,第8和第9平均值。然后你的功能将像 [0,0,0,0,3,0,1,1,1,0] 它是10维的,并且等于簇平均数。所以你可以从63个功能创建100000维向量。



但是我认为有一些错误,因为在应用BOW后,你的功能应该是1x100不128x100。您的群集意味着是128x1,您正在分配您的128x1大小的功能(您hvae 34 128x1功能的第一个图像,63 128x1功能的第二个图像,等)。所以在基本的你分配34或63功能到100手段,你的结果应该是1x100。


I am using BOW in opencv for clustering the features of variable size. However one thing is not clear from the documentation of the opencv and also i am unable to find the reason for this question:

assume: dictionary size = 100.

I use surf to compute the features, and each image has variable size descriptors e.g.: 128 x 34, 128 x 63, etc. Now in BOW each of them are clustered and I get a fixed descriptor size of 128 x 100 for a image. I know 100 is the cluster center created using kmeans clustering.

But I am confused in that, if image has 128 x 63 descriptors, than how come it clusters into 100 clusters which is impossible using kmeans UNLESS i convert the descriptor matrix to 1D. Wont converting to 1D will lose valid 128 dimensional information of a single key points?

I need to know how is the descriptor matrix manipulated to get 100 cluter centers from only 63 features.

解决方案

Think it like this.

You have 10 cluster means total and 6 features for current image. First 3 of those features are closest to 5th mean and remaining 3 of them are closest to 7th, 8th, and 9th mean respectively. Then your feature will be like [0, 0, 0, 0, 3, 0, 1, 1, 1, 0] or normalized version of this. Which is 10 dimensional, and that is equal to number of cluster mean. So you can create 100000 dimensional vector from 63 features if you want.

But still I think there is something wrong, because after you applied BOW, your features should be 1x100 not 128x100. Your cluster means are 128x1 and you are assigning your 128x1 sized features (you hvae 34 128x1 feature for first image, 63 128x1 feature for second image, etc.) to those means. So in basic you are assigning 34 or 63 features to 100 means, your result should be 1x100.

这篇关于袋视觉词在Opencv的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆