Click here to Skip to main content
15,881,281 members
Articles / Multimedia / Image Processing
Tip/Trick

Get Palm Hand Region from Binary Image on C# EmguCV

Rate me:
Please Sign up or sign in to vote.
4.00/5 (1 vote)
15 Aug 2012CPOL2 min read 26.5K   3.8K   7   4
Get Palm Hand Region from Binary Image of Hand on EmguCV

Image 1

Introduction

Get the palm hand region using convexity defect. Convexity defect is used to detect the base of a finger. 

Output: The original region of palm hand or circle region of the palm. Circle region is often used on palm hand recognition to support hand rotation.

Input: binary image, so you need to do segmentation first. 

Background 

This process runs based on the convexity defect method. (Source: http://opencv.willowgarage.com ) 

Image 2

  1. First, it finds the hull of the object; in the image, the hull is the red line. 
  2. Then from the hull, it finds the convexity defect. 
  3. Convexity defect consist of four elements:
    • start points: points where the defect begin  
    • end points: points where the defect end  
    • depth points: points that are farthest from the hull within the defect (between its start point and depth point)   
    • distance: distance between depth point to the hull  
  4. From every depth point we treat it as the boundary of the palm. Depth point should be on the palm region, but often depth points are detected on the finger. So, I use some parameter to  filter the depth point that is detected on the finger based on its distance. 
  5. After I filter the depth points, I draw it to the image.  

Using the code 

To use this code, you just simply create the object from the class palmHandSegmentation. Here is the example:

C#
palmHandSegmentation PHS = new palmHandSegmentation(); 
Image<Gray, byte> binaryHandImage = new Image<Gray, byte>("img/hand1.bmp"); // load the image 
Image<Gray, byte> palmOfHand = PHS.getPalm(binaryHandImage);  // get the palm of the hand 
Image<Gray, byte> circlePalmOfHand = PHS.getCirclePalm(binaryHandImage);  // get the circle region of the palm

You can also make adjustments on the parameter. The parameters are on the class palmHandSegmentation on the file 'palmHandSegmentation.cs'.

These parameters you can make adjustments on 'palmHandSegmentation.cs': 

C#
// adjust this to find best distance to detect finger
double minimumDistanceDepthPointToEndPointRatio = 0.15;
double circleRadiusMultiplier = 1.1; // adjust this to set your circle size

Recommendation

To create the circle region, I use a minimum enclosing circle from the depth points, then I take its center to create a new circle with the same center and radius that is from the distance from the center to the contour_of the hand. You can also obtain the center by computing the central moment from the palm region. 

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
Questionexe error Pin
tlktmr_rabia13-Dec-19 9:10
tlktmr_rabia13-Dec-19 9:10 
QuestionTypeInitializationException was unhandled Pin
Member 1215325221-Jan-16 3:26
Member 1215325221-Jan-16 3:26 
QuestionFind Objects in Binary Image Pin
sajawal20-Feb-13 20:17
sajawal20-Feb-13 20:17 
AnswerRe: Find Objects in Binary Image Pin
Shulha Yahya22-Feb-13 19:49
Shulha Yahya22-Feb-13 19:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.