이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
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
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!오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 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 (한국어)