MCPcopy Create free account
hub / github.com/davisking/dlib / randomly_sample_image_features

Function randomly_sample_image_features

dlib/statistics/image_feature_sampling.h:19–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17 typename pyramid_type
18 >
19 random_subset_selector<typename feature_extractor_type::descriptor_type> randomly_sample_image_features (
20 const image_array_type& images,
21 const pyramid_type& pyr,
22 const feature_extractor_type& fe_,
23 unsigned long num
24 )
25 {
26 feature_extractor_type fe;
27 fe.copy_configuration(fe_);
28 random_subset_selector<typename feature_extractor_type::descriptor_type> basis;
29 basis.set_max_size(num);
30
31 typedef typename image_array_type::type image_type;
32 image_type temp_img, temp_img2;
33
34 for (unsigned long i = 0; i < images.size(); ++i)
35 {
36 bool at_pyramid_top = true;
37 while (true)
38 {
39 if (at_pyramid_top)
40 fe.load(images[i]);
41 else
42 fe.load(temp_img);
43
44 if (fe.size() == 0)
45 break;
46
47 for (long r = 0; r < fe.nr(); ++r)
48 {
49 for (long c = 0; c < fe.nc(); ++c)
50 {
51 if (basis.next_add_accepts())
52 {
53 basis.add(fe(r,c));
54 }
55 else
56 {
57 basis.add();
58 }
59 }
60 }
61
62 if (at_pyramid_top)
63 {
64 at_pyramid_top = false;
65 pyr(images[i], temp_img);
66 }
67 else
68 {
69 pyr(temp_img, temp_img2);
70 swap(temp_img2,temp_img);
71 }
72 }
73 }
74 return basis;
75 }
76

Callers 3

test_1_poly_nnFunction · 0.85
test_1_poly_nn_boxesFunction · 0.85
setup_hashed_featuresFunction · 0.85

Calls 9

set_max_sizeMethod · 0.80
next_add_acceptsMethod · 0.80
swapFunction · 0.70
copy_configurationMethod · 0.45
sizeMethod · 0.45
loadMethod · 0.45
nrMethod · 0.45
ncMethod · 0.45
addMethod · 0.45

Tested by 2

test_1_poly_nnFunction · 0.68
test_1_poly_nn_boxesFunction · 0.68