diff --git a/examples/matching_to_many_images.rb b/examples/matching_to_many_images.rb index 0fef936..b96b652 100644 --- a/examples/matching_to_many_images.rb +++ b/examples/matching_to_many_images.rb @@ -11,6 +11,6 @@ images = image_files.map{|f| IplImage.load f, CV_LOAD_IMAGE_GRAYSCALE} matchs = query.match_descriptors("SURF", "SURF", "FlannBased", images) -match, count = matchs.max_by {|image, count| count} +match_index, count = matchs.max_by {|image_index, count| count} -puts "max match: #{image_files[images.index(match)]}" +puts "max match: #{image_files[match_index]}" diff --git a/ext/opencv/cvmat.cpp b/ext/opencv/cvmat.cpp index 387b193..621725e 100644 --- a/ext/opencv/cvmat.cpp +++ b/ext/opencv/cvmat.cpp @@ -5336,7 +5336,7 @@ rb_match_shapes(int argc, VALUE *argv, VALUE self) * match_descriptors(detector_type, descriptor_type, matcher_type, images) -> Hash * * Matching descriptors detected on one image to descriptors detected in image set. - * Returns a Hash contains match count of each image. + * Returns a Hash contains match count of each image index. * * detector_type is a string, options: "SURF" * descriptor_type is a string, options: "SURF" @@ -5377,7 +5377,7 @@ rb_match_descriptors(int argc, VALUE *argv, VALUE self) VALUE _matches = rb_hash_new(); for (size_t i=0; i