Changed code slightly to avoid a bug in visual studio 2005.

parent a963f5d5
...@@ -219,31 +219,39 @@ namespace dlib ...@@ -219,31 +219,39 @@ namespace dlib
return rectangle(feat_to_image_space(rect.tl_corner()), feat_to_image_space(rect.br_corner())); return rectangle(feat_to_image_space(rect.tl_corner()), feat_to_image_space(rect.br_corner()));
} }
template <
unsigned long T1,
unsigned long T2,
unsigned long T3,
unsigned long T4,
int T5,
int T6
>
friend void serialize (
const hog_image<T1,T2,T3,T4,T5,T6>& item,
std::ostream& out
);
template <
unsigned long T1, // these _PRIVATE_ functions are only here as a workaround for a bug in visual studio 2005.
unsigned long T2, void _PRIVATE_serialize (std::ostream& out) const
unsigned long T3, {
unsigned long T4, // serialize hist_cells
int T5, serialize(hist_cells.nc(),out);
int T6 serialize(hist_cells.nr(),out);
> hist_cells.reset();
friend void deserialize ( while (hist_cells.move_next())
hog_image<T1,T2,T3,T4,T5,T6>& item, serialize(hist_cells.element().values,out);
std::istream& in hist_cells.reset();
);
serialize(num_block_rows, out);
serialize(num_block_cols, out);
}
void _PRIVATE_deserialize (std::istream& in )
{
// deserialize item.hist_cells
long nc, nr;
deserialize(nc,in);
deserialize(nr,in);
hist_cells.set_size(nr,nc);
while (hist_cells.move_next())
deserialize(hist_cells.element().values,in);
hist_cells.reset();
deserialize(num_block_rows, in);
deserialize(num_block_cols, in);
}
private: private:
...@@ -489,18 +497,7 @@ namespace dlib ...@@ -489,18 +497,7 @@ namespace dlib
std::ostream& out std::ostream& out
) )
{ {
// serialize item.hist_cells item._PRIVATE_serialize(out);
serialize(item.hist_cells.nc(),out);
serialize(item.hist_cells.nr(),out);
item.hist_cells.reset();
while (item.hist_cells.move_next())
serialize(item.hist_cells.element().values,out);
item.hist_cells.reset();
serialize(item.num_block_rows, out);
serialize(item.num_block_cols, out);
} }
template < template <
...@@ -516,19 +513,7 @@ namespace dlib ...@@ -516,19 +513,7 @@ namespace dlib
std::istream& in std::istream& in
) )
{ {
// deserialize item.hist_cells item._PRIVATE_deserialize(in);
long nc, nr;
deserialize(nc,in);
deserialize(nr,in);
item.hist_cells.set_size(nr,nc);
while (item.hist_cells.move_next())
deserialize(item.hist_cells.element().values,in);
item.hist_cells.reset();
deserialize(item.num_block_rows, in);
deserialize(item.num_block_cols, in);
} }
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
......
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