关于树的帮助 [英] Helpg Regarding Tree
问题描述
我正在尝试开发一棵树来存储从图像中提取的特征.假设我在空间XY坐标中有1000个数据点(特征).现在,我正在对该数据执行k均值聚类(3个聚类).结果,我得到了三个小组.现在,我创建了一个具有三个节点的树.这3个节点将包含属于各个节点的数据点.因此,将对所有数据点进行分区.
现在,我转到第一个子节点.再次应用k均值聚类以创建另外3个子节点,并将信息进一步存储在这些节点中.然后,我转到第二个子节点,并再次创建3个子节点,依此类推.这是深度2.
因此,以这种方式,我必须生成一棵树.我可以深入到任何深度,子节点的数量也可能从3个不等5或10等.
我希望这些信息能给我一个清晰的印象.通常,我们将其称为单词模型包"中用于场景识别的词汇树.问题是生成树.我已经生成了一个静态树,该树有3个节点,深度为3.但是我需要动态机制.
I am trying to develop a tree to store the features extracted from the images. Let''s say I have 1000 data points (features) in space XY coordinates. Now I am performing k-mean clustering (3 Clusters) on this data. As a result I get three groups. Now I create a tree with three nodes. These 3 nodes will contain data points which belong to the respective nodes.So in this way all data points will be partitioned.
Now I go to first child node. Again apply k-mean clustering to create further 3 child nodes and further store the info in these nodes. Then I go to second child node and again create 3 child nodes and so on. This is depth 2.
So in this way I have to generate a tree. I can go up to any depth and number of child nodes may also vary from 3 e.g. 5 or 10 etc.
I hope this information will give a clear picture what i am trying to make. Normally we call it vocabulary tree used in Bag of Word Model for scene recognition. Problem is to generate the tree. I have already generated a static tree with 3 nodes and up to depth 3. But I need dynamic mechanism.
推荐答案
您看过Matlab,看看 Wikipedia文章 [
Did you have a look at Matlab, have a look Wikipedia article[^]
Thanks to you, now I know what is "Bags of words" !
您可以创建一个这样的结构:
You could create a struct like this:
typedef struct{
void *mydata;
int numchildren;
void **children;
}mytree;
其中,mydata
是指向您希望与每个树项目关联的数据的指针,numchildren
一个树项目具有的子代数,而children
是每个子代指向mytree
结构数组的指针.
Where mydata
is a pointer to the data you wish to associate with each tree item, numchildren
the number of a children a tree item has, and children
a pointer to an array of mytree
structs for each child.
这篇关于关于树的帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!