Zinc DLL interface = slow?

At the moment I’m working on a webcam game as part of my Master thesis research. There are many Computer Vision libraries available in C/C++ (for example with optical flow implementations or face detection), but C++ isn’t very suited for rapid prototyping in respect to interface and game graphics.

Flash is very useful for this. Also, reading the webcam input is a lot easier in Flash than in C. So, what’s the idea: Flash reads the webcam, sends the image data to C++. Then the C++ application sends back the meta information about the images / frames, which Flash uses to draw the game graphics and execute actions in the game.

Zinc
My plan was to use Zinc. With Zinc you can convert a .swf file (Flash) to a .exe (Executable). Zinc is actually a container like a browser, using an integrated Flash Player. What’s nice about Zinc is that you can shape the window of your application like you want, and they provide additional API functionality. With the extra API calls you can access low level system commands like rebooting the PC, or information like the CPU speed. It also provides database connectivity with MySQL and Access.

Using the Zinc API you can also access external DLL’s. So, what I tried to do was use this DLL access to analyse the webcam data in an external C++ application that uses existing Computer Vision libraries.
To test the DLL connection, I wrote tiny test DLL (source). It consists of two functies, Init and Process. Init is a pure dummy function, Process returns a small test string.

Flash
Calling the external DLL in Flash (AS3):

// Create the Bitmap
var bmd:BitmapData = new BitmapData(30, 30, false);
var rect:Rectangle = new Rectangle(0, 0, 30, 30);
var bytes:ByteArray = bmd.getPixels(rect);

// DLL
var myDLL:DLL = new DLL("TestDLL.dll");
parameterIndex = myDLL.addParameter("integer", "120");
parameterIndex = myDLL.addParameter("integer", "120");
myDLL.call("none", "Init");
myDLL.clear();

// Send data to DLL
parameterIndex = myDLL.addParameter("unsigned char*", bytes);
var result:String = myDLL.call("unsigned char*", "Process");
myDLL.clear();
myDLL.close();

Result
And we’re done! You would say… Unfortunately, some time profiling shows even the Init dummy function takes 30ms to execute. Sending a 120×120 bitmap takes 180ms. As 10FPS can be considered a minimum you want for analysis, we can conclude this is too slow to be useful.
The next and final attempt (because of time constraints) is to use a C++ server and use a Socket to communicate between Flash and the server.

