Structural deformable models
main.cpp
Go to the documentation of this file.
1 #include <fx.h>
2 #include <iostream>
3 #include "common.h"
4 #include "Data.h"
5 #include "ExpMap.h"
6 #include "Searcher.h"
7 using namespace std;
8 
9 bool setTitle(const char* title) {
10  cout << "Title: " << title << endl;
11  return true;
12 }
13 
14 bool setStatusText(const char* stext) {
15  cout << "Status: " << stext << endl;
16  return true;
17 }
18 
19 int main(int argc, char **argv)
20 {
21  // Make application
22  FXApp application("Deformable Model Segmentation","FoxText");
23  // Start app
24  application.init(argc,argv);
25 
26  Dataset data("freerect.tif");
27  Model model(&data);
28  model.readFile("quadc.dm");
29  Searcher m_Search;
30  //setup searcher
31  {
32  ExpectationMap em(model);
33  PropVec propl(0.), propu(0.);
34  Point2D dims((float)data.getDim1Size(),
35  (float)data.getDim2Size());
36  Model::setPropPos(propu, dims);
37  Model::setPropScale(propu, 4);
38  Model::setPropDir(propu, 2*M_PI);
39  Model::setPropScale(propl, 0.1);
40  em.setLB(propl);
41  em.setUB(propu);
42  cout << "propl="<<propl<<endl;
43  cout << "propu="<<propu<<endl;
44  cout << em.updateIntegral() << endl;
45  EMDRect* rd = new EMDRect(propl,propu);
46  PropVec propc((propl+propu)*0.5);
47  PropVec propd(propc-propl);
48  EMDGauss gd(propc,propd);
49  em.add(rd);
50  cout << em.updateIntegral() << endl;
51  cout << "rdv=" << em.getPropVec() << endl;
52  cout << rd->ratePropVec(propl) << endl;
53  cout << rd->ratePropVec(propl-propl) << endl;
54  DUMP(gd.ratePropVec(propc));
55  DUMP(gd.ratePropVec(propc+propd));
56  DUMP(gd.ratePropVec(propc+(propd*3)));
57  m_Search.setExpectationMap(em);
58  cout << "------------" << endl;
59  DUMP(model.getProperties());
60  Model *gm = em.generateInstance();
61  DUMP(gm->getStdRadius());
62  DUMP(gm->getProperties());
63  }
64 
65  return 0;
66 }
#define DUMP(expr)
Definition: common.h:16
void setExpectationMap(const ExpectationMap &em)
Definition: Searcher.cpp:346
int getDim1Size() const
Definition: Data.h:44
float ratePropVec(const PropVec &prop, Winner *winner=NULL) const
Definition: ExpMap.cpp:230
const PropVec & getProperties() const
Definition: Model.cpp:1263
int main(int argc, char **argv)
Definition: main.cpp:19
Model * generateInstance() const
Definition: ExpMap.cpp:184
bool setTitle(const char *title)
Definition: main.cpp:9
STL namespace.
void add(EMDistribution *ed)
Definition: ExpMap.cpp:23
PropVec & setPropDir(PropVec &prop, float dir)
Definition: PropVec.h:28
PropVec & setPropPos(PropVec &prop, const Point2D &p)
Definition: PropVec.h:16
void setUB(const PropVec &ub)
Definition: ExpMap.h:87
Definition: ExpMap.h:73
int getDim2Size() const
Definition: Data.h:45
bool setStatusText(const char *stext)
Definition: main.cpp:14
#define M_PI
Definition: mathutil.h:9
Definition: Model.h:33
float updateIntegral()
Definition: ExpMap.cpp:167
Definition: Data.h:21
virtual PropVec getPropVec() const
Definition: ExpMap.cpp:86
bool readFile(const char *filename, bool fullread=true)
Definition: Model.cpp:365
Definition: Point.h:16
PropVec & setPropScale(PropVec &prop, float pscale)
Definition: PropVec.h:22
void setLB(const PropVec &lb)
Definition: ExpMap.h:88
float ratePropVec(const PropVec &prop, Winner *winner=NULL) const
Definition: ExpMap.cpp:213