Cloudbooklet
  • News
  • Artificial Intelligence
  • Applications
  • Linux
No Result
View All Result
Cloudbooklet
  • News
  • Artificial Intelligence
  • Applications
  • Linux
No Result
View All Result
Cloudbooklet
No Result
View All Result
Home Google Cloud

How to Install OpenCV on Ubuntu 18.04

by Cloudbooklet
4 years ago
in Google Cloud, AWS
How To Install Opencv On Ubuntu 18.04
ShareTweetSendShare
Readers like you help support Cloudbooklet. When you make a purchase using links on our site, we may earn an affiliate commission.

How to Install OpenCV on Ubuntu 18.04. In this guide you are going to learn how to setup OpenCV (Open Source Computer Vision Library). OpenCV is an open-source highly optimized library with focus on real-time applications and has a wide range of support for C++, Python and Java interfaces support Linux, MacOS, Windows, iOS, and […]

ADVERTISEMENT

How to Install OpenCV on Ubuntu 18.04. In this guide you are going to learn how to setup OpenCV (Open Source Computer Vision Library). OpenCV is an open-source highly optimized library with focus on real-time applications and has a wide range of support for C++, Python and Java interfaces support Linux, MacOS, Windows, iOS, and Android.

The library has more than 2500 optimized algorithms for computer vision and machine learning to detect and recognize faces, identify objects, classify human actions in videos, track camera movements and many more.

This setup is tested on Google Cloud, it will work on other cloud services like AWS, Azure and on any VPS or dedicated servers running Ubuntu 18.04.

ADVERTISEMENT

Initial setup

Start by updating the package index and upgrading the packages to the latest available version.

You might also like

How To Setup Ssh Keys On Ubuntu

How to Setup SSH Keys on Ubuntu 20.04

4 months ago
Draggan Ai Editing Tool Install And Use Draggan Photo Editor

DragGAN AI Editing Tool Install and Use DragGAN Photo Editor

4 months ago
sudo apt update
sudo apt upgrade

Install OpenCV from Repository

OpenCV is available by default in the Ubuntu repositories. If you are just using OpenCV for programming and development purposes you can follow this method. Otherwise you need to install OpenCV from source. You can see this guide just below this method.

To install OpenCV with Python3 you can execute the following command in your terminal.

ADVERTISEMENT
sudo apt install python3-opencv

To install OpenCV with Python2 you can execute this command instead of the previous one.

sudo apt install python-opencv

Just wait for the installation to complete and verify the installation using the following command.

ADVERTISEMENT
python3 -c "import cv2; print(cv2.>version)"

This command will output the installed version of OpenCV. At the time of writing the OpenCV version installed is 3.2.0.

Output
3.2.0

Install OpenCV from Source

Installing OpenCV from source is the recommended method to install OpenCV to get control over the full installation.

ADVERTISEMENT

Follow to below mentioned steps to install OpenCV from source.

Start by installing cmake for configuring and gcc for compiling.

ADVERTISEMENT
sudo apt install git cmake gcc g++

Install Python-devel and Numpy for building Python bindings.

sudo apt install python3-dev python3-numpy

If you wish to install with Python2 you can try use the following command instead of the previous one.

sudo apt install python-dev python-numpy

Now you need GTK support for GUI features, Camera, Media and others.

sudo apt install libavcodec-dev libavformat-dev libswscale-dev libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev

For GTK 3 support use the following command.

sudo apt install libgtk-3-dev

For GTK 2 support, follow this instead the one before.

sudo apt install libgtk2.0-dev

These are the required packages to install OpenCV from source.

Now you can download OpenCV from using git.

git clone https://github.com/opencv/opencv.git

This command will download the latest stable version of OpenCV inside a opencv folder.

Navigate inside the opencv folder.

cd opencv

Create a new build directory and navigate inside the directory.

mkdir build && cd build

Configure OpenCV library using cmake command.

cmake ../

Now you can build the files using make command and install it using make install command

make
sudo make install

Once the installation is completed, you can verify it using the following command.

pkg-config --modversion opencv4
Output
4.2.0

Prepare yourself for a role working as an Information Technology Professional with Linux operating system

Conclusion

Now you have learned how to install OpenCV on Ubuntu 18.04 from repository and also build from source.

Thanks for your time. If you face any problem or any feedback, please leave a comment below.

Tags: AWSGoogle Cloud Platform
Share1Tweet1SendShare
Cloudbooklet

Cloudbooklet

Comments 1

  1. Avatar Of Murtuza Murtuza says:
    3 years ago

    I have followed all the steps for installing OpenCV on Python-3. But it installs for python2 every time. So, when I try to import cv2 in Python3 then it says “No module named cv2”.
    How should I fix this?

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Related Posts

Set Up Deep Learning With Nvidia, Cuda, Cudnn On Ubuntu

How to Set Up Deep Learning with Nvidia, CUDA, cuDNN on Ubuntu 22.04

7 months ago
How To Install Or Upgrade Php 8.2 On Ubuntu 22.04

How to Install or Upgrade PHP 8.2 on Ubuntu 22.04

9 months ago
How To Change Timezone On Ubuntu 22.04

How to Change Timezone on Ubuntu 22.04

1 year ago
How To Install Ansible On Ubuntu 22.04

How to Install Ansible on Ubuntu 22.04

1 year ago

Follow Us

Trending Articles

Ai Annotation Jobs

AI Annotation Jobs: Everything You Need to Know

September 18, 2023

Top 10 Advantages of a Cloud VPS Server

How to Use ChatGPT to Translate Your Website or Blog

Microsoft Surface Event: The Most Exciting and Innovative Launches and Updates

How to Create and Customize Stunning Contact Poster on iPhone

Amazon Prime Big Deal Days 2023: Best Deals

Popular Articles

Ai Gif Generator

8 Best AI GIF Generators of 2023

September 2, 2023

Top 7 AI Dream Interpreter to Understand Your Dreams

10 Best AI Video Generator Free of 2023

Microsoft Editor vs Grammarly: Which is the Best Grammar Checker?

AI Sketch: Turn Your Sketches into Photorealistic Images in Seconds

How to Use the Donne App: A Step-by-Step Guide for Fashion Lovers

Subscribe Now

loader

Subscribe to our mailing list to receives daily updates!

Email Address*

Name

Cloudbooklet Logo

Welcome to our technology blog, where we explore the latest advancements in the field of artificial intelligence (AI) and how they are revolutionizing cloud computing. In this blog, we dive into the powerful capabilities of cloud platforms like Google Cloud Platform (GCP), Amazon Web Services (AWS), and Microsoft Azure, and how they are accelerating the adoption and deployment of AI solutions across various industries. Join us on this exciting journey as we explore the endless possibilities of AI and cloud computing.

  • About
  • Contact
  • Disclaimer
  • Privacy Policy

Cloudbooklet © 2023 All rights reserved.

No Result
View All Result
  • News
  • Artificial Intelligence
  • Applications
  • Linux

Cloudbooklet © 2023 All rights reserved.