Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

import opencv vs import cv2

I recently installed opencv-python-3.4.0.12 via pip install on Mac OS. When I run the Python interpreter, import cv2 works fine whereas import opencv raises ModuleNotFoundError. However, when I run the Python3 Interpreter, import opencv works fine whereas import cv2 raises ModuleNotFoundError.

What is the reason behind this difference and on a related note, should I use import opencv or import cv2? Does cv2 refer to OpenCV version 2?

like image 743
stan25 Avatar asked Apr 30 '18 01:04

stan25


1 Answers

You should import cv2. OpenCV releases two types of Python interfaces, cv and cv2. latest one is cv2. This will give you an idea whether you have installed opencv correctly.

like image 157
Ishara Madhawa Avatar answered Sep 20 '22 09:09

Ishara Madhawa