plattysoft / ArToolKitJpctBaseLib

Other
20 stars 13 forks source link

Cache camera parameter files #6

Open michaelboyles opened 7 years ago

michaelboyles commented 7 years ago

Camera parameters have to be downloaded from ARToolkits server. This uses a curl command to get the file.

It would be nice to cache camera parameters on a device so that once a device has connected to the server once and downloaded this file once it does not have a dependency on being online again.

Not sure how possible this is but worth some investigation.

Perhaps we could even provide a small cache of popular devices' parameter files so that the user never actually needs to be online. Or is there a way to do this at install time when the user is obviously connected to the internet?

plattysoft commented 7 years ago

I was under the impression that ARToolkit did that caching already.

If I remember correctly, ARToolkit tries to get the right camera.params, if not, takes the default one on the phone, but if it manages to get it, it overrides it.

This was always my assumption. If that is not correct, then we may need to get quite deep into ARToolkit to fix it.

michaelboyles commented 7 years ago

You're right that there is always a fallback which is the camera.params on the device. This is usually pretty crappy and only 320x280 resolution.

Every time the application is started it tries to get the proper parameters for the device from their server. If it can't - because there isn't one for that device or the user is not connected to the internet - it uses the default. It does not store the param file it has downloaded so every time you start the app you need to download the file again. (why?)

You're also right that this is probably fairly low level. I know it uses libcurl which I think is an NDK thing. I wonder whether it's possible to intercept the HTTP request and maintain our own local cache to avoid having to touch ARToolkit code. If we did change ARToolkit code, how would we deal with pulling in their latest changes? It may be that I need to submit a pull request over there.

There are a lot of unknowns really. It would be good to at least investigate what is and is not possible.

plattysoft commented 7 years ago

ARToolkit has been under massive rework, since they have been working on a new version for a while, and for all I know, backwards compatibility is not guaranteed.

I think we could put someting into assets as camera.params, but also not sure about the current interface at NDK level.

With the current wrapper I have, we can access the NDK interface, but that's about it. I already improved the standard BaseExample to include support for fiducial trackers.

Maybe there's something that can be done. I'll take a quick look.

plattysoft commented 7 years ago

So, there is the native call to set the camera parameters on ARActvity If we can intercept the file and put the cached one here, then it's all fine, otherwise it would require rebuilding ARToolkit.