As we all know that we can change the colour of alternate rows with different colours very easy in excel but have you ever wondered can alternate row colour based on the condition the condition can be anything. We will try to choose the colour for the row based on a single condition. We can achieve this by just following this simple process to alternate row colour based on group in excel Let us see a simple process to alternate row colour in Excel based on group. Step 1 Let us assume a situation where we have a data where ... Read More
Let us assume we have a situation where we have collected names of people from two sources and you want to know the names of the people who have registered from the both sources and we want to make a list of then them so we can use this simple process to list the names of people present in both lists. We can also find the duplicate names present in the both lists. Let us see a simple process to align duplicate or matching values in two columns in Excel. Step 1 Open an Excel sheet where there are two ... Read More
When we create a pivot table in excel where there is a list of items and you want to know their share in the list in percentage. Read through this tutorial to understand how you can create a new column where it shows the percentage of grand total or subtotal column in a excel pivot table in a simple process. How to Add Percentage of Grand Total Column in Excel Pivot Table Let us see a simple process to add percentage column of total column in an Excel pivot table − Step 1 Let us assume the Excel sheet where ... Read More
The function cv2.approxPolyDP() approximates a contour shape to another shape with less number of vertices. It accepts the following arguments − cnt − The array of the contour points. epsilon − Maximum distance from contour to approximated contour. A wise selection of epsilon is needed to get the correct output. SyntaxThe following syntax are used to approximate a contour shape epsilon = 0.01*cv2.arcLength(cnt, True) approx = cv2.approxPolyDP(cnt, epsilon, True) Steps You can use the following steps to approximate a contour shape in an image − Import the required library. In all the following Python examples, the required ... Read More
The contours of the objects in an image are very helpful to compute the area and perimeter of the image. A contour of an image is a curve joining all the continuous points along the boundary, having the same color or intensity. Contours are used for shape analysis and object detection and recognition etc. To compute the area and perimeter of an object, we first detect the contour of the object and then apply cv2.contourArea() and cv2.arcLength() functions respectively. Syntax The following syntax are used for the functions − area = cv2.contourArea(cnt) perimeter = cv2.arcLength(cnt, True) Where, "cnt" is ... Read More
The solidity of an object is computed as the ratio of contour area to its convex hull area. So to compute the solidity, we first have to find the contour area and convex hull area. The contour area of an object can be found using cv2.contourArea() function. Equivalent Diameter is the diameter of the circle whose area is the same as the contour area. The solidity and equivalent diameter can be computed as below − Syntax area = cv2.contourArea(cnt) hull = cv2.convexHull(cnt) hull_area = cv2.contourArea(hull) solidity = float(area)/hull_area equi_diameter = np.sqrt(4*area/np.pi) Where, cnt is a numpy array of the ... Read More
The extent of an object is computed as the ratio of contour area to its bounding rectangle area. So, to compute the extent, we first have to find the contour area and bounding rectangle area. The contour area of an object can be found using cv2.contourArea() function. Syntax The extent can be computed as follows − area = cv2.contourArea(cnt) x, y, w, h = cv2.boundingRect(cnt) rect_area = w*h extent = float(area)/rect_area Here, "cnt" is a numpy array of the contour points of an object in the image. Steps You can use the following steps to compute extent of an ... Read More
The aspect ratio of an object is computed as the ratio between the width and height of the bounding rectangle of the object. So, to compute the aspect ratio, we first have to find the bounding rectangle of the object. Bounding rectangle of an object can be found using cv2.boundingRect() function. It accepts the contour points of the object and returns top-left coordinate (x, y) and (width, height) of the bounding rectangle. We use the width and height to compute the aspect ratio. Syntax x, y, w, h = cv2.boundingRect(cnt) aspect_ratio = float(w)/h Here, "cnt" is a numpy array ... Read More
A bilateral filter operation is highly effective in smoothing the image and removing noises. The main advantage of the bilateral filtering is that it preserves the edges unlike in average and median filtering. Bilateral filtering operation is slower in comparison to other filters. We can perform bilateral filtering on an image using the cv2.bilateralFilter() method. Syntax Following is the syntax of this method. cv2.bilateralFilter(img, d, sigmaColor, sigmaSpace) This method accepts the following parameters − img − The input image on which the bilateral filter operation to be applied. d − A variable of the type integer representing the ... Read More
We can fit an ellipse to an object using the function cv2.fitEllipse(). The ellipse is inscribed in a rotated rectangle. The rotated rectangle is a bounding rectangle with minimum area enclosing the object. Syntax The syntax used for this function is − ellipse = cv2.fitEllipse(cnt) Where, "cnt" is the contour points. It is represented as an array of contour points. Output − It returns a tuple of tuples in ((x, y), (majorAxis, minorAxis), angle) format. (x, y) is the coordinates of center and (majorAxis, minorAxis) is the lengths of minor and major axes and angle is the rotation angle ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP