Merge pull request #18121 from ivashmak:fixing_usac

This commit is contained in:
Alexander Alekhin 2020-08-20 13:23:12 +00:00
commit 8cc2cbf1c4
3 changed files with 7 additions and 6 deletions

View File

@ -247,7 +247,8 @@ public:
// find inliers from sample, points related to H, x' ~ Hx
for (int s = 0; s < sample_size; s++)
if (h_reproj_error->getError(sample[s]) < homography_threshold)
inliers_on_plane++;
if (++inliers_on_plane >= 5)
break;
// if there are at least 5 points lying on plane then F is degenerate
if (inliers_on_plane >= 5) {

View File

@ -745,7 +745,7 @@ bool run (const Ptr<const Model> &params, InputArray points1, InputArray points2
points_size = mergePoints(points1, points2, points, true);
} else {
if (params->isEssential()) {
CV_CheckEQ(!K1_.empty() && !K2_.empty(), true, "Intrinsic matrix must not be empty!");
CV_CheckEQ((int)(!K1_.empty() && !K2_.empty()), 1, "Intrinsic matrix must not be empty!");
K1 = K1_.getMat(); K1.convertTo(K1, CV_64F);
K2 = K2_.getMat(); K2.convertTo(K2, CV_64F);
if (! dist_coeff1.empty() || ! dist_coeff2.empty()) {
@ -782,7 +782,7 @@ bool run (const Ptr<const Model> &params, InputArray points1, InputArray points2
std::vector<Ptr<NeighborhoodGraph>> layers;
if (params->getSampler() == SamplingMethod::SAMPLING_PROGRESSIVE_NAPSAC) {
CV_CheckEQ(params->isPnP(), false, "ProgressiveNAPSAC for PnP is not implemented!");
CV_CheckEQ((int)params->isPnP(), 0, "ProgressiveNAPSAC for PnP is not implemented!");
const auto &cell_number_per_layer = params->getGridCellNumber();
layers.reserve(cell_number_per_layer.size());
const auto * const pts = (float *) points.data;

View File

@ -203,14 +203,14 @@ int main(int args, char** argv) {
image_dir = argv[2];
}
std::ifstream file(data_file, std::ios_base::in);
CV_CheckEQ(file.is_open(), true, "Data file is not found!");
CV_CheckEQ((int)file.is_open(), 1, "Data file is not found!");
std::string filename1, filename2;
std::getline(file, filename1);
std::getline(file, filename2);
Mat image1 = imread(image_dir+filename1);
Mat image2 = imread(image_dir+filename2);
CV_CheckEQ(image1.empty(), false, "Image 1 is not found!");
CV_CheckEQ(image2.empty(), false, "Image 2 is not found!");
CV_CheckEQ((int)image1.empty(), 0, "Image 1 is not found!");
CV_CheckEQ((int)image2.empty(), 0, "Image 2 is not found!");
// read calibration
Matx33d K;