MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Asked by M DINESH
on 23 Jan 2013

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.

*No products are associated with this question.*

Answer by M DINESH
on 23 Jan 2013

Accepted answer

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

Answer by Walter Roberson
on 23 Jan 2013

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.)

Show 13 older comments

Walter Roberson
on 25 Jan 2013

M DINESH
on 25 Jan 2013

kndly look into one of the image in below link.

http://imageshack.us/photo/my-images/855/20130125164432.jpg/

Answer by M DINESH
on 25 Jan 2013

Edited by Walter Roberson
on 25 Jan 2013

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.

Show 10 older comments

Walter Roberson
on 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.

## 4 Comments

## Walter Roberson (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/59621#comment_124418

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 (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/59621#comment_124462

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 (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/59621#comment_124491

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 (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/59621#comment_124560

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