showing error value during iterative process (in order to get the transformation matrix) in FLARToolKit

18 views
Skip to first unread message

Prama

unread,
Jun 7, 2011, 9:04:15 PM6/7/11
to FLARToolKit userz
I'm creating a simple augmented reality scene that I made based on Lee
Brimelow's tutorial, using Adobe Flex Builder. I already asked about
this in here.

I'm trying to find the PSNR of my program. To do such thing, I need to
know the iterative process--that FLARToolKit does to determine the
Transformation Matrix.

As we all know before the 3D image could be rendered on the marker,
FLARToolKit will detect the image from camera, and try to find any
rectangle shape that closely enough look like the .pat file that we've
declared in the program. The process itself, according to Hirokazu
Kato's presentation about ARToolKit, happens 4 times.

I wonder if I could show those 'numbers' (the iterative process/
errors) when I run my program? (I don't know where the numbers would
appear. Probably also included in the .swf file?)

The error will help me finding the PNSR of my program.

Thank you so much for the help. Sorry for being a newbie.

eric socolofsky

unread,
Jun 7, 2011, 9:19:06 PM6/7/11
to flartool...@googlegroups.com
for those who were wondering, PSNR = peak signal-to-noise ratio.
sounds like you probably want to use confidence values? and compare them across frames. that's something easily accessible, no?

sorry, been a while since i've dug into the code, maybe makc or others can provide more suggestions...

Makc

unread,
Jun 8, 2011, 3:45:28 AM6/8/11
to flartool...@googlegroups.com
On Wed, Jun 8, 2011 at 4:04 AM, Prama <prama.sh...@gmail.com> wrote:
> The process itself, according to Hirokazu
> Kato's presentation about ARToolKit, happens 4 times.
>
> I wonder if I could show those 'numbers' (the iterative process/
> errors) when I run my program?

I assume you are referring to
http://www.hitl.washington.edu/artoolkit/Papers/ART02-Tutorial.pdf
page 14

There is public var error:Number in NyARTransMatResult that
FLARTransMatResult extends. It is set in NyARTransMat's optimize()
method; if you look into its source, you can see this:

for (var i:int = 0;i<5; i++) {
...
var err:Number=errRate(rot,io_transvec, i_offset_3d, i_2d_vertex,4,vertex_3d);
//System.out.println("E:"+err);
...
min_err=err;
}
//System.out.println("END");
return min_err;

so, these error values are not preserved, and you only have last one
of them. If you need them all, you will have to modify FLARToolKit.

Prama

unread,
Jun 20, 2011, 2:57:04 PM6/20/11
to FLARToolKit userz
On Jun 8, 2:45 pm, Makc <makc.the.gr...@gmail.com> wrote:

> I assume you are referring tohttp://www.hitl.washington.edu/artoolkit/Papers/ART02-Tutorial.pdf
> page 14
>
> There is public var error:Number in NyARTransMatResult that
> FLARTransMatResult extends. It is set in NyARTransMat's optimize()
> method; if you look into its source, you can see this:
>
> for (var i:int = 0;i<5; i++) {
>         ...
>         var err:Number=errRate(rot,io_transvec, i_offset_3d, i_2d_vertex,4,vertex_3d);
>         //System.out.println("E:"+err);
>         ...
>         min_err=err;}
>
> //System.out.println("END");
> return min_err;
>
> so, these error values are not preserved, and you only have last one
> of them. If you need them all, you will have to modify FLARToolKit.


I see.. so it is almost impossible for me to acquire those values,
isn't it?
I'm sorry if it's a bit out of topic, but, I'm trying to find a way so
I can calculate PSNR of the program (video output)--that's why I was
wondering if I could get those error values..
Do you have any suggestion, Makc? Thank you before

eric socolofsky

unread,
Jun 20, 2011, 3:26:03 PM6/20/11
to flartool...@googlegroups.com
not impossible at all. that's the joy of open-source software.
just hack the code at the location makc suggested to store those values somewhere your application can access them.

Makc

unread,
Jun 20, 2011, 4:15:50 PM6/20/11
to flartool...@googlegroups.com
On Mon, Jun 20, 2011 at 10:26 PM, eric socolofsky <er...@transmote.com> wrote:
> not impossible at all.  that's the joy of open-source software.
> just hack the code at the location makc suggested to store those values somewhere your application can access them.

or, if you just need large sample for statistics, replace line
//System.out.println("E:"+err);
with
trace(err)
and you will have them in flash log file. then you can copy-paste to
spreadsheet app and do your magic

Daniel Ferenc Szak

unread,
Jun 20, 2011, 4:19:33 PM6/20/11
to flartool...@googlegroups.com

Good evening,

I would suggest dispatching a custom event with that local variable as data appended to it, and listen to it in the main app (if this class extends an eventdispatcher).

daniel.

Prama

unread,
Aug 7, 2011, 1:42:58 PM8/7/11
to FLARToolKit userz
Hello.

First of all, thank you so much for your help, Eric, Mack, and Daniel.
I've tried hacking the code, but I wasn't sure what to do next after
reading the .log files, because I didn't see any data that I can use.

!SESSION 2011-06-08 09:26:21.738
-----------------------------------------------
eclipse.buildId=unknown
java.version=1.5.0_11
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=in_ID
Command-line arguments: -os win32 -ws win32 -arch x86

