Mentions légales du service

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

Using colDims and rowDims to determine matrix transformation

parent 3cb5b03f
Branches
No related tags found
No related merge requests found
...@@ -3,14 +3,30 @@ function [LFRef,LFMask] = complete(LFRef,varargin) ...@@ -3,14 +3,30 @@ function [LFRef,LFMask] = complete(LFRef,varargin)
% Detailed explanation goes here % Detailed explanation goes here
LFSize = size(LFRef); LFSize = size(LFRef);
ImgSize = LFSize(1:3); numDims = ndims(LFRef);
ImgRes = LFSize(4:end); colDims = 1:min(3,numDims);
rowDims = 4:numDims;
LFRef = reshape(LFRef,prod(ImgSize),prod(ImgRes)); p = inputParser; p.StructExpand = true; p.KeepUnmatched = true;
p.addParameter('colDims', colDims, @isnumeric);
p.addParameter('rowDims', rowDims, @isnumeric);
p.parse(varargin{:});
colDims = p.Results.colDims;
rowDims = p.Results.rowDims;
colSize = LFSize(colDims);
rowSize = LFSize(rowDims);
LFRef = permute(LFRef,[colDims,rowDims]);
LFRef = reshape(LFRef,prod(colSize),prod(rowSize));
[LFRef,LFMask] = utils.complete(LFRef,varargin{:}); [LFRef,LFMask] = utils.complete(LFRef,varargin{:});
LFRef = reshape(LFRef ,[ImgSize,ImgRes]); LFRef = reshape(LFRef ,[colSize,rowSize]);
LFMask = reshape(LFMask,[ImgSize,ImgRes]); LFMask = reshape(LFMask ,[colSize,rowSize]);
LFRef = ipermute(LFRef ,[colDims,rowDims]);
LFMask = ipermute(LFMask,[colDims,rowDims]);
end end
\ No newline at end of file
...@@ -3,13 +3,29 @@ function [LFB,C,U,S,V] = factorize(LFRef,k,varargin) ...@@ -3,13 +3,29 @@ function [LFB,C,U,S,V] = factorize(LFRef,k,varargin)
% Detailed explanation goes here % Detailed explanation goes here
LFSize = size(LFRef); LFSize = size(LFRef);
ImgSize = LFSize(1:3); numDims = ndims(LFRef);
ImgRes = LFSize(4:end); colDims = 1:min(3,numDims);
rowDims = 4:numDims;
LFRef = reshape(LFRef,prod(ImgSize),prod(ImgRes)); p = inputParser; p.StructExpand = true; p.KeepUnmatched = true;
p.addParameter('colDims', colDims, @isnumeric);
p.addParameter('rowDims', rowDims, @isnumeric);
p.parse(varargin{:});
colDims = p.Results.colDims;
rowDims = p.Results.rowDims;
colSize = LFSize(colDims);
rowSize = LFSize(rowDims);
LFRef = permute(LFRef,[colDims,rowDims]);
LFRef = reshape(LFRef,prod(colSize),prod(rowSize));
rowSize = [k,1];
[LFB,C,U,S,V] = utils.factorize(LFRef,k); [LFB,C,U,S,V] = utils.factorize(LFRef,k);
LFB = reshape(LFB ,[ImgSize,k,1]); LFB = reshape (LFB,[colSize,rowSize]);
LFB = ipermute(LFB,[colDims,rowDims]);
end end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment