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
7b591aba
Commit
7b591aba
authored
Dec 13, 2011
by
Davis King
Browse files
Made assign_image() and assign_image_scaled() capable of assigning to
matrices.
parent
d45a52ed
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
5 deletions
+37
-5
dlib/image_transforms/assign_image.h
dlib/image_transforms/assign_image.h
+33
-3
dlib/image_transforms/assign_image_abstract.h
dlib/image_transforms/assign_image_abstract.h
+4
-2
No files found.
dlib/image_transforms/assign_image.h
View file @
7b591aba
...
@@ -10,6 +10,36 @@
...
@@ -10,6 +10,36 @@
namespace
dlib
namespace
dlib
{
{
// ----------------------------------------------------------------------------------------
template
<
typename
dest_image_type
,
typename
src_pixel_type
>
typename
enable_if
<
is_matrix
<
dest_image_type
>
>::
type
impl_assign_single_pixel
(
dest_image_type
&
img
,
long
r
,
long
c
,
const
src_pixel_type
&
pix
)
{
assign_pixel
(
img
(
r
,
c
),
pix
);
}
template
<
typename
dest_image_type
,
typename
src_pixel_type
>
typename
disable_if
<
is_matrix
<
dest_image_type
>
>::
type
impl_assign_single_pixel
(
dest_image_type
&
img
,
long
r
,
long
c
,
const
src_pixel_type
&
pix
)
{
assign_pixel
(
img
[
r
][
c
],
pix
);
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
template
<
template
<
...
@@ -27,7 +57,7 @@ namespace dlib
...
@@ -27,7 +57,7 @@ namespace dlib
{
{
for
(
long
c
=
0
;
c
<
src
.
nc
();
++
c
)
for
(
long
c
=
0
;
c
<
src
.
nc
();
++
c
)
{
{
assign_pixel
(
dest
[
r
][
c
]
,
src
(
r
,
c
));
impl_
assign_
single_
pixel
(
dest
,
r
,
c
,
src
(
r
,
c
));
}
}
}
}
}
}
...
@@ -82,7 +112,7 @@ namespace dlib
...
@@ -82,7 +112,7 @@ namespace dlib
if
(
src
.
size
()
==
1
)
if
(
src
.
size
()
==
1
)
{
{
assign_pixel
(
dest
[
0
][
0
]
,
src
(
0
,
0
));
impl_
assign_
single_
pixel
(
dest
,
0
,
0
,
src
(
0
,
0
));
return
;
return
;
}
}
...
@@ -126,7 +156,7 @@ namespace dlib
...
@@ -126,7 +156,7 @@ namespace dlib
{
{
const
double
val
=
get_pixel_intensity
(
src
(
r
,
c
))
-
lower
;
const
double
val
=
get_pixel_intensity
(
src
(
r
,
c
))
-
lower
;
assign_pixel
(
dest
[
r
][
c
]
,
scale
*
val
+
dest_min
);
impl_
assign_
single_
pixel
(
dest
,
r
,
c
,
scale
*
val
+
dest_min
);
}
}
}
}
}
}
...
...
dlib/image_transforms/assign_image_abstract.h
View file @
7b591aba
...
@@ -22,7 +22,8 @@ namespace dlib
...
@@ -22,7 +22,8 @@ namespace dlib
requires
requires
- src_image_type == is an implementation of array2d/array2d_kernel_abstract.h or
- src_image_type == is an implementation of array2d/array2d_kernel_abstract.h or
a dlib::matrix or something convertible to a matrix via array_to_matrix()
a dlib::matrix or something convertible to a matrix via array_to_matrix()
- dest_image_type == is an implementation of array2d/array2d_kernel_abstract.h
- dest_image_type == is an implementation of array2d/array2d_kernel_abstract.h or
is a dlib::matrix.
- pixel_traits<typename src_image_type::type> is defined
- pixel_traits<typename src_image_type::type> is defined
- pixel_traits<typename dest_image_type::type> is defined
- pixel_traits<typename dest_image_type::type> is defined
ensures
ensures
...
@@ -48,7 +49,8 @@ namespace dlib
...
@@ -48,7 +49,8 @@ namespace dlib
requires
requires
- src_image_type == is an implementation of array2d/array2d_kernel_abstract.h or
- src_image_type == is an implementation of array2d/array2d_kernel_abstract.h or
a dlib::matrix or something convertible to a matrix via array_to_matrix()
a dlib::matrix or something convertible to a matrix via array_to_matrix()
- dest_image_type == is an implementation of array2d/array2d_kernel_abstract.h
- dest_image_type == is an implementation of array2d/array2d_kernel_abstract.h or
is a dlib::matrix.
- pixel_traits<typename src_image_type::type> is defined
- pixel_traits<typename src_image_type::type> is defined
- pixel_traits<typename dest_image_type::type> is defined
- pixel_traits<typename dest_image_type::type> is defined
- thresh > 0
- thresh > 0
...
...
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