# Palm Center Extraction Based on Distance Transformation

Source: Internet
Author: User

Recently I am playing a gesture recognition project. The goal of the project is to allow the hand to move the mouse, click, double-click, in this way, the user can directly control the computer cursor for human-computer interaction without the mouse.

An important issue in this project is the extraction of palm center of gravity. To obtain the palm center of gravity, we usually calculate the center of gravity of the entire hand and approximate the palm center of gravity at this center of gravity. This method is only applicable to situations where no finger sticks out or only one finger sticks out, as shown in A, if all five fingers reach out, the palm Center of Gravity obtained through this method will be seriously deviated from the actual position, as shown in B.

To obtain an accurate palm center of gravity, you must remove the extended finger. Otherwise, the finger will inevitably affect the calculation of the palm center of gravity. This paper introduces a palm Center of Gravity extraction algorithm based on distance transformation. This algorithm can precisely locate the palm center without the impact of fingers.

The basic meaning of distance transformation is to calculate the distance from a non-zero pixel to the nearest zero pixel in an image, that is, the shortest distance to the zero pixel. Because the extended finger is relatively small (as shown in the "src" window image) compared to the palm of the hand, that is, the pixel distance on the finger is very short, therefore, the pixel value of the image after the Distance Transformation in the finger position is small (as shown in the "DST" window image), and it is binarization by setting a reasonable threshold value, then, you can obtain the image for finger removal (as shown in the "bidist" window image), and the palm center of gravity is the geometric center of the image.

The Distance Transformation Function of opencv is cvdisttransform. The specific meanings of each parameter of this function are not described here. Please refer to the user manual of opencv for details. The following code uses the tool vs2008 + opencv2.0.

```# Include <cv. h> # include
Program running result:

```
Related Keywords:

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

## A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

• #### Sales Support

1 on 1 presale consultation

• #### After-Sales Support

24/7 Technical Support 6 Free Tickets per Quarter Faster Response

• Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.