mirror of
https://github.com/ruby-opencv/ruby-opencv
synced 2023-03-27 23:22:12 -04:00
fix CvMat#match_descriptors for invalid image array
This commit is contained in:
parent
16a30a33e2
commit
2e82111ee0
2 changed files with 7 additions and 1 deletions
|
@ -5368,7 +5368,7 @@ rb_match_descriptors(int argc, VALUE *argv, VALUE self)
|
|||
cv::Mat queryImage = CVMAT(self);
|
||||
std::vector<cv::Mat> trainImages;
|
||||
for(int i=0; i < RARRAY_LEN(images); i++) {
|
||||
trainImages.push_back(CVMAT(RARRAY_PTR(images)[i]));
|
||||
trainImages.push_back(CVMAT_WITH_CHECK(RARRAY_PTR(images)[i]));
|
||||
}
|
||||
|
||||
cv::Ptr<cv::FeatureDetector> featureDetector = cv::FeatureDetector::create(RSTRING_PTR(detector_type));
|
||||
|
|
6
test/test_cvmat_matching.rb
Normal file → Executable file
6
test/test_cvmat_matching.rb
Normal file → Executable file
|
@ -48,4 +48,10 @@ class TestCvMat_matching < OpenCVTestCase
|
|||
@query.match_descriptors(@images, "SURF", "SURF", "wrong")
|
||||
end
|
||||
end
|
||||
|
||||
def test_match_descriptors_with_invalid_image_array
|
||||
assert_raise TypeError do
|
||||
@query.match_descriptors([DUMMY_OBJ, DUMMY_OBJ])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue