-
Notifications
You must be signed in to change notification settings - Fork 6
/
f_assign_color_diff_to_g_odd_logistic.m
31 lines (26 loc) · 1.4 KB
/
f_assign_color_diff_to_g_odd_logistic.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
function[diffInterAtGOdd] = f_assign_color_diff_to_g_odd_logistic(diffInter)
% code by Yan Niu
% input:
% diffInter: inter-channel difference. Its values at the red and blue
% positions have been restored;
global imgWidth
global imgHeight
global redIndex
global blueIndex
diffInterAtGOdd = NaN(imgHeight/2,imgWidth/2);
diffInterAtR = reshape(diffInter(redIndex),[imgHeight/2,imgWidth/2]);
diffInterAtB = reshape(diffInter(blueIndex),[imgHeight/2,imgWidth/2]);
startRow = 5; endRow = imgHeight-5; startCol = 5; endCol = imgWidth-5;
% linear interpolation at the boundary positions
diffInterAtGOdd(1:ceil(startRow/2)-1,:) = 0.5*(diffInterAtR(1:ceil(startRow/2)-1,:)+...
diffInterAtB(1:ceil(startRow/2)-1,:));
diffInterAtGOdd(ceil(endRow/2)+1:end,:) = 0.5*(diffInterAtR(ceil(endRow/2)+1:end,:)+...
diffInterAtB(ceil(endRow/2)+1:end,:));
diffInterAtGOdd(:,1:ceil(startCol/2)-1) = 0.5*(diffInterAtR(:,1:ceil(startCol/2)-1)+...
diffInterAtB(:,1:ceil(startCol/2)-1));
diffInterAtGOdd(:,ceil(endCol/2)+1:end) = 0.5*(diffInterAtR(:,ceil(endCol/2)+1:end)+...
diffInterAtB(:,ceil(endCol/2)+1:end));
%compute the interior region
diffInterAtGOddNoBoundary = f_interp_flat_logistic(diffInter,2,...
startRow,endRow,startCol,endCol);
diffInterAtGOdd(ceil(startRow/2):ceil(endRow/2), ceil(startCol/2):ceil(endCol/2)) = diffInterAtGOddNoBoundary;