Attention: Old PyARTK module is obsolete for a long time. Now the new ARTKBlender module is available. It works on current version of Blender and provides similar functionality as old one.

Blender 2.49 was released recently with new VideoTexture module derived from my blendVideoTex plug-in. It shows that plug-in is not needed anymore and I officially stopped its development.

I tried to run demo for PyARTK on new Blender, but it failed to detect markers. I spent several hours to find a source of this error and finally found it. It seems that VideoTexture module doesn’t provide correct video frame size after video replay was started. That’s why incorrect frame size was set to PyARTK and markers weren’t detected. So in this demo version is frame size hardcoded in script.

There is updated demo for download working on Blender 2.49.

For Blender 2.49a that uses Python 2.6 you’ll need new PyARTK binaries.

72 thoughts on “PyARTK demo for Blender 2.49

  1. thx,

    I got this error :

    “Python script error from controller “cont#CONTR#1”:
    Traceback (most recent call last):
    File “initPatt.py, line 1, in
    File “E:\DevTools\Python25\lib\site-packages\PyARTK\arlib.py, line 51, in
    AttributeError: ‘module’ object has no attribute ‘AR_HEADER_VERSION_MAJOR'”

    (I’m on Windows Vista)

  2. Hi, francois,

    this error happens sometimes, when you have improperly set PYTHONPATH environment variable, or PyARTK folder is on multiple places (Python folder, blender demo folder), so things become mismatched.
    It seems that blender demo remembers path to PyARTK on my computer, that is not available on yours, of course.

  3. great that works,
    I had to comment “Import blendVideoTex” in detect.py because it couldn’t import it (I guess that the lib replaced by VideoTexture now)

    still have another error though

    File “detect.py”, line 41, in
    AttributeError: ‘module’ object has no attribute ‘arObjs’

    and also, which modification should I do, to use my webcam instead ?

    thanks a lot and sorry to bothering so much 🙁 I’m such a Py noobs :s

  4. hi, francois,

    I’ve updated this demo, try if it works better for you.

    On webcam usage – I’m testing it with my webcam without success for now.

  5. also the webcam is working for me
    In “init.py” I changed the line “GameLogic.source = VideoTexture.VideoFFmpeg(obj[‘source’])” by “GameLogic.source = VideoTexture.VideoFFmpeg(obj[‘source’])”

    But the refresh is running so slow I don’t understand. I tried to change the scale mode to true or false, but still the same.

    A couple weeks ago I did a really similar scene and I had the exact same issue. At the time I thought it was because of a socket issue making the logic running low, but it seems you have the same problem and you don’t use sockets in your application :p. Please take a look at my thread, maybe that’s a bug into the VideoTexture function ? http://blenderartists.org/forum/showthread.php?p=1395942#post1395942

    if you want I can capture my screen and send you a video, so you’ll see what’s happen

    thanks for your help

  6. oops wrong copy/past too fast :p

    I meant In “init.py” I changed the line “GameLogic.source = VideoTexture.VideoFFmpeg(obj[‘source’])” by “GameLogic.source = VideoTexture.VideoFFmpeg(‘cam’,0,30,320,240)”

    but I guess you already noticed that ^^

  7. Hi, Francois,

    I have finally found a spare time and fixed demo to be usable for both video files and webcams. To use webcam it’s necessary to add property sourceIdx with proper webcam index to plane object that shows video.

  8. Ahoj,,napadlo mě jestli by nešlo na neviditelný objekt sloužící pro fyziku (ve tvém příkladu stolek) renderovat texturu videa s koordináty okna..??když by se pak nějaký objekt dostal za stolek, realisticky by za něj zapadl..tahle volba narozdíl od blenderu ale nefunguje v enginu..marně přemýšlím jak na stolek rendrovat to video aby sedlo s videem v pozadí ale stolek měl nějakou texturu pro požadovaný efekt…

  9. Ahoj, Jonáš,

    riešenie by bolo zobrazovať videotextúru na stolíku a výpočítavať mu UV súradnice v projekčnom zobrazení. Najlepšie nejakým pixel shaderom, tak ako sú robené zrkadlá.

  10. bezva..díky moc za radu..ještě docela dobře funguje nastavit duplikát stolku jako occluder..kulička pak také zmizí i když ne uplně realisticky..

  11. ahoj..nemohl by jsi prosímtě udělat příklad uv textury v tom projekčním zobrazení..?nějak se mi to pořád nedaří..díky moc

  12. Bohužiaľ, v shaderoch som slabý, takže to nie som schopný momentálne dať dokopy. Alternatívou by bolo počítať UV súradnice vrcholov v pythonovskom skripte, ale pritom vzniká dosť škaredé skreslenie textúry, takže to nie je dobrá možnosť.

  13. ahoj..mě ho to načte vždycky(max rozlišení 1024×768, videoFFmpeg změněno na ImageFFmpeg a framrate, repeat a video play odstraněn) ale nikdy se nedetekuje symbol..tobě ano?

  14. Ahoj, Jonáš,

    problém je v tom, že inicializácia patternov sa vykonáva až po prvej detekcii. Pri videu to nevadí, lebo v nasledujúcich snímkach to už bude v poriadku, ale jeden obrázok sa už potom nemení a teda ho nikdy nedetekuje.
    Riešením je doplniť podmienku na začiatku skriptu detect.py (po funkcii calcPos()) o kontrolu počtu inicializovaných patternov.
    Napr. takto:
    if hasattr(GameLogic, ‘tex’) and hasattr(GameLogic, ‘arObjs’) and len(GameLogic.arObjs) > 0:

  15. ahoj..nevim co dělám špatně ale ani tak to nefunguje..nemohl by jsi uploadovat upraveny .blend soubor? díky

  16. bezva díky moc..na co je tam ten PIL a ukládání obrázku? a nevíš jestli je artoolkit omezenej na nějaký rozlišení..třeba 1024×768 už to nedává..

  17. Ahoj,

    tento .blend je čisto testovací, preto tam je aj to uloženie obrázku cez PIL – aby bolo jasné, že je to totožný obrázok, ako je zdroj.
    To s veľkým rozlíšením obrázku overím večer a dám ti vedieť.

  18. Hoj, Jonáš,

    zväčšil som obrázok na 1024×768 a detekuje mi ho v pohode… Neviem, kde môžeš mať problém, skús mi poslať tvoj obrázok…

  19. Hi there!

    I have been messing around with your demo all night, and i think i’m almost there…

    Unfortunately, i can’t get rid of the error;

    import_arlib
    ImportError: DLL Load failed: %1 is not a valid Win32 application
    Python scrips error from controller “cont1#CONTR#1”:
    File “initPatt.py, line 1, in
    File “D:\DevTools\Python26\lib\site-packages\PyARTK\arlib.py, line 7, in

    And no matter what i do to my PYTHONPATH, i still get the same error. Have both PyARTK and ARtoolkit.
    I guess the problem must be, that it does not know where my PyARTK is, right? Since it still has your path, and therefore the wrong place…

  20. Hi, Tyleet,

    do you have Blender 2.49a with Python 2.6? If it’s so, you’ll need new PyARTK binaries compiled for this Python version. I updated article to make it clear.

  21. Thx for your reply.

    I am already using the new binaries, and running Blender 2.49b, and Python 2.6.1

    Which might be a problem…?

  22. Blender 2.49b downloaded and tested, no problems found. I have replicated your error, when I deleted _arlib.pyd from PyARTK folder in Python libs (path D:\DevTools\Python26\lib\site-packages\PyARTK\). So it seem that you didn’t set your PYTHONPATH correctly. Can you send me folders, where you stored PyARTK and PYTHONPATH value?

  23. The location of PyARTK;
    C:\Python26\Lib\site-packages\PyARTK

    And my PYTHONPATH;
    C:\Python26;C:\Python26\DLLS;C:\Python26\Lib;C:\Python26\Lib\lib-tk;C:\Python26\Lib\site-packages;C:\Python26\Lib\site-packages\PyARTK

    When i start Blender, it writes in the console window, that Python has been found.

    I am on a 64-bit Win7 Professional, btw.
    Thank you for trying to solve my problem!

  24. I also get the error:

    Python script error from controller “cont#CONTR#1”:
    Traceback (most recent call last):
    File “initPatt.py”, line 1, in
    File “C:\Program Files\Blender Foundation\Blender249\PyARTK\arlib.py”, li
    , in
    AR_HEADER_VERSION_MAJOR = _arlib.AR_HEADER_VERSION_MAJOR
    AttributeError: ‘module’ object has no attribute ‘AR_HEADER_VERSION_MAJOR’

    Can you tell me exactly where to put PyARTK and exactly how to where to set PYTHONPATH?

  25. Tyleet,

    so your situation need some experiments. It’s strange that Blender demo prints path of “my” Python folder, not yours. Try to create new blend file and check if arlib import (that single line I wrote previously) works in Blender.

    Akula,

    that’s definitelly problem with PyARTK configuration and I still haven’t single solution to it, that will work everywhere. Do you have duplicit PyARTK folders on various places? Keep just one PyARTK folder in your filesystem.

    Numpy for Python 2.6 is available at http://sourceforge.net/projects/numpy/files/

  26. hmm.. it is quite strange that your path is used, even when i try the import command in a fresh blender project.
    I get this in the console;

    Traceback (most recent call last):
    File “Text.001”, line 1, in
    File “D:\DevTools\Python26\lib\site-packages\PyARTK\arlib.py”, line 7, in
    import _arlib
    ImportError: DLL load failed: %1 is not a valid Win32 application.

  27. The numpy from sourceforge.net is on a mac .dmg, how do I get the files out? I tried an ISO converter but the file type is unsupported. Can you post the actual numpy files in a windows format? Thanks-

  28. hi Ashsid, i was wondering if its possible to create a blender standalone file with ur AR aplication… i tried to do one but when it runs, it looks for the pyartk folder and other directories…. folders that are already installed in the same computer… you know if it is possible to do a standalone?.. by the way, its awesome all this about AR… happy new year!
    thanks

    1. Hi, K_aifan,
      it’s possible to use PyARTK in blender standalone application, but its setup is somehow tricky. It depends on whether computer has Python installed or not. Basic rule is that on computer without Python store PyARTK folder in game folder, otherwise store PyARTK folder in Python Lib/site-packages folder. It still needs some experimentations on different computers setups to get it working. Run standalone game with console turned on to see error messages it outputs.
      Best regards

  29. ok… first try to run a standalone file errors_

    first i “packed”all data, dont know if that is necesary but it seemed to be hehe…

    -i hit the save game as runtime
    – tried to run the stand alone file
    – first windows warning message: wrap_oal.dll missing
    – i copied the file from the blender directory to the directory of the stand alone
    – second try to run standalone file: windows warning about a VCOM90.dll file not found
    – copied file to standalone directory
    – run stand alone file: console warning_:
    initpatt.py
    detect.py
    no module named PyARTK
    – copied PyARTK,Numpy folders to standalone directory
    -run standalone.. NO data/patern warning in the blender console
    -copied the Data folder to standalone folder
    -running the standalone again:
    standalone window: all grey
    console: detected GL_ARB texture env combine
    detected GL_ARB texture cube map
    detected GL_ARB multitexture
    detected GL_ARB shader_ojects
    detected GL_ARB vertex_shader
    detected GL_ARB fragment_shader
    detected GL_ARB vertex_program
    detected GL_ARB depth_texture
    detected GL_ARB separte_specular_color

    and nothing more

    something i am doing wrong, u k now?
    any help about this thanks.. very much

  30. by the way i am trying to run a PS3eye cam just installed with windows drivers… cant get it work in the blend file…. i think its because the cam.. dont know… other common webcams seem to function…anyway, the standalone is buildt with the “video file” option.. dont know why it isnt running, the blend file runs ok in blender with the arktdemo.avi

    salut!

  31. Hi, K_aifan,

    it seems that video file isn’t available in standalone. Try to add some logging (print messages) to scripts to see, where it gets, what it does and what not.

  32. Hi Ashsid
    … yeps… that was the file it was missing to make it work… added the video file to de standalone directory… and now it works fine
    many thanks for ur help Ashsid!

    salut!

  33. Hi Ashid,

    After compiling ARTooLKit and PyARTK 1.1.0 (removing the _videolib extension which gave me some errors) in buntu 9.04 64bit, I got the following error when playing artk249 demo:

    Python script error from controller “cont#CONTR#1”:
    Traceback (most recent call last):
    File “initPatt.py”, line 5, in
    TypeError: in method ‘arLoadPatt’, argument 1 of type ‘char const *’

    Is there something I did wrong?

    Regards,

    David.

  34. Hi David,

    have you changed anything in the demo? There should be passed a string as a parameter in this script. It’s built from subfolder name and file name stored in object’s property.

  35. Hi Ashsid,

    No, I didn’t touch anything. It sounds strange to me too. I also tryed passing the string literally but got the same error. Maybe it has something to do with the 64bit OS?

  36. Hi David,

    to make things clear try to run this little script directly in Python (outside Blender) with path to your pattern file:

    from PyARTK import arlib
    idx = arlib.arLoadPatt(‘myPatternFile.patt’)
    print idx

    If it fails then error is in PyARTK wrapper (possibly 64bit OS issue, but I’m not sure and I cannot test it).

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.