environment ・ Raspberry Pi3 Model B
First of all, I am trying to prepare the development environment in order to produce something that the image flows when a person passes in front. As for programming and electronic work, I'm almost a beginner, so the process is awkward, but I've solved one problem, so I'll make a note of it.
Installation of Raspberry Pi 2 ★ OpenCV 3.1.0 ~ Checking camera operation with C ++ & Python sample This blog post was very easy to understand, so I used it as a reference and did what was written from above. However, since the environment is Raspberry pi3 and python is also version 3, I worked while modifying the directory etc. It takes 3 hours with a sudden freeze on the way.
When I try to run the sample "video.py" after various installations are completed,
No module named cv2
```Occurs. Certainly, I can't find the file cv2 in the "modules" folder inside the opencv folder. (But is that so?)
I did a file search with cv2 for the time being, but I couldn't find it.
### Measure 1
***
#### Try putting something called pip
[Import Error : No module named cv2 on windows 7](http://stackoverflow.com/questions/40191866/import-error-no-module-named-cv2-on-windows-7)
I found a person with similar symptoms in this Q & A. The answer says "use pip". pip ...?
[Pip (Python package management)]
(http://make.bcde.jp/python/pippython package management /)
It seems that pip is a library management tool for python, so refer to this page and introduce pip.
Execute "Package search" in the above article to confirm the existence of cv2. I did "Display list of installed packages" and cv2 was not included in the current list of owned packages, so I tried to download it with "Install by specifying the package name", but it didn't work.
`$ sudo pip install cv2
Collecting cv2
Could not find a version that satisfies the requirement cv2(from versions: )
No matching distribution found for cv2
`
Continue to look for a solution. ..
### Measure 2
***
#### Put something called python-opencv
[[python] ImportError: Resolve No module named cv2](http://nc30mtd.oops.jp/blog/2016/07/importerror-no-module-named-cv2.html)
I found this article.
`$ sudo apt-get install python-opencv
`Try this command.
Also,
[Python - cannot import OpenCV module?](http://raspberrypi.stackexchange.com/questions/29148/python-cannot-import-opencv-module)
In the answer of this forum,
`$ sudo apt-get install libopencv-dev
`I'll put this in too.
### Solution!
***
The sample will work safely. Was good!
Recommended Posts