Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
LF
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LightFieldCodingLibrary
LF
Commits
5fef6fe0
Commit
5fef6fe0
authored
6 years ago
by
DIB Elian
Browse files
Options
Downloads
Patches
Plain Diff
Changed padding parameter
parent
5c3dfa48
No related branches found
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
codec.m
+3
-3
3 additions, 3 deletions
codec.m
pad.m
+4
-6
4 additions, 6 deletions
pad.m
read.m
+6
-5
6 additions, 5 deletions
read.m
unpad.m
+4
-2
4 additions, 2 deletions
unpad.m
write.m
+4
-5
4 additions, 5 deletions
write.m
with
21 additions
and
21 deletions
codec.m
+
3
−
3
View file @
5fef6fe0
...
...
@@ -29,7 +29,7 @@ p.addParameter('subSamp' , subSamp , @ischar);
p
.
addParameter
(
'bitDepth'
,
bitDepth
,
@
isnumeric
);
p
.
addParameter
(
'inColSpace'
,
'rgb'
,
@
ischar
);
p
.
addParameter
(
'outColSpace'
,
'ycbcr'
,
@
ischar
);
p
.
addParameter
(
'padding'
,
true
,
@
is
logical
);
p
.
addParameter
(
'padding'
,
8
,
@
is
numeric
);
p
.
addParameter
(
'encode'
,
true
,
@
islogical
);
p
.
addParameter
(
'decode'
,
true
,
@
islogical
);
...
...
@@ -65,11 +65,11 @@ end
% Write input yuv file
if
LFParams
.
encode
[
imgSize
,
imgRes
]
=
LF
.
write
(
LFRef
,
LFParams
,
'filename'
,
LFParams
.
refFilename
);
[
imgSize
,
imgRes
,
imgSizePad
]
=
LF
.
write
(
LFRef
,
LFParams
,
'filename'
,
LFParams
.
refFilename
);
end
% Convert inputs for HEVC
LFHEVCParams
=
LF
.
LFtoHEVC
(
imgSize
,
imgRes
,
LFParams
,
HEVCParams
);
LFHEVCParams
=
LF
.
LFtoHEVC
(
imgSize
Pad
,
imgRes
,
LFParams
,
HEVCParams
);
% Encode frames using HEVC
[
nbBits
,
peaksnr
]
=
HEVC
.
codec
(
LFHEVCParams
,
HEVCParams
);
...
...
This diff is collapsed.
Click to expand it.
pad.m
+
4
−
6
View file @
5fef6fe0
function
[
LFRef
,
LF
SizePad
]
=
pad
(
LFRef
,
blockSize
)
function
[
LFRef
,
img
SizePad
]
=
pad
(
LFRef
,
padding
)
%PAD Pad lightfield data
% [LFRef,LFSizePad] = pad(LFRef,blockSize)
LFSize
=
size
(
LFRef
);
LFSize
(
3
)
=
0
;
imgSize
=
LFSize
(
1
:
3
);
imgRes
=
LFSize
(
4
:
end
);
imgSizePad
=
ceil
(
imgSize
.
/
blockSize
)
.*
blockSize
;
imgSizePad
=
ceil
(
imgSize
.
/
padding
)
.*
padding
;
imgSizePad
(
3
)
=
imgSize
(
3
);
LFSizePad
=
[
imgSizePad
,
imgRes
];
padSize
=
LFSizePad
-
LFSize
;
padSize
=
[
imgSizePad
-
imgSize
,
zeros
(
1
,
numel
(
imgRes
))];
padSizePre
=
floor
(
padSize
/
2
);
padSizePost
=
padSize
-
padSizePre
;
...
...
This diff is collapsed.
Click to expand it.
read.m
+
6
−
5
View file @
5fef6fe0
...
...
@@ -7,7 +7,7 @@ filename = fullfile(pwd,'sequence');
% Create input parser scheme
p
=
inputParser
;
p
.
StructExpand
=
true
;
p
.
KeepUnmatched
=
true
;
p
.
addParameter
(
'filename'
,
filename
,
@
ischar
);
p
.
addParameter
(
'padding'
,
false
,
@
is
logical
);
p
.
addParameter
(
'padding'
,
1
,
@
is
numeric
);
% Parse arguments
p
.
parse
(
varargin
{:});
...
...
@@ -15,13 +15,14 @@ p.parse(varargin{:});
padding
=
p
.
Results
.
padding
;
% Recover frames
frames
=
yuv
.
read
(
imgSize
,
imgRes
,
varargin
{:});
imgSizePad
=
ceil
(
imgSize
.
/
padding
)
.*
padding
;
imgSizePad
(
3
)
=
imgSize
(
3
);
frames
=
yuv
.
read
(
imgSizePad
,
imgRes
,
varargin
{:});
% Recover LF
LFRec
=
LF
.
fromSlices
(
frames
);
if
padding
LFRec
=
LF
.
unpad
(
LFRec
,[
imgSize
,
imgRes
]);
end
% Undo padding
LFRec
=
LF
.
unpad
(
LFRec
,
imgSize
);
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
unpad.m
+
4
−
2
View file @
5fef6fe0
function
LFRef
=
unpad
(
LFRef
,
LF
Size
)
function
LFRef
=
unpad
(
LFRef
,
img
Size
)
%UNPAD Remove padding from lightfield data
% LFRef = unpad(LFRef,LFSize)
LFSizePad
=
size
(
LFRef
);
imgSizePad
=
LFSizePad
(
1
:
3
);
imgRes
=
LFSizePad
(
4
:
end
);
padSize
=
LF
SizePad
-
LF
Size
;
padSize
=
[
img
SizePad
-
img
Size
,
zeros
(
1
,
numel
(
imgRes
))]
;
padSizePre
=
floor
(
padSize
/
2
);
padSizePost
=
padSize
-
padSizePre
;
...
...
This diff is collapsed.
Click to expand it.
write.m
+
4
−
5
View file @
5fef6fe0
function
[
imgSize
,
imgRes
]
=
write
(
LFRef
,
varargin
)
function
[
imgSize
,
imgRes
,
imgSizePad
]
=
write
(
LFRef
,
varargin
)
%WRITE Write lightfield 4D(u,v,x,y) data to yuv file
% [LFSize,yuvSize] = WRITE(LFRef,varargin)
...
...
@@ -7,7 +7,7 @@ filename = fullfile(pwd,'sequence');
% Create input parser scheme
p
=
inputParser
;
p
.
StructExpand
=
true
;
p
.
KeepUnmatched
=
true
;
p
.
addParameter
(
'filename'
,
filename
,
@
ischar
);
p
.
addParameter
(
'padding'
,
false
,
@
is
logical
);
p
.
addParameter
(
'padding'
,
1
,
@
is
numeric
);
% Parse arguments
p
.
parse
(
varargin
{:});
...
...
@@ -22,9 +22,8 @@ m = utils.getMat(filename,true);
m
.
imgSize
=
imgSize
;
m
.
imgRes
=
imgRes
;
if
padding
LFRef
=
LF
.
pad
(
LFRef
,
8
);
end
% Do padding
[
LFRef
,
imgSizePad
]
=
LF
.
pad
(
LFRef
,
padding
);
% Change 5D LF to a collection of 2D frames
frames
=
LF
.
toSlices
(
LFRef
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment