Filter löschen
Filter löschen

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

2 Ansichten (letzte 30 Tage)
neha
neha am 18 Feb. 2011
Kommentiert: Hassan Javaid am 11 Mär. 2014
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.

Antworten (1)

Jonathan
Jonathan am 19 Feb. 2011
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 Kommentare
Jonathan
Jonathan am 20 Feb. 2011
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 am 11 Mär. 2014
I am also doing the same project can you tell me how the function works? And also the reasoning?

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Biomedical Imaging finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by