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

Function compute_box_dimensions

dlib/image_processing/detection_template_tools.h:18–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16// ----------------------------------------------------------------------------------------
17
18 inline rectangle compute_box_dimensions (
19 const double width_to_height_ratio,
20 const double area
21 )
22 {
23 // make sure requires clause is not broken
24 DLIB_ASSERT(width_to_height_ratio > 0 && area > 0,
25 "\t rectangle compute_box_dimensions()"
26 << "\n\t Invalid arguments were given to this function. "
27 << "\n\t width_to_height_ratio: " << width_to_height_ratio
28 << "\n\t area: " << area
29 );
30
31 /*
32 width*height == area
33 width/height == width_to_height_ratio
34 */
35
36 const int height = (int)std::floor(std::sqrt(area/width_to_height_ratio) + 0.5);
37 const int width = (int)std::floor(area/height + 0.5);
38
39 return centered_rect(0,0,width,height);
40 }
41
42// ----------------------------------------------------------------------------------------
43

Callers 8

test_1Function · 0.85
test_1mFunction · 0.85
test_1_fine_hogFunction · 0.85
test_1_polyFunction · 0.85
test_1m_polyFunction · 0.85
test_2Function · 0.85
test_3Function · 0.85
mainFunction · 0.85

Calls 3

centered_rectFunction · 0.85
floorFunction · 0.50
sqrtFunction · 0.50

Tested by 7

test_1Function · 0.68
test_1mFunction · 0.68
test_1_fine_hogFunction · 0.68
test_1_polyFunction · 0.68
test_1m_polyFunction · 0.68
test_2Function · 0.68
test_3Function · 0.68