Made this code a little more robust.

This commit is contained in:
Davis King 2012-01-02 21:57:03 -05:00
parent 125a572cbf
commit 0b2bfdde1f
1 changed files with 12 additions and 4 deletions

View File

@ -247,14 +247,22 @@ namespace dlib
{
fe.load(img);
feats.set_size(fe.nr(), fe.nc());
for (long r = 0; r < feats.nr(); ++r)
if (fe.size() != 0)
{
for (long c = 0; c < feats.nc(); ++c)
feats.set_size(fe.nr(), fe.nc());
for (long r = 0; r < feats.nr(); ++r)
{
feats[r][c] = phash(fe(r,c));
for (long c = 0; c < feats.nc(); ++c)
{
feats[r][c] = phash(fe(r,c));
}
}
}
else
{
feats.set_size(0,0);
}
fe.unload();
}