<commit_before>// File: transform_estimate.cc
// Date: Fri May 03 23:04:58 2013 +0800
// Author: <NAME> <<EMAIL>>

#include "transform_estimate.hh"

#include <set>
#include <Eigen/Dense>

#include "match_info.hh"
#include "lib/config.hh"
#include "lib/timer.hh"
#include "lib/imgproc.hh"
#include "feature/feature.hh"
#include "feature/matcher.hh"
using namespace std;
using namespace feature;

TransformEstimation::TransformEstimation(const feature::MatchData& m_match,
		const std::vector<feature::Descriptor>& m_f1,
		const std::vector<feature::Descriptor>& m_f2):
	match(m_match), f1(m_f1), f2(m_f2),
	f2_homo_coor(3, match.size())
{
	if (CYLINDER or TRANS)
		transform_type = Affine;
	else
		transform_type = Homo;
	int n = match.size();
	if (n < ESTIMATE_MIN_NR_MATCH) return;
	REP(i, n) {
		Vec2D old = f2[match.data[i].second].coor;
		f2_homo_coor.at(0, i) = old.x;
		f2_homo_coor.at(1, i) = old.y;
		f2_homo_coor.at(2, i) = 1;
	}
}

bool TransformEstimation::get_transform(MatchInfo* info) {
	TotalTimer tm("get_transform");
	// use Affine in cylinder mode, and Homography in normal mode
	int nr_match_used = (transform_type == Affine ? 6: 8) + 1 / 2;
	int nr_match = match.size();
	if (nr_match < ESTIMATE_MIN_NR_MATCH)
		return false;

	vector<int> inliers;
	set<int> selected;<commit_msg>fix bug of infinite loop in random sample<commit_after>// File: transform_estimate.cc
// Date: Fri May 03 23:04:58 2013 +0800
// Author: <NAME> <<EMAIL>>

#include "transform_estimate.hh"

#include <set>
#include <Eigen/Dense>

#include "match_info.hh"
#include "lib/config.hh"
#include "lib/timer.hh"
#include "lib/imgproc.hh"
#include "feature/feature.hh"
#include "feature/matcher.hh"
using namespace std;
using namespace feature;

TransformEstimation::TransformEstimation(const feature::MatchData& m_match,
		const std::vector<feature::Descriptor>& m_f1,
		const std::vector<feature::Descriptor>& m_f2):
	match(m_match), f1(m_f1), f2(m_f2),
	f2_homo_coor(3, match.size())
{
	if (CYLINDER or TRANS)
		transform_type = Affine;
	else
		transform_type = Homo;
	int n = match.size();
	if (n < ESTIMATE_MIN_NR_MATCH) return;
	REP(i, n) {
		Vec2D old = f2[match.data[i].second].coor;
		f2_homo_coor.at(0, i) = old.x;
		f2_homo_coor.at(1, i) = old.y;
		f2_homo_coor.at(2, i) = 1;
	}
}

bool TransformEstimation::get_transform(MatchInfo* info) {
	TotalTimer tm("get_transform");
	// use Affine in cylinder mode, and Homography in normal mode
	int nr_match_used = (transform_type == Affine ? 6: 8) + 1 / 2;
	int nr_match = match.size();
	if (nr_match < nr_match_used)
		return false;

	vector<int> inliers;
	set<int> selected;
{'fraction_non_alphanumeric': 0.14732824427480917, 'fraction_numerical': 0.028244274809160305, 'mean_word_length': 5.095348837209302, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6179890', 'n_tokens_mistral': 1116, 'n_tokens_neox': 1046, 'n_words': 238}