필터 지우기
필터 지우기

Demosaic VS ReturnedColorspace bayer

조회 수: 1 (최근 30일)
Jeff
Jeff 2011년 9월 23일
I have a 1920 x 1080 color camera that uses a bayer filter. I get the image with a NI camera link frame grabber.
If I get the image my taking a snap shot and applying a demosaic, the resulting image is correct.
If I try to set the .ReturnedColorspace = 'bayer', I get an image that has two additonal ghosts images (one above, one below) and the image appears to have an internlace misalignment.
Can anyone tell me why these give different results? Better yet, can anyone tell me how to set the videoinput properties to allow the ReturnedColorspace to work? I want the ReturnedColorspace technique to work since I would then be able to use the Preview command on the videoinput, vid.
clear all;
clc;
%%Demosaic
vid = videoinput('ni', 2, 'img0_Port1');
I = getsnapshot(vid);
J = demosaic(I, 'grbg');
figure;
imshow(J);
delete(vid);
clear vid;
%%Bayer Filter
vid = videoinput('ni', 2, 'img0_Port1');
vid.ReturnedColorspace = 'bayer';
vid.BayerSensorAlignment = 'grbg';
K = getsnapshot(vid);
figure;
imshow(K);
delete(vid);
clear vid;
  댓글 수: 2
Walter Roberson
Walter Roberson 2011년 9월 23일
Maybe asking for bayer makes the camera shake??
(I would add a wink to show I'm not serious, but... well, it _could_ happen.)
Jeff
Jeff 2011년 9월 28일
It works fine when the camera resolution is incorrectly set at 1000 x 1000, so that rules out any physical vibration.

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

답변 (2개)

Image Analyst
Image Analyst 2011년 9월 23일
Is the image monochrome? Is it possible that it's giving you the separate (raw) images? If it's color, maybe it's doing that but tinting the green image green, the red image red, and the blue image blue so that it looks color even though it's not - it's just the raw mosaiced image. Just guessing... Is it possible you could upload an image somewhere? Sorry I don't have a web cam on this computer or else I'd try your code.
  댓글 수: 6
Jeff
Jeff 2011년 9월 27일
I found those properties by watching the session log within the imaqtool toolbox. I haven't found much information on those properties either. I am using the same National Instruments adapter for both techniques.
To add to the confusion, I believe the colorspace method worked properly when the resolution was incorretly set to 1000 x 1000?
Jeff
Jeff 2011년 9월 27일
I want the ReturnedColorspace technique to work since I would then be able to use the Preview command on the videoinput, vid. Is there a way to Preview or show realtime a demoasiced image?

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


Jeff
Jeff 2011년 9월 30일
I found thru additional testing the problem with .ReturnedColorspace = 'bayer' is related to the aspect ratio being non-square. 1000 x 1000 - Works 1080 x 1080 - Works 1079 x 1080 - Problem 1920 x 1080 - Problem
Demosaic does not have issues with non-square aspect ratios.
A workaround is to use vid.ROIPosition = [420 0 1080 1080]; during preview(vid) and use the full ROI when collecting data.
I still don't know why the .ReturnedColorSpace can't handle non-square aspect ratios.

Community Treasure Hunt

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

Start Hunting!

Translated by