`
rotter
  • 浏览: 8700 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

OpenCV with Python - Getting start

阅读更多
== Env Setup (Windows OS) ==

  • OpenCV - 2.0
  • Python - 2.6.5

Step 1: System Parameter setup for Python Path:
set %PYTHON_HOME%=D:\Rotter\OCR\python26
set %PATH%=%PATH%;%PYTHON_HOME%


Step 2: Set OpenCV lib into Python lib path:
Ref:
http://docs.python.org/library/site.html
http://www.juyimeng.com/how-to-find-and-add-a-python-search-library-path.html

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


Note: Needn't run the 'setup-for-win.py' script in
OpenCV2.0\interfaces\swig\python as some tutorials said.

Step 3: (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:


Python IDE suggestion:
http://pyclassroom.appspot.com/2009/08/11/ide-recommend.html
  • 大小: 51.7 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics