Check if the image is empty using Python - OpenCV Last Updated : 03 Jan, 2023 Comments Improve Suggest changes Like Article Like Report Prerequisite: Basics of OpenCV OpenCV (Open Source Computer Vision) is a computer vision library that contains various functions to perform operations on pictures or videos. It was originally developed by Intel but was later maintained by Willow Garage and is now maintained by Itseez. This library is cross-platform that it is available in multiple programming languages such as Python, C++, etc. In this article, we’ll try to check if the opened image is empty or not by using OpenCV (Open Source Computer Vision). To do this OpenCV libraries are required to install: pip install opencv-pythonTo achieve this objective we will use cv2.imread() method, If this method read the image then it returns the image coordinates matrix otherwise it will return None. Input Image: Gfg.png Example: In this example, we will read the image and check found or not. Python3 # Importing OpenCV library import cv2 # user define function # that return None or def check_empty_img(img): # Reading Image # You can give path to the # image as first argument image = cv2.imread(img) # Checking if the image is empty or not if image is None: result = "Image is empty!!" else: result = "Image is not empty!!" return result # driver node img = "Gfg.png" # Calling and printing # the function print(check_empty_img(img)) Output: Image is not empty!!Example 2: In this example, here the image is not found. Python3 # Importing OpenCV library import cv2 # user define function # that return None or def check_empty_img(url): # Reading Image # You can give path to the # image as first argument image = cv2.imread(url) # Checking if the image is empty or not if image is None: result = "Image is empty!!" else: result = "Image is not empty!!" return result # driver node img = "geek.png" # Calling and printing # the function print(check_empty_img(img)) Output: Image is empty!! Comment More infoAdvertise with us Next Article Check if the image is empty using Python - OpenCV aditya_taparia Follow Improve Article Tags : Technical Scripter Python Technical Scripter 2020 OpenCV Python-OpenCV +1 More Practice Tags : python Similar Reads Concatenate images using OpenCV in Python To concatenate images vertically and horizontally with Python, cv2 library comes with two functions as: hconcat(): It is used as cv2.hconcat() to concatenate images horizontally. Here h means horizontal.vconcat(): It is used as cv2.vconcat() to concatenate images vertically. Here v means vertical.Im 3 min read Reading an image in OpenCV using Python Prerequisite: Basics of OpenCVIn this article, we'll try to open an image by using OpenCV (Open Source Computer Vision) library.  Following types of files are supported in OpenCV library:Windows bitmaps - *.bmp, *.dibJPEG files - *.jpeg, *.jpgPortable Network Graphics - *.png WebP - *.webp Sun raste 6 min read Color Identification in Images using Python - OpenCV An open-source library in Python, OpenCV is basically used for image and video processing. Not only supported by any system, such as Windows, Linux, Mac, etc. but also it can be run in any programming language like Python, C++, Java, etc. OpenCV also allows you to identify color in images. Donât you 3 min read How to Detect Shapes in Images in Python using OpenCV? Prerequisites: OpenCV OpenCV is an open source library used mainly for processing images and videos to identify shapes, objects, text etc. It is mostly used with python. In this article we are going to see how to detect shapes in image. For this we need cv2.findContours() function of OpenCV, and als 3 min read Cropping Faces from Images using OpenCV - Python Opencv is a python library mainly used for image processing and computer vision. In this article first, we detect faces after that we crop the face from the image. Face detection is the branch of image processing that uses to detect faces. We will use a pre-trained Haar Cascade model to detect faces 3 min read Add image to a live camera feed using OpenCV-Python In this article, we are going to learn how to insert an image in your live camera feed using OpenCV in Python. Stepwise ImplementationStep 1: Importing the libraries CV reads and stores all the images as a NumPy array. We need the NumPy library to manipulate the image and as expected we need the cv2 4 min read How to Check OpenCV Version in Python OpenCV (Open Source Computer Vision Library) is a powerful library for computer vision and image processing tasks. Whether you're a beginner or an experienced developer, knowing how to check the version of OpenCV you're using can be essential for compatibility and troubleshooting. In this article, w 3 min read Realtime Distance Estimation Using OpenCV - Python Prerequisite: Introduction to OpenCV In this article, we are going to see how to calculate the distance with a webcam using OpenCV in Python. By using it, one can process images and videos to identify objects, faces, or even the handwriting of a human. This article focuses on detecting objects. We w 5 min read Find Circles and Ellipses in an Image using OpenCV | Python To identify circles, ellipses, or in general, any shape in which the pixels are connected we use the SimpleBlobDetector() function of OpenCV. In non-technical terms, a blob is understood as a thick liquid drop. Here, we are going to call all shapes a blob. Our task is to detect and recognize whether 2 min read Image Steganography using OpenCV in Python Image Steganography is the process of hiding secret data in some image. In this post, we will hide one image inside another and convert it into another image and then extract back both the images from the previous image. The idea behind image-based Steganography is very simple. Images are composed o 3 min read Like