!ENTRY org.eclipse.core.resources 2 10035 2011-06-08 09:26:27.552
!MESSAGE The workspace exited with unsaved changes in the previous
session; refreshing workspace to recover changes.



But anyway, I've figured out another way I can get the PSNR that
FlarToolKit can tolerate, by using MATLAB.
There are two ways I can think of to do so :

1. Create FlarToolKit's simulation in MATLAB.
The problem in this method is, I'm not sure I will be able to
represent FlarToolKit mathematical process in MATLAB, since the
process itself is quite complicated for me. i.e detecting the marker,
transform the coordinates, until comparing the transformed image with
the .pat files. (just like what this tutorial explained in page 14,
including the errors http://www.hitl.washington.edu/artoolkit/Papers/ART02-Tutorial.pdf
although I'm planning to exclude the distortion variable since I'm not
dealing with real camera)

Automatically, if I am able to create such simulation, I will also get
the numbers--since with MATLAB, we are dealing with numbers and
matrices.
Numbers mean I can calculate the PSNR. :)

(talking about it is so much easier than doing it.)


2. Comparing the .pat files with the image that has been transformed
by FlarToolKit.
So in this way, I'm hoping I can acquire the image that has been
transform by FlarToolKit, so it can be compared to .pat files.
This is actually inspired by saqoosha's Intro-to-Flartoolkit, page 20
http://saqoo.sh/a/labs/FLARToolKit/Introduction-to-FLARToolKit.pdf
The problem now : How to acquire such image? hahaha. Is there anyway I
can get the image?


Again, I'm so sorry for these questions.

Regards,
Prama Shaumadhana

Makc

unread,
Aug 7, 2011, 3:05:31 PM8/7/11
to flartool...@googlegroups.com
On Sun, Aug 7, 2011 at 8:42 PM, Prama <prama.sh...@gmail.com> wrote:
> I wasn't sure what to do next after
> reading the .log files, because I didn't see any data that I can use.
>
> !SESSION 2011-06-08 09:26:21.738
> -----------------------------------------------
> eclipse.buildId=unknown
> java.version=1.5.0_11
> java.vendor=Sun Microsystems Inc.
> BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=in_ID
> Command-line arguments:  -os win32 -ws win32 -arch x86
>
> !ENTRY org.eclipse.core.resources 2 10035 2011-06-08 09:26:27.552
> !MESSAGE The workspace exited with unsaved changes in the previous
> session; refreshing workspace to recover changes.

if these lines are log file you're referring to, you're looking into wrong file.
see google for flash log location:
http://www.google.com/search?q=flash+log+location

also make sure you have debug player, or it will not log anything
http://www.google.com/search?q=installing+debug+flash+player

SDaniel

unread,
Aug 7, 2011, 3:25:06 PM8/7/11
to flartool...@googlegroups.com
2. Comparing the .pat files with the image that has been transformed
by FlarToolKit.
So in this way, I'm hoping I can acquire the image that has been
transform by FlarToolKit, so it can be compared to .pat files.
This is actually inspired by saqoosha's Intro-to-Flartoolkit, page 20
http://saqoo.sh/a/labs/FLARToolKit/Introduction-to-FLARToolKit.pdf
The problem now : How to acquire such image? hahaha. Is there anyway I
can get the image?

I don't know if this program can be useful for you.
In a spanish forum about augmented reality, the user ryo007 did a program that can convert the .pat in a preview (in HTML) of the original image: http://foro.aumentality.com/topic/ver-contenido-de-archivos-pat [ES] - If you need a translation please say me.
--
Sergio Daniel Fernández González (AKA ZoiX)

Prama

unread,
Aug 7, 2011, 4:15:46 PM8/7/11
to FLARToolKit userz
> I don't know if this program can be useful for you.
> In a spanish forum about augmented reality, the user ryo007 did a program
> that can convert the .pat in a preview (in HTML) of the original image:http://foro.aumentality.com/topic/ver-contenido-de-archivos-pat[ES] - If
> you need a translation please say me.

Thanks SDaniel :-)
But actually, I'm not having trouble previewing the .pat file. I'm
using MATLAB for showing the image. But maybe I'll download your
program just to compare what I got from MATLAB.
Thanks again.

>if these lines are log file you're referring to, you're looking into wrong file.
>see google for flash log location:
>http://www.google.com/search?q=flash+log+location
>also make sure you have debug player, or it will not log anything
>http://www.google.com/search?q=installing+debug+flash+player

Hmm.. I'm not sure if I did install the debugger.
Thanks for the tips, Mack :-)
But do you have any suggestion about my alternative ways?
Sorry for asking too much, Mack.
I'd really appreciate it :-)

Makc

unread,
Aug 7, 2011, 6:23:36 PM8/7/11
to flartool...@googlegroups.com
> But do you have any suggestion about my alternative ways?


no but compile and run this program:

package {
import flash.display.*;
public class Test extends Sprite {
public function Test () {
addEventListener ("enterFrame", test);
}
public function test (e:*):void {
trace (123);
}
}
}

it will fill log file with 123 so you could be positive you are
looking at the right place. then go back to messing with your hacked
flartoolkit source.

Reply all
Reply to author
Forward
0 new messages