FLARManager v0.6 (augmented reality in Flash)

when memes collide...

On to version 0.6. 1.0 is around the corner…
download here:
http://words.transmote.com/wp/flarmanager/

 

what is this?

FLARManager is a lightweight framework that makes it easier to build FLARToolkit augmented reality applications for Flash. it is compatible with a variety of 3D engines, and provides a more robust event-based system for managing marker addition, update, and removal. it supports detection and management of multiple patterns, and multiple markers of a given pattern.

 

what’s new this time around?

[customization]
FLARManager’s smoothing and adaptive thresholding display algorithms are now broken out into separate classes, allowing developers to implement their own algorithms. see Inside FLARManager: Customization for more info. additionally, custom smoother and threshold display algorithms can be implemented via flarConfig.xml, to allow fine-tuning without recompiling.

[better 2D support]
added .x, .y, .z, .rotation2D, .scale2D, and .matrix2D properties to FLARMarker, for easier access to 2D transformation properties that used to be hidden inside FLARToolkit’s 3D transformation matrices.

[better camera management]
changes to FLARCameraSource provide better camera management, with less of a chance that the wrong camera will be auto-selected.

[FLARManager deactivation and disposal]
improved support for de- and reactivating, and for completely removing FLARManager from memory.

[native mirroring]
developers no longer need to flip the viewport to achieve mirroring. when FLARManager.mirrorDisplay is set to true (as it is by default), FLARManager internally mirrors the matrices generated by FLARToolkit.

 


 
below is a full list of the changes since v0.5. most of these changes will not affect applications written with FLARManager v0.5, with the exception of the change in how adaptive thresholding is implemented (see below).

 

custom adaptive thresholding and smoothing

FLARManager’s smoothing and adaptive thresholding display algorithms are now broken out into separate classes, allowing developers to implement their own algorithms. see Inside FLARManager: Customization for more info. additionally, custom smoother and threshold display algorithms can be implemented via flarConfig.xml, to allow fine-tuning without recompiling.

as a result of these changes, FLARManager.adaptiveThresholding, .adaptiveThresholdSpeed, and adaptiveThresholdBias are deprecated and removed. developers should instead specify adaptive threshold speed and bias in a <thresholdAdapter> tag, as described here.

thanks to eugene zatepyakin and matt reynolds for their suggestions and contributions to the still-in-process IntegralImageThresholdAdapter and HistogramThresholdAdapter algorithms.

 

better camera management

FLARCameraSource now activates the first camera found, instead of defaulting to ‘USB Video Class Video’. if a camera reports no activity after a few seconds, the next camera in line is automatically selected. this continues until an active camera is found, or all camera options are exhausted. also, developers can manually specify a camera index (from Camera.names) via FLARCameraSource.cameraIndex.

 

better 2D support

added .x, .y, .z, .rotation2D, .scale2D, and .matrix2D properties to FLARMarker, for easier access to 2D transformation properties that used to be hidden inside FLARToolkit’s 3D transformation matrices. updated FLARManagerTutorial_2D and FLARManagerExample_2D to demonstrate these new properties.

 

updated 3D engines

the FLARManager distro now includes Away3D 3.3.4 (featuring vector shape primitives, like text) and Papervision3D 2.1.920 (featuring better COLLADA support).

 

more configuration options

in addition to exposing custom smoothing and adaptive thresholding in flarConfig.xml, developers can also specify the pixel size of a pattern at which it generates a transformation matrix of a scale of 1.0, via <pattern size='N'>; and can tweak FLARManager performance using <flarManagerSettings minimumLabelSize=’N'>. see the documentation page for more details.

 

native mirroring

developers no longer need to flip the viewport to achieve mirroring. when FLARManager.mirrorDisplay is set to true (as it is by default), FLARManager internally mirrors the matrices generated by FLARToolkit.

 

improved stability in tutorials/examples

a condition in a number of the tutorials and examples caused content to be absent from the screen, even when the marker was clearly present. this is fixed, by adding a handler for FLARMarkerEvent.MARKER_UPDATED events in those tutorials/examples.

 

FLARManager deactivation and disposal

FLARManager.activate(), FLARManager.deactivate(), and FLARManager.dispose() give developers more control over when FLARManager is consuming resources.

 

FLARManager.verbose

setting FLARManager.verbose to true allows developers to keep a closer eye on changes to FLARManager’s configuration via trace() output.

