Commit f85cd73e authored by Davis King's avatar Davis King

minor cleanup

parent 226f5af1
......@@ -19,8 +19,8 @@ namespace dlib
// ----------------------------------------------------------------------------------------
std::vector<std::vector<separable_filter_type> > build_separable_poly_filters (
const long window_size,
const long order = 2
const long order,
const long window_size
)
/*!
requires
......@@ -137,8 +137,8 @@ namespace dlib
// ----------------------------------------------------------------------------------------
std::vector<std::vector<separable_int32_filter_type> > build_separable_int32_poly_filters (
const long order,
const long window_size,
const long order = 2,
const double max_range = 300.0
)
/*!
......@@ -150,7 +150,7 @@ namespace dlib
- the "first" element is the row_filter, the second is the col_filter.
!*/
{
const std::vector<std::vector<separable_filter_type> >& filters = build_separable_poly_filters(window_size, order);
const std::vector<std::vector<separable_filter_type> >& filters = build_separable_poly_filters(order, window_size);
std::vector<std::vector<separable_int32_filter_type> > int_filters(filters.size());
for (unsigned long i = 0; i < filters.size(); ++i)
......
......@@ -25,6 +25,14 @@ namespace dlib
public:
typedef matrix<double, 0, 1> descriptor_type;
poly_image(
long order_,
long window_size_
)
{
setup(order_, window_size_);
}
poly_image (
)
{
......@@ -40,7 +48,7 @@ namespace dlib
border_size = (long)std::ceil(std::floor(window_size/2.0)/downsample);
num_rows = 0;
num_cols = 0;
filters = build_separable_poly_filters(window_size, order);
filters = build_separable_poly_filters(order, window_size);
}
long get_order (
......@@ -77,7 +85,7 @@ namespace dlib
border_size = (long)std::ceil(std::floor(window_size/2.0)/downsample);
num_rows = 0;
num_cols = 0;
filters = build_separable_poly_filters(window_size, order);
filters = build_separable_poly_filters(order, window_size);
}
void copy_configuration (
......@@ -221,25 +229,31 @@ namespace dlib
friend void serialize (const poly_image& item, std::ostream& out)
{
int version = 1;
serialize(version, out);
serialize(item.poly_coef, out);
serialize(item.order, out);
serialize(item.window_size, out);
serialize(item.border_size, out);
serialize(item.num_rows, out);
serialize(item.num_cols, out);
serialize(item.filters, out);
}
friend void deserialize (poly_image& item, std::istream& in )
{
int version = 0;
deserialize(version, in);
if (version != 1)
throw dlib::serialization_error("Unexpected version found while deserializing dlib::poly_image");
deserialize(item.poly_coef, in);
deserialize(item.order, in);
deserialize(item.window_size, in);
deserialize(item.border_size, in);
deserialize(item.num_rows, in);
deserialize(item.num_cols, in);
// just rebuild the filters instead of loading them
item.filters = build_separable_poly_filters(item.window_size, item.order);
deserialize(item.filters, in);
}
private:
......
......@@ -19,11 +19,6 @@ namespace dlib
REQUIREMENTS ON TEMPLATE PARAMETERS
- downsample >= 1
INITIAL VALUE
- size() == 0
- get_order() == 3
- get_window_size() == 13
WHAT THIS OBJECT REPRESENTS
This object is a tool for extracting local feature descriptors from an image.
In particular, it fits a polynomial to every local pixel patch in an image and
......@@ -54,7 +49,23 @@ namespace dlib
);
/*!
ensures
- this object is properly initialized
- #get_order() == 3
- #get_window_size() == 13
- #size() == 0
!*/
poly_image(
long order,
long window_size
);
/*!
requires
- 1 <= order <= 6
- window_size >= 3 && window_size is odd
ensures
- #get_order() == order
- #get_window_size() == window_size
- #size() == 0
!*/
void clear (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment