1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

Merge branch 4.x

This commit is contained in:
Alexander Smorkalov
2025-02-05 09:28:27 +03:00
180 changed files with 11419 additions and 1819 deletions
+2 -2
View File
@@ -534,8 +534,8 @@ void cv::fisheye::initUndistortRectifyMap( InputArray K, InputArray D, InputArra
if( m1type == CV_16SC2 )
{
int iu = cv::saturate_cast<int>(u*cv::INTER_TAB_SIZE);
int iv = cv::saturate_cast<int>(v*cv::INTER_TAB_SIZE);
int iu = cv::saturate_cast<int>(u*static_cast<double>(cv::INTER_TAB_SIZE));
int iv = cv::saturate_cast<int>(v*static_cast<double>(cv::INTER_TAB_SIZE));
m1[j*2+0] = (short)(iu >> cv::INTER_BITS);
m1[j*2+1] = (short)(iv >> cv::INTER_BITS);
m2[j] = (ushort)((iv & (cv::INTER_TAB_SIZE-1))*cv::INTER_TAB_SIZE + (iu & (cv::INTER_TAB_SIZE-1)));
+15
View File
@@ -353,6 +353,11 @@ Mat findHomography( InputArray _points1, InputArray _points2,
if( result && npoints > 4 && method != RHO)
{
// save the original points before compressing
const int npoints_input = npoints;
const Mat src_input = src.clone();
const Mat dst_input = dst.clone();
compressElems( src.ptr<Point2f>(), tempMask.ptr<uchar>(), 1, npoints );
npoints = compressElems( dst.ptr<Point2f>(), tempMask.ptr<uchar>(), 1, npoints );
if( npoints > 0 )
@@ -414,6 +419,16 @@ Mat findHomography( InputArray _points1, InputArray _points2,
.setGeodesic(true));
solver.optimize();
H.convertTo(H, H.type(), scaleFor(H.at<double>(2, 2)));
// find new inliers
const float thr_sqr = static_cast<float>(ransacReprojThreshold * ransacReprojThreshold);
cv::Mat errors;
cb->computeError(src_input, dst_input, H, errors);
uchar* maskptr = tempMask.ptr<uchar>();
const float * const errors_ptr = errors.ptr<float>();
for (int i = 0; i < npoints_input; i++) {
maskptr[i] = static_cast<uchar>(errors_ptr[i] <= thr_sqr);
}
}
}
+2 -2
View File
@@ -259,8 +259,8 @@ public:
double v = fy*invProj*vecTilt(1) + v0;
if( m1type == CV_16SC2 )
{
int iu = saturate_cast<int>(u*INTER_TAB_SIZE);
int iv = saturate_cast<int>(v*INTER_TAB_SIZE);
int iu = saturate_cast<int>(u*static_cast<double>(INTER_TAB_SIZE));
int iv = saturate_cast<int>(v*static_cast<double>(INTER_TAB_SIZE));
m1[j*2] = (short)(iu >> INTER_BITS);
m1[j*2+1] = (short)(iv >> INTER_BITS);
m2[j] = (ushort)((iv & (INTER_TAB_SIZE-1))*INTER_TAB_SIZE + (iu & (INTER_TAB_SIZE-1)));