Tutorial: Installation for Py OpenCV

Installation for Visual Studio Code

(updated 2022.4)

This installation guide is for programming Python OpenCV. Make sure you install the correct software version as instructed.

For DLIP Lectures:

  • Python >3.9

  • Anaconda for Python >3.9

  • OpenCV 4.x

1. Install Anaconda

Anaconda : Python and libraries package installer.

Follow: How to install Anaconda

2. Install Python via Anaconda

Python 3.9 (2022-1)

Python is already installed by installing Anaconda. But, we will make a virtual environment for a specific Python version.

  • Open Anaconda Prompt(admin mode)

  • First, update conda and pip

  • Then, Create virtual environment for Python 3.9.

  • Name the $ENV as py39. If you are in base, enter conda activate py39

image
  • After installation, activate the newly created environment

image

3. Install Libraries

Install Numpy, OpenCV, Matplot, Jupyter

4. Install Visual Studio Code

Follow: How to Install VS Code

5. Setup Configuration in Visual Studio Code

Follow: Python in VS Code

Follow: Jupyter Notebook in VS Code


EXERCISE

First, download the test image file: Click here

The image file must be in the same folder as the source file

Create a new source file as TU_OpenCVtest.py

Exercise 1

Run python code and submit the final output image

Exercise 2

Run python code and submit the final output image

Last updated

Was this helpful?