Skip navigation
Currently Being Moderated

compatibility between the OpenCV library using C / C + + to pass it to AS3 using Alchemy tool

Feb 5, 2012 11:23 AM

Tags: #actionscript3 #alchemy #c/c++ #opencv


I wonder that so many compatibility between the OpenCV libraryusing C / C + + to pass it to AS3 using Alchemy tool .... That is, you can compile the libraries cv.hy highgui.h for use in AS3?

In such case that yes you can, how can you do or where I shouldguide me?

Otherwise, other options are there to make that connection?

  • Currently Being Moderated
    Mar 2, 2012 12:44 PM   in reply to sthef4



    There is a project on github about just that :

    I made a fork :


    At this time, i've been able to compile opencv and run some basic filters like medianBlur.

    But i didn't achieve to run ViolaJones face detection. I'm stuck at loading the HaarCascade xml files in opencv Lib, as the loading structs in opencv are quite to complex for me to succeed...


    I just saw today a video of a guy who achieved to make opencv run as an AIR Native Extension :


    Good luck !

    Mark as:
  • Currently Being Moderated
    Mar 5, 2012 5:04 AM   in reply to Eric Helier

    I'm working on the exact same thing right now and so far I've run in to two problems


    The first problem when loading cascade classifiers is the definition of CV_XADD. By default it will use __gnu_cxx::__exchange_and_add which doesn't work in Alchemy. The solution is to make sure it uses the last define to do with CV_XADD in operation.hpp:


    template<typename _Tp> static inline _Tp CV_XADD(_Tp* addr, _Tp delta) { int tmp = *addr; *addr += delta; return tmp; }


    The second problem is to do with the global declaration of the CvTypes. I'm stilling looking for a proper solution to this.


    Update: more info on the global declarations: /4171120


    My best guess right now is to have a seperate method for initializing the globals when the clib gets initialized. In case you hadn't understood it yet, I'm talking about the global declarations of CvTypes such this one at the bottom of haar.cpp:


    CvType haar_type( CV_TYPE_NAME_HAAR, icvIsHaarClassifier,
                      icvReadHaarClassifier, icvWriteHaarClassifier,
                      icvCloneHaarClassifier );


    These aren't run by Alchemy and that causes the types to not be registered, which makes it impossible to parse the XML files.

    Mark as:
  • Currently Being Moderated
    Mar 5, 2012 8:17 AM   in reply to michielbrinkers

    fyi, the __gnu_cxx::__exchange_and_add problem can also be fixed by rebuilding libstdc++, as described here.

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points