- 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).
how to find number of pixels in a region of a hand?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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.
0 comentarios
Respuestas (1)
Jonathan
el 19 de Feb. de 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).
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 comentarios
Jonathan
el 20 de Feb. de 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
el 11 de Mzo. de 2014
I am also doing the same project can you tell me how the function works? And also the reasoning?
Ver también
Categorías
Más información sobre Biomedical Imaging en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!