ARToolKit を Flash に移植したよ。
こんちわ。さくーしゃです。
えーと、巷では Flash Player 10 beta で騒がしい感じになってきておりますが、そんな中、わたくしは ARToolKit を Flash (AS3) に移植してました。FLARToolKit と命名しておきましょう。まー、移植つっても本家からじゃなくって A虎@nyatla.jp 氏が Java に移植した NyARToolkit を AS3 で書き直したものなんだけど。言語仕様が近いだけあって C 版よりもはるかに移植しやすかったですな。
やっぱでもねー、速度的にはかなり厳しいもんがあるな。ラベリングの部分は Bitmap 師匠のコードをベースにほとんど書き直したんだけど、それでも複数マーカーの認識とかってのはかなり無理がありそう。
3D 表示部分も現状の Flash だとソフトウェアレンダリング(デモでは Papervision3D 使ってる)しか手がないわけで、そのへんもかなり足を引っ張る。(Astro なったらそのへんはある程度解消されるだろけど。)
つーわけで、まだいろいろ制限はあるものの Webcam とプリントされたマーカーさえあればブラウザだけでさくっと体験できちゃう Flash 版てのはお手軽でいーんじゃないかと思います。作るのも簡単だしね。
↓こちらが実際に動いてるデモ。
http://saqoosha.net/lab/FLARToolKit/
(※このマーカーをプリントして使ってくださいな → pattHiro.pdf)
んでもってソースコードは Spark Project にコミットしてあるので適当にどーぞ。ライセンスは NyARToolKit が GPL なので FLARToolKit も GPL てことになりますな。(ソース内の Copyright 表記が NyARToolKit のまんまなんだけど追々なおします。。)まだ速度的にチューニングできる部分は結構残ってるので興味あるひとはいじってやってください。
さあて、これでなんかオモロイもんつくろかのー。
追記 (5/17 1:45):trick7 の人が体験ムービーをアップしてくれてるよ!wwww
追記(8/3 20:00):サンプルで使ってる Papervision3D (GrateWhite)、どうやら最新リビジョンではカメラ関係のクラスが結構かわってるようで、動かなくなったらしい。そのうち直す。
追記(8/14 2:40):↑直した。GreatWhite の Camera3D クラスにも手をいれないとダメなのがにんともかんとも。。。
追記(2008/12/5):フォーラムできました。FLARToolKit についてのいろいろはこちらで。
English version project page available now! (Special thanks to daoki2)
Edit (2008/12/5): FLARToolKit forum is setup. Please use this forum to exchange infomation about FLARToolKit.






