0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

python3.5.4で画像処理モジュールのopencv-pythonを取得した後に pip install cv2をやってみました。

Last updated at Posted at 2018-09-23
==============
使用環境(使っているエディターやアプリケーションなど):
・python3.5.4
・windows7Professtional 32bit
・VisualStudioCode
[pip --version]
・18.0
[pip list]  ※()内はバージョンです
numpy(1.14.2)
pandas(0.23.4)
scipy(1.0.1)
matplotlib(2.2.2)
beautifulsoup4(4.0.6)
cycler(0.10.0)
Django(2.0.6)
Flask(0.12.1)
geojson(2.4.0)
gunicorn(19.8.1)
Jinja2(2.10)
jupyter(1.0.0)
ipython(6.4.0)
jsonschema(2.6.0)
Pillow(5.2.0)
scikitlearn(0.19.1)
virtualenv(16.0.0)
wheel(0.31.1)
urllib3(1.22)
(他にもいろいろモジュールをいれてます)
==============
[今回やってみたこと]
・opencv-pythonモジュールのインストール
・pythonのopencvのコードを実行してみた。
・pip install cv2の実行
[実行したコード]
import cv2
import sys

image_file = "./pakutas/photo1.jpg"

cascade_file = "haarcascade_frontalface_alt.xml"

image = cv2.imread(image_file)

image_gs = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)

cascade = cv2.CascadeClassifier(cascade_file)

face_list = cascade.detectMultiScale(image_gs,
    scaleFactor=1.1,
    minNeighbors=1,
    minSize=(150,150))

if len(face_list) > 0:

    print(face_list)
    color = (0,0,255)
    for face in face_list:
        x,y,w,h = face
        cv2.rectangle(image, (x,y), (x+w, y+h), color, thickness=8)
    cv2.imwrite("facedetect-output.PNG", image)

else:
    print("no fafe")
[実行した結果]
C:\Program Files\python3.5\aaa>python test.py
Traceback(most recent call last):
  File "test.py" line 1, in <module>
    import cv2
ImportError: No module named 'cv2'


との表示がでましたので、pip install cv2をしてみることにしました

[試しに pip install cv2を実行すると....]

C:\Users\user>pip install cv2
Collecting cv2
  Could not find a version that satisfies the requirement cv2 (from versions: )
No matching distribution found for cv2
....と表示がでました。

(ちなみにopencv-pythonは取得済みです。)

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?