mirror of
https://github.com/davisking/dlib.git
synced 2024-11-01 10:14:53 +08:00
Made the randomly_sample_image_features() routine a little more general.
Also improved its spec.
This commit is contained in:
parent
06dc489cc5
commit
ffa0ae4cfb
@ -5,7 +5,6 @@
|
||||
|
||||
#include "image_feature_sampling_abstract.h"
|
||||
#include "../statistics.h"
|
||||
#include "../image_transforms.h"
|
||||
|
||||
namespace dlib
|
||||
{
|
||||
@ -34,11 +33,17 @@ namespace dlib
|
||||
|
||||
for (unsigned long i = 0; i < images.size(); ++i)
|
||||
{
|
||||
assign_image(temp_img, images[i]);
|
||||
|
||||
while (temp_img.nr() > 10 && temp_img.nc() > 10)
|
||||
bool at_pyramid_top = true;
|
||||
while (true)
|
||||
{
|
||||
fe.load(temp_img);
|
||||
if (at_pyramid_top)
|
||||
fe.load(images[i]);
|
||||
else
|
||||
fe.load(temp_img);
|
||||
|
||||
if (fe.size() == 0)
|
||||
break;
|
||||
|
||||
for (long r = 0; r < fe.nr(); ++r)
|
||||
{
|
||||
for (long c = 0; c < fe.nc(); ++c)
|
||||
@ -54,8 +59,16 @@ namespace dlib
|
||||
}
|
||||
}
|
||||
|
||||
pyr(temp_img, temp_img2);
|
||||
temp_img2.swap(temp_img);
|
||||
if (at_pyramid_top)
|
||||
{
|
||||
at_pyramid_top = false;
|
||||
pyr(images[i], temp_img);
|
||||
}
|
||||
else
|
||||
{
|
||||
pyr(temp_img, temp_img2);
|
||||
swap(temp_img2,temp_img);
|
||||
}
|
||||
}
|
||||
}
|
||||
return basis;
|
||||
|
@ -29,6 +29,7 @@ namespace dlib
|
||||
dlib::hog_image
|
||||
- image_array_type == an implementation of dlib/array/array_kernel_abstract.h
|
||||
and it must contain image objects which can be passed to pyr() and fe.load()
|
||||
and are swappable by global swap().
|
||||
ensures
|
||||
- creates an image pyramid for each image in images and performs feature
|
||||
extraction on each pyramid level. Then selects a random subsample of at
|
||||
|
Loading…
Reference in New Issue
Block a user