OpenCV for Python beginners

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).

** How to run OpenCV sample **

** (1) Execution from command prompt **

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.

** (2) Execution in Spyder integrated environment **

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].

** (3) Start by double-clicking the script icon **

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.

** (4) Execution from IDLE **

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.

Reference information

"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

OpenCV for Python beginners
python textbook for beginners
[Python] Read images with OpenCV (for beginners)
Learning flow for Python beginners
Python3 environment construction (for beginners)
Python #function 2 for super beginners
Basic Python grammar for beginners
100 Pandas knocks for Python beginners
Python #list for super beginners
~ Tips for beginners to Python ③ ~
Python Exercise for Beginners # 2 [for Statement / While Statement]
Python for super beginners Python # dictionary type 1 for super beginners
Python #index for super beginners, slices
<For beginners> python library <For machine learning>
Python #len function for super beginners
Beginners use Python for web scraping (1)
Run unittests in Python (for beginners)
Beginners use Python for web scraping (4) ―― 1
Python #Hello World for super beginners
Python for super beginners Python # dictionary type 2 for super beginners
2016-10-30 else for Python3> for:
python [for myself]
Python2.7 + CentOS7 + OpenCV3
Roadmap for beginners
OpenCV Samples (Python)
[Note] openCV + python
Beginners practice Python
Python beginner's note
[Python] Accessing and cropping image pixels using OpenCV (for beginners)
Notes for using OpenCV on Windows10 Python 3.8.3.
INSERT into MySQL with Python [For beginners]
Let's put together Python for super beginners
WebApi creation with Python (CRUD creation) For beginners
Atcoder standard input set for beginners (python)
[For beginners] Try web scraping with Python
A textbook for beginners made by Python beginners
About Python for loops
Python Beginner's Guide (Functions)
The fastest way for beginners to master Python
python openCV installation (memo)
Spacemacs settings (for beginners)
Python basics ② for statement
Python for super beginners Python for super beginners # Easy to get angry
Causal reasoning and causal search with Python (for beginners)
Binarization with OpenCV / Python
Python beginners organize heapsort
For new students (Recommended efforts for Python beginners Part 1)
Memo # 3 for Python beginners to read "Detailed Python Grammar"
Summary about Python3 + OpenCV3
Python beginners organize quicksort
About Python, for ~ (range)
Memo # 1 for Python beginners to read "Detailed Python Grammar"
Python beginners touch Pytorch (3)
Refactoring tools for Python
OpenCV3 Python API list
Try to calculate RPN in Python (for beginners)
Easy understanding of Python for & arrays (for super beginners)
Python Dictionary Beginner's Guide
python for android Toolchain
Memo # 2 for Python beginners to read "Detailed Python Grammar"
Python OpenCV tutorial memo