25 Responses to “Zinc DLL interface = slow?”

  1. hal Says:

    Hi
    very interesting.
    do you think this program can link to an external dll which supplies either analog info or binary info from an external physiological monitoring program to control mouse movements or other flash parameters.
    thx
    Hal

  2. Marijn Says:

    Hi Hal,

    Can you tell me something more about what you’re trying to do?

  3. optical frames Says:

    HEY, THAT GIVES ME AN IDEA USEFUL INFOS FROM YOUR SITE. I SEE. THANKS ANYWAY :)!

  4. Jaruwan Says:

    Hey Marijib,
    I’m very new in flash, actionscrip, and zinc. I am using Macromedia flash 8 with action script. Can I use” var myDLL:DLL = new DLL(“TestDLL.dll”);” directly in actionscript?
    Thank you,

  5. sosFree Says:

    Hi, I ve downloaded the source code of cpp project and I am unable to compile it, I am using dev c++, can you tell me how to do ?
    it tells me that there are problems with linking

  6. sosFree Says:

    sorry I forgot to say that it is for face recognition project

  7. gamer22871 Says:

    Vureo has the highest quality flash games as well as selection. click to go to vureo.com

  8. Anonymous Says:

    Yildiznet Bursa SEO nice topic, look forward to more such issues.

  9. dwlkumar Says:

    how to published testdll.cpp in VB. plz help me…

  10. jjbqvptrw Says:

    ugg boots cheap They’re now awfully particular vogue equipment that speak of their wearer in more means than just one. You will have to preserve the delivery along with other overhead in your mind. Which means you have to promote designer purses, very well you’ve decided on an exceptionally successful and challenging marketplace to obtain into.
    Padlock shim sets typically feature four or 5 different-sized shims, that happen to be merely slender parts of spring steel. These ends are inserted within the gap the place the lock satisfies its hasp to ensure that the ideas disengage the locking mechanism within the housing. The base of your shim, in the meantime, is cut to suit the contours with the exposed U-shaped latch, supplying you more significant manage in maneuvering the end..

    louis vuitton handbags Hardly per day goes by exactly where we don’t must offer with a few style of challenge that demands our speedy consideration. Regardless of whether it is really a work-related conflict or personal problem, your power to regulate that issues may have a profound influence on your journey by lifetime. The situation is, you hardly ever know when or in which hassle will strike..

    http://www.luxurybrandssales.co.uk As a result, for anyone using an fascination in checking the future price of propane, it may be smart to continue to be up-to-date on existing OPEC guidelines. This is easy to do if the business tends to make its approach to the front-page headlines; nonetheless, you shouldn’t hold out for this to materialize. Educate oneself about OPEC, and just how their insurance policies for oil manufacturing have already been proven..

    http://www.cheapuggsonlinesale.com class=”MsoNormal” style=”MARGIN: 0in 0in 0pt”>In 1983, Congress amended the cultural safety act to produce that, for individuals born in 1938, the age of eligibility for total social safety added benefits would increase gradually from 65 to sixty seven. (For that reason the initial outcomes from the reform weren’t experienced until finally 2003, when people born in 1938 reached the age of 65, and also the full outcome won’t be thought until 2026, when people today born in 1959 achieve 67-it will be the deferral in the hurt that created the program politically feasible.) This is a unhappy commentary on our political program that there is no movement today for the same reform, which might raise the future age of entitlement to full social protection gains to 70 in recognition of carrying on with boosts in longevity, health, and profits. We’re in ostrich mode to date as addressing our fiscal challenges is anxious, despite the fact that the issues are considerably extra significant than they were in 1983..
    Your sales and profits web site is in which your online marketing success can start off or simply abruptly conclusion if you don’t existing or ‘structure’ your message appropriately. Good promotion copy requires not only to get persuasive but also delivered within an order or style that men and women can more easily method. The twelve move guideline offered over serves to ‘feed’ visitors particular data as essential.

    cheap ugg boots Get started by listing oneself with some on the social networking websites which the recruiters have a look at. These are generally web-sites that have valuable instruments for getting you observed. You may have to be more artistic in regards to getting noticed. For those who planning for an crisis scenario or camping trip, you would also require other goods besides ammunition. This involves emergency, ready-to-cook meals, first help and medical kits, water purifiers, individual sanitation things, rubbish bags, etc. Its be .

  11. male enhancement testimonials pictures Says:

    Its such as you learn my thoughts! You seem
    to grasp a lot approximately this, such as you wrote the book
    in it or something. I think that you simply can do with some % to force the message home a bit, but other than that, this is great blog. A great read. I’ll definitely be back.

    My website :: male enhancement testimonials pictures

  12. cheap nfl jerseys Says:

    hngbgdyhfgbjyt

  13. alpha cut hd Says:

    Thanks for your marvelous posting! I actually enjoyed reading
    it, you could be a great author. I will always bookmark your blog and definitely will come back at some
    point. I want to encourage you to ultimately continue your great writing,
    have a nice morning!

    my blog post … alpha cut hd

  14. 95 air max release dates Says:

    Hi! I realize this is somewhat off-topic but I needed to ask. Does managing a well-established website such as yours require a massive amount work? I’m brand new to running a blog however I do write in my diary everyday. I’d like to start a blog so I can share my experience and thoughts online. Please let me know if you have any kind of recommendations or tips for brand new aspiring bloggers. Thankyou!

  15. burberry shop online Says:

    Superb website you have here but I was curious if you knew of any discussion boards that cover the same topics discussed here? I’d really like to be a part of online community where I can get feedback from other knowledgeable individuals that share the same interest. If you have any suggestions, please let me know. Many thanks!

  16. damier authentic louis vuitton garment bag Says:

    Good day! Do you know if they make any plugins to safeguard against hackers? I’m kinda paranoid about losing everything I’ve worked hard on. Any tips?

  17. north face pullover Says:

    Hey there! I know this is kinda off topic however I’d figured I’d ask. Would you be interested in trading links or maybe guest writing a blog post or vice-versa? My site discusses a lot of the same topics as yours and I think we could greatly benefit from each other. If you are interested feel free to shoot me an e-mail. I look forward to hearing from you! Superb blog by the way!
    north face pullover http://revistabombeiros.com.br/images/north-face/@1@1onorth-face-pullover@2@5pz.asp

  18. http://www.skinterventionguidereviewed.com Says:

    Regarding the web blog owner, might I question just how do you manage junk posts?

    We are looking to pay up just for advice regarding how to control it!

  19. right forestall smoking Says:

    I’m truly enjoying the design and layout of your blog.

    It’s a very easy on the eyes which makes it much
    more pleasant for me to come here and visit more often. Did you hire out a designer
    to create your theme? Fantastic work!

  20. fickcommunity Says:

    Hmm is anyone else encountering problems with the pictures on this blog loading?
    I’m trying to determine if its a problem on my end or if it’s
    the blog. Any suggestions would be greatly appreciated.

  21. dang tin rao vat nha dat Says:

    Hi there to every body, it’s my first pay a visit of this website; this blog includes amazing and genuinely good data in favor of readers.

  22. viec lam rao vat Says:

    Great delivery. Great arguments. Keep up the good spirit.

  23. dien dan rao vat mua ban Says:

    Hi, I desire to subscribe for this web site to obtain most up-to-date updates,
    therefore where can i do it please help out.

  24. scrap my car Says:

    scrap my car

    Marijn Speelman » Blog Archive » Zinc DLL interface = slow?

  25. sportsthailand.net Says:

    At this moment I am going to do my breakfast, after having my breakfast coming again to read more news.

Leave a Reply