Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 6a3f500b authored by DIB Elian's avatar DIB Elian
Browse files

Renamed split to toSlices and join to fromSlices

parent e81e41ab
No related branches found
No related tags found
No related merge requests found
...@@ -132,7 +132,7 @@ classdef Viewer < handle ...@@ -132,7 +132,7 @@ classdef Viewer < handle
perm = [5,4,3,1,2]; perm = [5,4,3,1,2];
end end
obj.slices = LF.split(permute(obj.data,perm)); obj.slices = LF.toSlices(permute(obj.data,perm));
obj.statevec = false(1,5); obj.statevec = false(1,5);
obj.statevec(perm(4:5)) = true; obj.statevec(perm(4:5)) = true;
end end
......
function data = join(slices,varargin) function data = fromSlices(slices,varargin)
%JOIN Join lightfield slices into lightfield data %FROMSLICES Join lightfield slices into lightfield data
% data = join(slices) % data = fromSlices(slices)
% data = join(slices,dimsToSplit) % data = fromSlices(slices,dimsToSplit)
% data = join(slices,dimsToSplit,squeezeGrid) % data = fromSlices(slices,dimsToSplit,squeezeGrid)
% data = join(slices,dimsToSplit,squeezeGrid,squeezeSlices) % data = fromSlices(slices,dimsToSplit,squeezeGrid,squeezeSlices)
validSplitsFcn = @(x) isnumeric(x)||islogical(x); validSplitsFcn = @(x) isnumeric(x)||islogical(x);
defaultSplits = [0,0,0,1,1]; defaultSplits = [0,0,0,1,1];
......
...@@ -56,13 +56,13 @@ cellfun(@fill_frames,filenames,inds_u_v); ...@@ -56,13 +56,13 @@ cellfun(@fill_frames,filenames,inds_u_v);
frames = fill_empty(frames); frames = fill_empty(frames);
% Join frames % Join frames
data = LF.join(frames); data = LF.fromSlices(frames);
% %
switch ext switch ext
case '.png' case '.png'
if ~isempty(frames_alpha) if ~isempty(frames_alpha)
alpha = LF.join(frames_alpha); alpha = LF.fromSlices(frames_alpha);
else else
alpha = ones('like',data); alpha = ones('like',data);
end end
......
...@@ -2,10 +2,10 @@ function [datax,datay] = gradient(data) ...@@ -2,10 +2,10 @@ function [datax,datay] = gradient(data)
%GRADIENT Summary of this function goes here %GRADIENT Summary of this function goes here
% Detailed explanation goes here % Detailed explanation goes here
frames = LF.split(data); frames = LF.toSlices(data);
[framesx,framesy] = cellfun(@gradient,frames,'UniformOutput',false); [framesx,framesy] = cellfun(@gradient,frames,'UniformOutput',false);
datax = LF.join(framesx); datax = LF.fromSlices(framesx);
datay = LF.join(framesy); datay = LF.fromSlices(framesy);
end end
\ No newline at end of file
...@@ -18,7 +18,7 @@ padding = p.Results.padding; ...@@ -18,7 +18,7 @@ padding = p.Results.padding;
frames = yuv.read(imgSize,imgRes,varargin{:}); frames = yuv.read(imgSize,imgRes,varargin{:});
% Recover LF % Recover LF
LFRec = LF.join(frames); LFRec = LF.fromSlices(frames);
if padding if padding
LFRec = LF.unpad(LFRec,[imgSize,imgRes]); LFRec = LF.unpad(LFRec,[imgSize,imgRes]);
......
...@@ -12,7 +12,7 @@ map = p.Results.map; ...@@ -12,7 +12,7 @@ map = p.Results.map;
DelayTime = p.Results.DelayTime; DelayTime = p.Results.DelayTime;
data = utils.recast(data,'uint8'); data = utils.recast(data,'uint8');
frames = LF.split(data); frames = LF.toSlices(data);
maps = cellfun(@(f) map,frames,'UniformOutput',false); maps = cellfun(@(f) map,frames,'UniformOutput',false);
......
function slices = split(data,varargin) function slices = toSlices(data,varargin)
%SPLIT Split lightfield data into slices %FRAMES Split lightfield data into slices
% slices = split(data) % slices = toSlices(data)
% slices = split(data,dimsToSplit) % slices = toSlices(data,dimsToSplit)
% slices = split(data,dimsToSplit,squeezeGrid) % slices = toSlices(data,dimsToSplit,squeezeGrid)
% slices = split(data,dimsToSplit,squeezeGrid,squeezeSlices) % slices = toSlices(data,dimsToSplit,squeezeGrid,squeezeSlices)
validSplitsFcn = @(x) isnumeric(x)||islogical(x); validSplitsFcn = @(x) isnumeric(x)||islogical(x);
defaultSplits = [0,0,0,1,1]; defaultSplits = [0,0,0,1,1];
......
...@@ -52,7 +52,7 @@ switch ext ...@@ -52,7 +52,7 @@ switch ext
fun_write = @(frame,filename) imwrite(frame,fullfile(Dir,[filename,ext])); fun_write = @(frame,filename) imwrite(frame,fullfile(Dir,[filename,ext]));
end end
frames = LF.split(data); frames = LF.toSlices(data);
[X,Y] = ndgrid(1:size(frames,1),1:size(frames,2)); [X,Y] = ndgrid(1:size(frames,1),1:size(frames,2));
X = X+shift; Y = Y+shift; X = X+shift; Y = Y+shift;
...@@ -71,7 +71,7 @@ filenames = filenames(mask); ...@@ -71,7 +71,7 @@ filenames = filenames(mask);
switch ext switch ext
case '.png' case '.png'
if ~isempty(alpha) if ~isempty(alpha)
frames_alpha = LF.split(alpha); frames_alpha = LF.toSlices(alpha);
frames_alpha = frames_alpha(mask); frames_alpha = frames_alpha(mask);
cellfun(fun_write,frames,frames_alpha,filenames); cellfun(fun_write,frames,frames_alpha,filenames);
else else
......
...@@ -27,7 +27,7 @@ if padding ...@@ -27,7 +27,7 @@ if padding
end end
% Change 5D LF to a collection of 2D frames % Change 5D LF to a collection of 2D frames
frames = LF.split(LFRef); frames = LF.toSlices(LFRef);
% Write frames as a YUV sequence % Write frames as a YUV sequence
yuv.write(frames,varargin{:}); yuv.write(frames,varargin{:});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment