horshack

channelsToRawBayer.m

Apr 5th, 2021
796
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. %%
  2. %% Builds an interleaved bayer image from individual RGGB channels
  3. %%
  4. %% Parameters:
  5. %% cfaPatternStr - CFA pattern. Must be RGGB or GBRG
  6. %% r, g1, g2, b - Matricies containing the red, green1, green2, and blue channels
  7. %%
  8. %% Returns:
  9. %% Interleaved bayer image
  10. %%
  11. function [imgData] = channelsToRawBayer(cfaPatternStr, r, g1, g2, b)
  12.   redGreen1  = reshape([r'(:) g1'(:)]', [], size(r,1))';
  13.   green2Blue  = reshape([g2'(:) b'(:)]', [], size(g2,1))';
  14.   if (cfaPatternStr == "RGGB")
  15.     imgData = reshape([redGreen1(:) green2Blue(:)]',2*size(redGreen1,1), []);
  16.   elseif (cfaPatternStr == "GBRG")
  17.     imgData = reshape([green2Blue(:) redGreen1(:)]',2*size(redGreen1,1), []);
  18.   else
  19.     assert(0, "Unsupported CFA pattern string");
  20. end
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×