KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
comparable_omap.h
Go to the documentation of this file.
1 
7 //#include "Comparable_omap.h"
8 #ifndef COMPAREABLE_OMAP_H
9 #define COMPAREABLE_OMAP_H
10 
11 #include "i_cpp/i_image.h"
12 #include "i/i_float_io.h"
13 #include "i/i_float.h"
14 #include <stdio.h>
15 #include <l_cpp/l_exception.h>
16 #include <l_cpp/l_int_matrix.h>
17 //#include < boost/multi_array.hpp >
18 
19 
20 namespace kjb{
21 
27 
28 public:
29 
30 Comparable_omap(const Image &basein)
31 {
32  //base = basein;
33  //make_opposite_omap();
34  _num_cols = basein.get_num_cols();
35  _num_rows = basein.get_num_rows();
36  prepare_int_maps(basein);
37  totalbaseblack = get_black(basein);
38  total = basein.get_num_rows()*basein.get_num_cols();
39 }
40 
41 Comparable_omap(const std::string& fname) // : base(fname.c_str())
42 {
43  Image tempimg(fname.c_str());
44  _num_cols = tempimg.get_num_cols();
45  _num_rows = tempimg.get_num_rows();
46  //make_opposite_omap();
47  prepare_int_maps(tempimg);
48  totalbaseblack = get_black(tempimg);
49  total = tempimg.get_num_rows()*tempimg.get_num_cols();
50 }
51 
52 void prepare_int_maps(const kjb::Image & base);
53 
54 //double compare_omap(const Image & comparetoin) const;
55 
56 double compare_omap(const Int_matrix & imap) const;
57 
58 /*double match_pixels
59 (
60  const Image & basein,
61  const Image & comparetoin
62 ) const;*/
63 
64 /*const kjb::Image & get_base()
65 {
66  return base;
67 }
68 
69 const kjb::Image & get_reversed()
70 {
71  return reversedbase;
72 }*/
73 
75 (
76  const Int_matrix & imap,
77  Image & img
78 );
79 
81 (
82  const std::vector<kjb::Int_vector> & surface_changes,
83  int surface_counter
84 ) const;
85 
86 
87 //void make_opposite_omap();
88 
89 private:
90  //Image base;
91  //Image reversedbase;
92 
93  Int_matrix map_base;
94 
95  Int_matrix accum_hor;
96  Int_matrix accum_ver1;
97  Int_matrix accum_ver2;
98 
99 
100  double percentright;
101  int totalbaseblack;
102  int total;
103 
104 #warning "[Code police] Please don't create identifier names that start with"
105 #warning "[Code police] an underscore. Such identifiers are reserved."
106  int _num_cols;
107  int _num_rows;
108 
109 int get_black(const Image & howblack);
110 
111 }; //class Comparable_omap
112 
113 }//namespace kjb
114 
115 #endif
Comparable_omap(const std::string &fname)
Definition: comparable_omap.h:41
Definition for the Int_matrix class, a thin wrapper on the KJB Int_matrix struct and its related func...
double compare_omap(const Int_matrix &imap) const
Definition: comparable_omap.cpp:187
This class implements matrices, in the linear-algebra sense, restricted to integer-valued elements...
Definition: l_int_matrix.h:71
void convert_map_to_image(const Int_matrix &imap, Image &img)
Definition: comparable_omap.cpp:390
int get_num_rows() const
Return the number of rows in the image.
Definition: i_image.h:256
creates an omap from an image that can call compare_omap(compareto) to see how similar it is...
Definition: comparable_omap.h:26
int get_num_cols() const
Return the number of columns in the image.
Definition: i_image.h:262
void prepare_int_maps(const kjb::Image &base)
Definition: comparable_omap.cpp:23
double compare_omap_integral(const std::vector< kjb::Int_vector > &surface_changes, int surface_counter) const
Definition: comparable_omap.cpp:268
Comparable_omap(const Image &basein)
Definition: comparable_omap.h:30
Code for a wrapper class around the C struct KJB_Image.
Support for error handling exception classes in libKJB.
Wrapped version of the C struct KJB_image.
Definition: i_image.h:76