video stream height measurement
Ältere Kommentare anzeigen
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 Kommentare
Walter Roberson
am 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
am 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
am 23 Jan. 2013
Akzeptierte Antwort
Weitere Antworten (2)
Walter Roberson
am 23 Jan. 2013
0 Stimmen
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 Kommentare
Jurgen
am 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
am 23 Jan. 2013
Walter Roberson
am 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
am 23 Jan. 2013
Walter Roberson
am 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
am 24 Jan. 2013
Walter Roberson
am 24 Jan. 2013
You are trying what ?
M DINESH
am 24 Jan. 2013
Bearbeitet: Walter Roberson
am 24 Jan. 2013
Walter Roberson
am 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
am 24 Jan. 2013
Bearbeitet: Walter Roberson
am 24 Jan. 2013
Walter Roberson
am 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
am 25 Jan. 2013
M DINESH
am 25 Jan. 2013
Walter Roberson
am 25 Jan. 2013
That seems to be an empty image.
M DINESH
am 25 Jan. 2013
Bearbeitet: Walter Roberson
am 25 Jan. 2013
13 Kommentare
M DINESH
am 25 Jan. 2013
Walter Roberson
am 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
am 25 Jan. 2013
M DINESH
am 25 Jan. 2013
Bearbeitet: Walter Roberson
am 25 Jan. 2013
Walter Roberson
am 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
am 25 Jan. 2013
M DINESH
am 25 Jan. 2013
M DINESH
am 28 Jan. 2013
Bearbeitet: Walter Roberson
am 28 Jan. 2013
Walter Roberson
am 28 Jan. 2013
"while" loops do not use {} brackets in MATLAB.
M DINESH
am 28 Jan. 2013
Bearbeitet: Walter Roberson
am 28 Jan. 2013
M DINESH
am 28 Jan. 2013
Walter Roberson
am 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
am 11 Feb. 2013
Kategorien
Mehr zu Video Formats and Interfaces finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!