Filter löschen
Filter löschen

Is there a built-in Demosaicing option in Matlab which doesn't use interpolation and instead just reduces the image size?

3 Ansichten (letzte 30 Tage)
I am aware of demosaic(I,sensorAlignment) function in matlab. But if one would want to reduce noise and just reduce the resolution instead (e.g, to a quarter), does matlab already have a built-in function for that?

Akzeptierte Antwort

Neil Guertin
Neil Guertin am 22 Aug. 2017
There is not currently a built in way to do this. However, it is pretty simple to write:
I = imread('mandi.tif');
I = I(1:end-mod(end,2),1:end-mod(end,2)); %In case image dimensions are odd
I2 = zeros([size(I)/2 3],class(I));
I2(:,:,1) = I(2:2:end,2:2:end);
I2(:,:,2) = I(1:2:end,2:2:end)/2 + I(2:2:end,1:2:end)/2;
I2(:,:,3) = I(1:2:end,1:2:end);
imshow(I2)
However, there will be some artifacts that interpolation would have smoothed out: look at Mandi's chin for example. Also note that you are actually losing resolution in the green channel by averaging the two green pixels when you do it this way.
  1 Kommentar
Shida
Shida am 23 Aug. 2017
Thanks Neil. You are right, interpolation does help against artifacts. I am using a Canon EOS with .cr2 format so I have an 'rggb' bayer pattern. But indeed I don't get much difference if I skip interpolation (and instead just reduce the image size to a quarter). I am using dcraw for conversion which seems to already do a reasonable job and I wasn't able to get anything better this way. Thanks again for your response.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by