# What is a convexity defect?

## What is a convexity defect?

It can be depicted as the calculated difference between the convex hull and the contour. The convexity defect is defined as the points farthest from the convex points. So, if the finger tips are considered as the convex points, the trough between the fingers can also be considered as convexity defects.

### What does convexityDefects return?

According to opencv-pyhthon manual cv2. convexityDefects() returns four values which are [ start point, end point, farthest point, approximate distance to farthest point ]. I do not understand how the five lines of for loop is working?

**How do you identify convexity defects?**

OpenCV provides a function cv2. convexityDefects() for finding the convexity defects of a contour. This takes as input the contour and its corresponding hull indices and returns an array containing the convexity defects as output.

**What is convex hull OpenCV?**

A Convex object is one with no interior angles greater than 180 degrees. A shape that is not convex is called Non-Convex or Concave. Hull means the exterior or the shape of the object. Therefore, the Convex Hull of a shape or a group of points is a tight fitting convex boundary around the points or the shape.

## What is defects in convex hull?

In simple words, convexity defect is a cavity in an object (blob, contour) segmented out from an image. That means an area that do not belong to the object but located inside of its outer boundary -convex hull (read documentation of cv::convexHull function for details).

### What is contour OpenCV?

Contours can be explained simply as a curve joining all the continuous points (along the boundary), having same color or intensity. The contours are a useful tool for shape analysis and object detection and recognition. In OpenCV, finding contours is like finding white object from black background.

**What is cv2 approxPolyDP?**

The detection of shapes with the Hough transform is limited to circles. approxPolyDP() allows the approximation of polygons, so if your image contains polygons, they will be quite accurately detected, combining the usage of cv2. findContours and cv2.

**What is convex hull in image processing?**

The convex hull of a binary image is the set of pixels included in the smallest convex polygon that surround all white pixels in the input.

## What is convex hull area?

The convex hull of a set of points S S S is the intersection of all half-spaces that contain S S S. A half space in two dimensions is the set of points on or to one side of a line. This notion generalizes to higher dimensions.

### What is an image contour?

Contours in image processing. Contours are designed using edges. They are edges with an identity, geometrical parameters and are continuous. They are useful for shape analysis and object recognition.

**Can a convex curve have no convexity defects?**

Let’s understand this with the help of the below image. Here, the red line shows the convex hull, the grey line represents the contour and the black arrow shows the deviation of the hull from the contour (convexity defect). So, it’s obvious that the convex curve has no convexity defects.

**How to find convexity defects of a contour OpenCV?**

OpenCV provides a function cv2.convexityDefects () for finding the convexity defects of a contour. This takes as input the contour and its corresponding hull indices and returns an array containing the convexity defects as output. The basic syntax is given below.

## Which is the deviation from the convex hull?

Any deviation of the contour from its convex hull is known as the convexity defect. Let’s understand this with the help of the below image. Here, the red line shows the convex hull, the grey line represents the contour and the black arrow shows the deviation of the hull from the contour (convexity defect).

### How is OpenCV used to detect hand movement?

Software (i’m using opencv to detect human hand and find the distance between palm center and finger tips. Popular method of convex hull and convexity defect is used to detect the movement of hand.) python code you can get it from here