Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
73231f43
Commit
73231f43
authored
Mar 23, 2015
by
Davis King
Browse files
Added an optional scale output to the camera_transform.
parent
a8055361
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
3 deletions
+26
-3
dlib/geometry/point_transforms.h
dlib/geometry/point_transforms.h
+12
-3
dlib/geometry/point_transforms_abstract.h
dlib/geometry/point_transforms_abstract.h
+14
-0
No files found.
dlib/geometry/point_transforms.h
View file @
73231f43
...
@@ -842,19 +842,28 @@ namespace dlib
...
@@ -842,19 +842,28 @@ namespace dlib
double
get_camera_field_of_view
()
const
{
return
camera_field_of_view
;
}
double
get_camera_field_of_view
()
const
{
return
camera_field_of_view
;
}
unsigned
long
get_num_pixels
()
const
{
return
num_pixels
;
}
unsigned
long
get_num_pixels
()
const
{
return
num_pixels
;
}
dpoint
operator
()
(
inline
dpoint
operator
()
(
const
vector
<
double
>&
p
const
vector
<
double
>&
p
,
double
&
scale
)
const
)
const
{
{
vector
<
double
>
temp
=
p
-
camera_pos
;
vector
<
double
>
temp
=
p
-
camera_pos
;
temp
=
proj
*
temp
;
temp
=
proj
*
temp
;
const
double
distance
=
temp
.
z
()
>
0
?
temp
.
z
()
:
1e-9
;
const
double
distance
=
temp
.
z
()
>
0
?
temp
.
z
()
:
1e-9
;
const
double
scale
=
dist_scale
/
distance
;
scale
=
dist_scale
/
distance
;
temp
.
x
()
=
temp
.
x
()
*
scale
+
width
;
temp
.
x
()
=
temp
.
x
()
*
scale
+
width
;
temp
.
y
()
=
temp
.
y
()
*
scale
+
width
;
temp
.
y
()
=
temp
.
y
()
*
scale
+
width
;
return
temp
;
return
temp
;
}
}
dpoint
operator
()
(
const
vector
<
double
>&
p
)
const
{
double
scale
;
return
(
*
this
)(
p
,
scale
);
}
inline
friend
void
serialize
(
const
camera_transform
&
item
,
std
::
ostream
&
out
)
inline
friend
void
serialize
(
const
camera_transform
&
item
,
std
::
ostream
&
out
)
{
{
serialize
(
item
.
camera_pos
,
out
);
serialize
(
item
.
camera_pos
,
out
);
...
...
dlib/geometry/point_transforms_abstract.h
View file @
73231f43
...
@@ -632,6 +632,20 @@ namespace dlib
...
@@ -632,6 +632,20 @@ namespace dlib
plane is returned.
plane is returned.
!*/
!*/
dpoint
operator
()
(
const
vector
<
double
>&
p
,
double
&
scale
)
const
;
/*!
ensures
- Maps the given 3D point p into the 2D image plane defined by the camera
parameters given to this object's constructor. The 2D point in the image
plane is returned.
- #scale == a number that tells you how large things are at the point p.
Objects further from the camera appear smaller, in particular, they
appear #scale times their normal size.
!*/
vector
<
double
>
get_camera_pos
(
vector
<
double
>
get_camera_pos
(
)
const
;
)
const
;
/*!
/*!
...
...
Write
Preview
Markdown
is supported
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