File: detection_template_tools_abstract.h

package info (click to toggle)
mldemos 0.5.1-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 32,224 kB
  • ctags: 46,525
  • sloc: cpp: 306,887; ansic: 167,718; ml: 126; sh: 109; makefile: 2
file content (95 lines) | stat: -rw-r--r-- 3,291 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// Copyright (C) 2011  Davis E. King (davis@dlib.net)
// License: Boost Software License   See LICENSE.txt for the full license.
#undef DLIB_DETECTION_TEMPlATE_TOOLS_ABSTRACT_H__
#ifdef DLIB_DETECTION_TEMPlATE_TOOLS_ABSTRACT_H__

#include "../geometry.h"
#include <utility>
#include <vector>

namespace dlib
{

// ----------------------------------------------------------------------------------------

    rectangle compute_box_dimensions (
        const double width_to_height_ratio,
        const double area
    );
    /*!
        requires
            - area > 0
            - width_to_height_ratio > 0
        ensures
            - returns a rectangle with the given area and width_to_height_ratio.
            - In particular, returns a rectangle R such that:
                - R.area() == area (to within integer precision)
                - R.width()/R.height() == width_to_height_ratio (to within integer precision)
                - center(R) == point(0,0)
    !*/

// ----------------------------------------------------------------------------------------

    std::vector<rectangle> create_single_box_detection_template (
        const rectangle& object_box 
    );
    /*!
        ensures
            - returns a vector that contains only object_box.  
            - In particular, returns a vector V such that:
                - V.size() == 1
                - V[0] == object_box
    !*/

// ----------------------------------------------------------------------------------------

    std::vector<rectangle> create_overlapped_2x2_detection_template (
        const rectangle& object_box 
    );
    /*!
        ensures
            - Divides object_box up into four overlapping regions, the
              top half, bottom half, left half, and right half.  These
              four rectangles are returned inside a std::vector.
            - In particular, returns a vector V such that:
                - V.size() == 4
                - V[0] == top half of object_box 
                - V[1] == bottom half of object_box 
                - V[2] == left half of object_box 
                - V[3] == right half of object_box 
                - for all valid i: object_box.contains(V[i]) == true
    !*/

// ----------------------------------------------------------------------------------------

    std::vector<rectangle> create_grid_detection_template (
        const rectangle& object_box,
        unsigned int cells_x,
        unsigned int cells_y
    );
    /*!
        requires
            - cells_x > 0
            - cells_y > 0
        ensures
            - Divides object_box up into a grid and returns a vector 
              containing all the rectangles corresponding to elements
              of the grid.  Moreover, the grid will be cells_x elements
              wide and cells_y elements tall.
            - In particular, returns a vector V such that:
                - V.size() == cells_x*cells_y 
                - for all valid i: 
                    - object_box.contains(V[i]) == true
                    - V[i] == The rectangle corresponding to the ith grid
                      element. 
    !*/

// ----------------------------------------------------------------------------------------

}


#endif // DLIB_DETECTION_TEMPlATE_TOOLS_ABSTRACT_H__