chili-epfl / chilitags

Robust Fiducial Markers for Augmented Reality And Robotics
http://chili.epfl.ch/software
123 stars 57 forks source link

Tune the speed/precision compromise as a parameter #26

Closed qbonnard closed 9 years ago

qbonnard commented 10 years ago

Chilitags tries to optimize both detection performance and processing time, but sometimes it has to decide for a compromise. It would be nice to have a Chilitats::setPerformance(level) that would take values like FASTEST, FAST, PRECISE, MOST_PRECISE, etc. and set various parameters all over Chilitags to implement the user's compromise.

This issue aims at collecting parameters that could be adjusted to implement this:

ayberkozgur commented 10 years ago

This is a much needed feature for Android. On a 1.6Ghz ARM Cortex-9, scanning a 640x360 image takes about 25 ms when there is no tag in sight. Takes about 35 ms when there is 1 tag in sight. takes up to 110 ms when there are 40 tags in sight. The times have no noticeable difference when the libraries (both Chilitags and OpenCV) are built with -O3 and NDEBUG symbols. The times are around 20 ms, 25 ms, 90 ms for the Exynos 5 Octa 1.9GHz respectively. Needless to say, it's much much faster on the desktop. I didn't specifically measure the numbers but on a Core-i7 2.0Ghz, the processing of 40 tags in sight doesn't cause framerate do drop even a little bit, so it's definitely below 30ms. And the image is 640x480 too.

Maybe this is not specific for this issue but GPU processing should definitely be implemented sometime in the future (if OpenCV supports such a thing of course).

qbonnard commented 10 years ago

Ah yes, my good old dream or running Chilitags on GPU. OpenCV should help a lot with that. On Android, I think it only works with the Tegra platform though. I'll add the GPU thing as another enhancement Issue in the growing wishlist ;)

qbonnard commented 10 years ago

Here is a proposition on how to tune the performance of chilitags https://github.com/qbonnard/chilitags/tree/performance_tuning

It only allows to disable the corner refinment for now, with the following results:

4: RefineCorners makes 20 new false negatives 4: n Pixels Avg. processing time difference 4: 8 76800 -35% 4: 16 307200 -34% 4: 1 1228800 -3% 4: 3 1920000 -25% 4: 4 7990272 -55%

Regarding the interface, I took my inspiration from @severin-lemaignan 's love for templates to provide a unified interface for all the performance tweaks:

tunePerformance<TuningType>(parameters...);

e.g. :

tunePerformance<Performance::RefineCorners>(false);
tunePerformance<Performance::ExpectedTagSize>(20, 100);

Comments welcome !

ayberkozgur commented 10 years ago

We should definitely be able to disable the pyrDown via parameters.

qbonnard commented 10 years ago

Yep, that's definitely coming. There are several ways to do that:

qbonnard commented 10 years ago

Also, I think the interface with the template tricks is a bad idea... It will be hell to document.

severin-lemaignan commented 10 years ago

I won't merge any code that relies on templates for global configuration!! forget about it! :-)

From the end-user point of view, I think an interface like:

chilitags::Chilitags3D chilitags3D(Size(w, h), chilitags::FASTEST);

would be the best.

chilitags::FASTEST can be a binary mask equal to chilitags::NOREFINE | chilitags::NOPYR | ... This allows power users to finely tune the optimizations they want to enable or not.

Simple and sweet :-)

ayberkozgur commented 10 years ago

Yes, this API looks much nicer.

severin-lemaignan commented 10 years ago

thresholding instead of canny is proposed in issue #25

qbonnard commented 9 years ago

Speed tuning done in https://github.com/chili-epfl/chilitags/issues/37.