現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
video stream height measurement
8 ビュー (過去 30 日間)
古いコメントを表示
M DINESH
2013 年 1 月 23 日
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
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?
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
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
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.
その他の回答 (2 件)
Walter Roberson
2013 年 1 月 23 日
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
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
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
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
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
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
2013 年 1 月 24 日
i am trying with the belo0w syntax. [width,height] and it is giving me the constant ans as 480.
M DINESH
2013 年 1 月 24 日
編集済み: Walter Roberson
2013 年 1 月 24 日
imread()
h=im2double()
height=size(h,1)
this is the syntax i have tried.
Walter Roberson
2013 年 1 月 24 日
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
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
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
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....
Walter Roberson
2013 年 1 月 25 日
M DINESH
2013 年 1 月 25 日
編集済み: Walter Roberson
2013 年 1 月 25 日
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
2013 年 1 月 25 日
how i can process the above pixel measurement from a continuous video stream.
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
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
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
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
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
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.?????
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....
Walter Roberson
2013 年 1 月 28 日
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
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.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
アジア太平洋地域
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)