OpenCV-Python 이란?
OpenCV-Python(Open Source Computer Vision-Python)은 컴퓨터 비전 문제를 해결하기 위해 설계된 python bindings 라이브러리다.C/C++ 과 비교했을 때 파이썬은 느리다.
파이썬은 C/C++로 쉽게 확장될 수 있어 C/C++로 집약적인 코드를 작성하고 파이썬 모듈로 사용할 수 있는 Python wrappers를 만들 수 있다. 이것은 두 가지 이점이 있다. 첫째, 코드는 원래의 C/C++ 코드만큼 빠르다.둘째, C/C++ 보다 파이썬으로 코딩하는 것이 더 쉽다.
설치
1. VS Code 설치
https://code.visualstudio.com/
에디터로는 Visual Studio Code를 사용하여 앞으로 OpenCV 실습을 진행할 예정이므로 VS Code를 설치했다.
Visual Studio Code - Code Editing. Redefined
Visual Studio Code is a code editor redefined and optimized for building and debugging modern web and cloud applications. Visual Studio Code is free and available on your favorite platform - Linux, macOS, and Windows.
code.visualstudio.com
2. 파이썬 설치
https://www.python.org/downloads/
파이썬 버전 3.x 또는 파이썬 2.7.x 를 사용해야한다.
나는 파이썬 버전은 3.9.1 64bit 사용했다.
Download Python
The official home of the Python Programming Language
www.python.org
3. Numpy 패키지 설치
VS Code 터미널 창에서 아래 명령어를 입력하여 numpy를 설치한다.
pip install numpy
4. Matplotlib 설치
VS Code 터미널 창에서 아래 명령어를 입력하여 numpy를 설치한다.
Matplotlib는 필수는 아니지만 설치하는 것이 앞으로 실습을 진행할 때 유용하다.
pip install matplotlib
5. OpenCV-python 설치
VS Code 터미널 창에서 아래 명령어를 입력하여 opencv를 설치해준다.
pip install opencv-python
4. 설치 완료 후 확인
test.py 파일을 만들어 준 뒤 아래 코드를 실행.
import cv2 as cv
print(cv.__version__)
4.5.2
다음과 같이 설치된 opencv 버전이 출력되면 완료.
'Programming > OpenCV' 카테고리의 다른 글
[OpenCV-python] 2. Getting Started with Videos (0) | 2021.06.08 |
---|---|
[OpenCV-python] 1. Getting Started with Images (0) | 2021.06.07 |