JenyaKirmiza / javacv

Automatically exported from code.google.com/p/javacv
GNU General Public License v2.0
0 stars 0 forks source link

problems to acces data from all the detected patterns with singleTracker #301

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi Samuel,

Thanks for your librairy javacv and your encapsulation of artoolkitPlus. 
I don't manage to use the SingleTracker class described in ARToolKitPlus.java.

In C++, I used singleTracker with the method calc(...), 
selectDetectedMarker(id),  selectBestMarkerByCf(), etc. 
And I have no problem to retreive data from all the detected patterns.
For precision, this is the C++ code that I use :
-------------------
ARToolKitPlus::TrackerSingleMarker * singleTracker = new ...;
ARToolKitPlus::ARMarkerInfo * info;
int nbTotalMarker;
QVector<int>  detectedPatterns  = QVector<int>::fromStdVector( 
singleTracker->calc(data, &info, &nbTotalMarker ) );
 for (int i=0; i<nbTotalMarker; i++ )
      std::cout << " id : " << info[i].id << endl;
-------------------
But after analysis of artoolkitPlus.java, I can't find the methods calc and 
selectDetectedMarker(id) so I tried with arDetectMarker.

So the code in java is :
-------------------
ARMarkerInfo markers = new ARMarkerInfo(null);
int[] nbDMotif = new int[1];
singleTracker.arDetectMarker( ima.getByteBuffer(), 
                              singleTracker.getThreshold(), 
                              markers, nbDMotif );
for (int i = 0; i < numDetected; i++) {
   System.out.println("- id " + i +" : " + markers.position(i).id()
                       + "    conf : " +  markers.position(i).cf());
}

-------------------
The tracker finds the good number of patterns but I can't access data from all 
detected patterns. So I need your help to understand the problem. 

What steps will reproduce the problem?
1. I initialize the singleTracker with "LogitechPro4000.dat"
2. I used the image markerboard_480-499.png of the artoolkitplus to test the 
tracker.
3. I ask to program to print the id and confience of all detected patterns. But 
for a few pattern, the data are wrong.

What is the expected output? What do you see instead?
I expected the list of all detected patterns and I obtain :

Liste des motifs détectés
- id 0 : -1    conf : 0.0
- id 1 : -1    conf : 0.0
- id 2 : 483    conf : 1.0
- id 3 : -1    conf : 0.0
- id 4 : -1    conf : 0.0
- id 5 : 488    conf : 0.944444477558136
- id 6 : 487    conf : 0.944444477558136
- id 7 : 486    conf : 1.0
- id 8 : 494    conf : 1.0
- id 9 : 493    conf : 1.0
- id 10 : 492    conf : 1.0
- id 11 : 491    conf : 1.0
- id 12 : 498    conf : 1.0
- id 13 : 497    conf : 1.0
- id 14 : 496    conf : 1.0

What version of the product are you using? On what operating system?
javacv 0.4 with eclipse and windows 7

Please provide any additional information below.

If I use a image with one pattern as "artoolkitplus_TestCamImg_Marker31.jpg" 
then I can't obtain the id of pattern. The only anwser for id  is -1.

I attach a file source code with the two problems.

Thanks in advances for your help.

Original issue reported on code.google.com by stef.pre...@gmail.com on 9 Apr 2013 at 1:56

Attachments:

GoogleCodeExporter commented 9 years ago
As explained in the README.txt file, please try to call the function this way: 
arDetectMarker(..., markers.position(0), ...) 

Original comment by samuel.a...@gmail.com on 11 Apr 2013 at 10:42

GoogleCodeExporter commented 9 years ago
Hello Samuel, 

Thanks for your fast answer, 
I try your solution "markers.position(0)" but the results are the same for two 
examples in file source code.

Any others ideas will be welcome.

Thanks

Original comment by stef.pre...@gmail.com on 11 Apr 2013 at 12:41

GoogleCodeExporter commented 9 years ago
I've looked at this and the results look alright. I'm not sure where you got 
markerboard_480-499.png, but I tried with markerboard_480-499.jpg, and with the 
C++ code I am attaching, and I get similar output:

- id 0 : -1    conf : 0.000000
- id 1 : -1    conf : 0.000000
- id 2 : -1    conf : 0.000000
- id 3 : -1    conf : 0.000000
- id 4 : 489    conf : 0.944444
- id 5 : 488    conf : 1.000000
- id 6 : 487    conf : 1.000000
- id 7 : -1    conf : 0.000000
- id 8 : -1    conf : 0.000000
- id 9 : 493    conf : 1.000000
- id 10 : 492    conf : 1.000000
- id 11 : 491    conf : 1.000000
- id 12 : 498    conf : 1.000000
- id 13 : 497    conf : 1.000000
- id 14 : 496    conf : 1.000000

This looks alright to me, but if it doesn't to you, then the problem isn't 
related with JavaCV, but with ARToolKitPlus. 

As a side note, newer versions of ARToolKitPlus may give different results and 
may have missing functions you are looking for: issue #234 

Original comment by samuel.a...@gmail.com on 13 Apr 2013 at 2:22

Attachments:

GoogleCodeExporter commented 9 years ago
FYI, I've made changes to support ARToolKitPlus 2.3.0, which contains at least 
some of the functions you were looking for:
http://code.google.com/p/javacv/source/detail?r=b80bcf5cceacc8453511890fed9d93c8
7fa91d71
Let me know if you see anything missing from that, thanks!

Original comment by samuel.a...@gmail.com on 22 Jun 2013 at 3:03