Flip an Image in OpenCV Python

Shahid Akhtar Khan
Updated on 02-Dec-2022 07:12:23

18K+ Views

In OpenCV, an image can be flipped using the function cv2.flip(). Using this function we can flip the image across X-axis, Y-axis and across both axes. It accepts a flag flipCode as an argument to flip the image across the axis. If the flipCode is set to 0, the image is flipped across the x-axis and if the flipCode is set to a positive integer (say 1), the image is flipped across the Y-axis. If the flipCode is set to a negative integer (say "-1"), the image is flipped across both axes. Steps To flip an image, one could ... Read More

Access and Modify Pixel Value in an Image Using OpenCV Python

Shahid Akhtar Khan
Updated on 02-Dec-2022 07:10:33

15K+ Views

To access a single pixel value in an image we can use indexing the same as we do to NumPy array indexing. We can use slicing to access a sequence of pixel values. To modify the pixel values we use the simple Python assignment operator ("="). Steps To access and modify pixel values in an image we could follow the below steps- Import the required library. In all the following examples, the required Python library is OpenCV. Make sure you have already installed it. Read the input RGB image using cv2.imread(). The RGB image read using this method ... Read More

Split an Image into Different Color Channels in OpenCV Python

Shahid Akhtar Khan
Updated on 02-Dec-2022 07:08:26

8K+ Views

A color image consists of three color channels- Red, Green and Blue. These color channels can be split using cv2.split() function. Let's look at the steps to split an image into different color channels- Import the required library. In all the following examples, the required Python library is OpenCV. Make sure you have already installed it. Read the input image using cv2.imread() method. Specify full path of image with the image type (i.e. png or jpg) Apply cv2.split() function on the input image img. It returns blue, green and red channel pixel values as numpy arrays. Assign ... Read More

Perform Sqrbox Filter Operation on an Image using OpenCV Python

Shahid Akhtar Khan
Updated on 02-Dec-2022 07:04:51

494 Views

We can perform SQRBox Filter operation on an image using cv2.sqrBoxFilter(). It calculates the normalized sum of squares of the pixel values overlapping the filter. We use the following syntax for this method − cv2.sqrBoxFilter(img, ddepth, ksize, borderType) where, img is the input image, ddepth is the output image depth, ksize is kernel size and borderType is border mode used to extrapolate pixels outside of the image. Steps To perform SQRBox filter operation, you could follow the steps given below- Import the required library. In all the following examples, the required Python library is OpenCV. Make sure ... Read More

Add Borders to an Image in OpenCV Python

Shahid Akhtar Khan
Updated on 02-Dec-2022 07:02:40

2K+ Views

OpenCV provides the function cv2.copyMakeBorder() to add borders in images. To add border in an image, you could follow the steps given below − The first step is to import required libraries. In all below Python examples the required Python library is OpenCV. Make sure you have already installed it. The next step is to read an input image using the cv2.imread() function. Specify the full image path with image types (.jpg or .png). Specify different parameters to the function cv2.copyMakeBorder(). The different parameters to be specified are src, dst, top, bottom, left, right, borderType, and value. Call ... Read More

Find and Draw Extreme Points of an Object on an Image Using OpenCV Python

Shahid Akhtar Khan
Updated on 02-Dec-2022 06:59:32

2K+ Views

To find and draw the extreme points of an object in the input image, we could follow the steps given below − The first step is to import required libraries. In all below Python examples the required Python library is OpenCV. Make sure you have already installed it. The next step is to read an input image using the cv2.imread() function. Specify the full image path with image types (.jpg or .png). Convert the input image to grayscale. Apply thresholding on the grayscale image to create a binary image. Adjust the second parameter to get a better contour ... Read More

Draw Circles Using Mouse Events in OpenCV Python

Shahid Akhtar Khan
Updated on 02-Dec-2022 06:55:16

2K+ Views

There are different types of muse events such as left or right button click, mouse move, left button double click etc. OpenCV provides us with different types of mouse events such as cv2.EVENT_LBUTTONDOWN for mouse left button down, cv2.EVENT_RBUTTONDOWN for right button down, cv2.EVENT_LBUTTONDBLCLK for left button double click and others. A mouse event returns the coordinates (x, y) of the mouse event. To perform an action when an event happens, we define a mouse callback function. We use mouse events to draw circles on the image. Steps To draw circles using mouse events, follow the steps given below ... Read More

Difference Between Capital Reserve and Revenue Reserve

Kiran Kumar Panigrahi
Updated on 02-Dec-2022 06:09:59

2K+ Views

In a company, there are two types of reserves namely Capital Reserve and Revenue Reserve. The basic difference between the two is that, capital reserve is the fund created for non-trading activities, whereas the revenue capital is the fund created for trading activities. In this article, we will discuss all the important differences between capital reserve and revenue reserve. But before that, let's start with some basics of capital reserve and revenue reserve so it will become easier to understand how they are different from each other. What is Capital Reserve? The type of reserve that is created from the ... Read More

Difference Between Website and Portal

Kiran Kumar Panigrahi
Updated on 02-Dec-2022 06:07:29

9K+ Views

Websites and Portals both have a webbased interface. They are correlated terms in the Internet terminology. The basic difference between a website and a portal is that a website is a collection of related webpages, whereas a portal is a gateway to the World Wide Web and is used to access various services of the Internet. In this article, we will discuss the important differences between website and portal. Let's start with a basic introduction of what websites and portals are. What is a Website? A Website is a collection of related webpages and is made to available under one ... Read More

Difference Between Web Page and Website

Kiran Kumar Panigrahi
Updated on 02-Dec-2022 06:05:41

4K+ Views

Web page and website are related terms and sometimes people tend to use them interchangeably, but they are distinct from each other. The basic difference between a web page and a website is that a web page is a text document written in HTML (Hyper Text Markup Language) and is rendered by a web browser, whereas a website is a collection of related webpages having a specific address, called URL, on the Internet. This article is meant for explaining the important differences between web page and website. But, before going into the differences, let's have a basic overview of what ... Read More

Advertisements