Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
IAH public
DeProj
Commits
8449afa6
Commit
8449afa6
authored
Jun 30, 2020
by
Jean-Yves TINEVEZ
Browse files
GET_Z Returns the Z position of points taken from a height-map.
parent
ec34a16d
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/get_z.m
0 → 100644
View file @
8449afa6
function
z_coords
=
get_z
(
P
,
H
,
pixel_size
,
voxel_depth
)
%GET_Z Returns the Z position of points taken from a height-map
% - P is a Nx2 list of points, in physical coordinates.
% - H is the height map, encoding the z plane of interest for all X & Y.
% - pixel_size: convert pixel coordinates to physical coordinates.
% - voxel_size: convert plane of interest to physical coordinates.
% Returns the Z coordinates vector in physical coordinates.
Pp
=
round
(
P
/
pixel_size
);
% pixel coordinates.
[
height
,
width
]
=
size
(
H
);
xp
=
Pp
(
:,
1
);
xp
(
xp
<
1
)
=
1
;
xp
(
xp
>
width
)
=
width
;
yp
=
Pp
(
:,
2
);
yp
(
yp
<
1
)
=
1
;
yp
(
yp
>
height
)
=
height
;
xy_ind
=
sub2ind
(
size
(
H
),
yp
,
xp
);
z_coords
=
H
(
xy_ind
)
*
voxel_depth
;
end
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment