Hello there!
If you've encounter an spooky message box (under Windows), which occurs
every now and then, telling you that a variable 's1' isn't initialized,
than you may
find this mail useful. I've find the location this error is generated
and I've
a (quick hack-)solution
In my opinion this error occurs when the ARToolKit 'recognize' a pattern
pretty far away (mostly caused by wrong-recognized environment-features).
When you look in the code of the ARToolKit you'll see that a variable 's1'
will be used in arGetTransMat2.c and arUtil.c. Functions of the arUtil.c
aren't used in JARToolKit. In arGetTransMat2.c there are two functions
declaring a variable 's1', first 'double arModifyMatrix(...)' and second
'double arsModifyMatrix(...)' (the second function isn't used by JARToolKit
due to not supporting stereo views at the moment). So the error occurs
in the
function 'double arModifyMatrix(...)'.
If you look in this function you'll see that the variable 's1' is
declared (line 30)
and used the first time in line 75. I suppose the error is located in
line 70 - 81:
<arGetTransMat2.c>
...
70 if( err < minerr ) {
71 minerr = err;
72 ma = a1;
73 mb = b1;
74 mc = c1;
75 s1 = t1; s2 = t2; s3 = t3;
76 }
....
80 if( s1 == 0 && s2 == 0 && s3 == 0 ) factor *= 0.5;
....
If 'err' is greater than 'minerr' then 's1' will be never initialize.
So the
statement in line 80 will cause an error.
My (quick hack-)solution is to initialize the variables 's1' to 's3'
with ' 0'
and the variables 'ma', 'mb' and 'mc' with 0.0 (I don't have checked any
side effects, so I can't guarantee a success in all situations).
Best solution would be a better error-handling within the ARToolKit (maybe
in the next version )
Regards
Jörg Stöcklein
|