Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
ef50e2af
Commit
ef50e2af
authored
Mar 10, 2012
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added pyramid_disable.
parent
e3307db4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
133 additions
and
0 deletions
+133
-0
image_pyramid.h
dlib/image_transforms/image_pyramid.h
+119
-0
image_pyramid_abstract.h
dlib/image_transforms/image_pyramid_abstract.h
+14
-0
No files found.
dlib/image_transforms/image_pyramid.h
View file @
ef50e2af
...
@@ -12,6 +12,125 @@
...
@@ -12,6 +12,125 @@
namespace
dlib
namespace
dlib
{
{
// ----------------------------------------------------------------------------------------
class
pyramid_disable
:
noncopyable
{
public
:
template
<
typename
T
>
vector
<
double
,
2
>
point_down
(
const
vector
<
T
,
2
>&
)
const
{
return
vector
<
double
,
2
>
(
0
,
0
);
}
template
<
typename
T
>
vector
<
double
,
2
>
point_up
(
const
vector
<
T
,
2
>&
)
const
{
return
vector
<
double
,
2
>
(
0
,
0
);
}
// -----------------------------
template
<
typename
T
>
vector
<
double
,
2
>
point_down
(
const
vector
<
T
,
2
>&
p
,
unsigned
int
levels
)
const
{
if
(
levels
==
0
)
return
p
;
else
return
vector
<
double
,
2
>
(
0
,
0
);
}
template
<
typename
T
>
vector
<
double
,
2
>
point_up
(
const
vector
<
T
,
2
>&
p
,
unsigned
int
levels
)
const
{
if
(
levels
==
0
)
return
p
;
else
return
vector
<
double
,
2
>
(
0
,
0
);
}
// -----------------------------
rectangle
rect_up
(
const
rectangle
&
rect
)
const
{
return
rectangle
(
point_up
(
rect
.
tl_corner
()),
point_up
(
rect
.
br_corner
()));
}
rectangle
rect_up
(
const
rectangle
&
rect
,
unsigned
int
levels
)
const
{
return
rectangle
(
point_up
(
rect
.
tl_corner
(),
levels
),
point_up
(
rect
.
br_corner
(),
levels
));
}
// -----------------------------
rectangle
rect_down
(
const
rectangle
&
rect
)
const
{
return
rectangle
(
point_down
(
rect
.
tl_corner
()),
point_down
(
rect
.
br_corner
()));
}
rectangle
rect_down
(
const
rectangle
&
rect
,
unsigned
int
levels
)
const
{
return
rectangle
(
point_down
(
rect
.
tl_corner
(),
levels
),
point_down
(
rect
.
br_corner
(),
levels
));
}
// -----------------------------
public
:
template
<
typename
in_image_type
,
typename
out_image_type
>
void
operator
()
(
// we do this #ifdef stuff to avoid compiler warnings about unused variables.
#ifdef ENABLE_ASSERTS
const
in_image_type
&
original
,
#else
const
in_image_type
&
,
#endif
out_image_type
&
down
)
const
{
// make sure requires clause is not broken
DLIB_ASSERT
(
original
.
nr
()
>
10
&&
original
.
nc
()
>
10
&&
is_same_object
(
original
,
down
)
==
false
,
"
\t
void pyramid_disable::operator()"
<<
"
\n\t
original.nr(): "
<<
original
.
nr
()
<<
"
\n\t
original.nc(): "
<<
original
.
nc
()
<<
"
\n\t
is_same_object(original, down): "
<<
is_same_object
(
original
,
down
)
<<
"
\n\t
this: "
<<
this
);
COMPILE_TIME_ASSERT
(
pixel_traits
<
typename
in_image_type
::
type
>::
has_alpha
==
false
);
COMPILE_TIME_ASSERT
(
pixel_traits
<
typename
out_image_type
::
type
>::
has_alpha
==
false
);
down
.
clear
();
}
};
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
class
pyramid_down
:
noncopyable
class
pyramid_down
:
noncopyable
...
...
dlib/image_transforms/image_pyramid_abstract.h
View file @
ef50e2af
...
@@ -190,6 +190,20 @@ namespace dlib
...
@@ -190,6 +190,20 @@ namespace dlib
!*/
!*/
};
};
// ----------------------------------------------------------------------------------------
class
pyramid_disable
:
noncopyable
{
/*!
WHAT THIS OBJECT REPRESENTS
This is a function object with an interface identical to pyramid_down (defined
at the top of this file) except that it downsamples images at a ratio of infinity
to 1. That means it always outputs images of size 0 regardless of the size
of the inputs. This is useful as a method for disabling the image pyramid
feature of a routine which uses an image pyramid.
!*/
};
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
}
}
...
...
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