For the time being, install a distribution such as [Python (x, y)](Python (x, y) --Downloads.) Although the Spyder integrated environment can now be launched, For those who are new to Python, I will explain how to run the OpenCV sample (Note).
Open a command prompt. Move the directory. cd (opencv directory) \ sources \ samples \ python2
python script name
Those that require command arguments
USAGE: facerec_demo.py </path/to/images> [</path/to/store/images/at>] Shows how to use, such as. In that case, give an argument as specified by usage and operate it on the command line.
If you want to set the value of the command argument (sys.argv) from the Spyder integrated environment In [Run] [Configure] [Command line options] It can be operated by specifying [Run] and then selecting [Run].
Not recommended.
Even if it works fine, some scripts will display a normal display on the console, exit immediately and close the console. Even if an error occurs, the console will be closed instantly, so you cannot check the details of the error.
It is a standard distribution Tk-based execution environment, Once you get used to the Spyder integrated environment, we don't recommend it. The unfortunate point is that if you create and execute a script that outputs to standard output, it will be orders of magnitude slower than the command prompt environment. Scripts that work with command arguments are considered to have wanted command arguments to be specified.
It is common to all cases (1) to (4), (Python installation directory) \ Lib \ site-packages It is necessary to have a copy of cv2.pyd in.
Even if you use OpenCV3.0, you can use it by copying cv2.pyd in the same way.
[Install OpenCV3.0 on Python] http://python-gazo.blog.jp/opencv/ver3_install
In this way, once you can run the script as it is distributed, Then if the script had the filename hard-coded, Try changing the input file name and executing it.
If it is a process for one still image, try to process it for a list of continuous still images, or open an AVI file and rewrite it to perform a series of processes.
Try to get used to python while doing such a rewrite.
"Introduction to Pyconjp 2014 OpenCV python interface" http://www.slideshare.net/payashim/pyconjp-2014-opencv
"How to use OpenCV from python on each OS" http://www.slideshare.net/katsuhiromorishita/opencvpython?related=1
"Latest software development environment for computer vision SSII2015 Tutorial hayashi" http://www.slideshare.net/payashim/ssii-2015-hayashi
「Face Recognition with OpenCV and scikit-learn」 http://www.slideshare.net/lucidfrontier45/face-recognition-with-opencv-and-scikitlearn
"About image processing with Python" http://www.slideshare.net/yasutomo57jp/python-43606096
"Using Python for image processing" http://www.slideshare.net/yasutomo57jp/pythona
Must-see "OpenCV-Python Tutorials" http://qiita.com/nonbiri15/items/facf9e6cf4f73cb69d9b
Note: If you failed with imprort cv2
, make sure you have copied cv2.pyd to site-packages.
There is cv2.pyd in the set downloaded by OpenCV. Lib \ site-packages for your version of python
Example C: \ Python27 \ Lib \ site-packages
Please copy to.
Recommended Posts