필터 지우기
필터 지우기

Video frame selection

조회 수: 1 (최근 30일)
Colm
Colm 2011년 11월 16일
I'm sure this has an easy answer but if I set a trigger to capture 2 frames how can I independently assign '[vid,1]' and '[vid,2]' as variables? My reason for doing this is to subtract one image from another (and then divide the qualitative noise. 2 to the power of 0.5, Dark current calculations).
vid = videoinput('gige', 1, 'Mono16');
src = getselectedsource(vid);
vid.FramesPerTrigger = 2;
start(vid);
Thanks

채택된 답변

David Tarkowski
David Tarkowski 2011년 11월 16일
There are a number of ways to this that are roughly equivalent. By default the GETDATA command returns N frames where N is equal to the value of the FramesPerTrigger property when GETDATA is called. You could do something like:
data = getdata(vid);
diffFrame = data(:,:,:,2) - data(:,:,:,1);
You can also specify the number of frames that GETDATA should return:
image1 = getdata(vid, 1); % Here 1 is the number of frames to return
image2 = getdata(vid, 1);
diffFrame = image2 - image1;
Of course, you could also do:
data = getdata(vid); % Get both frames
image1 = data(:,:,:,1); % The first frame
image2 = data(:,:,:,2); % The second frame
diffFrame = image2 - image1;
  댓글 수: 3
Colm
Colm 2011년 11월 23일
but the variable 'diffFrame' doesn't contain any negitive values?
Image Analyst
Image Analyst 2011년 11월 23일
You need to cast as single() or double() because uint8 doesn't allow any values outside 0-255.

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by