From 51be8642f24d63c6be0a963bcfe7ba4ca2dd19af Mon Sep 17 00:00:00 2001
From: Elian Dib <elian.dib@inria.fr>
Date: Thu, 10 Oct 2019 11:37:54 +0200
Subject: [PATCH] Changed  getQueryCoordsAffineOptimized to
 get_affine_query_coordinates

Simplified the code
---
 ...imized.m => get_affine_query_coordinates.m | 35 +++++--------------
 1 file changed, 9 insertions(+), 26 deletions(-)
 rename getQueryCoordsAffineOptimized.m => get_affine_query_coordinates.m (67%)

diff --git a/getQueryCoordsAffineOptimized.m b/get_affine_query_coordinates.m
similarity index 67%
rename from getQueryCoordsAffineOptimized.m
rename to get_affine_query_coordinates.m
index 119e732..2c08d0a 100644
--- a/getQueryCoordsAffineOptimized.m
+++ b/get_affine_query_coordinates.m
@@ -1,43 +1,26 @@
-function [SRXq,SRYq,SRDisp] = getQueryCoordsAffineOptimized(LFRef,dispParams)
-%GETQUERYCOORDSAFFINE Summary of this function goes here
+function [SRXq,SRYq,SRDisp] = get_affine_query_coordinates(Label,lfgv,dispParams)
+%GET_AFFINE_QUERY_COORDINATES Summary of this function goes here
 %   Detailed explanation goes here
 %%
 
 %% Initialize constants and interpolants
 % Lightfield properties
-LFSize = size(LFRef.Color);
-ImgRes = LFSize(4:end);
-Label  = LFRef.Label;
-centerView = floor(ImgRes/2)+1;
 numLab = max(Label(:));
+lfgv{3} = 1;
+ugv = reshape(lfgv{4},1,1,1,[],1);
+vgv = reshape(lfgv{5},1,1,1,1,[]);
+[X,Y,~,U,V] = ndgrid(lfgv{:});
+[SRXq,SRYq,SRDisp] = deal(cell(1,numLab));
 
 % Replace missing values by zero (to avoid interpolation errors)
 Label(isnan(Label))=0;
 
-% Compute projected coordinates of reference samples
-gv = arrayfun(@(x) 1:x,LFSize,'UniformOutput',false);
-gv{3} = 1;
-ugv = reshape(gv{4},1,1,1,[],1);
-vgv = reshape(gv{5},1,1,1,1,[]);
-ugv = ugv-centerView(1);
-vgv = vgv-centerView(2);
-
-%%
-[X,Y,~,U,V] = ndgrid(gv{:});
-U = U-centerView(1);
-V = V-centerView(2);
-
-%%
-[SRXq,SRYq,SRDisp] = deal(cell(1,numLab));
-
-%% Remove entries corresponding to missing labels in accordance to loadReference
+% Remove entries corresponding to missing labels in accordance to loadReference
 ind = ~cellfun(@isempty,dispParams);
 dispParams = dispParams(ind);
 
 %%
 fprintf('Super-ray sampling coordinates computation...\n');
-
-%%
 progress('',0);
 for lab = 1:numLab
     msg = ['Initializing super-ray ',num2str(lab),'/',num2str(numLab),'\n'];
@@ -64,7 +47,7 @@ for lab = 1:numLab
     D_ = a.*X_+b.*Y_+c;
     D_ = reshape(D_,size(X_));
     
-    [SRXq{lab},SRYq{lab}] = ndgrid(srxgv,srygv,gv{3:end});
+    [SRXq{lab},SRYq{lab}] = ndgrid(srxgv,srygv,lfgv{3:end});
     SRXq{lab} = SRXq{lab}+ugv.*D_;
     SRYq{lab} = SRYq{lab}+vgv.*D_;
     
-- 
GitLab