Commit 96b38d4a authored by Alexander Alekhin's avatar Alexander Alekhin

Merge remote-tracking branch 'upstream/3.4' into merge-3.4

parents 03730e1e 5d2cf95a
...@@ -445,8 +445,13 @@ bool CustomPattern::findRtRANSAC(InputArray objectPoints, InputArray imagePoints ...@@ -445,8 +445,13 @@ bool CustomPattern::findRtRANSAC(InputArray objectPoints, InputArray imagePoints
InputOutputArray rvec, InputOutputArray tvec, bool useExtrinsicGuess, int iterationsCount, InputOutputArray rvec, InputOutputArray tvec, bool useExtrinsicGuess, int iterationsCount,
float reprojectionError, int minInliersCount, OutputArray inliers, int flags) float reprojectionError, int minInliersCount, OutputArray inliers, int flags)
{ {
int npoints = imagePoints.getMat().checkVector(2);
CV_Assert(npoints > 0);
double confidence_factor = (double)minInliersCount / (double)npoints;
double confidence = confidence_factor < 0.001 ? 0.001 : confidence_factor > 0.999 ? 0.999 : confidence_factor;
solvePnPRansac(objectPoints, imagePoints, cameraMatrix, distCoeffs, rvec, tvec, useExtrinsicGuess, solvePnPRansac(objectPoints, imagePoints, cameraMatrix, distCoeffs, rvec, tvec, useExtrinsicGuess,
iterationsCount, reprojectionError, minInliersCount, inliers, flags); iterationsCount, reprojectionError, confidence, inliers, flags);
return true; // for consistency with the other methods return true; // for consistency with the other methods
} }
...@@ -459,8 +464,12 @@ bool CustomPattern::findRtRANSAC(InputArray image, InputArray cameraMatrix, Inpu ...@@ -459,8 +464,12 @@ bool CustomPattern::findRtRANSAC(InputArray image, InputArray cameraMatrix, Inpu
if (!findPattern(image, imagePoints, objectPoints)) if (!findPattern(image, imagePoints, objectPoints))
return false; return false;
double confidence_factor = (double)minInliersCount / (double)imagePoints.size();
double confidence = confidence_factor < 0.001 ? 0.001 : confidence_factor > 0.999 ? 0.999 : confidence_factor;
solvePnPRansac(objectPoints, imagePoints, cameraMatrix, distCoeffs, rvec, tvec, useExtrinsicGuess, solvePnPRansac(objectPoints, imagePoints, cameraMatrix, distCoeffs, rvec, tvec, useExtrinsicGuess,
iterationsCount, reprojectionError, minInliersCount, inliers, flags); iterationsCount, reprojectionError, confidence, inliers, flags);
return true; return true;
} }
......
...@@ -245,7 +245,7 @@ bool FacemarkKazemiImpl :: buildRegtree(regtree& tree,vector<training_sample>& s ...@@ -245,7 +245,7 @@ bool FacemarkKazemiImpl :: buildRegtree(regtree& tree,vector<training_sample>& s
while(!curr.empty()){ while(!curr.empty()){
pair<long,long> range= make_pair(curr.front().index1,curr.front().index2); pair<long,long> range= make_pair(curr.front().index1,curr.front().index2);
long node_no = curr.front().node_no; long node_no = curr.front().node_no;
splitr split; splitr split = {0, 0, 0};
//generate a split //generate a split
if(node_no<=numSplitNodes){ if(node_no<=numSplitNodes){
if(generateSplit(curr,pixel_coordinates,samples,split,sum)){ if(generateSplit(curr,pixel_coordinates,samples,split,sum)){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment