Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SR
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
Admin message
GitLab upgrade completed. Current version is 17.11.3.
Show more breadcrumbs
LightFieldCodingLibrary
SR
Commits
1ee22639
Commit
1ee22639
authored
5 years ago
by
DIB Elian
Browse files
Options
Downloads
Patches
Plain Diff
Added function to compute super-rays coordinates from affine parameters
parent
333874aa
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
getQueryCoordsAffineOptimized.m
+86
-0
86 additions, 0 deletions
getQueryCoordsAffineOptimized.m
with
86 additions
and
0 deletions
getQueryCoordsAffineOptimized.m
0 → 100644
+
86
−
0
View file @
1ee22639
function
[
SRXq
,
SRYq
,
SRDisp
]
=
getQueryCoordsAffineOptimized
(
LFRef
,
dispParams
)
%GETQUERYCOORDSAFFINE 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
(:));
% 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
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'
];
progress
(
msg
);
M
=
Label
==
lab
;
a
=
dispParams
{
lab
}(
1
);
b
=
dispParams
{
lab
}(
2
);
c
=
dispParams
{
lab
}(
3
);
X_
=
X
(
M
(:));
Y_
=
Y
(
M
(:));
U_
=
U
(
M
(:));
V_
=
V
(
M
(:));
tX
=
X_
-
U_
.*
(
a
.*
X_
+
b
.*
Y_
+
c
)
.
/(
1
+
a
.*
U_
+
b
.*
V_
);
tY
=
Y_
-
V_
.*
(
a
.*
X_
+
b
.*
Y_
+
c
)
.
/(
1
+
a
.*
U_
+
b
.*
V_
);
srxgv
=
floor
(
min
(
tX
(:))):
ceil
(
max
(
tX
(:)));
srygv
=
floor
(
min
(
tY
(:))):
ceil
(
max
(
tY
(:)));
[
X_
,
Y_
]
=
ndgrid
(
srxgv
,
srygv
);
D_
=
a
.*
X_
+
b
.*
Y_
+
c
;
D_
=
reshape
(
D_
,
size
(
X_
));
[
SRXq
{
lab
},
SRYq
{
lab
}]
=
ndgrid
(
srxgv
,
srygv
,
gv
{
3
:
end
});
SRXq
{
lab
}
=
SRXq
{
lab
}
+
ugv
.*
D_
;
SRYq
{
lab
}
=
SRYq
{
lab
}
+
vgv
.*
D_
;
SRDisp
{
lab
}
=
ones
(
size
(
SRXq
{
lab
}))
.*
D_
;
end
progress
(
''
,
0
);
fprintf
(
'\n'
);
function
progress
(
msg
,
varargin
)
persistent
sz
if
isempty
(
sz
);
sz
=
0
;
end
if
nargin
>
1
;
sz
=
varargin
{
1
};
end
fprintf
(
repmat
(
'\b'
,
1
,
sz
));
fprintf
(
msg
);
sz
=
numel
(
msg
)
-
count
(
msg
,
'\n'
);
end
end
\ No newline at end of file
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