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
b13bb364
Commit
b13bb364
authored
May 30, 2011
by
Davis King
Browse files
Made threshold_image() handle signed pixels properly.
parent
2dd28ac0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
8 deletions
+5
-8
dlib/image_transforms/thresholding.h
dlib/image_transforms/thresholding.h
+4
-7
dlib/image_transforms/thresholding_abstract.h
dlib/image_transforms/thresholding_abstract.h
+1
-1
No files found.
dlib/image_transforms/thresholding.h
View file @
b13bb364
...
...
@@ -24,7 +24,7 @@ namespace dlib
void
threshold_image
(
const
in_image_type
&
in_img
,
out_image_type
&
out_img
,
unsigned
long
thresh
typename
pixel_traits
<
typename
in_image_type
::
type
>::
basic_pixel_type
thresh
)
{
COMPILE_TIME_ASSERT
(
pixel_traits
<
typename
in_image_type
::
type
>::
has_alpha
==
false
);
...
...
@@ -45,13 +45,10 @@ namespace dlib
{
for
(
long
c
=
0
;
c
<
in_img
.
nc
();
++
c
)
{
typename
out_image_type
::
type
p
;
assign_pixel
(
p
,
in_img
[
r
][
c
]);
if
(
p
>=
thresh
)
p
=
on_pixel
;
if
(
get_pixel_intensity
(
in_img
[
r
][
c
])
>=
thresh
)
assign_pixel
(
out_img
[
r
][
c
],
on_pixel
);
else
p
=
off_pixel
;
out_img
[
r
][
c
]
=
p
;
assign_pixel
(
out_img
[
r
][
c
],
off_pixel
);
}
}
}
...
...
dlib/image_transforms/thresholding_abstract.h
View file @
b13bb364
...
...
@@ -22,7 +22,7 @@ namespace dlib
void
threshold_image
(
const
in_image_type
&
in_img
,
out_image_type
&
out_img
,
unsigned
long
thresh
typename
pixel_traits
<
typename
in_image_type
::
type
>::
basic_pixel_type
thresh
);
/*!
requires
...
...
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