フィルターのクリア

how to find number of pixels in a region of a hand?

2 ビュー (過去 30 日間)
neha
neha 2011 年 2 月 18 日
コメント済み: Hassan Javaid 2014 年 3 月 11 日
We are doing a project on detection of asl. We have extracted hand from the background. Now we need to do feature extraction for which we are using radial length signature. We need to find the number of pixels from the centroid to the edge of the hand. We are successful in drawing the radial lines but now we are stuck with counting the number of pixels from centroid to the edge. Can somebody pls help us.

回答 (1 件)

Jonathan
Jonathan 2011 年 2 月 19 日
I am making some assumptions, here, about how you count pixels. Hopefully, these assumptions will be clear via the following examples.
I assume your radial lines go from the center of pixel (0,0) to the center of pixel (a,b).
  • Example 1: (a,b) = (0,b). Answer = b+1.
  • Example 2: (a,b) = (1,2). Answer = 4. The line passes through (0,0), (0,1), (1,1), and (1,2).
  • Example 3: (a,b) = (2,2). Answer = 3. The line passes through (0,0), (1,1), and (2,2).
To summarize this counting method into a formula, we need to characterize the conditions under which the line passes through a pixel vertex (as in example 3) and not a pixel edge (as in examples 1 and 2). I can give you the reasoning behind my answer if you like. For now I give you the formula below.
function numPts = numPoints(a,b)
diagPixels = gcd(a+1,b+1) - 1;
numPts = a + b + 1 - diagPixels;
end
~Jonathan
  2 件のコメント
Jonathan
Jonathan 2011 年 2 月 20 日
If you want to count all four pixels at a vertex crossing, use the following for numPts.
numPts = a + b + 1 + 2*diagPixels;
~Jonathan
Hassan Javaid
Hassan Javaid 2014 年 3 月 11 日
I am also doing the same project can you tell me how the function works? And also the reasoning?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeBiomedical Imaging についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by