May 17th, 2008 at 04:36 AM
こんばんは。はじめまして。
blogのコメント欄を見て飛んできました。
ActionScript3版の実装成功おめでとうございます。
私も同じ構成で作ろうとしていたんですが、先を越されちゃいましたねw
JavaよりもFlashの方がユーザーに近いですし、色んな応用が出てくるんじゃないかと、個人的には楽しみにしてます。
開発頑張ってくださいネ
PS.
mixiにNyARToolkitのコミュニティがあります。よければ遊びに来てください。http://mixi.jp/view_community.pl?id=3311281
May 17th, 2008 at 09:44 AM
スゴス!!!
アストロのPixelBender使って、ラベリングの処理をFlashの外に出しちゃったら、結構スピードアップするんじゃないっすか??
May 17th, 2008 at 02:12 PM
はじめまして。しのぶです。
NyarToolkit DemoをAppletにしたりしております。
FLARToolKitサッソク試してみました!さくさく動きますねー!
オモロイもん期待してます☆
May 17th, 2008 at 03:19 PM
誰かやるとは思っていましたが流石!
今日のteracoはスゴイコトになっている予感。w
May 18th, 2008 at 11:23 AM
みなさんこんにちわ。
> A虎@さん
すいませんすいません。公開したらコメントしにいこうとおもって、ブログ書いてたらそのまま忘れてたす。
AS3 化は実は NyARToolKit 0.7 ぐらいのときにやっちゃってて、なんかおもしろコンテンツとともに出そうとおもってたんですけどなかなかできなくって、A虎@さんのブログにちらっと AS3 版の話がでてたんでもーいーやって出しちゃいましたw
mixi にコミュなんてあったんですねー。チェックしまーす。
> fladdict さ
Flex でプロファイリングしてるとラベリングよりはマーカーのパターンマッチングのほうが重いかんじ。まー、いずれにしても Pixel Bender をうまく使えば高速化できるとはおもうねー。3D も Astro 版 Papervision とか出ればかなり使えるもんになるんじゃなかろうか。
> Shinobu さ
Applet も使ってみるっていうところでは Flash とさほど変わんないですよね。Processing から使えるようにすればそっちのがいろいろと強力な気も。。
> れんさっ
あー、まー、でも、そなにスゴイコトにもなってないw
May 18th, 2008 at 12:20 PM
こんにちは。
AS版を開発してること教えてもらえてたら、多分私は作りませんでしたよw
結果として慌てさせてしまったようで…申し訳ない。
(でもインパクトのある開発は、こっそりやりたいときもありますよねw)
表示系の件、blogのコメント欄に参考にする資料載せときました。もしよければ見てみてください。
May 18th, 2008 at 10:54 PM
> A虎@ さん
あはは。ええまあちょっと内部事情もありまして。。w
資料ありがとうございます。ちょっと試してみますー。
May 20th, 2008 at 05:54 AM
こんにちはー Flashへの移植おめでとうございます.
ブログにて紹介させていただきました.
これを応用して何か実用的なものが作れるといいなーと
期待しております.
May 20th, 2008 at 06:31 PM
> なおきさん
こんんんにちわ。紹介ありがとうございます。
そですねー、こっから何を作るかってのが重要ですよねー。うーむ。
May 30th, 2008 at 12:27 AM
Hi !
Sorry I can’t read nor speak japanese…
You made a amazing work !
I just found a bug with the multi marker detector :
file FLARMultiMarkerDetector.as, line 155
replace
var c2:int = match_patt.getConfidence();
by
var c2:Number = match_patt.getConfidence();
Keep up the good work ;)
May 30th, 2008 at 07:03 PM
Thanks, prayone!
I’ve fixed and commited to repository.
Enjoy!
Jun 1st, 2008 at 07:50 PM
kudos ! this is awesome, someone had to write this in flash, you’re genius.
Jun 5th, 2008 at 03:30 PM
You guys rock! This is as close to Do-it-yourself augmented reality that I have seen.
See more augmented reality demos, devices and engines at http://www.gamesalfresco.com.
Many, many thanks for sharing this with the world.
Sep 9th, 2008 at 12:43 AM
Sorry for writing in english.
I downloaded your FLARToolkit Class, and I can’t make it work properly. I’m loading a specific pattern (patt file), but i’m getting every pattern recognized as the same. Even the example that you post, works the same with any black square drawn in a paper (it’s not necessary to print patt.hiro, it works with any pattern, wich is wrogn). If you could post some directions on this, it would be great! And… Congratulations for your work! Cheers.
Sep 9th, 2008 at 10:46 AM
Hi, tannis.
Sorry, I can’t understand your problem. please tell me more detail.
Sep 10th, 2008 at 12:09 AM
thanks, I already fixed it. The problem is that when only one marker is on the screen, the SingleMarkerDetector takes it as the correct marker. What I did, is force the script to check the level of confidence, not against another marker on screen (since of course ther isn’t another), but to check against an average value (for example, I set 0.65). I’m getting really good results with that, actually if I point my camera to a marker that is not the one I loaded, nothing is drawn on the screen. Wich is what I needed, of course. Anything you need, please write me an e-mail, i’ll be glad to answer, and once again, congratulations for your work.
Sep 29th, 2008 at 12:43 AM
hi Taniss, I have the same problem.
can you contact me : tim_timmers @@@ hotmail dot com ?
Thanks!
Sweet work Saqoosha!
Oct 20th, 2008 at 10:24 PM
Hi!
That’s really great work!
Unfortunately I only can watch the demo. I tried to checkout (with subversion) the files but I always get an error “XML data was not well-formed”. Did I do a mistake or isn’t the code located at http://www.libspark.org/browser/as3/FLARToolKit/trunk/ anymore?
I’d really be glad to have a look at it too!
Thanks a lot!
Tom
Oct 21st, 2008 at 07:05 PM
Is it possible to detect more than one markers at the moment? I have seen the samples and its using SingleMarkerDetector. Is there any example with more than one markers?
Thanks in advance!
Oct 21st, 2008 at 07:07 PM
Hey Tom, I had the same problem. The proper svn address would be http://www.libspark.org/svn/as3/FLARToolKit/trunk.
Good luck
Oct 22nd, 2008 at 12:48 AM
to psilos.
The class org.libspark.flartoolkit.detector.FLARDetectMarker is for multi marker detection. but I have not used this class.
If you succeed, please report!
Dec 13th, 2008 at 03:26 AM
in response to psilos.
i’ve had mixed results using the multimarker class. Basically what it does is take an array of markers and loops through them looking for the ar marker.
but it doesnt work as well as the simple marker and I still havent figure out why. maybe something wrong with my code.
heres what i’ve done:
1. load 2 or more markers
var codes:Array = new Array();
var widths:Array = new Array();
_code = new FLARCode(16, 16);
_code.loadFromURL(“../Data/marker1.pat”);
codes.push(_code);
_code = new FLARCode(16, 16);
_code.loadFromURL(“../Data/marker2.pat”);
codes.push(_code);
widths.push(MARKER_SIZE);
widths.push(MARKER_SIZE);
this._ctx.mdetector = new FLARMultiMarkerDetector(this._param, codes, widths);
2. then create a nodes array and push the Flar nodes into it:
nodes.push(this._scene.addChild(new FLARBaseNode()));
3. create papervision objects and add them as childs of the nodes created:
nodes[0].addChild(new Plane(wmat, MARKER_SIZE, MARKER_SIZE));
nodes[1].addChild(new Plane(wmat, MARKER_SIZE, MARKER_SIZE));
4. in your application loop check which markers are being detected:
var i:int = nodes.length;
while (i– > 0)
{
nodes[i].visible = false;
if (this._ctx.mdetector.detectMarkerLite(this._ctx.raster, 100) && this._ctx.mdetector.getConfidence(i) > 0.5)
{
trace(i + ” ” + this._ctx.mdetector.getConfidence(i));
this._ctx.mdetector.getTranslationMatrix(i,this._ctx.resultMat);
nodes[i].visible = true;
nodes[i].setTranslationMatrix(this._ctx.resultMat);
}
}
Feb 12th, 2009 at 01:31 AM
Hi, I’ve just looked into this and it stuff is sweet.
I’ve got a question thou. Is it possible to use a different marker rather than a square? I was thinking using a circle with a dash across it like the London underground logo:
http://subtitlestocinema.files.wordpress.com/2008/11/london_underground_logo.jpg
Any ideas how to achieve that?
Thanks
Feb 12th, 2009 at 11:07 AM
Hi Tom,
It’s impossible to use other than the square for the marker in FLARToolKit. But you can design inside of square. Please refer http://saqoosha.net/en/2008/06/05/676/ (currently in Japanese only, sorry.)
Aug 3rd, 2009 at 09:40 PM
Hi.. i want to work with NyARToolkit..
Could you please give me some guidelines.
Thanks
Srikanth