"...the corners are not determined very accurately. If the threshold
is not VERY close to correct, the
corners can be off by a few (or MORE!) pixels, since the blob will
bloom out or shrink in depending on
how far off the threshold is. If the corners are off by even 1 pixel,
the orientation of the marker
will be wrong..."
I did some tests here to verify this, and I am still *not* convinced
that this is the cause. Basically, I added this code to standard cube
example:
var sq:FLARSquare = detector.getSquare ();
for (var i:int = 0; i < 4; i++) {
var ix:int = sq.imvertex[i].x;
var iy:int = sq.imvertex[i].y;
var c:uint = 0xFFFF0000; bd.setPixel (ix + 0, iy + 0, c);
bd.setPixel (ix - 1, iy + 0, c); bd.setPixel (ix + 1, iy + 0, c);
bd.setPixel (ix + 0, iy - 1, c); bd.setPixel (ix + 0, iy + 1, c);
}
and watched the output for a bit. From just looking at red crosses
jumping around together with my cube, it is easy to think just what
Blair said, but if you try to compare the sequence of images in your
head (or in photoshop :) you will notice a lot of frames with exactly
the same detected square corners but cube still placed differently. I
am attaching two frames for example.
There is no doubt that jitter does come from source image, but it
doesnt seem to be just square corners problem. The question to Blair
is, what *other* things did you modified apart from subpixel corner
detection?
It's not surprising. The original one didn't work very well either.
It's all a form of smoothing, similar in effect to all the stuff
people here have tried. In the end, you can't recreate lost data.
>> So it seems the only suspect is now "lines" array
>> in FLARSquare
>
> In fact, page 16 says ARToolKit does 4 lines fitting, not 4 corners
> detection.
That's only referring to how they determine if it's a square (they
walk the edge, looking for segments that form lines, and throw out any
blobs that have more or less then 4).
> You can see that in getSquareLine () method of
> FLARSquareDetector - sqvertex array is calculated as intersection of
> lines. Therefore, the key to removing jitter should be in better line
> fitting method, or if you go with refined corners as Blair suggests,
> you still have to update lines to match new corner coords.... back to
> thinking.
I'll have to look at the code (again) to see if I believe this. We
took the output corners from the ARToolkit and refined them with the
original image. Because the ARToolkit pose-estimator sucks (it's
slow, and is unstable, which is probably what you are seeing), we
actually use (now) a different one (also from OpenCV). The
combination gave VERY stable tracking.
HOWEVER, using a better pose estimator REQUIRES having a calibrated
camera. If you try using better, more accurate/stable pose estimators
with bad data (e.g., images taken from cameras where the calibration
data is not actually for the current camera), they perform very badly
(sometimes failing, or giving horrible results).
For those who don't know, the calibration files tell the system what
the internal properties of the camera are. These include the field of
view, where the optical center of projection of the image is (for
typical cameras, the center of projection of the lens will not fall
exactly in the center of the image sensor), and an estimate (typically
expressed as the coefficients of a polynomial) describing the barrel
distortion of the lens (these are the distortions that cause lines to
curve as they approach the edge of the image). These are the typical
parameters for a normal camera.
The values change if you change the zoom OR the focus of the camera!
Even for focus, they change slightly, and for cheaper cameras, if you
return to a previous setting, the values might be different (because
the lens has physically shifted in it's seating).
The one "good" thing about the ARToolkit optimization-based pose
estimator is that it will at least work (for some definition of
"work") when the camera you are using does not really correspond to
the calibration (.dat) file you are using (which, in the case of FLAR,
is almost always the case!).
Line fitting only works if the camera is calibrated, since that
calibration is used to remove barrel distortion and other other
distortion from the image (making it rectilinear, and making the edges
straight). If you are not able to do this (again, since we don't have
calibrated cameras, we can't properly undistort the image), you can't
do anything useful with the edges.
BTW, the original ARToolkit camera calibration approach was also
pretty poor.
So, what some of the ongoing discussion about jitter is probably
seeing relates not just to the quality of the corners, but to the
LOCATION in the image of the marker. If the camera is not calibrated
and there are ANY distortions that are different than the calibration
file. If you move the marker in image to the left/right (by even a
pixel) you may get a slightly different result.
I also suspect that, since the camera calibration is not correct, that
the optimization is hitting different local minima based on it's
starting conditions; it's getting "plausible" results that are within
the error tolerance of algorithm, but are slightly different each time.
BTW, I believe Rekimoto's group created the tracking technology for
the PS3 Eye of Judgement game, for those who care about trivia.
People in the computer vision community have done vision based
tracking of squares for a while, though. The big deal with Rekimoto's
work and the ARToolkit was in using it for AR.
one somewhat OT thing i just thought about -- it's truly awesome that
saqoosha spent all this time porting NYARToolkit into AS3, but...the
real refinement of the engine is (i imagine) happening in the original
C++ codebase, in the original ARToolkit. FLARToolkit isn't likely to
see those upgrades without someone to keep an eye on the ARToolkit
codebase, and to upgrade continuously.
a better solution for FLARToolkit is to loop it into the relevant
segments of the ARToolkit codebase via Alchemy. this has the double
benefit of performance increase and closer tie-in with the developers
who *really* know what's going on, and are actively developing. i'm
definitely not qualified to do this...but hopefully someone will step
up to the plate sometime in the near future. i know saqoosha is
investigating possibilities with Alchemy and PixelBender, but not
really sure what route he's taking.
back to on-topic, in the meantime, makc, seems like the most rewarding
route to go would be to control jitter with easing, on the client side
(rather than within the engine). while that kind of correction is
perhaps a bit more computationally-expensive than fixes within the
engine, and also likely results in less responsiveness (as it smoothes
all motion, including jitter), it probably won't make too much of a
difference in the application speed, and will have a substantial
positive impact on the appearance of the model positioning/
transformation.
yet another thing to add to the list for FLARManager.
-e
thanks,
-eric
On Apr 23, 2009, at 10:31 AM, makc wrote:
from this page:
"The person who wants to be a commiter, please send your username and
password or the SHA1 hash of your password to beintera...@gmail.com
. "
http://www.libspark.org/wiki/WikiStart/en
that's what i did, after prompting from saqoosha, and shindo
yoshihiro, the libspark organizer, was very open to contribution.
blair -- thx for the ARToolkitPlus suggestion. will look into it.
makc, if you do the same, let's keep communicating here so we don't
duplicate work.
-e
interesting they randomize threshold; i was thinking more of
incrementing it and finding a good range, or possibly taking a tree
approach, undershoot then overshoot then undershoot a little less then
overshoot a little less, zeroing in on a good value / range.
On Tue, Apr 28, 2009 at 12:46 PM, Thomas Brault <thomas...@gmail.com> wrote:
> Very impressive result, but i don't realy understand your modifications,
> what filter did you apply exactly ? Can you zip your source and share it ?
>
sorry I was far far away from the internet for this whole week, I will
do this shortly.
@eric, I've got commit rights to spark, but I could not get in touch
with saqoosha about this. I assume I could commit any way, because
changes I need (a setter for to-bin filter) are not breaking, but it
certainly would be nice to have his agreement beforehand.
sorry for long time no reply.
similar modifications are already applied my local version.
so, your changes are welcome. thank you!
but if you wanna commit big changes,
it's better to create anothre branch.
I didn't experience any team development.
any suggestion are welcome.
--
Saqoosha
s...@saqoosha.net
http://saqoosha.net/