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
5b30b06d
Commit
5b30b06d
authored
Oct 22, 2011
by
Davis King
Browse files
Options
Browse Files
Download
Plain Diff
merged
parents
e4ae6686
2e1927cd
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
37 changed files
with
1743 additions
and
28 deletions
+1743
-28
algs.h
dlib/algs.h
+5
-0
array2d_kernel_1.h
dlib/array2d/array2d_kernel_1.h
+8
-0
disjoint_subsets.h
dlib/disjoint_subsets.h
+11
-0
disjoint_subsets.h
dlib/disjoint_subsets/disjoint_subsets.h
+142
-0
disjoint_subsets_abstract.h
dlib/disjoint_subsets/disjoint_subsets_abstract.h
+99
-0
geometry.h
dlib/geometry.h
+1
-0
border_enumerator.h
dlib/geometry/border_enumerator.h
+100
-0
border_enumerator_abstract.h
dlib/geometry/border_enumerator_abstract.h
+113
-0
image_transforms.h
dlib/image_transforms.h
+2
-0
equalize_histogram.h
dlib/image_transforms/equalize_histogram.h
+6
-0
equalize_histogram_abstract.h
dlib/image_transforms/equalize_histogram_abstract.h
+2
-0
label_connected_blobs_abstract.h
dlib/image_transforms/label_connected_blobs_abstract.h
+1
-1
randomly_color_image.h
dlib/image_transforms/randomly_color_image.h
+71
-0
randomly_color_image_abstract.h
dlib/image_transforms/randomly_color_image_abstract.h
+41
-0
segment_image.h
dlib/image_transforms/segment_image.h
+0
-0
segment_image_abstract.h
dlib/image_transforms/segment_image_abstract.h
+51
-0
spatial_filtering_abstract.h
dlib/image_transforms/spatial_filtering_abstract.h
+2
-2
is_kind.h
dlib/is_kind.h
+13
-0
matrix.h
dlib/matrix.h
+1
-0
matrix_conv.h
dlib/matrix/matrix_conv.h
+298
-0
matrix_conv_abstract.h
dlib/matrix/matrix_conv_abstract.h
+138
-0
matrix_utilities.h
dlib/matrix/matrix_utilities.h
+38
-0
matrix_utilities_abstract.h
dlib/matrix/matrix_utilities_abstract.h
+16
-0
optimization_bobyqa.h
dlib/optimization/optimization_bobyqa.h
+2
-5
sqlite.h
dlib/sqlite/sqlite.h
+4
-1
structural_svm_problem.h
dlib/svm/structural_svm_problem.h
+1
-1
CMakeLists.txt
dlib/test/CMakeLists.txt
+1
-0
array2d.cpp
dlib/test/array2d.cpp
+4
-0
disjoint_subsets.cpp
dlib/test/disjoint_subsets.cpp
+106
-0
geometry.cpp
dlib/test/geometry.cpp
+160
-0
makefile
dlib/test/makefile
+3
-2
matrix4.cpp
dlib/test/matrix4.cpp
+154
-0
algorithms.xml
docs/docs/algorithms.xml
+55
-16
containers.xml
docs/docs/containers.xml
+28
-0
imaging.xml
docs/docs/imaging.xml
+38
-0
metaprogramming.xml
docs/docs/metaprogramming.xml
+14
-0
term_index.xml
docs/docs/term_index.xml
+14
-0
No files found.
dlib/algs.h
View file @
5b30b06d
...
...
@@ -384,6 +384,11 @@ namespace dlib
{
static
const
bool
value
=
true
;
};
template
<
typename
T
>
struct
is_const_type
<
const
T
&>
{
static
const
bool
value
=
true
;
};
// ----------------------------------------------------------------------------------------
...
...
dlib/array2d/array2d_kernel_1.h
View file @
5b30b06d
...
...
@@ -487,6 +487,14 @@ namespace dlib
}
}
// ----------------------------------------------------------------------------------------
template
<
typename
T
,
typename
MM
>
struct
is_array2d
<
array2d
<
T
,
MM
>
>
{
const
static
bool
value
=
true
;
};
// ----------------------------------------------------------------------------------------
}
...
...
dlib/disjoint_subsets.h
0 → 100644
View file @
5b30b06d
// Copyright (C) 2011 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license.
#ifndef DLIB_DISJOINt_SUBSETS_
#define DLIB_DISJOINt_SUBSETS_
#include "disjoint_subsets/disjoint_subsets.h"
#endif // DLIB_DISJOINt_SUBSETS_
dlib/disjoint_subsets/disjoint_subsets.h
0 → 100644
View file @
5b30b06d
// Copyright (C) 2011 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license.
#ifndef DLIB_DISJOINT_SUBsETS_H__
#define DLIB_DISJOINT_SUBsETS_H__
#include "disjoint_subsets_abstract.h"
#include <vector>
#include "../algs.h"
namespace
dlib
{
// ----------------------------------------------------------------------------------------
class
disjoint_subsets
{
public
:
void
clear
(
)
{
items
.
clear
();
}
void
set_size
(
unsigned
long
new_size
)
{
items
.
resize
(
new_size
);
for
(
unsigned
long
i
=
0
;
i
<
items
.
size
();
++
i
)
{
items
[
i
].
parent
=
i
;
items
[
i
].
rank
=
0
;
}
}
unsigned
long
size
(
)
const
{
return
items
.
size
();
}
unsigned
long
find_set
(
unsigned
long
item
)
const
{
// make sure requires clause is not broken
DLIB_ASSERT
(
item
<
size
(),
"
\t
unsigned long disjoint_subsets::find_set()"
<<
"
\n\t
item must be less than size()"
<<
"
\n\t
item: "
<<
item
<<
"
\n\t
size(): "
<<
size
()
<<
"
\n\t
this: "
<<
this
);
if
(
items
[
item
].
parent
==
item
)
{
return
item
;
}
else
{
// find root of item
unsigned
long
x
=
item
;
do
{
x
=
items
[
x
].
parent
;
}
while
(
items
[
x
].
parent
!=
x
);
// do path compression
const
unsigned
long
root
=
x
;
x
=
item
;
while
(
items
[
x
].
parent
!=
x
)
{
const
unsigned
long
prev
=
x
;
x
=
items
[
x
].
parent
;
items
[
prev
].
parent
=
root
;
}
return
root
;
}
}
unsigned
long
merge_sets
(
unsigned
long
a
,
unsigned
long
b
)
{
// make sure requires clause is not broken
DLIB_ASSERT
(
a
!=
b
&&
a
<
size
()
&&
b
<
size
()
&&
find_set
(
a
)
==
a
&&
find_set
(
b
)
==
b
,
"
\t
unsigned long disjoint_subsets::merge_sets(a,b)"
<<
"
\n\t
invalid arguments were given to this function"
<<
"
\n\t
a: "
<<
a
<<
"
\n\t
b: "
<<
b
<<
"
\n\t
size(): "
<<
size
()
<<
"
\n\t
find_set(a): "
<<
find_set
(
a
)
<<
"
\n\t
find_set(b): "
<<
find_set
(
b
)
<<
"
\n\t
this: "
<<
this
);
if
(
items
[
a
].
rank
>
items
[
b
].
rank
)
{
items
[
b
].
parent
=
a
;
return
a
;
}
else
{
items
[
a
].
parent
=
b
;
if
(
items
[
a
].
rank
==
items
[
b
].
rank
)
{
items
[
b
].
rank
=
items
[
b
].
rank
+
1
;
}
return
b
;
}
}
private
:
/*
See the book Introduction to Algorithms by Cormen, Leiserson, Rivest and Stein
for a discussion of how this algorithm works.
*/
struct
data
{
unsigned
long
rank
;
unsigned
long
parent
;
};
mutable
std
::
vector
<
data
>
items
;
};
// ----------------------------------------------------------------------------------------
}
#endif // DLIB_DISJOINT_SUBsETS_H__
dlib/disjoint_subsets/disjoint_subsets_abstract.h
0 → 100644
View file @
5b30b06d
// Copyright (C) 2011 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license.
#undef DLIB_DISJOINT_SUBsETS_ABSTRACT_H__
#ifdef DLIB_DISJOINT_SUBsETS_ABSTRACT_H__
#include <vector>
#include "../algs.h"
namespace
dlib
{
// ----------------------------------------------------------------------------------------
class
disjoint_subsets
{
/*!
INITIAL VALUE
- size() == 0
WHAT THIS OBJECT REPRESENTS
This object represents a set of integers which is partitioned into
a number of disjoint subsets. It supports the two fundamental operations
of finding which subset a particular integer belongs to as well as
merging subsets.
!*/
public
:
void
clear
(
);
/*!
ensures
- #size() == 0
- returns this object to its initial value
!*/
void
set_size
(
unsigned
long
new_size
);
/*!
ensures
- #size() == new_size
- for all valid i:
- #find_set(i) == i
(i.e. this object contains new_size subsets, each containing exactly one element)
!*/
unsigned
long
size
(
)
const
;
/*!
ensures
- returns the total number of integer elements represented
by this object.
!*/
unsigned
long
find_set
(
unsigned
long
item
)
const
;
/*!
requires
- item < size()
ensures
- Each disjoint subset can be represented by any of its elements (since
the sets are all disjoint). In particular, for each subset we define
a special "representative element" which is used to represent it.
Therefore, this function returns the representative element for the
set which contains item.
- find_set(find_set(item)) == find_set(item)
- Note that if A and B are both elements of the same subset then we always
have find_set(A) == find_set(B).
!*/
unsigned
long
merge_sets
(
unsigned
long
a
,
unsigned
long
b
)
/*!
requires
- a != b
- a < size()
- b < size()
- find_set(a) == a
(i.e. a is the representative element of some set)
- find_set(b) == b
(i.e. b is the representative element of some set)
ensures
- #find_set(a) == #find_set(b)
(i.e. merges the set's containing a and b)
- returns #find_set(a)
!*/
};
// ----------------------------------------------------------------------------------------
}
#endif // DLIB_DISJOINT_SUBsETS_ABSTRACT_H__
dlib/geometry.h
View file @
5b30b06d
...
...
@@ -5,6 +5,7 @@
#include "geometry/rectangle.h"
#include "geometry/vector.h"
#include "geometry/border_enumerator.h"
#endif // DLIB_GEOMETRy_HEADER
...
...
dlib/geometry/border_enumerator.h
0 → 100644
View file @
5b30b06d
// Copyright (C) 2011 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license.
#ifndef DLIB_BORDER_EnUMERATOR_H_
#define DLIB_BORDER_EnUMERATOR_H_
#include "border_enumerator_abstract.h"
#include "rectangle.h"
namespace
dlib
{
// ----------------------------------------------------------------------------------------
class
border_enumerator
{
public
:
border_enumerator
(
)
{
}
border_enumerator
(
const
rectangle
&
rect_
,
unsigned
long
border_size
)
:
rect
(
rect_
),
inner_rect
(
shrink_rect
(
rect_
,
border_size
))
{
reset
();
}
void
reset
(
)
{
p
=
rect
.
tl_corner
();
p
.
x
()
-=
1
;
}
bool
at_start
(
)
const
{
point
temp
=
rect
.
tl_corner
();
temp
.
x
()
-=
1
;
return
temp
==
p
;
}
bool
current_element_valid
(
)
const
{
return
rect
.
contains
(
p
)
&&
!
inner_rect
.
contains
(
p
);
}
bool
move_next
()
{
p
.
x
()
+=
1
;
if
(
p
.
x
()
>
rect
.
right
())
{
p
.
y
()
+=
1
;
p
.
x
()
=
rect
.
left
();
}
else
if
(
inner_rect
.
contains
(
p
))
{
p
.
x
()
=
inner_rect
.
right
()
+
1
;
}
return
current_element_valid
();
}
unsigned
long
size
(
)
const
{
return
rect
.
area
()
-
inner_rect
.
area
();
}
const
point
&
element
(
)
const
{
// make sure requires clause is not broken
DLIB_ASSERT
(
current_element_valid
(),
"
\t
point border_enumerator::element()"
<<
"
\n\t
This function can't be called unless the element is valid."
<<
"
\n\t
this: "
<<
this
);
return
p
;
}
private
:
point
p
;
rectangle
rect
;
rectangle
inner_rect
;
// the non-border regions of rect
};
// ----------------------------------------------------------------------------------------
}
#endif // DLIB_BORDER_EnUMERATOR_H_
dlib/geometry/border_enumerator_abstract.h
0 → 100644
View file @
5b30b06d
// Copyright (C) 2011 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license.
#undef DLIB_BORDER_EnUMERATOR_ABSTRACT_H_
#ifdef DLIB_BORDER_EnUMERATOR_ABSTRACT_H_
#include "rectangle_abstract.h"
namespace
dlib
{
// ----------------------------------------------------------------------------------------
class
border_enumerator
{
/*!
POINTERS AND REFERENCES TO INTERNAL DATA
All operations on this object other than calling element() invalidate
pointers and references to internal data.
WHAT THIS OBJECT REPRESENTS
This object is an enumerator over the border points of a rectangle.
!*/
public
:
border_enumerator
(
);
/*!
ensures
- #move_next() == false
(i.e. this object is "empty" and won't enumerate anything)
- current_element_valid() == false
- at_start() == true
- size() == 0
!*/
border_enumerator
(
const
rectangle
&
rect
,
unsigned
long
border_size
);
/*!
ensures
- This object will enumerate over the border points which are inside rect
but within border_size of the edge. For example, if border_size == 1
then it enumerates over the single point wide strip of points all around
the interior edge of rect.
- current_element_valid() == false
- at_start() == true
- size() == rect.area() - shrink_rect(rect,border_size).area()
(i.e. the number of points in the border area of rect)
!*/
bool
at_start
(
)
const
;
/*!
ensures
- returns true if *this represents one position before the first point
(this would also make the current element invalid) else returns false
!*/
void
reset
(
);
/*!
ensures
- #current_element_valid() == false
- #at_start() == true
!*/
bool
current_element_valid
(
)
const
;
/*!
ensures
- returns true if we are currently at a valid element else
returns false
!*/
bool
move_next
(
);
/*!
ensures
- moves to the next element. i.e. #element() will now
return the next border point.
- the return value will be equal to #current_element_valid()
- #at_start() == false
- returns true if there is another element
- returns false if there are no more elements in the container
!*/
unsigned
long
size
(
)
const
;
/*!
ensures
- returns the number of border points
!*/
const
point
&
element
(
)
const
;
/*!
requires
- current_element_valid() == true
ensures
- returns the current border point
!*/
};
// ----------------------------------------------------------------------------------------
}
#endif // DLIB_BORDER_EnUMERATOR_ABSTRACT_H_
dlib/image_transforms.h
View file @
5b30b06d
...
...
@@ -13,6 +13,8 @@
#include "image_transforms/integral_image.h"
#include "image_transforms/image_pyramid.h"
#include "image_transforms/label_connected_blobs.h"
#include "image_transforms/randomly_color_image.h"
#include "image_transforms/segment_image.h"
#endif // DLIB_IMAGE_TRANSFORMs_
dlib/image_transforms/equalize_histogram.h
View file @
5b30b06d
...
...
@@ -27,6 +27,9 @@ namespace dlib
{
COMPILE_TIME_ASSERT
(
pixel_traits
<
typename
in_image_type
::
type
>::
is_unsigned
==
true
);
typedef
typename
pixel_traits
<
typename
in_image_type
::
type
>::
basic_pixel_type
in_image_basic_pixel_type
;
COMPILE_TIME_ASSERT
(
sizeof
(
in_image_basic_pixel_type
)
<
sizeof
(
long
));
// make sure hist is the right size
if
(
R
==
1
)
hist
.
set_size
(
1
,
pixel_traits
<
typename
in_image_type
::
type
>::
max
()
+
1
);
...
...
@@ -64,6 +67,9 @@ namespace dlib
COMPILE_TIME_ASSERT
(
pixel_traits
<
typename
in_image_type
::
type
>::
is_unsigned
==
true
);
COMPILE_TIME_ASSERT
(
pixel_traits
<
typename
out_image_type
::
type
>::
is_unsigned
==
true
);
typedef
typename
pixel_traits
<
typename
in_image_type
::
type
>::
basic_pixel_type
in_image_basic_pixel_type
;
COMPILE_TIME_ASSERT
(
sizeof
(
in_image_basic_pixel_type
)
<
sizeof
(
long
));
typedef
typename
in_image_type
::
type
in_pixel_type
;
typedef
typename
out_image_type
::
type
out_pixel_type
;
...
...
dlib/image_transforms/equalize_histogram_abstract.h
View file @
5b30b06d
...
...
@@ -27,6 +27,7 @@ namespace dlib
- pixel_traits<typename out_image_type::type>::has_alpha == false
- pixel_traits<typename in_image_type::type>::is_unsigned == true
- pixel_traits<typename out_image_type::type>::is_unsigned == true
- pixel_traits<typename in_image_type::type>::max() < std::numeric_limits<long>::max()
ensures
- #out_img == the histogram equalized version of in_img
- #out_img.nc() == in_img.nc()
...
...
@@ -49,6 +50,7 @@ namespace dlib
requires
- in_image_type == is an implementation of array2d/array2d_kernel_abstract.h
- pixel_traits<typename in_image_type::type>::is_unsigned == true
- pixel_traits<typename in_image_type::type>::max() < std::numeric_limits<long>::max()
- hist must be capable of representing a column vector of length
pixel_traits<typename in_image_type>::max(). I.e. if R and C are nonzero
then they must be values that don't conflict with the previous sentence.
...
...
dlib/image_transforms/label_connected_blobs_abstract.h
View file @
5b30b06d
...
...
@@ -177,7 +177,7 @@ namespace dlib
- else
- #label_img[r][c] != 0
- if (img.size() != 0) then
- returns max(array_to_matrix(label_img))+1
- returns max(array_to_matrix(
#
label_img))+1
(i.e. returns a number one greater than the maximum blob id number,
this is the number of blobs found.)
- else
...
...
dlib/image_transforms/randomly_color_image.h
0 → 100644
View file @
5b30b06d
// Copyright (C) 2011 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license.
#ifndef DLIB_RANDOMLY_COlOR_IMAGE_H__
#define DLIB_RANDOMLY_COlOR_IMAGE_H__
#include "randomly_color_image_abstract.h"
#include "../hash.h"
#include "../pixel.h"
#include "../matrix.h"
namespace
dlib
{
// ----------------------------------------------------------------------------------------
template
<
typename
T
>
struct
op_randomly_color_image
:
does_not_alias
{
op_randomly_color_image
(
const
T
&
img_
)
:
img
(
img_
){}
const
T
&
img
;
const
static
long
cost
=
7
;
const
static
long
NR
=
0
;
const
static
long
NC
=
0
;
typedef
rgb_pixel
type
;
typedef
const
rgb_pixel
const_ret_type
;
typedef
typename
T
::
mem_manager_type
mem_manager_type
;
typedef
row_major_layout
layout_type
;
const_ret_type
apply
(
long
r
,
long
c
)
const
{
const
unsigned
long
gray
=
get_pixel_intensity
(
img
[
r
][
c
]);
if
(
gray
!=
0
)
{
const
uint32
h
=
murmur_hash3
(
&
gray
,
sizeof
(
gray
));
rgb_pixel
pix
;
pix
.
red
=
static_cast
<
unsigned
char
>
(
h
)
%
200
+
55
;
pix
.
green
=
static_cast
<
unsigned
char
>
(
h
>>
8
)
%
200
+
55
;
pix
.
blue
=
static_cast
<
unsigned
char
>
(
h
>>
16
)
%
200
+
55
;
return
pix
;
}
else
{
// keep black pixels black
return
rgb_pixel
(
0
,
0
,
0
);
}
}
long
nr
()
const
{
return
img
.
nr
();
}
long
nc
()
const
{
return
img
.
nc
();
}
};
template
<
typename
image_type
>
const
matrix_op
<
op_randomly_color_image
<
image_type
>
>
randomly_color_image
(
const
image_type
&
img
)
{
typedef
op_randomly_color_image
<
image_type
>
op
;
return
matrix_op
<
op
>
(
op
(
img
));
}
// ----------------------------------------------------------------------------------------
}
#endif // DLIB_RANDOMLY_COlOR_IMAGE_H__
dlib/image_transforms/randomly_color_image_abstract.h
0 → 100644
View file @
5b30b06d
// Copyright (C) 2011 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license.
#undef DLIB_RANDOMLY_COlOR_IMAGE_ABSTRACT_H__
#ifdef DLIB_RANDOMLY_COlOR_IMAGE_ABSTRACT_H__
#include "randomly_color_image_abstract.h"
#include "../hash.h"
#include "../pixel.h"
#include "../matrix.h"
namespace
dlib
{
// ----------------------------------------------------------------------------------------
template
<
typename
image_type
>
const
matrix_exp
randomly_color_image
(
const
image_type
&
img
);
/*!
requires
- image_type is an implementation of array2d/array2d_kernel_abstract.h
- pixel_traits<image_type::type> must be defined
ensures
- randomly generates a mapping from gray level pixel values
to the RGB pixel space and then uses this mapping to create
a colored version of img. Returns a matrix which represents
this colored version of img.
- black pixels in img will remain black in the output image.
- The returned matrix will have the same dimensions as img.
!*/
// ----------------------------------------------------------------------------------------
}
#endif // DLIB_RANDOMLY_COlOR_IMAGE_ABSTRACT_H__
dlib/image_transforms/segment_image.h
0 → 100644
View file @
5b30b06d
This diff is collapsed.
Click to expand it.
dlib/image_transforms/segment_image_abstract.h
0 → 100644
View file @
5b30b06d
// Copyright (C) 2011 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license.
#undef DLIB_SEGMENT_ImAGE_ABSTRACT_H__
#ifdef DLIB_SEGMENT_ImAGE_ABSTRACT_H__
namespace
dlib
{
// ----------------------------------------------------------------------------------------
template
<
typename
in_image_type
,
typename
out_image_type
>
void
segment_image
(
const
in_image_type
&
in_img
,
out_image_type
&
out_img
,
const
unsigned
long
k
=
200
,
const
unsigned
long
min_diff
=
0
);
/*!
requires
- in_image_type == an implementation of array2d/array2d_kernel_abstract.h
- out_image_type == an implementation of array2d/array2d_kernel_abstract.h
- in_image_type::type == an unsigned 8-bit or 16bit integer type.
- out_image_type::type == unsigned integer type
- is_same_object(in_img, out_img) == false
ensures
- Attempts to segment in_img into regions which have some visual consistency to them.
In particular, this function implements the algorithm described in the paper:
Efficient Graph-Based Image Segmentation by Felzenszwalb and Huttenlocher.
- #out_img.nr() == in_img.nr()
- #out_img.nc() == in_img.nc()
- for all valid r and c:
- #out_img[r][c] == an integer value indicating the identity of the segment
containing the pixel in_img[r][c].
- The k parameter is a measure used to influence how large the segment regions will
be. Larger k generally results in larger segments being produced. For a deeper
discussion of the k parameter you should consult the above referenced paper.
- Any neighboring segments with an edge between them with a pixel difference <= min_diff
will always be merged. So making min_diff bigger makes this algorithm more eager
to merge neighboring segments.
!*/
// ----------------------------------------------------------------------------------------
}
#endif // DLIB_SEGMENT_ImAGE_ABSTRACT_H__
dlib/image_transforms/spatial_filtering_abstract.h
View file @
5b30b06d
...
...
@@ -36,8 +36,8 @@ namespace dlib
- filter.nr() % 2 == 1 (i.e. must be odd)
- filter.nc() % 2 == 1 (i.e. must be odd)
ensures
- Applies the given spatial filter to in_img and stores the result in out_img
. Also
divides each resulting pixel by scale.
- Applies the given spatial filter to in_img and stores the result in out_img
(i.e.
cross-correlates in_img with filter). Also
divides each resulting pixel by scale.
- The intermediate filter computations will be carried out using variables of type EXP::type.
This is whatever scalar type is used inside the filter matrix.
- Pixel values are stored into out_img using the assign_pixel() function and therefore
...
...
dlib/is_kind.h
View file @
5b30b06d
...
...
@@ -59,6 +59,19 @@ namespace dlib
ASSERT_ARE_SAME_TYPE
(
helper
,
void
);
};
// ----------------------------------------------------------------------------------------
template
<
typename
T
>
struct
is_array2d
:
public
default_is_kind_value
{
/*!
- if (T is an implementation of array2d/array2d_kernel_abstract.h) then
- is_array2d<T>::value == true
- else
- is_array2d<T>::value == false
!*/
};
// ----------------------------------------------------------------------------------------
template
<
typename
T
>
...
...
dlib/matrix.h
View file @
5b30b06d
...
...
@@ -10,6 +10,7 @@
#include "matrix/matrix_assign.h"
#include "matrix/matrix_la.h"
#include "matrix/symmetric_matrix_cache.h"
#include "matrix/matrix_conv.h"
#ifdef DLIB_USE_BLAS
#include "matrix/matrix_blas_bindings.h"
...
...
dlib/matrix/matrix_conv.h
0 → 100644
View file @
5b30b06d
// Copyright (C) 2011 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license.
#ifndef DLIB_MATRIx_CONV_H__
#define DLIB_MATRIx_CONV_H__
#include "matrix_conv_abstract.h"
#include "matrix.h"
namespace
dlib
{
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
template
<
typename
M1
,
typename
M2
,
bool
flip_m2
=
false
>
struct
op_conv
{
op_conv
(
const
M1
&
m1_
,
const
M2
&
m2_
)
:
m1
(
m1_
),
m2
(
m2_
),
nr_
(
m1
.
nr
()
+
m2
.
nr
()
-
1
),
nc_
(
m1
.
nc
()
+
m2
.
nc
()
-
1
)
{
if
(
nr_
<
0
||
m1
.
size
()
==
0
||
m2
.
size
()
==
0
)
nr_
=
0
;
if
(
nc_
<
0
||
m1
.
size
()
==
0
||
m2
.
size
()
==
0
)
nc_
=
0
;
}
const
M1
&
m1
;
const
M2
&
m2
;
long
nr_
;
long
nc_
;
const
static
long
cost
=
(
M1
::
cost
+
M2
::
cost
)
*
10
;
const
static
long
NR
=
(
M1
::
NR
*
M2
::
NR
==
0
)
?
(
0
)
:
(
M1
::
NR
+
M2
::
NR
-
1
);
const
static
long
NC
=
(
M1
::
NC
*
M2
::
NC
==
0
)
?
(
0
)
:
(
M1
::
NC
+
M2
::
NC
-
1
);
typedef
typename
M1
::
type
type
;
typedef
type
const_ret_type
;
typedef
typename
M1
::
mem_manager_type
mem_manager_type
;
typedef
typename
M1
::
layout_type
layout_type
;
const_ret_type
apply
(
long
r
,
long
c
)
const
{
type
temp
=
0
;
const
long
min_rr
=
std
::
max
<
long
>
(
r
-
m2
.
nr
()
+
1
,
0
);
const
long
max_rr
=
std
::
min
<
long
>
(
m1
.
nr
()
-
1
,
r
);
const
long
min_cc
=
std
::
max
<
long
>
(
c
-
m2
.
nc
()
+
1
,
0
);
const
long
max_cc
=
std
::
min
<
long
>
(
m1
.
nc
()
-
1
,
c
);
for
(
long
rr
=
min_rr
;
rr
<=
max_rr
;
++
rr
)
{
for
(
long
cc
=
min_cc
;
cc
<=
max_cc
;
++
cc
)
{
if
(
flip_m2
)
temp
+=
m1
(
rr
,
cc
)
*
m2
(
m2
.
nr
()
-
r
+
rr
-
1
,
m2
.
nc
()
-
c
+
cc
-
1
);
else
temp
+=
m1
(
rr
,
cc
)
*
m2
(
r
-
rr
,
c
-
cc
);
}
}
return
temp
;
}
long
nr
()
const
{
return
nr_
;
}
long
nc
()
const
{
return
nc_
;
}
template
<
typename
U
>
bool
aliases
(
const
matrix_exp
<
U
>&
item
)
const
{
return
m1
.
aliases
(
item
)
||
m2
.
aliases
(
item
);
}
template
<
typename
U
>
bool
destructively_aliases
(
const
matrix_exp
<
U
>&
item
)
const
{
return
m1
.
aliases
(
item
)
||
m2
.
aliases
(
item
);
}
};
template
<
typename
M1
,
typename
M2
>
const
matrix_op
<
op_conv
<
M1
,
M2
>
>
conv
(
const
matrix_exp
<
M1
>&
m1
,
const
matrix_exp
<
M2
>&
m2
)
{
COMPILE_TIME_ASSERT
((
is_same_type
<
typename
M1
::
type
,
typename
M2
::
type
>::
value
==
true
));
typedef
op_conv
<
M1
,
M2
>
op
;
return
matrix_op
<
op
>
(
op
(
m1
.
ref
(),
m2
.
ref
()));
}
template
<
typename
M1
,
typename
M2
>
const
matrix_op
<
op_conv
<
M1
,
M2
,
true
>
>
xcorr
(
const
matrix_exp
<
M1
>&
m1
,
const
matrix_exp
<
M2
>&
m2
)
{
COMPILE_TIME_ASSERT
((
is_same_type
<
typename
M1
::
type
,
typename
M2
::
type
>::
value
==
true
));
typedef
op_conv
<
M1
,
M2
,
true
>
op
;
return
matrix_op
<
op
>
(
op
(
m1
.
ref
(),
m2
.
ref
()));
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
template
<
typename
M1
,
typename
M2
,
bool
flip_m2
=
false
>
struct
op_conv_same
{
op_conv_same
(
const
M1
&
m1_
,
const
M2
&
m2_
)
:
m1
(
m1_
),
m2
(
m2_
),
nr_
(
m1
.
nr
()),
nc_
(
m1
.
nc
())
{
if
(
m1
.
size
()
==
0
||
m2
.
size
()
==
0
)
nr_
=
0
;
if
(
m1
.
size
()
==
0
||
m2
.
size
()
==
0
)
nc_
=
0
;
}
const
M1
&
m1
;
const
M2
&
m2
;
long
nr_
;
long
nc_
;
const
static
long
cost
=
(
M1
::
cost
+
M2
::
cost
)
*
10
;
const
static
long
NR
=
M1
::
NR
;
const
static
long
NC
=
M1
::
NC
;
typedef
typename
M1
::
type
type
;
typedef
type
const_ret_type
;
typedef
typename
M1
::
mem_manager_type
mem_manager_type
;
typedef
typename
M1
::
layout_type
layout_type
;
const_ret_type
apply
(
long
r
,
long
c
)
const
{
r
+=
m2
.
nr
()
/
2
;
c
+=
m2
.
nc
()
/
2
;
type
temp
=
0
;
const
long
min_rr
=
std
::
max
<
long
>
(
r
-
m2
.
nr
()
+
1
,
0
);
const
long
max_rr
=
std
::
min
<
long
>
(
m1
.
nr
()
-
1
,
r
);
const
long
min_cc
=
std
::
max
<
long
>
(
c
-
m2
.
nc
()
+
1
,
0
);
const
long
max_cc
=
std
::
min
<
long
>
(
m1
.
nc
()
-
1
,
c
);
for
(
long
rr
=
min_rr
;
rr
<=
max_rr
;
++
rr
)
{
for
(
long
cc
=
min_cc
;
cc
<=
max_cc
;
++
cc
)
{
if
(
flip_m2
)
temp
+=
m1
(
rr
,
cc
)
*
m2
(
m2
.
nr
()
-
r
+
rr
-
1
,
m2
.
nc
()
-
c
+
cc
-
1
);
else
temp
+=
m1
(
rr
,
cc
)
*
m2
(
r
-
rr
,
c
-
cc
);
}
}
return
temp
;
}
long
nr
()
const
{
return
nr_
;
}
long
nc
()
const
{
return
nc_
;
}
template
<
typename
U
>
bool
aliases
(
const
matrix_exp
<
U
>&
item
)
const
{
return
m1
.
aliases
(
item
)
||
m2
.
aliases
(
item
);
}
template
<
typename
U
>
bool
destructively_aliases
(
const
matrix_exp
<
U
>&
item
)
const
{
return
m1
.
aliases
(
item
)
||
m2
.
aliases
(
item
);
}
};
template
<
typename
M1
,
typename
M2
>
const
matrix_op
<
op_conv_same
<
M1
,
M2
>
>
conv_same
(
const
matrix_exp
<
M1
>&
m1
,
const
matrix_exp
<
M2
>&
m2
)
{
COMPILE_TIME_ASSERT
((
is_same_type
<
typename
M1
::
type
,
typename
M2
::
type
>::
value
==
true
));
typedef
op_conv_same
<
M1
,
M2
>
op
;
return
matrix_op
<
op
>
(
op
(
m1
.
ref
(),
m2
.
ref
()));
}
template
<
typename
M1
,
typename
M2
>
const
matrix_op
<
op_conv_same
<
M1
,
M2
,
true
>
>
xcorr_same
(
const
matrix_exp
<
M1
>&
m1
,
const
matrix_exp
<
M2
>&
m2
)
{
COMPILE_TIME_ASSERT
((
is_same_type
<
typename
M1
::
type
,
typename
M2
::
type
>::
value
==
true
));
typedef
op_conv_same
<
M1
,
M2
,
true
>
op
;
return
matrix_op
<
op
>
(
op
(
m1
.
ref
(),
m2
.
ref
()));
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
template
<
typename
M1
,
typename
M2
,
bool
flip_m2
=
false
>
struct
op_conv_valid
{
op_conv_valid
(
const
M1
&
m1_
,
const
M2
&
m2_
)
:
m1
(
m1_
),
m2
(
m2_
),
nr_
(
m1
.
nr
()
-
m2
.
nr
()
+
1
),
nc_
(
m1
.
nc
()
-
m2
.
nc
()
+
1
)
{
if
(
nr_
<
0
||
nc_
<=
0
||
m1
.
size
()
==
0
||
m2
.
size
()
==
0
)
nr_
=
0
;
if
(
nc_
<
0
||
nr_
<=
0
||
m1
.
size
()
==
0
||
m2
.
size
()
==
0
)
nc_
=
0
;
}
const
M1
&
m1
;
const
M2
&
m2
;
long
nr_
;
long
nc_
;
const
static
long
cost
=
(
M1
::
cost
+
M2
::
cost
)
*
10
;
const
static
long
NR
=
(
M1
::
NR
*
M2
::
NR
==
0
)
?
(
0
)
:
(
M1
::
NR
-
M2
::
NR
+
1
);
const
static
long
NC
=
(
M1
::
NC
*
M2
::
NC
==
0
)
?
(
0
)
:
(
M1
::
NC
-
M2
::
NC
+
1
);
typedef
typename
M1
::
type
type
;
typedef
type
const_ret_type
;
typedef
typename
M1
::
mem_manager_type
mem_manager_type
;
typedef
typename
M1
::
layout_type
layout_type
;
const_ret_type
apply
(
long
r
,
long
c
)
const
{
r
+=
m2
.
nr
()
-
1
;
c
+=
m2
.
nc
()
-
1
;
type
temp
=
0
;
const
long
min_rr
=
std
::
max
<
long
>
(
r
-
m2
.
nr
()
+
1
,
0
);
const
long
max_rr
=
std
::
min
<
long
>
(
m1
.
nr
()
-
1
,
r
);
const
long
min_cc
=
std
::
max
<
long
>
(
c
-
m2
.
nc
()
+
1
,
0
);
const
long
max_cc
=
std
::
min
<
long
>
(
m1
.
nc
()
-
1
,
c
);
for
(
long
rr
=
min_rr
;
rr
<=
max_rr
;
++
rr
)
{
for
(
long
cc
=
min_cc
;
cc
<=
max_cc
;
++
cc
)
{
if
(
flip_m2
)
temp
+=
m1
(
rr
,
cc
)
*
m2
(
m2
.
nr
()
-
r
+
rr
-
1
,
m2
.
nc
()
-
c
+
cc
-
1
);
else
temp
+=
m1
(
rr
,
cc
)
*
m2
(
r
-
rr
,
c
-
cc
);
}
}
return
temp
;
}
long
nr
()
const
{
return
nr_
;
}
long
nc
()
const
{
return
nc_
;
}
template
<
typename
U
>
bool
aliases
(
const
matrix_exp
<
U
>&
item
)
const
{
return
m1
.
aliases
(
item
)
||
m2
.
aliases
(
item
);
}
template
<
typename
U
>
bool
destructively_aliases
(
const
matrix_exp
<
U
>&
item
)
const
{
return
m1
.
aliases
(
item
)
||
m2
.
aliases
(
item
);
}
};
template
<
typename
M1
,
typename
M2
>
const
matrix_op
<
op_conv_valid
<
M1
,
M2
>
>
conv_valid
(
const
matrix_exp
<
M1
>&
m1
,
const
matrix_exp
<
M2
>&
m2
)
{
COMPILE_TIME_ASSERT
((
is_same_type
<
typename
M1
::
type
,
typename
M2
::
type
>::
value
==
true
));
typedef
op_conv_valid
<
M1
,
M2
>
op
;
return
matrix_op
<
op
>
(
op
(
m1
.
ref
(),
m2
.
ref
()));
}
template
<
typename
M1
,
typename
M2
>
const
matrix_op
<
op_conv_valid
<
M1
,
M2
,
true
>
>
xcorr_valid
(
const
matrix_exp
<
M1
>&
m1
,
const
matrix_exp
<
M2
>&
m2
)
{
COMPILE_TIME_ASSERT
((
is_same_type
<
typename
M1
::
type
,
typename
M2
::
type
>::
value
==
true
));
typedef
op_conv_valid
<
M1
,
M2
,
true
>
op
;
return
matrix_op
<
op
>
(
op
(
m1
.
ref
(),
m2
.
ref
()));
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
}
#endif // DLIB_MATRIx_CONV_H__
dlib/matrix/matrix_conv_abstract.h
0 → 100644
View file @
5b30b06d
// Copyright (C) 2011 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license.
#undef DLIB_MATRIx_CONV_ABSTRACT_H__
#ifdef DLIB_MATRIx_CONV_ABSTRACT_H__
#include "matrix_abstract.h"
namespace
dlib
{
// ----------------------------------------------------------------------------------------
const
matrix_exp
conv
(
const
matrix_exp
&
m1
,
const
matrix_exp
&
m2
);
/*!
requires
- m1 and m2 both contain elements of the same type
ensures
- returns a matrix R such that:
- R is the convolution of m1 with m2. In particular, this function is
equivalent to performing the following in matlab: R = conv2(m1,m2).
- R::type == the same type that was in m1 and m2.
- R.nr() == m1.nr()+m2.nr()-1
- R.nc() == m1.nc()+m2.nc()-1
!*/
// ----------------------------------------------------------------------------------------
const
matrix_exp
xcorr
(
const
matrix_exp
&
m1
,
const
matrix_exp
&
m2
);
/*!
requires
- m1 and m2 both contain elements of the same type
ensures
- returns a matrix R such that:
- R is the cross-correlation of m1 with m2. In particular, this
function returns conv(m1,flip(m2)).
- R::type == the same type that was in m1 and m2.
- R.nr() == m1.nr()+m2.nr()-1
- R.nc() == m1.nc()+m2.nc()-1
!*/
// ----------------------------------------------------------------------------------------
const
matrix_exp
conv_same
(
const
matrix_exp
&
m1
,
const
matrix_exp
&
m2
);
/*!
requires
- m1 and m2 both contain elements of the same type
ensures
- returns a matrix R such that:
- R is the convolution of m1 with m2. In particular, this function is
equivalent to performing the following in matlab: R = conv2(m1,m2,'same').
In particular, this means the result will have the same dimensions as m1 and will
contain the central part of the full convolution. Therefore, conv_same(m1,m2) is
equivalent to subm(conv(m1,m2), m2.nr()/2, m2.nc()/2, m1.nr(), m1.nc()).
- R::type == the same type that was in m1 and m2.
- R.nr() == m1.nr()
- R.nc() == m1.nc()
!*/
// ----------------------------------------------------------------------------------------
const
matrix_exp
xcorr_same
(
const
matrix_exp
&
m1
,
const
matrix_exp
&
m2
);
/*!
requires
- m1 and m2 both contain elements of the same type
ensures
- returns a matrix R such that:
- R is the cross-correlation of m1 with m2. In particular, this
function returns conv_same(m1,flip(m2)).
- R::type == the same type that was in m1 and m2.
- R.nr() == m1.nr()
- R.nc() == m1.nc()
!*/
// ----------------------------------------------------------------------------------------
const
matrix_exp
conv_valid
(
const
matrix_exp
&
m1
,
const
matrix_exp
&
m2
);
/*!
requires
- m1 and m2 both contain elements of the same type
ensures
- returns a matrix R such that:
- R is the convolution of m1 with m2. In particular, this function is
equivalent to performing the following in matlab: R = conv2(m1,m2,'valid').
In particular, this means only elements of the convolution which don't require
zero padding are included in the result.
- R::type == the same type that was in m1 and m2.
- if (m1 has larger dimensions than m2) then
- R.nr() == m1.nr()-m2.nr()+1
- R.nc() == m1.nc()-m2.nc()+1
- else
- R.nr() == 0
- R.nc() == 0
!*/
// ----------------------------------------------------------------------------------------
const
matrix_exp
xcorr_valid
(
const
matrix_exp
&
m1
,
const
matrix_exp
&
m2
);
/*!
requires
- m1 and m2 both contain elements of the same type
ensures
- returns a matrix R such that:
- R is the cross-correlation of m1 with m2. In particular, this
function returns conv_valid(m1,flip(m2)).
- R::type == the same type that was in m1 and m2.
- if (m1 has larger dimensions than m2) then
- R.nr() == m1.nr()-m2.nr()+1
- R.nc() == m1.nc()-m2.nc()+1
- else
- R.nr() == 0
- R.nc() == 0
!*/
// ----------------------------------------------------------------------------------------
}
#endif // DLIB_MATRIx_CONV_ABSTRACT_H__
dlib/matrix/matrix_utilities.h
View file @
5b30b06d
...
...
@@ -3967,6 +3967,44 @@ namespace dlib
return
matrix_op
<
op
>
(
op
(
m
.
ref
()));
}
// ----------------------------------------------------------------------------------------
template
<
typename
M
>
struct
op_flip
{
op_flip
(
const
M
&
m_
)
:
m
(
m_
){}
const
M
&
m
;
const
static
long
cost
=
M
::
cost
;
const
static
long
NR
=
M
::
NR
;
const
static
long
NC
=
M
::
NC
;
typedef
typename
M
::
type
type
;
typedef
typename
M
::
const_ret_type
const_ret_type
;
typedef
typename
M
::
mem_manager_type
mem_manager_type
;
typedef
typename
M
::
layout_type
layout_type
;
const_ret_type
apply
(
long
r
,
long
c
)
const
{
return
m
(
m
.
nr
()
-
r
-
1
,
m
.
nc
()
-
c
-
1
);
}
long
nr
()
const
{
return
m
.
nr
();
}
long
nc
()
const
{
return
m
.
nc
();
}
template
<
typename
U
>
bool
aliases
(
const
matrix_exp
<
U
>&
item
)
const
{
return
m
.
aliases
(
item
);
}
template
<
typename
U
>
bool
destructively_aliases
(
const
matrix_exp
<
U
>&
item
)
const
{
return
m
.
aliases
(
item
);
}
};
template
<
typename
M
>
const
matrix_op
<
op_flip
<
M
>
>
flip
(
const
matrix_exp
<
M
>&
m
)
{
typedef
op_flip
<
M
>
op
;
return
matrix_op
<
op
>
(
op
(
m
.
ref
()));
}
// ----------------------------------------------------------------------------------------
template
<
typename
T
,
long
NR
,
long
NC
,
typename
MM
,
typename
L
>
...
...
dlib/matrix/matrix_utilities_abstract.h
View file @
5b30b06d
...
...
@@ -400,6 +400,22 @@ namespace dlib
M(r,c) == m(m.nr()-r-1, c)
!*/
// ----------------------------------------------------------------------------------------
const
matrix_exp
flip
(
const
matrix_exp
&
m
);
/*!
ensures
- flips the matrix m from up to down and left to right and returns the
result. I.e. returns flipud(fliplr(m)).
- returns a matrix M such that:
- M::type == the same type that was in m
- M has the same dimensions as m
- for all valid r and c:
M(r,c) == m(m.nr()-r-1, m.nc()-c-1)
!*/
// ----------------------------------------------------------------------------------------
template
<
...
...
dlib/optimization/optimization_bobyqa.h
View file @
5b30b06d
...
...
@@ -2670,7 +2670,7 @@ L350:
integer
isav
;
doublereal
temp
=
0
,
zero
=
0
,
xsav
=
0
,
xsum
=
0
,
angbd
=
0
,
dredg
=
0
,
sredg
=
0
;
integer
iterc
;
doublereal
resid
=
0
,
delsq
=
0
,
ggsav
=
0
,
tempa
=
0
,
tempb
=
0
,
ratio
=
0
,
sqstp
=
0
,
doublereal
resid
=
0
,
delsq
=
0
,
ggsav
=
0
,
tempa
=
0
,
tempb
=
0
,
redmax
=
0
,
dredsq
=
0
,
redsav
=
0
,
onemin
=
0
,
gredsq
=
0
,
rednew
=
0
;
integer
itcsav
=
0
;
doublereal
rdprev
=
0
,
rdnext
=
0
,
stplen
=
0
,
stepsq
=
0
;
...
...
@@ -2750,7 +2750,6 @@ L350:
iterc
=
0
;
nact
=
0
;
sqstp
=
zero
;
i__1
=
n
;
for
(
i__
=
1
;
i__
<=
i__1
;
++
i__
)
{
xbdi
[
i__
]
=
zero
;
...
...
@@ -3003,7 +3002,6 @@ L120:
xbdi
[
i__
]
=
one
;
goto
L100
;
}
ratio
=
one
;
/* Computing 2nd power */
d__1
=
d__
[
i__
];
/* Computing 2nd power */
...
...
@@ -3221,7 +3219,7 @@ L210:
doublereal
d__1
,
d__2
,
d__3
;
/* Local variables */
integer
i__
,
j
,
k
,
j
l
,
j
p
;
integer
i__
,
j
,
k
,
jp
;
doublereal
one
,
tau
,
temp
;
integer
nptm
;
doublereal
zero
,
alpha
,
tempa
,
tempb
,
ztest
;
...
...
@@ -3267,7 +3265,6 @@ L210:
/* Apply the rotations that put zeros in the KNEW-th row of ZMAT. */
jl
=
1
;
i__2
=
nptm
;
for
(
j
=
2
;
j
<=
i__2
;
++
j
)
{
if
((
d__1
=
zmat
[
knew
+
j
*
zmat_dim1
],
std
::
abs
(
d__1
))
>
ztest
)
{
...
...
dlib/sqlite/sqlite.h
View file @
5b30b06d
...
...
@@ -268,7 +268,10 @@ namespace dlib
);
const
char
*
data
=
reinterpret_cast
<
const
char
*>
(
sqlite3_column_text
(
stmt
,
idx
));
return
std
::
string
(
data
);
if
(
data
!=
0
)
return
std
::
string
(
data
);
else
return
std
::
string
();
}
double
get_column_as_double
(
...
...
dlib/svm/structural_svm_problem.h
View file @
5b30b06d
...
...
@@ -131,7 +131,7 @@ namespace dlib
long
max_use
=
1
;
if
(
lru_count
.
size
()
!=
0
)
max_use
=
max
(
vector_to_matrix
(
lru_count
))
+
1
;
lru_count
.
push_back
(
lru_count
.
size
()
);
lru_count
.
push_back
(
max_use
);
}
}
...
...
dlib/test/CMakeLists.txt
View file @
5b30b06d
...
...
@@ -34,6 +34,7 @@ set (tests
data_io.cpp
directed_graph.cpp
discriminant_pca.cpp
disjoint_subsets.cpp
ekm_and_lisf.cpp
empirical_kernel_map.cpp
entropy_coder.cpp
...
...
dlib/test/array2d.cpp
View file @
5b30b06d
...
...
@@ -548,6 +548,10 @@ namespace
DLIB_TEST
((
char
*
)
&
img
[
0
][
0
]
+
img
.
width_step
()
==
(
char
*
)
&
img
[
1
][
0
]);
}
COMPILE_TIME_ASSERT
(
is_array2d
<
array2d
<
unsigned
char
>
>::
value
==
true
);
COMPILE_TIME_ASSERT
(
is_array2d
<
array2d
<
float
>
>::
value
==
true
);
COMPILE_TIME_ASSERT
(
is_array2d
<
float
>::
value
==
false
);
}
...
...
dlib/test/disjoint_subsets.cpp
0 → 100644
View file @
5b30b06d
// Copyright (C) 2011 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license.
#include <sstream>
#include <string>
#include <cstdlib>
#include <ctime>
#include <dlib/disjoint_subsets.h>
#include "tester.h"
namespace
{
using
namespace
test
;
using
namespace
dlib
;
using
namespace
std
;
logger
dlog
(
"test.disjoint_subsets"
);
void
test_disjoint_subset
()
{
print_spinner
();
disjoint_subsets
s
;
DLIB_TEST
(
s
.
size
()
==
0
);
s
.
set_size
(
5
);
DLIB_TEST
(
s
.
size
()
==
5
);
DLIB_TEST
(
s
.
find_set
(
0
)
==
0
);
DLIB_TEST
(
s
.
find_set
(
1
)
==
1
);
DLIB_TEST
(
s
.
find_set
(
2
)
==
2
);
DLIB_TEST
(
s
.
find_set
(
3
)
==
3
);
DLIB_TEST
(
s
.
find_set
(
4
)
==
4
);
unsigned
long
id
=
s
.
merge_sets
(
1
,
3
);
DLIB_TEST
(
s
.
find_set
(
0
)
==
0
);
DLIB_TEST
(
s
.
find_set
(
1
)
==
id
);
DLIB_TEST
(
s
.
find_set
(
2
)
==
2
);
DLIB_TEST
(
s
.
find_set
(
3
)
==
id
);
DLIB_TEST
(
s
.
find_set
(
4
)
==
4
);
id
=
s
.
merge_sets
(
s
.
find_set
(
1
),
4
);
DLIB_TEST
(
s
.
find_set
(
0
)
==
0
);
DLIB_TEST
(
s
.
find_set
(
1
)
==
id
);
DLIB_TEST
(
s
.
find_set
(
2
)
==
2
);
DLIB_TEST
(
s
.
find_set
(
3
)
==
id
);
DLIB_TEST
(
s
.
find_set
(
4
)
==
id
);
unsigned
long
id2
=
s
.
merge_sets
(
0
,
2
);
DLIB_TEST
(
s
.
find_set
(
0
)
==
id2
);
DLIB_TEST
(
s
.
find_set
(
1
)
==
id
);
DLIB_TEST
(
s
.
find_set
(
2
)
==
id2
);
DLIB_TEST
(
s
.
find_set
(
3
)
==
id
);
DLIB_TEST
(
s
.
find_set
(
4
)
==
id
);
id
=
s
.
merge_sets
(
s
.
find_set
(
1
),
s
.
find_set
(
0
));
DLIB_TEST
(
s
.
find_set
(
0
)
==
id
);
DLIB_TEST
(
s
.
find_set
(
1
)
==
id
);
DLIB_TEST
(
s
.
find_set
(
2
)
==
id
);
DLIB_TEST
(
s
.
find_set
(
3
)
==
id
);
DLIB_TEST
(
s
.
find_set
(
4
)
==
id
);
DLIB_TEST
(
s
.
size
()
==
5
);
s
.
set_size
(
1
);
DLIB_TEST
(
s
.
size
()
==
1
);
DLIB_TEST
(
s
.
find_set
(
0
)
==
0
);
s
.
set_size
(
2
);
DLIB_TEST
(
s
.
size
()
==
2
);
DLIB_TEST
(
s
.
find_set
(
0
)
==
0
);
DLIB_TEST
(
s
.
find_set
(
1
)
==
1
);
id
=
s
.
merge_sets
(
0
,
1
);
DLIB_TEST
(
s
.
size
()
==
2
);
DLIB_TEST
(
id
==
s
.
find_set
(
0
));
DLIB_TEST
(
id
==
s
.
find_set
(
1
));
DLIB_TEST
(
s
.
size
()
==
2
);
s
.
clear
();
DLIB_TEST
(
s
.
size
()
==
0
);
}
class
tester_disjoint_subsets
:
public
tester
{
public
:
tester_disjoint_subsets
(
)
:
tester
(
"test_disjoint_subsets"
,
"Runs tests on the disjoint_subsets component."
)
{}
void
perform_test
(
)
{
test_disjoint_subset
();
}
}
a
;
}
dlib/test/geometry.cpp
View file @
5b30b06d
...
...
@@ -10,6 +10,8 @@
#include <dlib/string.h>
#include <dlib/matrix.h>
#include <dlib/rand.h>
#include <dlib/array2d.h>
#include <dlib/image_transforms.h>
#include "tester.h"
...
...
@@ -366,10 +368,168 @@ namespace
}
// ----------------------------------------------------------------------------------------
void
test_border_enumerator
()
{
border_enumerator
be
;
DLIB_TEST
(
be
.
at_start
()
==
true
);
DLIB_TEST
(
be
.
size
()
==
0
);
DLIB_TEST
(
be
.
current_element_valid
()
==
false
);
DLIB_TEST
(
be
.
move_next
()
==
false
);
DLIB_TEST
(
be
.
at_start
()
==
false
);
DLIB_TEST
(
be
.
current_element_valid
()
==
false
);
DLIB_TEST
(
be
.
move_next
()
==
false
);
DLIB_TEST
(
be
.
at_start
()
==
false
);
DLIB_TEST
(
be
.
current_element_valid
()
==
false
);
DLIB_TEST
(
be
.
size
()
==
0
);
be
=
border_enumerator
(
rectangle
(
4
,
4
,
4
,
4
),
1
);
DLIB_TEST
(
be
.
at_start
()
==
true
);
DLIB_TEST
(
be
.
size
()
==
1
);
be
=
border_enumerator
(
rectangle
(
4
,
4
,
4
,
4
),
3
);
DLIB_TEST
(
be
.
at_start
()
==
true
);
DLIB_TEST
(
be
.
size
()
==
1
);
be
=
border_enumerator
(
rectangle
(
4
,
4
,
4
,
4
),
0
);
DLIB_TEST
(
be
.
at_start
()
==
true
);
DLIB_TEST
(
be
.
size
()
==
0
);
be
=
border_enumerator
(
rectangle
(
4
,
4
,
5
,
5
),
0
);
DLIB_TEST
(
be
.
at_start
()
==
true
);
DLIB_TEST
(
be
.
size
()
==
0
);
be
=
border_enumerator
(
rectangle
(
4
,
4
,
5
,
5
),
1
);
DLIB_TEST
(
be
.
at_start
()
==
true
);
DLIB_TEST
(
be
.
size
()
==
4
);
be
=
border_enumerator
(
rectangle
(
4
,
4
,
5
,
5
),
2
);
DLIB_TEST
(
be
.
size
()
==
4
);
be
=
border_enumerator
(
rectangle
(
4
,
4
,
6
,
6
),
1
);
DLIB_TEST
(
be
.
size
()
==
8
);
be
=
border_enumerator
(
rectangle
(
4
,
4
,
6
,
6
),
2
);
DLIB_TEST
(
be
.
size
()
==
9
);
be
=
border_enumerator
(
rectangle
(
4
,
4
,
6
,
6
),
3
);
DLIB_TEST
(
be
.
size
()
==
9
);
DLIB_TEST
(
be
.
at_start
()
==
true
);
array2d
<
unsigned
char
>
img
,
img2
;
for
(
int
size
=
1
;
size
<
10
;
++
size
)
{
for
(
int
bs
=
0
;
bs
<
4
;
++
bs
)
{
img
.
set_size
(
size
,
size
);
img2
.
set_size
(
size
,
size
);
assign_all_pixels
(
img
,
1
);
assign_all_pixels
(
img2
,
1
);
zero_border_pixels
(
img2
,
bs
,
bs
);
be
=
border_enumerator
(
get_rect
(
img
),
bs
);
DLIB_TEST
(
be
.
at_start
()
==
true
);
DLIB_TEST
(
be
.
current_element_valid
()
==
false
);
while
(
be
.
move_next
())
{
DLIB_TEST
(
be
.
at_start
()
==
false
);
DLIB_TEST
(
be
.
current_element_valid
()
==
true
);
DLIB_TEST_MSG
(
get_rect
(
img
).
contains
(
be
.
element
())
==
true
,
get_rect
(
img
)
<<
" "
<<
be
.
element
()
);
const
point
p
=
be
.
element
();
img
[
p
.
y
()][
p
.
x
()]
=
0
;
}
DLIB_TEST
(
be
.
at_start
()
==
false
);
DLIB_TEST
(
be
.
current_element_valid
()
==
false
);
DLIB_TEST
(
be
.
move_next
()
==
false
);
DLIB_TEST
(
be
.
current_element_valid
()
==
false
);
DLIB_TEST
(
be
.
move_next
()
==
false
);
DLIB_TEST
(
be
.
current_element_valid
()
==
false
);
DLIB_TEST
(
be
.
at_start
()
==
false
);
DLIB_TEST
(
array_to_matrix
(
img
)
==
array_to_matrix
(
img2
));
}
}
for
(
int
size
=
1
;
size
<
10
;
++
size
)
{
for
(
int
bs
=
0
;
bs
<
4
;
++
bs
)
{
img
.
set_size
(
size
,
size
+
5
);
img2
.
set_size
(
size
,
size
+
5
);
assign_all_pixels
(
img
,
1
);
assign_all_pixels
(
img2
,
1
);
zero_border_pixels
(
img2
,
bs
,
bs
);
const
point
shift
(
4
,
5
);
be
=
border_enumerator
(
translate_rect
(
get_rect
(
img
),
shift
),
bs
);
DLIB_TEST
(
be
.
at_start
()
==
false
);
DLIB_TEST
(
be
.
current_element_valid
()
==
false
);
while
(
be
.
move_next
())
{
DLIB_TEST
(
be
.
current_element_valid
()
==
true
);
DLIB_TEST
(
be
.
at_start
()
==
false
);
DLIB_TEST_MSG
(
get_rect
(
img
).
contains
(
be
.
element
()
-
shift
)
==
true
,
get_rect
(
img
)
<<
" "
<<
be
.
element
()
);
const
point
p
=
be
.
element
()
-
shift
;
img
[
p
.
y
()][
p
.
x
()]
=
0
;
}
DLIB_TEST
(
be
.
current_element_valid
()
==
false
);
DLIB_TEST
(
be
.
move_next
()
==
false
);
DLIB_TEST
(
be
.
current_element_valid
()
==
false
);
DLIB_TEST
(
be
.
move_next
()
==
false
);
DLIB_TEST
(
be
.
current_element_valid
()
==
false
);
DLIB_TEST
(
be
.
at_start
()
==
false
);
DLIB_TEST
(
array_to_matrix
(
img
)
==
array_to_matrix
(
img2
));
}
}
for
(
int
size
=
1
;
size
<
10
;
++
size
)
{
for
(
int
bs
=
0
;
bs
<
4
;
++
bs
)
{
img
.
set_size
(
size
+
2
,
size
);
img2
.
set_size
(
size
+
2
,
size
);
assign_all_pixels
(
img
,
1
);
assign_all_pixels
(
img2
,
1
);
zero_border_pixels
(
img2
,
bs
,
bs
);
const
point
shift
(
-
4
,
5
);
be
=
border_enumerator
(
translate_rect
(
get_rect
(
img
),
shift
),
bs
);
DLIB_TEST
(
be
.
current_element_valid
()
==
false
);
while
(
be
.
move_next
())
{
DLIB_TEST
(
be
.
current_element_valid
()
==
true
);
DLIB_TEST_MSG
(
get_rect
(
img
).
contains
(
be
.
element
()
-
shift
)
==
true
,
get_rect
(
img
)
<<
" "
<<
be
.
element
()
);
const
point
p
=
be
.
element
()
-
shift
;
img
[
p
.
y
()][
p
.
x
()]
=
0
;
}
DLIB_TEST
(
be
.
current_element_valid
()
==
false
);
DLIB_TEST
(
be
.
move_next
()
==
false
);
DLIB_TEST
(
be
.
current_element_valid
()
==
false
);
DLIB_TEST
(
be
.
move_next
()
==
false
);
DLIB_TEST
(
be
.
current_element_valid
()
==
false
);
DLIB_TEST
(
array_to_matrix
(
img
)
==
array_to_matrix
(
img2
));
}
}
}
// ----------------------------------------------------------------------------------------
class
geometry_tester
:
public
tester
{
...
...
dlib/test/makefile
View file @
5b30b06d
...
...
@@ -49,13 +49,14 @@ SRC += create_iris_datafile.cpp
SRC
+=
data_io.cpp
SRC
+=
directed_graph.cpp
SRC
+=
discriminant_pca.cpp
SRC
+=
disjoint_subsets.cpp
SRC
+=
ekm_and_lisf.cpp
SRC
+=
empirical_kernel_map.cpp
SRC
+=
entropy_coder.cpp
SRC
+=
entropy_encoder_model.cpp
SRC
+=
geometry.cpp
SRC
+=
find_max_factor_graph_nmplp.cpp
SRC
+=
find_max_factor_graph_viterbi.cpp
SRC
+=
geometry.cpp
SRC
+=
graph.cpp
SRC
+=
hash.cpp
SRC
+=
hash_map.cpp
...
...
@@ -136,7 +137,7 @@ OBJ = $(TMP:.c=.o)
$(TARGET)
:
$(OBJ)
@
echo
Linking
$@
@
$(CC)
$(
LFLAGS)
$(OBJ
)
-o
$@
@
$(CC)
$(
OBJ)
$(LFLAGS
)
-o
$@
@
echo
Build Complete
.cpp.o
:
$<
...
...
dlib/test/matrix4.cpp
View file @
5b30b06d
...
...
@@ -611,6 +611,157 @@ namespace
template
<
long
D1
,
long
D2
,
long
D3
,
long
D4
>
void
test_conv
()
{
dlog
<<
LINFO
<<
D1
<<
" "
<<
D2
<<
" "
<<
D3
<<
" "
<<
D4
;
matrix
<
int
,
D1
,
D1
>
a
(
1
,
1
);
matrix
<
int
,
D2
,
D2
>
b
(
2
,
2
);
matrix
<
int
,
D3
,
D3
>
c
(
3
,
3
);
matrix
<
int
,
D4
,
D1
>
d
(
4
,
1
);
a
=
4
;
b
=
1
,
2
,
3
,
4
;
c
=
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
;
d
=
1
,
2
,
3
,
4
;
matrix
<
int
>
temp
(
4
,
4
),
temp2
;
temp
=
1
,
4
,
7
,
6
,
7
,
23
,
33
,
24
,
19
,
53
,
63
,
42
,
21
,
52
,
59
,
36
;
DLIB_TEST
(
conv
(
b
,
c
)
==
temp
);
DLIB_TEST
(
conv
(
c
,
b
)
==
temp
);
DLIB_TEST
(
xcorr
(
c
,
flip
(
b
))
==
temp
);
temp
.
set_size
(
2
,
2
);
temp
=
23
,
33
,
53
,
63
;
DLIB_TEST
(
conv_same
(
b
,
c
)
==
temp
);
DLIB_TEST
(
xcorr_same
(
b
,
flip
(
c
))
==
temp
);
temp2
.
set_size
(
2
,
2
);
temp2
=
63
,
53
,
33
,
23
;
DLIB_TEST
(
flip
(
temp
)
==
temp2
);
DLIB_TEST
(
flip
(
temp
)
==
fliplr
(
flipud
(
temp
)));
DLIB_TEST
(
conv_valid
(
b
,
c
).
nr
()
==
0
);
DLIB_TEST
(
conv_valid
(
b
,
c
).
nc
()
==
0
);
DLIB_TEST
(
conv_valid
(
c
,
b
)
==
temp
);
DLIB_TEST
(
xcorr_valid
(
c
,
flip
(
b
))
==
temp
);
temp
.
set_size
(
1
,
1
);
temp
=
16
;
DLIB_TEST
(
conv
(
a
,
a
)
==
temp
);
DLIB_TEST
(
conv_same
(
a
,
a
)
==
temp
);
DLIB_TEST
(
conv_valid
(
a
,
a
)
==
temp
);
DLIB_TEST
(
xcorr
(
a
,
a
)
==
temp
);
DLIB_TEST
(
xcorr_same
(
a
,
a
)
==
temp
);
DLIB_TEST
(
xcorr_valid
(
a
,
a
)
==
temp
);
temp
.
set_size
(
0
,
0
);
DLIB_TEST
(
conv
(
temp
,
temp
).
nr
()
==
0
);
DLIB_TEST
(
conv
(
temp
,
temp
).
nc
()
==
0
);
DLIB_TEST
(
conv_same
(
temp
,
temp
).
nr
()
==
0
);
DLIB_TEST
(
conv_same
(
temp
,
temp
).
nc
()
==
0
);
DLIB_TEST_MSG
(
conv_valid
(
temp
,
temp
).
nr
()
==
0
,
conv_valid
(
temp
,
temp
).
nr
());
DLIB_TEST
(
conv_valid
(
temp
,
temp
).
nc
()
==
0
);
DLIB_TEST
(
conv
(
c
,
temp
).
nr
()
==
0
);
DLIB_TEST
(
conv
(
c
,
temp
).
nc
()
==
0
);
DLIB_TEST
(
conv_same
(
c
,
temp
).
nr
()
==
0
);
DLIB_TEST
(
conv_same
(
c
,
temp
).
nc
()
==
0
);
DLIB_TEST
(
conv_valid
(
c
,
temp
).
nr
()
==
0
);
DLIB_TEST
(
conv_valid
(
c
,
temp
).
nc
()
==
0
);
DLIB_TEST
(
conv
(
temp
,
c
).
nr
()
==
0
);
DLIB_TEST
(
conv
(
temp
,
c
).
nc
()
==
0
);
DLIB_TEST
(
conv_same
(
temp
,
c
).
nr
()
==
0
);
DLIB_TEST
(
conv_same
(
temp
,
c
).
nc
()
==
0
);
DLIB_TEST
(
conv_valid
(
temp
,
c
).
nr
()
==
0
);
DLIB_TEST
(
conv_valid
(
temp
,
c
).
nc
()
==
0
);
temp
.
set_size
(
5
,
2
);
temp
=
1
,
2
,
5
,
8
,
9
,
14
,
13
,
20
,
12
,
16
;
DLIB_TEST
(
conv
(
b
,
d
)
==
temp
);
DLIB_TEST
(
xcorr
(
b
,
flip
(
d
))
==
temp
);
temp
.
set_size
(
2
,
2
);
temp
=
9
,
14
,
13
,
20
;
DLIB_TEST
(
conv_same
(
b
,
d
)
==
temp
);
DLIB_TEST
(
xcorr_same
(
b
,
flip
(
d
))
==
temp
);
DLIB_TEST
(
conv_valid
(
b
,
d
).
nr
()
==
0
);
DLIB_TEST
(
xcorr_valid
(
b
,
flip
(
d
)).
nr
()
==
0
);
DLIB_TEST_MSG
(
conv_valid
(
b
,
d
).
nc
()
==
0
,
conv_valid
(
b
,
d
).
nc
());
DLIB_TEST
(
xcorr_valid
(
b
,
flip
(
d
)).
nc
()
==
0
);
temp
.
set_size
(
5
,
5
);
temp
=
1
,
4
,
10
,
12
,
9
,
8
,
26
,
56
,
54
,
36
,
30
,
84
,
165
,
144
,
90
,
56
,
134
,
236
,
186
,
108
,
49
,
112
,
190
,
144
,
81
;
DLIB_TEST
(
conv
(
c
,
c
)
==
temp
);
DLIB_TEST
(
xcorr
(
c
,
flip
(
c
))
==
temp
);
matrix
<
int
>
temp3
=
c
;
temp3
=
conv
(
temp3
,
c
);
DLIB_TEST
(
temp3
==
temp
);
temp3
=
c
;
temp3
=
conv
(
c
,
temp3
);
DLIB_TEST
(
temp3
==
temp
);
temp
.
set_size
(
3
,
3
);
temp
=
26
,
56
,
54
,
84
,
165
,
144
,
134
,
236
,
186
;
DLIB_TEST
(
conv_same
(
c
,
c
)
==
temp
);
DLIB_TEST
(
xcorr_same
(
c
,
flip
(
c
))
==
temp
);
temp3
=
c
;
temp3
=
conv_same
(
c
,
temp3
);
DLIB_TEST
(
temp3
==
temp
);
temp3
=
c
;
temp3
=
conv_same
(
temp3
,
c
);
DLIB_TEST
(
temp3
==
temp
);
temp
.
set_size
(
1
,
1
);
temp
=
165
;
DLIB_TEST
(
conv_valid
(
c
,
c
)
==
temp
);
DLIB_TEST
(
xcorr_valid
(
c
,
flip
(
c
))
==
temp
);
temp3
=
c
;
temp3
=
conv_valid
(
c
,
temp3
);
DLIB_TEST
(
temp3
==
temp
);
temp3
=
c
;
temp3
=
conv_valid
(
temp3
,
c
);
DLIB_TEST
(
temp3
==
temp
);
}
class
matrix_tester
:
public
tester
...
...
@@ -625,6 +776,9 @@ namespace
void
perform_test
(
)
{
test_conv
<
0
,
0
,
0
,
0
>
();
test_conv
<
1
,
2
,
3
,
4
>
();
test_stuff
();
for
(
int
i
=
0
;
i
<
10
;
++
i
)
matrix_test
();
...
...
docs/docs/algorithms.xml
View file @
5b30b06d
...
...
@@ -25,20 +25,7 @@
<section>
<name>
Tools
</name>
<item>
bigint
</item>
<item>
crc32
</item>
<item>
rand
</item>
<item>
hash
</item>
<item>
murmur_hash3
</item>
<item>
running_stats
</item>
<item>
running_scalar_covariance
</item>
<item>
mean_sign_agreement
</item>
<item>
correlation
</item>
<item>
covariance
</item>
<item>
r_squared
</item>
<item>
mean_squared_error
</item>
<item>
running_covariance
</item>
<item>
random_subset_selector
</item>
<item>
randomly_subsample
</item>
<item>
disjoint_subsets
</item>
<item
nolink=
"true"
>
<name>
Quantum Computing
</name>
<sub>
...
...
@@ -49,6 +36,7 @@
<item
nolink=
"true"
>
<name>
Geometry
</name>
<sub>
<item>
border_enumerator
</item>
<item>
rectangle
</item>
<item>
vector
</item>
<item>
point
</item>
...
...
@@ -89,8 +77,6 @@
<item>
hsort_array
</item>
<item>
isort_array
</item>
<item>
put_in_range
</item>
<item>
md5
</item>
<item>
median
</item>
<item>
qsort_array
</item>
<item>
square_root
</item>
<item
nolink=
"true"
>
...
...
@@ -104,6 +90,30 @@
</item>
</section>
<section>
<name>
Statistics
</name>
<item>
rand
</item>
<item>
median
</item>
<item>
running_stats
</item>
<item>
running_scalar_covariance
</item>
<item>
mean_sign_agreement
</item>
<item>
correlation
</item>
<item>
covariance
</item>
<item>
r_squared
</item>
<item>
mean_squared_error
</item>
<item>
running_covariance
</item>
<item>
random_subset_selector
</item>
<item>
randomly_subsample
</item>
</section>
<section>
<name>
Hashing
</name>
<item>
md5
</item>
<item>
crc32
</item>
<item>
hash
</item>
<item>
murmur_hash3
</item>
</section>
</top>
</menu>
...
...
@@ -234,6 +244,19 @@
</description>
</component>
<!-- ************************************************************************* -->
<component>
<name>
border_enumerator
</name>
<file>
dlib/geometry.h
</file>
<spec_file>
dlib/geometry/border_enumerator_abstract.h
</spec_file>
<description>
This object is an
<a
href=
"containers.html#enumerable"
>
enumerator
</a>
over the border
<a
href=
"#point"
>
points
</a>
of a
<a
href=
"#rectangle"
>
rectangle
</a>
.
</description>
</component>
<!-- ************************************************************************* -->
<component>
...
...
@@ -258,6 +281,22 @@
<!-- ************************************************************************* -->
<component>
<name>
disjoint_subsets
</name>
<file>
dlib/disjoint_subsets.h
</file>
<spec_file
link=
"true"
>
dlib/disjoint_subsets/disjoint_subsets_abstract.h
</spec_file>
<description>
This object represents a set of integers which is partitioned into
a number of disjoint subsets. It supports the two fundamental operations
of finding which subset a particular integer belongs to as well as
merging subsets.
</description>
</component>
<!-- ************************************************************************* -->
<component>
<name>
running_stats
</name>
<file>
dlib/statistics.h
</file>
...
...
docs/docs/containers.xml
View file @
5b30b06d
...
...
@@ -387,6 +387,34 @@
<name>
trans
</name>
<link>
dlib/matrix/matrix_utilities_abstract.h.html#trans
</link>
</item>
<item>
<name>
conv
</name>
<link>
dlib/matrix/matrix_conv_abstract.h.html#conv
</link>
</item>
<item>
<name>
conv_same
</name>
<link>
dlib/matrix/matrix_conv_abstract.h.html#conv_same
</link>
</item>
<item>
<name>
conv_valid
</name>
<link>
dlib/matrix/matrix_conv_abstract.h.html#conv_valid
</link>
</item>
<item>
<name>
xcorr
</name>
<link>
dlib/matrix/matrix_conv_abstract.h.html#xcorr
</link>
</item>
<item>
<name>
xcorr_same
</name>
<link>
dlib/matrix/matrix_conv_abstract.h.html#xcorr_same
</link>
</item>
<item>
<name>
xcorr_valid
</name>
<link>
dlib/matrix/matrix_conv_abstract.h.html#xcorr_valid
</link>
</item>
<item>
<name>
flip
</name>
<link>
dlib/matrix/matrix_utilities_abstract.h.html#flip
</link>
</item>
<item>
<name>
flipud
</name>
<link>
dlib/matrix/matrix_utilities_abstract.h.html#flipud
</link>
...
...
docs/docs/imaging.xml
View file @
5b30b06d
...
...
@@ -125,6 +125,7 @@
<section>
<name>
Morphology
</name>
<item>
label_connected_blobs
</item>
<item>
segment_image
</item>
<item>
binary_dilation
</item>
<item>
binary_erosion
</item>
<item>
binary_open
</item>
...
...
@@ -148,6 +149,7 @@
<name>
Miscellaneous
</name>
<item>
cv_image
</item>
<item>
randomly_color_image
</item>
<item>
draw_line
</item>
<item>
fill_rect
</item>
...
...
@@ -486,6 +488,26 @@
</component>
<!-- ************************************************************************* -->
<component>
<name>
randomly_color_image
</name>
<file>
dlib/image_transforms.h
</file>
<spec_file
link=
"true"
>
dlib/image_transforms/randomly_color_image_abstract.h
</spec_file>
<description>
Randomly generates a mapping from gray level pixel values
to the RGB pixel space and then uses this mapping to create
a colored version an image.
<p>
This function is useful for displaying the results of some image
segmentation. For example, the output of
<a
href=
"#label_connected_blobs"
>
label_connected_blobs
</a>
or
<a
href=
"#segment_image"
>
segment_image
</a>
.
</p>
</description>
</component>
<!-- ************************************************************************* -->
<component>
...
...
@@ -1052,6 +1074,22 @@
</component>
<!-- ************************************************************************* -->
<component>
<name>
segment_image
</name>
<file>
dlib/image_transforms.h
</file>
<spec_file
link=
"true"
>
dlib/image_transforms/segment_image_abstract.h
</spec_file>
<description>
Attempts to segment an image into regions which have some visual consistency to them.
In particular, this function implements the algorithm described in the paper:
<blockquote>
Efficient Graph-Based Image Segmentation by Felzenszwalb and Huttenlocher.
</blockquote>
</description>
</component>
<!-- ************************************************************************* -->
<component>
...
...
docs/docs/metaprogramming.xml
View file @
5b30b06d
...
...
@@ -43,6 +43,7 @@
<item>
static_switch
</item>
<item>
noncopyable
</item>
<item>
enable_if
</item>
<item>
is_array2d
</item>
<item>
is_graph
</item>
<item>
is_rand
</item>
<item>
is_matrix
</item>
...
...
@@ -410,6 +411,19 @@
</component>
<!-- ************************************************************************* -->
<component>
<name>
is_array2d
</name>
<file>
dlib/is_kind.h
</file>
<spec_file
link=
"true"
>
dlib/is_kind.h
</spec_file>
<description>
This is a template where is_array2d
<
T
>
::value == true when T
is an
<a
href=
"containers.html#array2d"
>
array2d
</a>
object.
</description>
</component>
<!-- ************************************************************************* -->
<component>
...
...
docs/docs/term_index.xml
View file @
5b30b06d
...
...
@@ -100,7 +100,10 @@
<term
file=
"bayes.html"
name=
"node_next_parent_assignment"
/>
<term
file=
"bayes.html"
name=
"node_cpt_filled_out"
/>
<term
file=
"algorithms.html"
name=
"disjoint_subsets"
/>
<term
link=
"algorithms.html#disjoint_subsets"
name=
"union-find"
/>
<term
file=
"algorithms.html"
name=
"rectangle"
/>
<term
file=
"algorithms.html"
name=
"border_enumerator"
/>
<term
file=
"algorithms.html"
name=
"edge"
/>
<term
file=
"algorithms.html"
name=
"is_join_tree"
/>
<term
file=
"algorithms.html"
name=
"create_join_tree"
/>
...
...
@@ -317,9 +320,17 @@
<term
file=
"dlib/matrix/matrix_utilities_abstract.h.html"
name=
"diag_exp"
/>
<term
file=
"dlib/matrix/matrix_utilities_abstract.h.html"
name=
"diagm"
/>
<term
file=
"dlib/matrix/matrix_utilities_abstract.h.html"
name=
"trans"
/>
<term
file=
"dlib/matrix/matrix_utilities_abstract.h.html"
name=
"flip"
/>
<term
file=
"dlib/matrix/matrix_utilities_abstract.h.html"
name=
"fliplr"
/>
<term
file=
"dlib/matrix/matrix_utilities_abstract.h.html"
name=
"flipud"
/>
<term
file=
"dlib/matrix/matrix_conv_abstract.h.html"
name=
"conv"
/>
<term
file=
"dlib/matrix/matrix_conv_abstract.h.html"
name=
"conv_same"
/>
<term
file=
"dlib/matrix/matrix_conv_abstract.h.html"
name=
"conv_valid"
/>
<term
file=
"dlib/matrix/matrix_conv_abstract.h.html"
name=
"xcorr"
/>
<term
file=
"dlib/matrix/matrix_conv_abstract.h.html"
name=
"xcorr_same"
/>
<term
file=
"dlib/matrix/matrix_conv_abstract.h.html"
name=
"xcorr_valid"
/>
<term
file=
"dlib/matrix/symmetric_matrix_cache_abstract.h.html"
name=
"symmetric_matrix_cache"
/>
<term
name=
"dot"
>
...
...
@@ -474,6 +485,7 @@
<term
link=
"metaprogramming.html#portability_macros"
name=
"portability macros"
/>
<term
file=
"metaprogramming.html"
name=
"static_switch"
/>
<term
file=
"metaprogramming.html"
name=
"is_graph"
/>
<term
file=
"metaprogramming.html"
name=
"is_array2d"
/>
<term
file=
"metaprogramming.html"
name=
"is_rand"
/>
<term
file=
"metaprogramming.html"
name=
"is_matrix"
/>
<term
file=
"metaprogramming.html"
name=
"is_std_vector"
/>
...
...
@@ -929,6 +941,7 @@
<term
link=
"dlib/image_transforms/thresholding_abstract.h.html"
name=
"off_pixel"
/>
<term
file=
"imaging.html"
name=
"randomly_color_image"
/>
<term
file=
"imaging.html"
name=
"assign_image"
/>
<term
file=
"imaging.html"
name=
"assign_image_scaled"
/>
<term
file=
"imaging.html"
name=
"assign_all_pixels"
/>
...
...
@@ -947,6 +960,7 @@
<term
file=
"imaging.html"
name=
"binary_difference"
/>
<term
file=
"imaging.html"
name=
"label_connected_blobs"
/>
<term
file=
"imaging.html"
name=
"segment_image"
/>
<term
file=
"imaging.html"
name=
"neighbors_8"
/>
<term
file=
"imaging.html"
name=
"neighbors_4"
/>
<term
file=
"imaging.html"
name=
"connected_if_both_not_zero"
/>
...
...
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