-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
Closed
Labels
Milestone
Description
System Information
OS: Any
Branch: 4.x, 5.x affected too
Detailed description
I fill ORB features mask with 255 and 1 in ROI. The ORB produce different results for the two cases.
Steps to reproduce
TEST(Features2D_ORB, MaskValue)
{
Mat gray = imread(cvtest::findDataFile("features2d/tsukuba.png"), IMREAD_GRAYSCALE);
ASSERT_FALSE(gray.empty());
cv::Rect roi(gray.cols/4, gray.rows/4, gray.cols/2, gray.rows/2);
Mat mask255 = Mat::zeros(gray.size(), CV_8UC1);
mask255(roi).setTo(255);
Mat mask1 = Mat::zeros(gray.size(), CV_8UC1);
mask1(roi).setTo(1);
Ptr<ORB> orb = cv::ORB::create();
vector<KeyPoint> keypoints_mask255;
Mat descriptors_mask255;
orb->detectAndCompute(gray, mask255, keypoints_mask255, descriptors_mask255, false);
std::cout << "keypoints_mask255.size(): " << keypoints_mask255.size() << std::endl;
std::cout << "descriptors_mask255.size(): " << descriptors_mask255.size() << std::endl;
vector<KeyPoint> keypoints_mask1;
Mat descriptors_mask1;
orb->detectAndCompute(gray, mask1, keypoints_mask1, descriptors_mask1, false);
std::cout << "keypoints_mask1.size(): " << keypoints_mask1.size() << std::endl;
std::cout << "descriptors_mask1.size(): " << descriptors_mask1.size() << std::endl;
Mat diff = descriptors_mask1 != descriptors_mask255;
ASSERT_EQ(countNonZero(diff), 0) << "descriptors are not identical";
}
Log:
[ RUN ] Features2D_ORB.MaskValue
keypoints_mask255.size(): 496
descriptors_mask255.size(): [32 x 496]
keypoints_mask1.size(): 109
descriptors_mask1.size(): [32 x 109]
unknown file: Failure
C++ exception with description "OpenCV(4.10.0-dev) /home/alexander/Projects/OpenCV/opencv-master/modules/core/src/arithm.cpp:1345: error: (-209:Sizes of input arguments do not match) The operation is neither 'array op array' (where arrays have the same size and the same type), nor 'array op scalar', nor 'scalar op array' in function 'compare'
" thrown in the test body.
[ FAILED ] Features2D_ORB.MaskValue (15 ms)
[----------] 1 test from Features2D_ORB (15 ms total)
[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (15 ms total)
[ PASSED ] 0 tests.
[ FAILED ] 1 test, listed below:
[ FAILED ] Features2D_ORB.MaskValue
Issue submission checklist
- I report the issue, it's not a question
- I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
- I updated to the latest OpenCV version and the issue is still there
- There is reproducer code and related data files (videos, images, onnx, etc)
Reactions are currently unavailable