Friday, March 14, 2025

How to install OPENCV package of python in Ubuntu

 First be sure that gedit is already installed in your system. 

If it is not installed, run this command 

                                sudo apt  install gedit  # version 46.1-3

Next run : 

                                sudo apt update

Now, run these following commands to install opencv in your ubuntu operating system.

sudo apt install libopencv-dev python3-opencv

Check opencv version:

                                python3 -c "import cv2; print(cv2.__version__)"


After installing, you can check wheather your program is properly running or not, you can simply write a sample code like....

To create python file : gedit p1.py

import cv2 img = cv2.imread("/home/arik/Downloads/image.jpeg", cv2.IMREAD_GRAYSCALE) cv2.imshow('image',img) cv2.waitKey(0) cv2.destroyAllWindows()

Here is the above given image:  




To run : python3 p1.py

If output is,


So, your installation is successfull.

Complete Works of Swami Vivekananda [Volume 8,Page - 2069]

  Complete Works of Swami Vivekananda [ Volume 8, Page - 2069] Jesus Christ was God — the Personal God become man. He has manifested Himsel...