Skip to content

Commit

Permalink
change addImage to getVisualWords of KMeansTree
Browse files Browse the repository at this point in the history
  • Loading branch information
iamaxman committed Apr 27, 2016
1 parent 74e1695 commit aabe559
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.alibaba</groupId>
<artifactId>simpleimage.parent</artifactId>
<version>1.2.4</version>
<version>1.2.7</version>
<name>simpleimage.parent</name>
<packaging>pom</packaging>
<description>Pure Java Image library</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public List<Score> getRankedList(List<Integer> queryVWList, List<Score> candidat
}

public List<Integer> quntinize(List<? extends Clusterable> points) {
return tree.addImage(points);
return tree.getVisualWords(points);
}

public List<Score> getCandidate(List<Integer> visualWords) {
Expand Down Expand Up @@ -219,7 +219,7 @@ public void buildIndex(List<? extends Clusterable> points, int Id) {
List<Integer> visualWords;
LinkedList<Integer> tmpInvertFile;

visualWords = tree.addImage(points);
visualWords = tree.getVisualWords(points);
Collections.sort(visualWords);
simpleHistogramFile.put(Id, visualWords);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,17 @@ public List<KMeansTreeNode> getLeafsList() {
return nodes;
}

public List<Integer> addImage(List<? extends Clusterable> imagePoints) {
public List<Integer> getVisualWords(List<? extends Clusterable> imagePoints) {
List<Integer> visual_word_list = new ArrayList<Integer>();
for (Clusterable value : imagePoints) {
visual_word_list.add(addPoint(value));
visual_word_list.add(getVisualWord(value));
}
return visual_word_list;
}

public int addPoint(Clusterable point) {
public int getVisualWord(Clusterable point) {
numWords += 1;
return rootNode.addValue(point);
return rootNode.getValueId(point);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,15 @@ public int getId() {
/**
* Adds a clusterable to the current vocab tree for word creation
*/
public int addValue(Clusterable c) {
public int getValueId(Clusterable c) {
currentItems++;
/*
* if(isLeafNode()) { return id; }
*/
int index = TreeUtils.findNearestNodeIndex(subNodes, c);
if (index >= 0) {
KMeansTreeNode node = subNodes.get(index);
return node.addValue(c);
return node.getValueId(c);
}
return id;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
public interface VocabularyTree {
public List<Float> getCurrentWords();

public List<Integer> addImage(List<? extends Clusterable> imagePoint);
public List<Integer> getVisualWords(List<? extends Clusterable> imagePoint);

public void reset();
}

0 comments on commit aabe559

Please sign in to comment.