how to get boundary of a hand image???
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
i am new to matlab. doing my project on hand geometry. i am stuck in finding the boundary of the image. infact I have found it but the resultant is an inverted image! please help me!
here is my code
I= imread('pre.jpg');
dim = size(BW);
col = round(dim(2)/2)-90;
row = find(BW(:,col), 1 );
boundary = bwtraceboundary(BW,[row, col],'N');
imshow(I)
K = plot(boundary(:,1),boundary(:,2),'k','LineWidth',3);
0 commentaires
Réponses (3)
Matt Kindig
le 19 Juin 2012
Images in MATLAB are read in as row x column matrices, like any other matrix. Thus, the horizontal position of a given pixel is indicated by the 2nd dimension of a given position, while the vertical position is given by the 1st dimension of a given position. For example, given an image M that is 600 x 250, the pixel M(100,50) refers to the pixel that is 100 rows down (i.e. vertically) and 50 pixels right (i.e. horizontally).
By contrast, plots are commonly thought of in x-y coordinates, where the first coordinate is the horizontal (not vertical) position, and the second coordinate is the vertical position. Also, the origin for plots is (typically) at the lower left corner, while the origin for images is the upper left corner.
Thus, if you plot(boundary(:,2), boundary(:,1)), I believe the image should come out correctly. You should also search the Help for "axis ij" to understand how to change the axis orientation to accommodate either the image convention or the plot convention.
0 commentaires
Image Analyst
le 19 Juin 2012
Use bwboundaries() instead. Then call "hold on" and plot right over your image. Upload your image if you want a demo.
3 commentaires
Image Analyst
le 14 Août 2012
Nisha, regarding your comment to your "Answer":
Did you try ANDing the images?
intersectionImage = binaryImage1 & binaryImage2;
You can use poly2mask() if you need to turn polygon vertexes into binary images.
Nisha Rajiv
le 13 Août 2012
I have used the same code and i have got the boundary of the image. now i need to make two image boundary to interact to check the interaction points. Since I am new to Matlab i have no idea how to proceed kindly guide me on this...
2 commentaires
Image Analyst
le 13 Août 2012
I don't know what this means: "to interact to check the interaction points". What kind of interaction is taking place? Did you possibly mean intersect, instead of interact?
Nisha Rajiv
le 13 Août 2012
ya kind of...it is like i should make both the boundaries to touch each other and find out the number of points that are touching in both the boundaries. Like i have 2 polygons of irregular shape and now i extract the boundary and make them touch each other to find out their levels of interaction...Am i conveying correctly.
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!