1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 08:13:04 +04:00

Added new data types to cv::Mat & UMat (#23865)

* started working on adding 32u, 64u, 64s, bool and 16bf types to OpenCV

* core & imgproc tests seem to pass

* fixed a few compile errors and test failures on macOS x86

* hopefully fixed some compile problems and test failures

* fixed some more warnings and test failures

* trying to fix small deviations in perf_core & perf_imgproc by revering randf_64f to exact version used before

* trying to fix behavior of the new OpenCV with old plugins; there is (quite strong) assumption that video capture would give us frames with depth == CV_8U (0) or CV_16U (2). If depth is > 7 then it means that the plugin is built with the old OpenCV. It needs to be recompiled, of course and then this hack can be removed.

* try to repair the case when target arch does not have FP64 SIMD

* 1. fixed bug in itoa() found by alalek
2. restored ==, !=, > and < univ. intrinsics on ARM32/ARM64.
This commit is contained in:
Vadim Pisarevsky
2023-08-04 10:50:03 +03:00
committed by GitHub
parent fa91c1445e
commit 518486ed3d
52 changed files with 2363 additions and 859 deletions
@@ -2010,8 +2010,8 @@ double CV_MultiviewCalibrationTest_CPP::calibrateStereoCamera( const vector<vect
img_pts2.copyTo(image_points_all[1][i]);
}
std::vector<Size> image_sizes (2, imageSize);
Mat visibility_mat = Mat_<bool>::ones(2, numImgs);
std::vector<bool> is_fisheye(2, false);
Mat visibility_mat = Mat_<uchar>::ones(2, numImgs);
std::vector<uchar> is_fisheye(2, false);
std::vector<int> all_flags(2, flags);
double rms = calibrateMultiview(objectPoints, image_points_all, image_sizes, visibility_mat,
Rs, Ts, Ks, distortions, rvecs, tvecs, is_fisheye, errors_mat, noArray(), false, all_flags);
+2 -2
View File
@@ -610,9 +610,9 @@ TEST_F(fisheyeTest, multiview_calibration)
right_pts.copyTo(image_points_all[1][i]);
}
std::vector<cv::Size> image_sizes(2, imageSize);
cv::Mat visibility_mat = cv::Mat_<bool>::ones(2, (int)leftPoints.size()), errors_mat, output_pairs;
cv::Mat visibility_mat = cv::Mat_<uchar>::ones(2, (int)leftPoints.size()), errors_mat, output_pairs;
std::vector<cv::Mat> Rs, Ts, Ks, distortions, rvecs0, tvecs0;
std::vector<bool> is_fisheye(2, true);
std::vector<uchar> is_fisheye(2, true);
int flag = 0;
flag |= cv::CALIB_RECOMPUTE_EXTRINSIC;
flag |= cv::CALIB_CHECK_COND;
+5 -5
View File
@@ -65,7 +65,7 @@ TEST(multiview_calibration, accuracy) {
std::vector<std::vector<cv::Vec3f>> objPoints;
std::vector<std::vector<cv::Mat>> image_points_all(num_cameras);
cv::Mat ones = cv::Mat_<float>::ones(1, num_pts);
std::vector<std::vector<bool>> visibility;
std::vector<std::vector<uchar>> visibility;
cv::Mat centroid = cv::Mat(cv::Matx31f(
(float)cv::mean(pattern.row(0)).val[0],
(float)cv::mean(pattern.row(1)).val[0],
@@ -83,7 +83,7 @@ TEST(multiview_calibration, accuracy) {
cv::Mat pattern_new = (R * (pattern - centroid * ones) + centroid * ones + t * ones).t();
std::vector<cv::Mat> img_pts_cams(num_cameras);
std::vector<bool> visible(num_cameras, false);
std::vector<uchar> visible(num_cameras, (uchar)0);
int num_visible_patterns = 0;
for (int c = 0; c < num_cameras; c++) {
cv::Mat img_pts;
@@ -108,7 +108,7 @@ TEST(multiview_calibration, accuracy) {
}
}
if (are_all_pts_in_image) {
visible[c] = true;
visible[c] = 1;
num_visible_patterns += 1;
img_pts.copyTo(img_pts_cams[c]);
}
@@ -124,10 +124,10 @@ TEST(multiview_calibration, accuracy) {
break;
}
}
cv::Mat visibility_mat = cv::Mat_<bool>(num_cameras, (int)objPoints.size());
cv::Mat visibility_mat = cv::Mat_<uchar>(num_cameras, (int)objPoints.size());
for (int c = 0; c < num_cameras; c++) {
for (int f = 0; f < (int)objPoints.size(); f++) {
visibility_mat.at<bool>(c, f) = visibility[f][c];
visibility_mat.at<uchar>(c, f) = visibility[f][c];
}
}