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
9aeda127
"...api/git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "ae026db7aabeb464079e1441e158b1418f600d4f"
Commit
9aeda127
authored
Aug 08, 2011
by
Davis King
Browse files
Added fill_rect() for images.
parent
0ece9a01
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
0 deletions
+43
-0
dlib/image_transforms/draw.h
dlib/image_transforms/draw.h
+23
-0
dlib/image_transforms/draw_abstract.h
dlib/image_transforms/draw_abstract.h
+20
-0
No files found.
dlib/image_transforms/draw.h
View file @
9aeda127
...
@@ -143,6 +143,29 @@ namespace dlib
...
@@ -143,6 +143,29 @@ namespace dlib
}
}
// ----------------------------------------------------------------------------------------
template
<
typename
image_type
,
typename
pixel_type
>
void
fill_rect
(
image_type
&
img
,
const
rectangle
&
rect
,
const
pixel_type
&
pixel
)
{
rectangle
area
=
rect
.
intersect
(
get_rect
(
img
));
for
(
long
r
=
area
.
top
();
r
<=
area
.
bottom
();
++
r
)
{
for
(
long
c
=
area
.
left
();
c
<=
area
.
right
();
++
c
)
{
assign_pixel
(
img
[
r
][
c
],
pixel
);
}
}
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
}
}
...
...
dlib/image_transforms/draw_abstract.h
View file @
9aeda127
...
@@ -32,6 +32,26 @@ namespace dlib
...
@@ -32,6 +32,26 @@ namespace dlib
(i.e. it draws the line from (x1,y1) to (x2,y2) onto the image)
(i.e. it draws the line from (x1,y1) to (x2,y2) onto the image)
!*/
!*/
// ----------------------------------------------------------------------------------------
template
<
typename
image_type
,
typename
pixel_type
>
void
fill_rect
(
image_type
&
img
,
const
rectangle
&
rect
,
const
pixel_type
&
pixel
);
/*!
requires
- pixel_traits<pixel_type> is defined
ensures
- fills the area defined by rect in the given image with the given pixel value.
!*/
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
}
}
...
...
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