smartdoc.hpp 1.98 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#ifndef APPS_SMARTDOC_SMARTDOC_HPP
# define APPS_SMARTDOC_SMARTDOC_HPP

#include <mln/core/image/image2d.hpp>
#include <mln/core/grays.hpp>
#include <mln/core/colors.hpp>
#include <mln/morpho/component_tree/component_tree.hpp>


/**************************************/
/***  CONFIGURATIONS                ***/
/**************************************/

constexpr unsigned GRAINSIZE = 10;
15
constexpr float CORNER_TOLERANCE = 0.35;
16
17
18
19
20
21
22
23
24

// Min/Max Size of the target (in % the image size)
constexpr float MIN_OBJECT_SIZE = 0.05;
constexpr float MAX_OBJECT_SIZE = 0.3;

constexpr float WEIGHT_DEPTH = 1;
constexpr float WEIGHT_QUAD = 1;
constexpr float WEIGHT_NOISE = 1;

25
constexpr float MAX_DISTANCE_INTER_FRAME = 100;
26
constexpr int NQUAD = 7;
27
28
29
30
31
32




using tree_t = mln::morpho::component_tree<unsigned, mln::image2d<unsigned> >;

33
34
35
36
37
38
struct process_result_t
{
  std::array<mln::point2d, 4> points;
  float                       energy;
};

39
40
41
42
43
44
45
46
47
48
49

/// \brief Document detection method entry point.
/// It returns the pair \p (detected, QUAD) where \p detected
/// is a boolean set to true if a detection occured and \p QUAD
/// is the quadruplet of points (UL, UR, LR, LL)
///
/// \param tree The Color ToS
/// \param imdepth The depth image
/// \param[out] feedback The image with the detected object colorized (must be the same size of imdepth)
/// \param csvfile (optional) Path to the CSV file where attributes will be saved
/// \param treefile (optional) Path to the file where the tree will be saved (after filtering)
50
std::array<process_result_t, NQUAD>
51
52
53
54
55
56
process(tree_t& tree,
        const mln::image2d<mln::uint16>& imdepth,
        const char* csvfile = nullptr,
        const char* treefile = nullptr);


57
58
59
60
61
void
draw_quad_superimpose(std::array<mln::point2d, 4> quad,
                      const mln::image2d<mln::uint16>& depth,
                      mln::image2d<mln::rgb8>& out);

62
63
64
65
66
void
draw_quad_superimpose(std::array<mln::point2d, 4> quad,
                      mln::image2d<mln::rgb8>& out);


67
68


69
#endif // ! APPS_SMARTDOC_SMARTDOC_HPP