hand detection in image

2 次查看(过去 30 天)
Math
Math 2014-5-21
评论: Sadiq 2014-6-29
My program captures an image from the webcam, and this image that I want to isolate the hand but is not working. Regionprops tried to grab his hand as the second largest area of the image after the head, but does not recognize. Need urgent help to fix the problem, Thanks!
Sorry for bad english, I'm foreign
my program:
% Starting Webcam . vid = videoinput ( ' Winvideo ', 1 ' RGB24_640x480 '); vid.FramesPerTrigger = 1; preview ( vid ) ; start ( vid ) ; % Get the image and display it pause ( 10 ) % Timeout 10s to initialize camera rgbImage = getSnapshot ( vid ) ; imshow ( rgbImage ) ; % Save the Picture on the Desktop saveas ( gcf , ' Imagemteste.jpg ' ) ; pause ( 3 )
% Define variables format long g ; format compact ; fontSize = 20 ; % Open Image folder = ' C : \ Users \ Castle \ Desktop ' ; BaseFileName = ' Imagemteste.jpg ' ; % Full name prefixed with path FullFileName = fullfile (folder , BaseFileName ) ;
% Convert to grayscale grayImage = imread ( FullFileName ) ; % Taking the error , converts the image to grayscale using only the channel % green [ rows , columns , numberOfColorBands ] = size ( grayImage ) ; if numberOfColorBands > 1 grayImage grayImage = ( : , : , 2 ) ; end
% Display the image in grayscale subplot ( 2 , 2, 1 ); imshow ( grayImage [ ] ); on axis ; title (' Original Image Grey ', ' FontSize ' , fontSize ) ; % Binarizar Image binaryImage grayImage = < 128 ; subplot ( 2 , 2, 2 ); imshow ( binaryImage [ ] ); title (' binarized image ', ' FontSize ' , fontSize ) ; % labels each object in a binary image labeledImage = bwlabel ( binaryImage ); % Measures the size of each region detected measurements regionprops = ( labeledImage , ' BoundingBox ', ' Position ' ) ; for k = 1 : length ( measurements ) = thisBB measurements ( k ) BoundingBox . ; rectangle ( ' Position' , [ thisBB (1) thisBB (2) thisBB (3) thisBB (4)] , " EdgeColor ',' r ' , lineWidth 2 ) end % Extract the hand which is the second largest element of the image allAreas = [ measurements.Area ] ; [ sortedAreas , sortingIndexes ] = sort ( allAreas , ' descend ' ) ; % sort in ascending order handIndex = sortingIndexes (2); Using IsMember % ( ) to extract the hand from the labeled image . handImage = IsMember ( labeledImage , handIndex ) ; 1 % Binarizar again handImage handImage = > 0 ; % Plot the final image subplot ( 2 , 2, 3); imshow ( handImage [ ] ); title (' Image of Hand ', ' FontSize ' , fontSize ) ;
  1 个评论
Sadiq
Sadiq 2014-6-29
hi dear i am working on the same project, my task is also to recognize hand from video frames, it will be very nice of you if you help me,, my email id is sadiqanusar@gmail.com,

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Processing and Computer Vision 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by