function [Pix_out] = correlation0(Pix_in)
%
%CORRELATION0  Performs initialization for correlation-based color 
%              interpolation
%
%   Usage: [Pix_out] = correlation(Pix_in)
%
%      Pix_out       = Interpolated image 3D array output
%                      Valid range: 0 <= Pix_out(:,:,:) <= 255 (8 bits)
%
%      Pix_in        = Bayer CFA RGB image 3D array input
%                      Valid range: 0 <= Pix_in(:,:,:) <= 255 (8 bits)
%
%   Assumptions: Pix_in has the following format -
%
%        1 2 3 4 . . . w      d   Color Plane
%     ------------------     --- -------------
%   1 |  G R G R . . . R      1   R
%   2 |  B G B G . . . G      2   G
%   3 |  G R G R . . . R      3   B
%   4 |  B G B G . . . G
%   . |  . . . . . . . R
%   . |  . . . . . . . G
%   . |  . . . . . . . R
%   h |  B G B G B G B G
%
%   Author:    Gary Embler
%   Email:     gary_embler@agilent.com
%   Date:      04/09/01
%   Reference: "Correlation-Based Color Mosaic Interpolation Using a
%              Connectionist Approach", G. Embler
%
%   Copyright (c) 2001 by Gary Embler
%

%======================================================================
% Initialization
%----------------------------------------------------------------------

[h, w, d]   = size(Pix_in);
Pix_out     = zeros(h, w, d);

if (d ~= 3),
   warning('Correlation only takes bmp with 3 color planes');
else

%======================================================================
% Pixels Pass-Through
%----------------------------------------------------------------------

Pix_out = Pix_in;

%======================================================================
% Zero-out Edges
%----------------------------------------------------------------------

% Left Edge

Pix_out(1:h,1:2,1:d)       = zeros(h,2,d);


% Right Edge

Pix_out(1:h,(w-1):w,1:d)   = zeros(h,2,d);


% Top Edge

Pix_out(1:2,1:w,1:d)       = zeros(2,w,d);


% Bottom Edge

Pix_out((h-1):h,1:w,1:d)   = zeros(2,w,d);

%======================================================================

end
