horshack

swapRedBlueChannels.m

Apr 5th, 2021 (edited)
765
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. %%
  2. %% Swaps the Red and Blue channels of an A7 III raw image
  3. %%
  4. function swapRedBlueChannels()
  5.  
  6.   cfaPatternStr = "RGGB";
  7.  
  8.   %% read raw data generated by LibRaw's unprocessed_raw.exe
  9.   imgDataIn = imread("in.ARW.pgm");
  10.   imgDataIn = resize(imgDataIn, 4024, 6024); % A73 visible dimensions
  11.  
  12.   %% split the raw data into its separate RGGB channels
  13.   [r, g1, g2, b] = rawBayerToChannels(cfaPatternStr, imgDataIn);
  14.  
  15.   %% for fun, swap the R and B channels
  16.   imgDataOut = channelsToRawBayer(cfaPatternStr, b, g1, g2, r);
  17.  
  18.   %% write a PGM with the new data
  19.   imwrite(imgDataOut, "out.pgm");
  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.

×