OpenCV practice-installing and using Python
Since the next step is to start to study deep learning, many algorithms and applications in the deep learning field are implemented using Python. It takes too much time to convert Python into C ++ code, it is better to directly learn the Python direct medical Python code. Building a Python environment is very time-consuming, but now I think there are not many steps, mainly because various strange problems will always occur when I don't understand it. Now, let's record the correct steps.
Environment setup:
1. There is nothing to say about installing Python. Just keep going to the next step. I installed Python2.7.11. Select to add environment variables during installation.
2. IDE uses Pycharm Community.
3. Install numpy.
4. Find cv2.pyd in the * \ opencv \ build \ python \ 2.7 \ x64 folder and copy it to the * \ Python2.7.11 \ Lib \ site-packages folder of the Python Installation File.
Then you can. Based on my memories, this is enough. Open Pycharm and Create new project, right-click the project created after creation, and choose new and Python file.
Enter your first Python version of opencv program:
Import cv2import numpy as npimg = cv2.imread ("D: \ miao1.jpg") cv2.imshow ("miao", img) cv2.waitKey (10000)
It seems to be simpler than C ++, And the configuration process is simpler than.
The running result is as follows:
Here we only use opencv, which we are most familiar with, to familiarize ourselves with Python. More in-depth application is yet to be studied.