Results 1 to 7 of 7
  1. #1

    import cv into BGE

    Hello, I am trying to write a script for the BGE that uses openCV. I have installed openCV, python 2.7, and blender 2.62, all on windows 7. When I run a script from within the GE, it doesn't like the import cv command even though I can open python and run that command, and it imports just fine.

    I guess what I'm wondering is where blender looks for these things, and how I can tell it to use the installation of Python, or look in the same places as is does.

    Any help would be appreciated! Thanks!

    -Andrew Miller



  2. #2
    Member twerdster's Avatar
    Join Date
    May 2011
    Location
    Haifa
    Posts
    40
    Id like to know exactly the same thing!



  3. #3
    Blender 2.62 uses python 3, which isn't yet supported by openCV. The solution I've found has been to install python 2.6, blender 2.49b, and then I am able to use the openCV libraries in the GE. That's the workaround I've come up with, although I imagine that it should be possible to right your own python wrappers for openCV that would be compatible with python 3 if you really needed to use blender 2.62

    I have been able to get a video stream from my webcam and alter it (using a dilate or erode filter) and then display it live as a texture in the game. Unfortunately it has been rather slow, so I will try to see if it can be improved by not re-importing everything... I'll let you know if I get any more useful results.



  4. #4
    Member twerdster's Avatar
    Join Date
    May 2011
    Location
    Haifa
    Posts
    40
    Thanks. Im now trying to compile Blender using Python 2.7. Maybe that will solve my problem.



  5. #5
    I found a very random version of 2.49 compiled with python 2.7, it was from some website in french, and I have no clue what other features have been changed or if it's even safe, but here's the link... http://www.zoo-logique.org/3D.Blende...9c-ini_p27.zip

    I would suggest recompiling openCV with python 2.6, because that will probably be much easier and stabler overall.



  6. #6
    Member twerdster's Avatar
    Join Date
    May 2011
    Location
    Haifa
    Posts
    40
    Thanks, for the time being Ive gone for a small hack where I just make a system call within python 3.2 to python 2.7 and run a script like that.
    There isnt too much to be moved around so its okay as a temporary workaround.



  7. #7
    Member VeroWright's Avatar
    Join Date
    Dec 2016
    Location
    New York, NY
    Posts
    9
    Great, I was having pretty same issue and solved it with the help of this thread. Thanks for sharing your insights!



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •