== Env Setup (Windows OS) ==
[list]
[*] OpenCV - 2.0
[*] Python - 2.6.5
[/list]
[b]Step 1[/b]: System Parameter setup for Python Path:
[b]Step 2[/b]: Set OpenCV lib into Python lib path:
Ref:
[url]http://docs.python.org/library/site.html[/url]
[url]http://www.juyimeng.com/how-to-find-and-add-a-python-search-library-path.html[/url]
Create opencv.pth in %PYTHON_PATH%\Lib\site-packages:
[b]Note[/b]: Needn't run the 'setup-for-win.py' script in
OpenCV2.0\interfaces\swig\python as some tutorials said.
[b]Step 3[/b]: (Just get some video & pic resources)
Create a fold name as 'src' for the test code.
Copy 'D:\Rotter\OCR\OpenCV2.0\samples\c' fold in to 'src'.
At last, the directory tree looks like:
OCR
|- OpenCV2.0
|- python26
|- Lib
|- site-packages
|- opencv.pth
|- src
|- c
Exampel.py: (put it in the 'src')
You can get:
[img]http://dl.iteye.com/upload/attachment/295636/f32286a7-eff5-357c-9d47-4f91a497852c.jpg[/img]
Python IDE suggestion:
[url]http://pyclassroom.appspot.com/2009/08/11/ide-recommend.html[/url]
[list]
[*] OpenCV - 2.0
[*] Python - 2.6.5
[/list]
[b]Step 1[/b]: System Parameter setup for Python Path:
set %PYTHON_HOME%=D:\Rotter\OCR\python26
set %PATH%=%PATH%;%PYTHON_HOME%
[b]Step 2[/b]: Set OpenCV lib into Python lib path:
Ref:
[url]http://docs.python.org/library/site.html[/url]
[url]http://www.juyimeng.com/how-to-find-and-add-a-python-search-library-path.html[/url]
Create opencv.pth in %PYTHON_PATH%\Lib\site-packages:
D:\Rotter\OCR\OpenCV2.0\Python2.6\Lib\site-packages\opencv
D:\Rotter\OCR\OpenCV2.0\bin
[b]Note[/b]: Needn't run the 'setup-for-win.py' script in
OpenCV2.0\interfaces\swig\python as some tutorials said.
[b]Step 3[/b]: (Just get some video & pic resources)
Create a fold name as 'src' for the test code.
Copy 'D:\Rotter\OCR\OpenCV2.0\samples\c' fold in to 'src'.
At last, the directory tree looks like:
OCR
|- OpenCV2.0
|- python26
|- Lib
|- site-packages
|- opencv.pth
|- src
|- c
Exampel.py: (put it in the 'src')
import cv
import highgui
if __name__=='__main__':
image=highgui.cvLoadImage("./c/airplane.jpg",1)
highgui.cvNamedWindow("picwin")
highgui.cvShowImage("picwin",image)
highgui.cvWaitKey(0)
highgui.cvDestroyWindow("picwin")
You can get:
[img]http://dl.iteye.com/upload/attachment/295636/f32286a7-eff5-357c-9d47-4f91a497852c.jpg[/img]
Python IDE suggestion:
[url]http://pyclassroom.appspot.com/2009/08/11/ide-recommend.html[/url]