47 Comments

  1. Rafael Lima says:

    Can not wait to get out the 1.0 version with improved light and contrast.
    Anyway, it was very good this update.

  2. Guile C. says:

    Great!!!

    Thanks for this update!

    But I have a problem: I’ve got a marker active, include in activeMarkers vector, but I’ve got the MARKER_REMOVED dispatched and the MARKER_ADDED not dispatched after this. Its not sinc anyway.

    Any help?

    Thanks in advance!

  3. Ric says:

    Any chance I can get some help getting v0.6 running in Flash CS4 Pro?

    I’ve created a FLA with the class set to FLARManagerExampleLauncher, and I’ve added the supporting libraries to my library path in publish settings. When I compile, I’m getting a ton of errors and warnings. They start off with a series of errors in the labeling class:

    1044: Interface method attachDestination in namespace org.libspark.flartoolkit.core.labeling:IFLARLabeling not implemented by class org.libspark.flartoolkit.core.labeling:FLARLabeling_BitmapData.

  4. Ric says:

    Sorry to spam, but previous comment was cut off…

    I can see that these methods are in the class so I’m at a loss as to why they’re failing. I’ve been banging my head on this for a while and finally am to the point of asking for any help at all.

    Has anyone got v0.6 working in Flash, and if so do you have any idea what I’m doing wrong?

    Thanks,

    -Ric

  5. ericsoco says:

    @guile — i’m sorry, i’m not understanding your question…there is a problem, caused by markerRemovalDelay > 0, in which the MARKER_REMOVED event for a given marker is dispatched *after* the MARKER_ADDED event is dispatched. this happens when a marker moves very quickly to a new location. it’s best resolved by adding a MARKER_UPDATED handler as well, as done in, for example, FLARManager_Tutorial2D.

    also, you asked about Away3D Lite — no plans to add support, but it should be quite simple; i understand the basic framework is the same, so you should be able to just remove the Away3D 3.3.4 SWC and add in the Away3D Lite package or SWC and be up and running, no?

  6. ericsoco says:

    @ric — very strange. yes, the attachDestination method is implemented by FLARLabeling_BitmapData, and i’m definitely not seeing that error. perhaps you should download the latest FLARToolkit via SVN? although that’s exactly what’s included in the FLARManager distro. if you figure out the problem, please let us know…

  7. Ric says:

    @ericsoco Looks like it may be a Flash CS4 bug. Here’s what I’ve learned so far:
    * I downloaded the latest FLARtolkit from the SVN, and it has the same issue (which is expected given that’s the same code you ship with).
    * I can compile FM v0.5 without issue, with either the latest FLARtoolkit or the older version that shipped with v0.5.
    * I get the same issue if I downgrade FLARtoolkit to the version that shipped with v0.5.
    This was smelling like a bug in Flash Pro CS4 (shocker, I know), so I did some googling and turned up this blog post which looked promising (and shows a workaround):
    http://blog.webdeely.com/2009/02/cs4-doesnt-like-the-combo-of-internal-classes-and-interfaces-in-as3/
    I’ve done a bit of digging in FLARmanager to see if I could alter singletons that may be tripping this bug, but so far all I’ve done is bork the code further. Any chance this makes more sense to you?

  8. ericsoco says:

    @ric — looks like you’re probably right. dunno why FM v0.5 does not have this problem, perhaps there was a change in FLARLabeling_BitmapData in between the two releases. dunno (i don’t maintain the FLARToolkit source). but yes, FLARLabeling_BitmapData does implement an interface *and* include an internal class, which matches the bug description in your link. so, to fix it, try creating a dummy interface and also implementing it in FLARLabeling_BitmapData, and let us know if that works. thanks!

  9. [...] Dependency Injection September 29, 2009 — mattreyuk I’ve been taking a look at the latest FLAR Manager code with a view to implementing the histogram bias generation for adaptive thresholding I’ve [...]

  10. Kaspar says:

    Good stuff, thanks.

  11. max says:

    i’m having exactly the same error as ric , what version of flash are you using?
    or what version should i use to compile right, i see many people have no problem in compiling the code i have flash cs4 version 10

  12. max says:

    solved it

  13. Ric says:

    @max: How did you solve this?

  14. Gerald Yeo says:

    Just implement another dummy interface for FLARLabeling_BitmapData:

    public class FLARLabeling_BitmapData implements IFLARLabeling, IDummy {...

  15. Vossler says:

    I am wondering how to change video’s res to 1280×720, I make some changed in flarConfig.xml
    flarConfig.xml、flarConfig_loader.xml and flarConfig_wide.xml to follow,but video’s res remian 640×480, anyway to slove this?

    My webcam can support to 1280×720 at 30 fps (microsoft lifecam)

    tahnks

  16. ericsoco says:

    @vossler, try:

    you could probably capture at a higher res than that, but only if you have a fast computer.
    i’ve never tested FLARManager with a non-4×3 camera, so it’s possible there’s a bug in there, but that *should* work.

  17. Nacho says:

    Hi! awesome work man!!! its really great!!

    i’ m having problems controlling the animations with collada models, is there any way to do this??
    not just starting the animation when the model is loaded or looping it through the constructor of the DAE class, i mean controlling the animations separately, for example i want to do this:
    if (“some key is pressed”)
    {
    //load animation A or load animation B
    }

    maybe there is a way to get the frames, so i can load an animation from x frame to x frame and so on….

    well, thats the problem!! please HELP!!!!
    thanks!!! and again, awesome work with flarmanager!!!!

  18. ericsoco says:

    @nacho, i don’t know much about pv3d or collada. try the flartoolkit forum.

  19. Rob says:

    Hey guys I’m trying to run this in Flash CS4 too. How exactly do I “Just implement another dummy interface for FLARLabeling_BitmapData: public class FLARLabeling_BitmapData implements “? Thanks.

  20. atmospherix says:

    @ericsoco – FYI, I was having issues with detecting my camera on my Mac (using Flash CS4). For whatever reason Flash thinks I have 3 different camera sources, yet only one physical camera attached. The bit of code in FLARCameraSource.as that cycles thru the cameras just sets the active camera to the last one in the list, which in my case was not a true camera. I removed the code and just used this.camera = Camera.getCamera(); which should return the default. I’m guessing the code that was there was to make sure all cameras were tried to activate – any thoughts if what I changed it to would cause problems?

    @rob, in FLARLabeling_BitmapData.as, add a dummy class after “implements” in the class declaration, such as IDummy:


    public class FLARLabeling_BitmapData implements IFLARLabeling, IDummy

    then, in the same location as FLARLabeling_BitmapData.as, create an empty interface named IDummy.as:


    package org.libspark.flartoolkit.core.labeling {
    public interface IDummy {
    }
    }

  21. Daniel says:

    Rob and all other Flash CS4 users:

    Step 1.- Open the FLARLabeling_BitmapData.as file and replace the line that says:
    public class FLARLabeling_BitmapData implements IFLARLabeling {
    with this line:
    public class FLARLabeling_BitmapData implements IFLARLabeling, IFLARDummy {
    (Should be around line 44). Save and close the file.

    Step 2.- Create an AS file named IFLARDummy.as in the same folder where FLARLabeling_BitmapData.as is. Inside IFLARDummy.as paste the following code:

    package org.libspark.flartoolkit.core.labeling {
    public interface IFLARDummy {
    }
    }

    That’s it! This will resolve the Flash CS4 complie error.
    Hope this works for you as it worked for me!

  22. ericsoco says:

    @atmospherix:
    yeah, this camera thing is a huge pain in my ass. and a lot of other asses, like yours. jim alliban just suggested something else to try, but will be a bit until i have it implemented. if you want FLARManager to just use Camera.getCamera(), you can do so by downloading the latest from SVN, and setting your FLARCameraSource.useDefaultCamera = true:


    var flarManager:FLARManager = new FLARManager("configfilepath");
    flarManager.flarCameraSource.useDefaultCamera = true;

    if we can get this issue sorted, i’ll release a new minor version with the fix in it. been lots of people with this problem lately.

    @atmospherix & @daniel — thx for explaining how to get around that CS4 bug!

  23. Rob says:

    @atmospherix

    Thanks for getting back to me! Unfortunately I have more errors popping up after I implement the dummy class.

    Warning: 1090: Migration issue: The onMouseDown event handler is not triggered automatically by Flash Player at run time in ActionScript 3.0. You must first register this handler for the event using addEventListener ( ‘mouseDown’, callback_handler).

    Warning: 1090: Migration issue: The onMouseMove event handler is not triggered automatically by Flash Player at run time in ActionScript 3.0. You must first register this handler for the event using addEventListener ( ‘mouseMove’, callback_handler).

    Warning: 1090: Migration issue: The onMouseUp event handler is not triggered automatically by Flash Player at run time in ActionScript 3.0. You must first register this handler for the event using addEventListener ( ‘mouseUp’, callback_handler).

    Warning: 1090: Migration issue: The onKeyDown event handler is not triggered automatically by Flash Player at run time in ActionScript 3.0. You must first register this handler for the event using addEventListener ( ‘keyDown’, callback_handler).

    I’m going to try to work through these but if you know what’s going on it’d be much appreciated!

  24. ericsoco says:

    @atmospherix — those aren’t errors, they’re just CS4 being cranky about me using names for event handlers that make sense. ignore them. (the flex/flash builder compiler doesn’t generate those errors, thankfully.)

  25. Rob says:

    I set up the dummy class but now I receive this error
    VerifyError: Error #1014: Class Vid could not be found.

    at global$init()

    I still get the mirgration issue warnings as well.

  26. ericsoco says:

    *** CAMERA FIX ***
    to those who were having camera selection issues, please download the latest from SVN. i believe it’s fixed now. if so, i’ll roll it out as a minor version.

  27. th3d0g says:

    @daniel

    Cheers, this works in CS4.

  28. pd7 says:

    Hi,
    I keep getting theses vid errors also.
    I cannot find where the problem could be.
    1046: Type was not found or was not a compile-time constant: Vid
    1180: Call to a possibly undefined method Vid

    thanks.

  29. ericsoco says:

    @pd7 — no idea. you must have altered the code in some way, there is nothing in FLARManager called ‘Vid’.

  30. pd7 says:

    Thank you. I just figured it out.
    I was doing a tutorial where you could play a video. where the swc had the flv playback that was of type vid. I had to add the swc file correctly into flash builder by adding it to my library path.

    thanks.

  31. [...] Thanks to the wonderful comments on the flarmanager site, a solution was found. This comment was found there (http://words.transmote.com/wp/20090923/flarmanager-v0-6-augmented-reality-in-flash/): [...]

  32. ads says:

    Hi @pd7 and ericsoco,

    I think I’ve been following the same tutorial and have the same error msg being returned …

    1046: Type was not found or was not a compile-time constant: Vid
    1180: Call to a possibly undefined method Vid

    Was wondering if you could point me in the right direction in terms of loading an swc correctly into my flash builder project and library …

    Thanks in advance!

  33. ericsoco says:

    @ads — i really have no idea where you’re getting ‘Vid’ from…what file is returning those errors? it should be visible in the console / error dialog.

  34. pd7 says:

    yes i was following the same tutorial. Vid is a .swc file that is being used in that tutorial.
    what you have to do is In flash builder add the Vid.swc file into the library path in the project.
    go into the properties of your project- actionscript build path and add the swc to your library path from your src folder.

    that should fix those errors msg’s.

  35. ericsoco says:

    @pd7 — what tutorial? not one of mine…

  36. ads says:

    Thanks guys, yep, got the right .swc file loaded now (this was from a tutorial on loading videos onto planes … http://www.gotoandlearn.com/play?id=114)

    Thanks again … now onto loading/attaching different videos to different markers!

  37. ericsoco says:

    @ads — thanks for answering this question. relieved to hear it’s not my issue :) and good for other readers to know about.

  38. BenJah says:

    Warning: 1090: Migration issue: The onMouseDown event handler is not triggered automatically by Flash Player at run time in ActionScript 3.0. You must first register this handler for the event using addEventListener ( ‘mouseDown’, callback_handler).

    =========================

    Hi

    I’m usign Flash CS4 10.2, and at this issue I replace onMouseDown to fOnMouseDown, same nomenclature for the rest: “fOn…” and the migration issue solved.

    Thanks for the dummy class by the way.

  39. FlarGuy says:

    Hey, I’m using the tutorial from Lee about FLARManager and I’m almost through it! However, I am getting an error about DesignerLayer, and I don’t know that I ever used that. It may have been caused from creating an swc by converting an FLVPlayback into a movieclip symbol and exporting it as a flex component, and then exporting it as an swc.
    Any Idea how this can be solved?

  40. ericsoco says:

    @flarguy – no idea, sorry. never heard of DesignerLayer. ask lee?

  41. Flacoloco says:

    @daniel

    thanks for the dummy trick. It works perfect for me (Flash CS4 v10.0, Mac)

  42. berylsun says:

    hi..i just started to use FM and very new to AR..im following the same tutorial and getting the same errors which are
    1046: Type was not found or was not a compile-time constant: Vid
    1180: Call to a possibly undefined method Vid
    may i know where to get the Vid.SWC?more specified path to get it? i dun seems like able to find the swc in my src folder and add to the lib path in the project..

  43. ericsoco says:

    @berylsun — this is a problem with lee’s tutorial, and i don’t know how to help you. it came up on the flartoolkit forum, and i believe if you search there you’ll find an answer.

  44. berylsun says:

    thanks for answering my question..problem solved :D
    u need to go to the site where u got the tutorial and get the source file..the vid.swc is inside the src folder..take that and include it into ur src folder and add to ur project’s build path :)

  45. suzan says:

    hello~I am a new learner for flarmananger, I only find a tutorial for how to use flarmanager v0.6, but i can’t download this lib.
    DO U HAVE ONE?CAN U SENT IT TO MY EMAIL?THANKS A LOT
    from a poor english speaker

  46. MO Ansari says:

    Hi, im new to flarmanager too

    i really need the flarmanager v06 just like suzan

    CAN YOU PLEASE SEND IT TO MY EMAIL
    THANKS A LOT

Leave a Reply

Additional comments powered by BackType