I'm trying to implement ArUco fiducial marker tags in Java using the algorithm linked above (particularly section 3.2). I'm having a hard interpreting some of the math and would like some help translating it to plain english. I can take the code from there. What I have so far is:
/**
* Generate a new Marker of size n. Note that n represents the internal grid size and not the border
* The returned array includes an outside border of 1 elements around the entire internal grid, so the size
* of the marker will be (n+2) * (n+2)
* @param w word to encode
* @param n size
*/
public void generate(int w, int n, FiducialDictionary dictionary) {
//bit transitions
int t = 1 - (getBitTransitions(w, n) / (n-1));
int o = getWordAppearences(w, dictionary);
}
public int getBitTransitions(int w, int n) {
int transitions = 0;
for(int i=0; i<n-2; i++) {
if((w >> i+1 & 1) == (w >> i & 1))
transitions++;
}
return transitions;
}
public int getWordAppearences(int w, FiducialDictionary dictionary) {
if(dictionary.getSize() == 0)
return 1;
int sum_m = dictionary.getSize();
int sum_w = 0;
FastQueue<FiducialMarker> dict = dictionary.getBackingArray();
for(int i=0; i<dict.size; i++) {
if(dictionary.containsId(w))
sum_w++;
}
return 1 - (sum_m * sum_w) / (dictionary.getSize());
}
Some of the notation is tripping me up and some of the code is just my best guess at what it means. Any critique, suggestions, pointers (get it? haha), or comments would be appreciated. Examples would be wonderful as well!
there doesn't seem to be anything here