🥋0. OpenCV Build - option#3 Python easiest way
Contents
OpenCV + Python build (1/2) - python+OpenCV install
OpenCV + Python build (2/2) - vs code setting
1. Install Python
Window & Mac Download Python installer file
👉🏻 https://www.python.org/downloads/release/python-373/
- download python installer


- run installer and check path


- Make sure where python will be installed


- check python version


- pip upgrade
pip install --upgrade pip
- Refer to other side tutorial : https://www.ics.uci.edu/~pattis/common/handouts/pythoneclipsejava/python.html
2. Install Python OpenCV
- opencv-python installation
pip install opencv-contrib-python


- check OpenCV version


3. Install IDE
Download Visual Studio Code : https://code.visualstudio.com/Download


- Install




- run VS code -> Set python interpreter -> run simple code
- Find python in "extensions:marketplace" and install


- type in command window "python: select interpreter"


- select python execute which we have installed before


- run code


4. Test OpenCV
Simple OpenCV Code : https://gist.github.com/MareArts/9034e7e638a30551d9ef370c4a364618
import numpy as np
import cv2
cap = cv2.VideoCapture(0)
ret, frame = cap.read()
while(True):
# Capture frame-by-frame
ret, frame = cap.read()
# Our operations on the frame come here
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
# Display the resulting frame
cv2.imshow('frame',gray)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()

🙇🏻 Thank you!
🎁 Source code, Material(pdf) and example images 👇
https://www.marearts.com/products/opencv-lecture-materials-1