video stream height measurement

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

Walter Roberson
Walter Roberson 2013년 1월 23일
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?
M DINESH
M DINESH 2013년 1월 23일
편집: M DINESH 2013년 1월 23일
the object will be in the same distance. The object height varies(withn the known region) and it has to be measured. The data has to be plotted in a histogram.
Jack Sparrow
Jack Sparrow 2013년 1월 23일
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
M DINESH 2013년 1월 23일
since my camera parameters are remain constant and also the reference object is located in the same distance. e.g.: I am lighting an candle from a fixed distance from a camera and i want to measure the height of the flame as a real time data. I m capturing the video and i m converting it to a image file and i m struck in measuring the flame height and plotted in an scaled graph like histogram

댓글을 달려면 로그인하십시오.

 채택된 답변

M DINESH
M DINESH 2013년 1월 23일

0 개 추천

the object will be in the same distance. The object height varies(withn the known region) and it has to be measured.

추가 답변 (2개)

Walter Roberson
Walter Roberson 2013년 1월 23일

0 개 추천

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

Jurgen
Jurgen 2013년 1월 23일
Alternatively calculate the magnification with the lens formula. Then find the pixel size based on the ratio of resolution and sensor size.
M DINESH
M DINESH 2013년 1월 23일
편집: M DINESH 2013년 1월 23일
can you pls help with the syntax.
M DINESH
M DINESH 2013년 1월 23일
while i m trying to read the image data its displays the frame data only not the image data in the frame
Walter Roberson
Walter Roberson 2013년 1월 23일
I do not think I understand what you mean about "the frame data only" ? How are you reading the frames?
M DINESH
M DINESH 2013년 1월 23일
first i m getting the video and i am converting it to a image in 'png' format. i m using imread and getdata from image acquisition toolbox. Am i doning it correct way or it is some other syntax to find the height of the image.
Walter Roberson
Walter Roberson 2013년 1월 23일
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
M DINESH 2013년 1월 24일
i am trying with the belo0w syntax. [width,height] and it is giving me the constant ans as 480.
Walter Roberson
Walter Roberson 2013년 1월 24일
You are trying what ?
M DINESH
M DINESH 2013년 1월 24일
편집: Walter Roberson 2013년 1월 24일
imread()
h=im2double()
height=size(h,1)
this is the syntax i have tried.
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
M DINESH 2013년 1월 24일
편집: Walter Roberson 2013년 1월 24일
vid=videoinput('winvideo',1);
start(vid);
data=getdata(vid,1);
image(data);
im=find(data);
[x,y]=find(data);
x2=max(x);
x1=min(x);
y2=max(y);
y1=min(y);
y3=y2-y1;
i have used the above syntax for finding pixel values. but every time its showing the constant value.
help me with this to sort it out.
Walter Roberson
Walter Roberson 2013년 1월 24일
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
M DINESH 2013년 1월 25일
I used improfile to find out the RGB value and i put a RGB threshold value for red,green and blue region for the image and after that i read the pixel height and it is giving me the height of the pixel. I have tried for 10 nos of picture and the pixel height varies accordingly. But i have a doubt,whether the values are right or wrong. In next step, i need to bring the image and also the pixel value in GUI window . Need your help....
M DINESH
M DINESH 2013년 1월 25일
kndly look into one of the image in below link.
Walter Roberson
Walter Roberson 2013년 1월 25일
That seems to be an empty image.

댓글을 달려면 로그인하십시오.

M DINESH
M DINESH 2013년 1월 25일
편집: Walter Roberson 2013년 1월 25일

0 개 추천

im=imread('*.jpg');
red=im(:,:,1);
green=im(:,:,2);
blue=im(:,:,3);
light=red>200&green>200&blue>200;
[x,c]=find(light);
x2=max(x);
x1=min(x);
y2=max(c);
y1=min(c);
x2
774
x1
9
y2
765
y1
10
Warning: Image is too big to fit on screen; displaying at 56% scale.
this is the answer i got for pixel measurement.

댓글 수: 13

M DINESH
M DINESH 2013년 1월 25일
how i can process the above pixel measurement from a continuous video stream.
Walter Roberson
Walter Roberson 2013년 1월 25일
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
M DINESH 2013년 1월 25일
Is the pixel measurement is right. shold i have to use a while loop for gettign the images. Also i need to view the video and pixel vlaue in a single GUI window. What i have to do for that.
M DINESH
M DINESH 2013년 1월 25일
편집: Walter Roberson 2013년 1월 25일
vid=videoinput('winvideo',1);
start(vid);
d=getdata(vid,1);
R=d(:,:,1);
G=d(:,:,2);
B=d(:,:,3);
light=R>200&G>200&B>200;
[x,y]=find(d);
x2=max(x);
x1=min(x);
y2=max(y);
y1=min(y);
x1
x2
y1
y2
This is the exact syntax's i have been tried for measuring pixel.
If this is right, help me to get the continuous video stream into the M-file for processing.
Walter Roberson
Walter Roberson 2013년 1월 25일
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
M DINESH 2013년 1월 25일
M DINESH
M DINESH 2013년 1월 25일
i have created a GUI file and i wrote the syntax in the m-file. but how can i view the captured video in the GUI file.
M DINESH
M DINESH 2013년 1월 28일
편집: Walter Roberson 2013년 1월 28일
while executing the below code i m getting an error in 'while' loop.
vid=videoinput('winvideo',1);
triggerconfig(vid,'manual');
set(vid,'FramesPerTrigger',1);
set(vid,'TriggerRepeat', Inf);
start(vid);
while(1)
{
trigger(vid);
im= getdata(vid,1);
imshow(im);
}
end
stop(vid),delete(vid),clear vid;
This is the error i m getting .
??? Error: File: C:\MATLAB7\work\Untitled1.m Line: 9 Column: 4
The expression to the left of the equals sign is not a valid target for an assignment.
what i have to do for this.?????
Walter Roberson
Walter Roberson 2013년 1월 28일
"while" loops do not use {} brackets in MATLAB.
M DINESH
M DINESH 2013년 1월 28일
편집: Walter Roberson 2013년 1월 28일
while(1);
trigger(handles.video);
d=getdata(handles.video,1);
R=d(:,:,1);
G=d(:,:,2);
B=d(:,:,3);
light=R<20&G<20&B<20;
[x,y]=find(light);
x2=max(y);
handles.static Text.Value=x2;
end
Here i am trying to get the value of 'X2' in Static Text box and the value is not written.
Solution pls....
M DINESH
M DINESH 2013년 1월 28일
whether the pixel measurement is right??????.
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
M DINESH 2013년 2월 11일
i have bought an video capture card and i m trying to install adapter in the matlab. i have used imaqregister ,but i couldn't get the dll file.

댓글을 달려면 로그인하십시오.

질문:

2013년 1월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by