Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

OpenCV Installation

OpenCV Installation with What is OpenCV, History, Installation, Reading Images, Writing Images, Resize Image, Image Rotation, Gaussian Blur, Blob Detection, Face Detection and Face Recognition etc.

<< Back to OPENCV

Installation of the OpenCV

Install OpenCV using Anaconda

The first step is to download the latest Anaconda graphic installer for Windows from it official site. Choose your bit graphical installer. You are suggested to install 3.7 working with Python 3.

Installation of OpenCV

Choose the graphical bit installer

Installation of OpenCV

After installing it, open the Anaconda prompt and type the following command.

conda install -c conda-forge opencv

Installation of OpenCV

Press the Enter button and it will download all the related OpenCV configuration.

Installation of OpenCV

Install OpenCV in the Windows via pip

OpenCV is a Python library so it is necessary to install Python in the system and install OpenCV using pip command:

pip install opencv-contrib-python --upgrade

We can install it without extra modules by the following command:

pip install opencv-python

Installation of OpenCV

Open the command prompt and type the following code to check if the OpenCV is installed or not.

Installation of OpenCV

Installation OpenCV in MacOS

In this section, we will learn about the installation of OpenCV on macOS using the Homebrew. The advantage of using the Homebrew is that it simplifies the installation process. It requires a few commands to install. The installation steps are the following:

Step-1: Install the Xcode command line Tools

To install the Xcode type the following command in terminal.

sudo xcode-select --install

To verify that it installed successfully, type the following command.

sudo xcode-select -p

If it shows /Application/ then we can proceed further.

Step-2: Install Homebrew

To install Homebrew, type the following command in terminal.

ruby -e "$(curl -fsSL"

A shell script .bashrc is located in your home directory that Bash runs whenever it is started interactively. We can locate the home directory using the following command.

echo $HOME

It should display output like


Step-3: Install Python 3

To start with OpenCV, it is necessary to install Python. To install Python 3 using Homebrew, type the following command:

brew install python3

To check the python version by running the following command:

python3 --version

It will display the version of downloaded Python.

Step - 4 Install OpenCV

To install the OpenCV3 type the following command:

brew install opencv3 -with-contrib -with-python3

Setup a Python 3 Virtual Environment

The virtualenv and virtualenvwrapper packages provide the facility to set the virtual environments. It is important to set the virtual environment to work with multiple projects without introducing conflict in their dependencies.

To install virtualenv and virtualenvwrapper we use pip (Python Package Manager):

pip3 install virtualenv and virtualenv virtualenvwrapper

We also need to update ~/.bashrc:

VIRTUALENVWRAPPER_PYTHON ='/user/local/bin/python3'
export WORKON_HOME = $HOME/.virtualenvs

Now we can create a Python 3 virtual environment:

mkvirtualenv cv3 -p python3

We can access the OpenCV by using the following command.

workon cv3

The above command activates the OpenCV in the system.

Next TopicRead & Save Images

Related Links:

Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf