2 #include <vtec_core/image.h> 3 #include <homography_optimizer/types.h> 12 const int posy,
const int sizex,
const int sizey)
36 v_H[0] = H.at<
double>(0, 0);
37 v_H[1] = H.at<
double>(0, 1);
38 v_H[2] = H.at<
double>(0, 2);
39 v_H[3] = H.at<
double>(1, 0);
40 v_H[4] = H.at<
double>(1, 1);
41 v_H[5] = H.at<
double>(1, 2);
42 v_H[6] = H.at<
double>(2, 0);
43 v_H[7] = H.at<
double>(2, 1);
44 v_H[8] = H.at<
double>(2, 2);
46 double score =
optimizer->optimize(v_image, v_H, alpha, beta, predictor);
48 H.at<
double>(0, 0) = v_H[0];
49 H.at<
double>(0, 1) = v_H[1];
50 H.at<
double>(0, 2) = v_H[2];
51 H.at<
double>(1, 0) = v_H[3];
52 H.at<
double>(1, 1) = v_H[4];
53 H.at<
double>(1, 2) = v_H[5];
54 H.at<
double>(2, 0) = v_H[6];
55 H.at<
double>(2, 1) = v_H[7];
56 H.at<
double>(2, 2) = v_H[8];
76 auto vtec_homographies =
optimizer->getHomographySequence();
77 size_t size = vtec_homographies.size();
78 std::vector<cv::Mat> cv_homographies;
80 for (
int i = 0; i < size; ++i)
83 VTEC::Homography* vtec_H = vtec_homographies[i];
87 cv_homographies.push_back(cv_H);
89 return cv_homographies;
94 VTEC::Homography vtec_h;
101 VTEC::Image vtec_template;
102 optimizer->getCurrentTemplate(vtec_template);
108 VTEC::Image vtec_template;
109 optimizer->getReferenceTemplate(vtec_template);
115 VTEC::Homography vtec_h;
void getCurrentTemplate(cv::Mat &img)
Gets the current template.
IBGHomographyOptimizer * optimizer
bool setReferenceTemplate(const cv::Mat &ref_image, const int posx, const int posy, const int sizex, const int sizey)
Sets the reference template.
double optimize(const cv::Mat &curr_image, cv::Mat &H, float &alpha, float &beta, int predictor)
Optimization function.
void cv2vtecHomography(const cv::Mat &cv_h, VTEC::Homography &vtec_h)
Converts opencv matrix to vtec homography.
IBGHomographyOptimizerCvWrapper()
Constructor.
void getReferenceTemplate(cv::Mat &img)
Gets the reference template.
void setHomography(const cv::Mat H)
Sets the homography.
void cv2vtecImg(const cv::Mat &image, VTEC::Image &vtec_img)
Converts a opencv image to vtec format.
std::vector< cv::Mat > getHomographySequence()
Gets the homography sequence.
void vtec2cvImg(const VTEC::Image &vtec_img, cv::Mat &image)
Converts vtec image to opencv format.
void getHomography(cv::Mat &H)
Gets the homography.
std::vector< int > getNbIterations()
Gets the number of iterations.
void vtec2cvHomography(const VTEC::Homography &vtec_h, cv::Mat &cv_h)
Converts vtec homography to opencv matrix.