1
0
Fork 0
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:
ser1zw 2012-08-20 16:16:45 +09:00
parent 16a30a33e2
commit 2e82111ee0
2 changed files with 7 additions and 1 deletions

View file

@ -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
View 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