Hello, I have a final project for video processing, but i am stuck. I only could make the video work, and got snapshots, and i am not really sure that works.

The idea is, while the video is on, each 5 frames will take a picture or snapshot and then identify if match with any letter. In sum, is a hand language translator in video streaming. I can realize how to create a data base for the images, i want to use edge detection to this comparing process. I want to know how to save images (like a database) and then when a image that is on the video is equal to one of the data base it will tell which character i am calling. Thanks a lot.
this is what i got (I know that is not much but, i don't have experience with video streaming processing):
vid= videoinput('winvideo',1,'MJPG_1280x720');
set(vid,'FramesPerTrigger',inf);
set(vid,'ReturnedColorSpace','grayscale');
vid.FrameGrabinterval=5;
start(vid);
while(vid.framesAcquired<=100)
data=getsnapshot(vid);
dif_im2=im2bw(data, graythresh(data));
dif_im=edge(dif_im2);

 Réponse acceptée

I haven't used it (I always use getsnapshot()), but have you looked at getdata(vid, 5) to get 5 frames out of the video stream?

6 commentaires

thansk for your help. Now i have another problem. I need to automatically crop the image where is the hand in binary format. The think is to crop it to get the centroid of it. If there any function to do this? Thanks.
You don't need to crop it to get the centroid of it. You can get the centroid of it without cropping. Simply do this, like in my Image Segmentation Tutorial:
labeledImage = bwlabel(binaryImage);
blobMeasurements = regionprops(labeledImage, 'Centroid');
blobCentroid = blobMeasurements(1).Centroid;
Be aware though that the centroid is in (x,y) order, which is (column, row) NOT (row, column).
Thanks. That helps a lot, but the thing is that I need to cut the image in 4 exact quadrants.
I used this code:
I6=I4(1:size(I4,1)/2,1:size(I4,2)/2,:);
I7=I4(size(I4,1)/2+1:size(I4,1),1:size(I4,2)/2,:);
I8=I4(1:size(I4,1)/2,size(I4,2)/2+1:size(I4,2),:);
I9=I4(size(I4,1)/2+1:size(I4,1),size(I4,2)/2+1:size(I4,2),:);
The thing with those commands is that i had the image cut into 4 equal pieces, but was the whole image not the object. Why? Because it is easier to compare the quadrant of 4 sizes than the whole size. This is my last request, and sorry if I am bothering you. Thanks again.
I don't understand at all how cutting the image up into 4 parts, with parts of the hand possibly being in some or all of the 4 separate subimages, would be easier.
Your "request" is not really a request. I can't find any question to me in your comment. But whatever, you seem to think you know what you're doing, so good luck with it.
sorry if i don't know how ask. Maybe if i attach you the image you can understand what i want to do. the image hand.png is the final image i got from making segmentation to an image from rgb. I want to crop only the hand in 4 parts (equally), I know how to label the object, i was able to divide the image with the command i showed you before, but i got the hole image crop. I want only the to cut the hand in 4 pieces. could you help me with this?
OK, so you want to cut the object (hand) into 4 quadrants, not the image. So you need to find the centroid (like I gave before):
labeledImage = bwlabel(binaryImage);
blobMeasurements = regionprops(labeledImage, 'Centroid');
blobCentroid = blobMeasurements(1).Centroid;
Then you need to round it to the nearest row or column because indexes have to be integers. Then you need to use that in your 4 indexing operations:
middleRow = round(blobCentroid(2) / 2);
middleColumn = round(blobCentroid(1) / 2);
upperLeft = binaryImage(1:middleRow, 1:middleColumn);
lowerLeft = binaryImage(middleRow+1:end, 1:middleColumn);
upperRight = binaryImage(1:middleRow, middleColumn+1:end);
lowerRight = binaryImage(middleRow+1:end, middleColumn+1:end);

Connectez-vous pour commenter.

Plus de réponses (1)

Hi every one, this is what I got so far, I now have how to capture images and process them, but still I don't know how to make the video continuously take 5 pics, because when its get the images stops. In addition to this, i still don't know how to compare them with a "database" (I also don't know how to do it), and then show the letter. please really help me.
vid= videoinput('winvideo',1,'MJPG_1280x720');
set(vid,'FramesPerTrigger',inf);
set(vid,'ReturnedColorSpace','grayscale');
vid.FrameGrabinterval=5;
start(vid);
preview(vid);
hold on
while(vid.framesAcquired<=100)
data=getsnapshot(vid);
dif_im2=im2bw(data, graythresh(data));
dif_im=edge(dif_im2);
end
stop(vid);

Community Treasure Hunt

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

Start Hunting!

Translated by