2008年5月20日火曜日

NyARToolkit on Google Android 更新と公開


ずいぶん前にNyARToolkitをAndroidの上で動かしてみたわけですが、
NyARToolkitの作者 A虎@ さんのご好意によりSourceforge.jpにてサブプロジェクトとして公開することになりました!

Eclipseのプロジェクトをエクスポートしたものなので、動かすにはAndroidSDKおよびプラグインが必要です。
(みゅおさんがAndroidのドキュメントを日本語化しておられます。ありがたい!)


当時にくらべて本家NyARToolkitが格段にブラッシュアップされているため速度も大幅に改善。
1.2秒に一回ぐらい認識できます、、、前は10秒だったからね。。。
(開発環境がとても貧弱なため、Androidエミュレータの制限によるものでは無い可能性もあります)
ついでに少しUIも付けてみました。実機欲しいなぁ~。


エミュレータでは現在のところカメラデバイスは実装されていないので
JMFでキャプチャした画像をソケット通信で送ってます。
送信用のプログラムサンプルも同封してありますが、
関連ライブラリが必要で面倒なのでApplet及びJWSにしたものを公開します。
現在のところWindows版のみです。

P.S.
Flash版も開発され空前のAR移植ブームですなぁ。しみじみ。
開発環境およびNativeCapableフレームワークもほぼ完成し今週中には公開できそうです。
いろんなARアプリがブラウザの上で遊べる時代になると楽しいな!!

6 件のコメント:

kojira さんのコメント...

Android SDK1.0の対応ってもしかして出来てます?
Androidのソースが公開されたので本家ARToolkitをArm向けコンパイルしたものをJNIでつないで実装できるかもしれません。
もしできたらかなりの速度アップが期待できそうですね。

Shinobu IZUMI さんのコメント...

本家への対応は今のところ手を出していません。
ネイティブで書くと、かなり速くなると思いますが、
配布公開等が難しくならないかな?と心配しています。

kojira さんのコメント...

そうですか
そのうち試してみたいと思います
Android SDK1.0対応のNyatoolkitは公開の予定はありませんか?

AntarAtman さんのコメント...

Hi Shinobu,

Seeing that you put the NyARToolkit on android, you probably know how to put an overlay surface over the camera preview and handle threading to draw object both on opengl surface or simple 2d canvas

I tried your apk on the emulator but unfotunately it showed only a black screen (maybe the problem I have anyway is the emulator?).
I also look at the code but I do not see any special different to what I tried already.

I am able to put images on a SurfaceView or simple View that is put over the camera preview (SurfaceView copied from the exampel in the SDK (1.5)
but I can only use the onDraw method and thus have to invalidate the canvas (and thus get slow performance) and no opengl surface.

I tried to use the SurfaceView with a threading mechanism and getting teh canvas by locking it as it is done in the lunar view example in the SDK but it shows only the camera preview. Please note that I use transparency and it works when I use only the onDraw method. Here is a code of someone who just did this: using ondraw method with a transparent backgroudn to display stuff over the camera preview: http://groups.google.com/group/android-developers/browse_thread/thread/d8587b4b2139a85/6e1f453ac051f6bd?hl=en&lnk=gst&q=camera+preview#6e1f453ac051f6bd

But for using threading and locking up canvas as well as GLSurfaceView, I cannot make it work, Here is my last code:
http://antaraatman.blogspot.com/2009/06/overlay-surface-on-camera-preview-for.html

and (for teh SurfaceView)

http://antaraatman.blogspot.com/2009/06/overlay-surface-on-camera-preview-for_10.html



When I comment the line mOverlaySurfaceView.bringToFront();

I cannto see any more teh camera preview but the backgroudn is blacm meaning that the screen have been updated (so the threading is working)

on the otehr hand when it is uncommented, the camera preview is seen with an overlay red transprency set in the OverlaySurfaceView construtor method.


It seems to me that when the camera preview is working there is no possibility for the thread to start.


I hope you can help me. I am sorry if you not expect such kind of question on your blog. If it is the case, there is similar question going on in google discussion group for android if you like to anwser http://groups.google.com/group/android-beginners/browse_thread/thread/489e56ea2a1d42a9/8ba40db1a24c9127?hl=en&lnk=gst&q=OpenGL+View+on+top+of+Camera#8ba40db1a24c9127

Thank you,

小影 さんのコメント...

You no longer love android huh? I found the project cannot started on current SDK... (I dont sure if it is related to version though...)

Shinobu IZUMI さんのコメント...

hi, I'm affraid my implementation was not for the current SDK as you mentioned. However the program is not complicated one so you may be able to modify and run on current one. :)