video stream height measurement
Afficher commentaires plus anciens
i m working on video analysing program where i have to measure the height of the incoming video stream object, Now i took the video stream into the matlab. I couldnt do the measurement part .Can u pls help me with this analysing part.
4 commentaires
Walter Roberson
le 23 Jan 2013
Are the objects always the same distance away? Is the camera always using the same aperture? Or does each image contain an object of known size?
Jack Sparrow
le 23 Jan 2013
I think you need to know atleast the intrinsic or extrinsic parameter of the camera or atleast have an object in the reference area. I'm currently working on something close to this for my M.Sc but i'm stalk at calculating the vanishing point in the image after getting the vanishing lines.
M DINESH
le 23 Jan 2013
Réponse acceptée
Plus de réponses (2)
Walter Roberson
le 23 Jan 2013
0 votes
Provided that the same aperture will always be used, since the object will always be at the same distance, the easiest way to proceed would be to start by inserting an object of known size into the scene, taking an image of it, and finding the height in pixels of the known real-world height. Once you have the height in pixels, you can trivially calculate a scaling factor between pixels and real-world.
After that, it just becomes a matter of figuring out the size in pixels of each presented object, and multiplying that by the real-world scale factor previously calculated. As long as nothing changes (e.g., distance does not change.)
16 commentaires
Jurgen
le 23 Jan 2013
Alternatively calculate the magnification with the lens formula. Then find the pixel size based on the ratio of resolution and sensor size.
M DINESH
le 23 Jan 2013
Walter Roberson
le 23 Jan 2013
I do not think I understand what you mean about "the frame data only" ? How are you reading the frames?
M DINESH
le 23 Jan 2013
Walter Roberson
le 23 Jan 2013
getdata() is suitable for getting an image from video. You could process that image directly, or you could write it out for later processing. If you did do later processing then you could imread() the saved image.
When you have an image in memory, you can do image processing on it to find the height in pixels, and then multiply the height in pixels by the pre-calculated scaling factor in order to find the real-world height.
M DINESH
le 24 Jan 2013
Walter Roberson
le 24 Jan 2013
You are trying what ?
M DINESH
le 24 Jan 2013
Modifié(e) : Walter Roberson
le 24 Jan 2013
Walter Roberson
le 24 Jan 2013
As I wrote above,
After that, it just becomes a matter of figuring out the size in pixels of each presented object, and multiplying that by the real-world scale factor previously calculated.
You have not found the size in pixels of each presented object (in the image). You need to analyze the image content for that. The link I gave above should show some ideas on how to do that. The link was http://www.mathworks.co.uk/matlabcentral/answers/57813-image-color-segmentation-to-find-different-objects-of-a-candle
M DINESH
le 24 Jan 2013
Modifié(e) : Walter Roberson
le 24 Jan 2013
Walter Roberson
le 24 Jan 2013
Due to noise in video system hardware, it is not uncommon for "black" pixels to not be exactly 0, and chances are good that at least one pixel in any one row or column would be non-zero just because of noise. And if the background is not completely black, many more pixels would be non-0. You likely need to threshold the data at the very least.
Please save one of the frames as an image file and upload it so we can have a look at it; http://www.mathworks.com/matlabcentral/answers/7924-where-can-i-upload-images-and-files-for-use-on-matlab-answers
M DINESH
le 25 Jan 2013
M DINESH
le 25 Jan 2013
Walter Roberson
le 25 Jan 2013
That seems to be an empty image.
M DINESH
le 25 Jan 2013
Modifié(e) : Walter Roberson
le 25 Jan 2013
13 commentaires
M DINESH
le 25 Jan 2013
Walter Roberson
le 25 Jan 2013
I don't think you can imread('*.jpg')
To work on a continuous stream, replace the imread() with the command to fetch a frame.
M DINESH
le 25 Jan 2013
M DINESH
le 25 Jan 2013
Modifié(e) : Walter Roberson
le 25 Jan 2013
Walter Roberson
le 25 Jan 2013
Yes, use a while loop.
I do not know if the pixel measurement is right, as the image you posted earlier appears to be empty.
M DINESH
le 25 Jan 2013
M DINESH
le 25 Jan 2013
M DINESH
le 28 Jan 2013
Modifié(e) : Walter Roberson
le 28 Jan 2013
Walter Roberson
le 28 Jan 2013
"while" loops do not use {} brackets in MATLAB.
M DINESH
le 28 Jan 2013
Modifié(e) : Walter Roberson
le 28 Jan 2013
M DINESH
le 28 Jan 2013
Walter Roberson
le 28 Jan 2013
set(handles.staticText, 'String', num2str(x2));
I have not bothered to analyze the image you posted to figure out whether the pixel measurements are right. I suggest that you display the image and draw vertical bars at min(y) and max(y) to see whether the results look reasonable.
M DINESH
le 11 Fév 2013
Catégories
En savoir plus sur Video Formats and Interfaces dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!