Previous Thread  Next Thread

chat icon import OpenCV on Blender

nestor20

Posted: Thu Aug 30, 2012 4:43 pm
Joined: 30 Aug 2012
Posts: 2
At first !thank you for try to help me! Smile Smile and now-->
----------------------------------------------------------------------
i wanna import openCV python library in blender(bge) for use the realtime function "camera tracking" and "object dectect" and I find some guys who have done some games with openCV and Blender(it's true).
----------------------------------------------------------------------------------
I have installed openCV 2.4
I have python 2.7 and 3.2
I have installed openCv in the both versions
I have Blender 2.6.2
I have the file "cv2.pyd" in the folder "C:\Archivos de programa\Blender Foundation\Blender\2.62\python\lib\site-packages"
-------------------------------------------------------------------
anybody know how to import openCV in Blender?
-------------------------------------------------
I tryed writing a python script for the bge (with a always sensor and a python controller connected to the other sensor)

This is the scripts that i tryed to use:
---------------------------------------------------
# 1 script

import sys
sys.path.append("C:\opencv\build\python\2.7")
import cv

--- ERROR: no module named "cv" --


# 2 script

import sys
sys.path.append("C:\opencv\build\python\2.7")
import cv2

--- ERROR: no module named "cv2" --


# 3 script

import sys
sys.path.append("C:\opencv\build\python\2.7")
import opencv from cv

--- ERROR: no module named "opencv" --


# 4 script

import sys
sys.path.append("C:\opencv\build\python\2.7")
from opencv.cv import cv

--- ERROR: no module named "opencv.cv" --


# 5 script

import sys
sys.path.append("C:\opencv\build\python\2.7")
from opencv.cv import cv2

--- ERROR: no module named "cv" --


# 6 script

import sys
sys.path.append("C:\Archivos de programa\Blender Foundation\Blender\2.62\python\lib\site-packages)
import cv

--- ERROR: no module named "cv" --


# 6 script

import sys
sys.path.append("C:\Archivos de programa\Blender Foundation\Blender\2.62\python\lib\site-packages)
import cv2

--- ERROR: no module named "cv2" --


............................
and 20 scripts more!
.............................

thanks you for help me!
Smile
Reply with quote


stiv

Posted: Thu Aug 30, 2012 5:16 pm
Joined: 05 Aug 2003
Posts: 3489
New Blender uses Python 3.2. It comes with its own copy of Python.

In order to import modules, they must be for Python 3. If you build modules with Python 2, they are unlikely to install.
Reply with quote


nestor20

Posted: Thu Aug 30, 2012 8:02 pm
Joined: 30 Aug 2012
Posts: 2
stiv wrote:
New Blender uses Python 3.2. It comes with its own copy of Python.

In order to import modules, they must be for Python 3. If you build modules with Python 2, they are unlikely to install.


thanks you but...

how i can get blender 2.62 with python 2.7?

I try to use the version 2.49b how is the last blender version how uses python 2.x(2.6 exactly) but (you will have to excuse me) i dont like blender
2.49b is too different. Sad

i try to find a solution! SmileSad
Reply with quote


stiv

Posted: Thu Aug 30, 2012 9:26 pm
Joined: 05 Aug 2003
Posts: 3489
Quote:
how i can get blender 2.62 with python 2.7?


You cannot. New Blender needs Python 3. It cannot be compiled with Python 2.

A quick google suggests opencv does not work with python3 yet.
Reply with quote


mjrmua

Posted: Sun Sep 02, 2012 9:35 pm
Joined: 01 Jan 1970
Posts: 3
stiv wrote:

You cannot. New Blender needs Python 3.


Is there an older version of blender that will work with python 2.x?
Reply with quote


stiv

Posted: Sun Sep 02, 2012 9:51 pm
Joined: 05 Aug 2003
Posts: 3489
Old Blender (2.49) uses Python 2. IIRC, official versions were compiled with Py 2.5 or 2.6, but you can build it with any Py version greater than 2.3 or so.

You might be able to find it already built on graphicall.org .
Reply with quote


mjrmua

Posted: Sun Sep 02, 2012 11:07 pm
Joined: 01 Jan 1970
Posts: 3
How about running the CV in python 2.7, then set up some sockets communication between blender-python and the openCV program?

Not sure what's the best way to set this up in blender though, Maybe a repeating delay sensor that triggers the blender script to poll openCV program server?

Can blender experts suggest a better solution?
Reply with quote


 
Jump to:  
Powered by phpBB © 2001, 2005 phpBB Group