Added an unload() to the hog_image.

This commit is contained in:
Davis King 2011-12-30 23:13:04 -05:00
parent 2eeaf11fa8
commit cae3da777f
3 changed files with 26 additions and 5 deletions

View File

@ -245,18 +245,17 @@ namespace dlib
const image_type& img
)
{
feature_extractor fe_temp;
fe_temp.copy_configuration(fe);
fe_temp.load(img);
fe.load(img);
feats.set_size(fe_temp.nr(), fe_temp.nc());
feats.set_size(fe.nr(), fe.nc());
for (long r = 0; r < feats.nr(); ++r)
{
for (long c = 0; c < feats.nc(); ++c)
{
feats[r][c] = phash(fe_temp(r,c));
feats[r][c] = phash(fe(r,c));
}
}
fe.unload();
}
// ----------------------------------------------------------------------------------------

View File

@ -86,6 +86,9 @@ namespace dlib
load_impl(array_to_matrix(img));
}
inline void unload(
) { clear(); }
inline unsigned long size (
) const { return static_cast<unsigned long>(nr()*nc()); }

View File

@ -169,6 +169,25 @@ namespace dlib
- #size() > 0
!*/
inline void unload (
);
/*!
ensures
- #nr() == 0
- #nc() == 0
- clears only the state information which is populated by load(). For
example, let H be a hog_image object. Then consider the two sequences
of instructions:
Sequence 1:
H.load(img);
H.unload();
H.load(img);
Sequence 2:
H.load(img);
Both sequence 1 and sequence 2 should have the same effect on H.
!*/
inline unsigned long size (
) const;
/*!