White and black dot detection using OpenCV Python

Gireesha Devara
Updated on 30-May-2023 15:58:07
OpenCV python is one of the image processing libraries in python and it uses the Numpy array to store the image data so that all the image arrays are represented as a ndarray type. The cv2.findContours() method in the python OpenCV module is used for detecting the objects in a binary image. In the article below, we will use this method to detect the White and Black dots (objects) in an image. Following is the syntax of this method – cv2.findContours(image, mode, method[, contours[, hierarchy[, offset]]]) Where, Image is an 8-bit single-channel image (binary image). Contours is ... Read More

Rotate image without cutting off sides using OpenCV Python

Gireesha Devara
Updated on 30-May-2023 15:55:23
Rotating an image is the most basic operation in image editing. The python OpenCV library provides the methods cv2.getRotationMatrix2D(), cv2.rotate() to do this task very easily. The cv2.rotate() will rotate the image in 0 or 90 or 180 or 270 angles only where as Cv2.getRotationMatrix2D() will rotate the image to any specified angle. In the article below, we will rotate the image without cropping or cutting off sides using OpenCV Python. To rotate an image using the cv2.getRotationMatrix2D() method then we need to follow below three steps − First, we need to get the centre of rotation. Next ... Read More

Check if the image is empty using OpenCV Python

Gireesha Devara
Updated on 30-May-2023 15:48:46
OpenCV is an Open Source Computer Vision Library in python. It is one of the image processing libraries in python and it uses the python Numpy library so that all the image arrays are represented as a ndarray type. OpenCV-python needs the numpy library, we need to make sure that the numpy is also installed in our python interpreter. In this article, we will see the different ways to check if the given image is empty or not using OpenCV Python. Let’s observe the input-output scenarios to understand how to check if the given image is empty or not ... Read More

Splitting and Merging Channels with OpenCV Python

Gireesha Devara
Updated on 30-May-2023 15:44:09
A standard digital Color image is represented by pixels and each pixel is a combination of primary colors. And a channel is a grayscale image that is made up of only one of its primary colors of a colored image. For example, an RGB image has three channels: red, green, and blue. Observe the below colored images to see how each channel looks separately: Below grayscale images are the representation of each channel of the RGB image. In this article, we will discuss how to split and merge channels of an image using python openCV library. Splitting channels ... Read More

Top Hat and Black Hat Transform using OpenCV Python

Gireesha Devara
Updated on 30-May-2023 15:34:25
Top Hat and Black Hat Transforms are the Morphological transformations operations on the binary images. Generally, the morphological operations process the image based on the morphology, structure, or shape. Top-hat transform is an operation that opens an image and then subtracts it from the original image (top hat = image - opening). It is used to extract small elements and details from given images which is nothing but feature extraction, image enhancement, and other operations. Whereas the Black Hat Transform operation is nothing but the difference between an image closing and the input image itself (black hat = closing ... Read More

OpenCV Python program to read and save an Image

Gireesha Devara
Updated on 30-May-2023 15:31:19
OpenCV-python is an Open Source Computer Vision Library in python it is used to process images and videos for detecting faces and objects. It is one of the image processing libraries in python and uses the python Numpy library so that all the image arrays are represented as a ndarray type. Install OpenCV using pip Pip install opencv-python OpenCV needs the numpy library, we need to make sure that the numpy library is also installed. The Python OpenCV module provides functions cv2.imread() and cv2.imwrite() to read/load and write/save image files. In this article, we will see reading ... Read More

Contour Plot using Python Matplotlib

Gireesha Devara
Updated on 30-May-2023 15:25:12
Matplotlib is free and open-source plotting library in python. It is used to create 2-Dimensional graphs and plots by using python scripts. To utilize the matplotlib functionalities we need to install the library first. Install using pip By execute the below command in the command prompt we can easily install the latest stable package for Matplotlib from PyPi. pip install Matplotlib You can install Matplotlib through conda, using the following command – conda install -c conda-forge matplotlib A Contour plot is used for visualizing three-dimensional data in a two-dimensional surface by plotting constant z slices, called contours. ... Read More

Contour Plots using Plotly in Python

Gireesha Devara
Updated on 30-May-2023 15:17:55
In python Plotly referred as "plotly.py". It is a free and open-source plotting library that is built on top of “plotly.js”. It supports more than 40 unique chart types. This library is mainly used for financial, geographical, scientific, 3-dimensional, and data analysis applications. It can be used to plot various types of charts and graphs like scatter plots, line plots, bar charts, box plots, histograms, pie charts, area charts, box plots, histograms, heatmaps, subplots, multiple-axes, etc. Installing plotly Execute the below commands in the command prompt to install the plotly module. It is an easy way to install the ... Read More

Constructors in Python

Gireesha Devara
Updated on 30-May-2023 15:03:29
In python every class has a constructor, it is a special method specified inside a class. The constructor/initializer will automatically invoke while creating a new object for the class. When an object is initialized, the constructor assigns values to the data members within the class. It is not necessary to define a constructor explicitly. But for creating a constructor we need to follow the below rules − For a class, it allows only one constructor. The constructor name must be __init__. A constructor must be defined with an instance attribute (nothing but specifying the self keyword as a ... Read More

Conversion between binary, hexadecimal and decimal numbers using Coden module

Gireesha Devara
Updated on 30-May-2023 14:57:06
The coden is a python library developed by Tanmay Earappa, which is used for secret codes (decoding and encoding secret codes). This module provides functionalities to do the code conversions. Following are few functions and their functionalities provided by this module – coden.secret(): It is used for decode or encode the secret codes based on the input of the mode parameter. hex_to_bin(): It will do the Hexadecimal to Binary conversion. int_to_bin(): It will do the Decimal to Binary conversion. int_to_hex(): It will do the Decimal to Hexadecimal conversion Install Coden with pip With the pip command we can ... Read More
1 2 3 4 5 ... 10739 Next
Advertisements