I tried to sort out the objects from the image of the steak set meal-⑤ Similar image feature point detection

Introduction

In I tried to sort out objects from the image of steak set meal-③ Similar image heat map detection, I detected similar images by heat map. However, as another method, I tried to see what the result would be when detecting feature points.

Reference source

-[Calculate image similarity with Python + OpenCV](Calculate image similarity with Python + OpenCV)

Source code

grouping_image2


#!/usr/local/bin/python
# -*- coding: utf-8 -*-

import cv2
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import selectivesearch
import os
import sys

def main():
    # loading lena image
    img = cv2.imread("{Image path}")

    # perform selective search
    img_lbl, regions = selectivesearch.selective_search(
        img,
        scale=500,
        sigma=0.9,
        min_size=10
    )

    candidates = set()

    for r in regions:
        # excluding same rectangle (with different segments)
        if r['rect'] in candidates:
            continue

        # excluding regions smaller than 2000 pixels
        if r['size'] < 2000:
            continue

        # distorted rects
        x, y, w, h = r['rect']

        if w / h > 1.2 or h / w > 1.2:
            continue

        candidates.add(r['rect'])

    # draw rectangles on the original image
    fig, ax = plt.subplots(ncols=1, nrows=1, figsize=(6, 6))
    ax.imshow(img)

    overlaps = {}

    #Count the number of overlaps and assign them to the array.
    for x, y, w, h in candidates:
        group = '%s_%s_%s_%s' % (x, y, w, h)

        for x2, y2, w2, h2 in candidates:
            if x2 - w < x < x2 + w2 and y2 - h < y < y2 + h2:

                if not group in overlaps:
                    overlaps[group] = 0

                overlaps[group] = overlaps[group] + 1

    #Outputs files with 30 or more overlaps (30 is arbitrarily thresholded).
    for key, overlap in enumerate(overlaps):
        if overlap > 30:
            for x, y, w, h in candidates:
                group = '%s_%s_%s_%s' % (x, y, w, h)

                if group in overlaps:
                    cv2.imwrite("{Directory path}" + str(group) + '.jpg', img[y:y + h, x:x + w])

    image_dir = "{Directory path}"
    target_files = os.listdir(image_dir)
    files = os.listdir(image_dir)

    group_images = {}

    for target_file in target_files:
        if target_file == '.DS_Store':
            continue

        #Load the image file.
        target_image_path = image_dir + target_file
        target_image = cv2.imread(target_image_path)

        #Generate feature point data.
        bf = cv2.BFMatcher(cv2.NORM_HAMMING)
        # detector = cv2.AKAZE_create()
        detector = cv2.ORB_create()
        (target_kp, target_des) = detector.detectAndCompute(target_image, None)

        similarity_images = {}

        for file in files:
            if file == '.DS_Store' or file == target_file:
                continue
            try:
                #Load the image file.
                comparing_image_path = image_dir + file
                comparing_image = cv2.imread(comparing_image_path)

                #Generate feature point data.
                (comparing_kp, comparing_des) = detector.detectAndCompute(comparing_image, None)

                #Calculate the distance between feature points to calculate the similarity of images.
                matches = bf.match(target_des, comparing_des)

                #Converts the result to probability notation.
                dist = [m.distance for m in matches]
                probability = sum(dist) / len(dist)
            except cv2.error:
                probability = 100000

            #Outputs the similarity.
            print("target file: " + target_file, "file: " + file, "similarity: " + str(probability))

if __name__ == "__main__":
    main()

result

For ORB

('target file: 0_0_553_419.jpg', 'file: 0_0_599_419.jpg', 'similarity: 10.066')
('target file: 0_0_553_419.jpg', 'file: 137_146_120_74.jpg', 'similarity: 114.752')
('target file: 0_0_553_419.jpg', 'file: 137_45_404_229.jpg', 'similarity: 57.85')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 0_0_553_419.jpg', 'file: 161_184_89_58.jpg', 'similarity: 100000')
('target file: 0_0_553_419.jpg', 'file: 178_121_226_133.jpg', 'similarity: 72.288')
('target file: 0_0_553_419.jpg', 'file: 178_45_363_220.jpg', 'similarity: 60.832')
('target file: 0_0_553_419.jpg', 'file: 178_45_363_229.jpg', 'similarity: 60.274')
('target file: 0_0_553_419.jpg', 'file: 227_285_134_108.jpg', 'similarity: 74.564')
('target file: 0_0_553_419.jpg', 'file: 227_285_135_111.jpg', 'similarity: 73.186')
('target file: 0_0_553_419.jpg', 'file: 229_45_312_220.jpg', 'similarity: 63.454')
('target file: 0_0_553_419.jpg', 'file: 229_49_156_125.jpg', 'similarity: 66.79')
('target file: 0_0_553_419.jpg', 'file: 238_49_147_113.jpg', 'similarity: 69.928')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 0_0_553_419.jpg', 'file: 238_96_63_66.jpg', 'similarity: 100000')
('target file: 0_0_553_419.jpg', 'file: 273_0_326_365.jpg', 'similarity: 59.974')
('target file: 0_0_553_419.jpg', 'file: 273_174_119_91.jpg', 'similarity: 107.31')
('target file: 0_0_553_419.jpg', 'file: 273_8_227_127.jpg', 'similarity: 72.85')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 0_0_553_419.jpg', 'file: 286_208_84_54.jpg', 'similarity: 100000')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 0_0_553_419.jpg', 'file: 286_208_85_55.jpg', 'similarity: 100000')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 0_0_553_419.jpg', 'file: 289_210_81_52.jpg', 'similarity: 100000')
('target file: 0_0_553_419.jpg', 'file: 297_49_88_88.jpg', 'similarity: 89.28')
('target file: 0_0_553_419.jpg', 'file: 301_0_298_268.jpg', 'similarity: 66.55')
('target file: 0_0_553_419.jpg', 'file: 301_0_298_365.jpg', 'similarity: 62.89')
('target file: 0_0_553_419.jpg', 'file: 31_0_100_119.jpg', 'similarity: 84.416')
('target file: 0_0_553_419.jpg', 'file: 31_0_258_143.jpg', 'similarity: 79.114')
('target file: 0_0_553_419.jpg', 'file: 31_0_258_191.jpg', 'similarity: 71.458')
('target file: 0_0_553_419.jpg', 'file: 31_0_529_414.jpg', 'similarity: 18.948')
('target file: 0_0_553_419.jpg', 'file: 31_0_533_416.jpg', 'similarity: 20.062')
('target file: 0_0_553_419.jpg', 'file: 329_45_212_220.jpg', 'similarity: 71.26')
('target file: 0_0_553_419.jpg', 'file: 336_45_205_220.jpg', 'similarity: 71.14')
('target file: 0_0_553_419.jpg', 'file: 379_259_161_122.jpg', 'similarity: 77.456')
('target file: 0_0_553_419.jpg', 'file: 39_112_521_302.jpg', 'similarity: 32.126')
('target file: 0_0_553_419.jpg', 'file: 39_115_521_299.jpg', 'similarity: 32.158')
('target file: 0_0_553_419.jpg', 'file: 405_174_126_94.jpg', 'similarity: 82.138')
('target file: 0_0_553_419.jpg', 'file: 408_303_156_113.jpg', 'similarity: 75.892')
('target file: 0_0_553_419.jpg', 'file: 408_305_156_111.jpg', 'similarity: 75.468')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 0_0_553_419.jpg', 'file: 525_366_74_53.jpg', 'similarity: 100000')
('target file: 0_0_553_419.jpg', 'file: 52_184_224_199.jpg', 'similarity: 57.48')
('target file: 0_0_553_419.jpg', 'file: 52_184_311_211.jpg', 'similarity: 48.768')
('target file: 0_0_553_419.jpg', 'file: 52_230_194_153.jpg', 'similarity: 63.69')
('target file: 0_0_553_419.jpg', 'file: 52_230_224_153.jpg', 'similarity: 62.202')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 0_0_553_419.jpg', 'file: 545_258_54_107.jpg', 'similarity: 100000')
('target file: 0_0_553_419.jpg', 'file: 56_0_200_113.jpg', 'similarity: 83.034')
('target file: 0_0_553_419.jpg', 'file: 56_0_217_116.jpg', 'similarity: 82.33')
('target file: 0_0_553_419.jpg', 'file: 57_245_167_106.jpg', 'similarity: 73.444')
('target file: 0_0_553_419.jpg', 'file: 57_245_167_112.jpg', 'similarity: 71.926')
('target file: 0_0_553_419.jpg', 'file: 57_245_167_134.jpg', 'similarity: 69.264')
('target file: 0_0_553_419.jpg', 'file: 57_45_484_334.jpg', 'similarity: 31.454')
('target file: 0_0_553_419.jpg', 'file: 57_45_496_334.jpg', 'similarity: 30.714')
('target file: 0_0_553_419.jpg', 'file: 59_0_197_113.jpg', 'similarity: 82.358')
('target file: 0_0_553_419.jpg', 'file: 70_268_146_110.jpg', 'similarity: 78.664')
('target file: 0_0_599_419.jpg', 'file: 0_0_553_419.jpg', 'similarity: 10.04')
('target file: 0_0_599_419.jpg', 'file: 137_146_120_74.jpg', 'similarity: 114.648')
('target file: 0_0_599_419.jpg', 'file: 137_45_404_229.jpg', 'similarity: 57.818')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 0_0_599_419.jpg', 'file: 161_184_89_58.jpg', 'similarity: 100000')
('target file: 0_0_599_419.jpg', 'file: 178_121_226_133.jpg', 'similarity: 72.058')
('target file: 0_0_599_419.jpg', 'file: 178_45_363_220.jpg', 'similarity: 60.514')
('target file: 0_0_599_419.jpg', 'file: 178_45_363_229.jpg', 'similarity: 59.968')
('target file: 0_0_599_419.jpg', 'file: 227_285_134_108.jpg', 'similarity: 73.962')
('target file: 0_0_599_419.jpg', 'file: 227_285_135_111.jpg', 'similarity: 72.458')
('target file: 0_0_599_419.jpg', 'file: 229_45_312_220.jpg', 'similarity: 62.952')
('target file: 0_0_599_419.jpg', 'file: 229_49_156_125.jpg', 'similarity: 66.496')
('target file: 0_0_599_419.jpg', 'file: 238_49_147_113.jpg', 'similarity: 69.24')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 0_0_599_419.jpg', 'file: 238_96_63_66.jpg', 'similarity: 100000')
('target file: 0_0_599_419.jpg', 'file: 273_0_326_365.jpg', 'similarity: 57.856')
('target file: 0_0_599_419.jpg', 'file: 273_174_119_91.jpg', 'similarity: 107.078')
('target file: 0_0_599_419.jpg', 'file: 273_8_227_127.jpg', 'similarity: 72.558')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 0_0_599_419.jpg', 'file: 286_208_84_54.jpg', 'similarity: 100000')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 0_0_599_419.jpg', 'file: 286_208_85_55.jpg', 'similarity: 100000')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 0_0_599_419.jpg', 'file: 289_210_81_52.jpg', 'similarity: 100000')
('target file: 0_0_599_419.jpg', 'file: 297_49_88_88.jpg', 'similarity: 88.796')
('target file: 0_0_599_419.jpg', 'file: 301_0_298_268.jpg', 'similarity: 64.96')
('target file: 0_0_599_419.jpg', 'file: 301_0_298_365.jpg', 'similarity: 60.608')
('target file: 0_0_599_419.jpg', 'file: 31_0_100_119.jpg', 'similarity: 84.626')
('target file: 0_0_599_419.jpg', 'file: 31_0_258_143.jpg', 'similarity: 78.84')
('target file: 0_0_599_419.jpg', 'file: 31_0_258_191.jpg', 'similarity: 71.386')
('target file: 0_0_599_419.jpg', 'file: 31_0_529_414.jpg', 'similarity: 20.542')
('target file: 0_0_599_419.jpg', 'file: 31_0_533_416.jpg', 'similarity: 21.168')
('target file: 0_0_599_419.jpg', 'file: 329_45_212_220.jpg', 'similarity: 70.852')
('target file: 0_0_599_419.jpg', 'file: 336_45_205_220.jpg', 'similarity: 70.748')
('target file: 0_0_599_419.jpg', 'file: 379_259_161_122.jpg', 'similarity: 77.396')
('target file: 0_0_599_419.jpg', 'file: 39_112_521_302.jpg', 'similarity: 32.466')
('target file: 0_0_599_419.jpg', 'file: 39_115_521_299.jpg', 'similarity: 32.054')
('target file: 0_0_599_419.jpg', 'file: 405_174_126_94.jpg', 'similarity: 82.374')
('target file: 0_0_599_419.jpg', 'file: 408_303_156_113.jpg', 'similarity: 75.978')
('target file: 0_0_599_419.jpg', 'file: 408_305_156_111.jpg', 'similarity: 75.418')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 0_0_599_419.jpg', 'file: 525_366_74_53.jpg', 'similarity: 100000')
('target file: 0_0_599_419.jpg', 'file: 52_184_224_199.jpg', 'similarity: 57.374')
('target file: 0_0_599_419.jpg', 'file: 52_184_311_211.jpg', 'similarity: 49.128')
('target file: 0_0_599_419.jpg', 'file: 52_230_194_153.jpg', 'similarity: 63.664')
('target file: 0_0_599_419.jpg', 'file: 52_230_224_153.jpg', 'similarity: 62.094')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 0_0_599_419.jpg', 'file: 545_258_54_107.jpg', 'similarity: 100000')
('target file: 0_0_599_419.jpg', 'file: 56_0_200_113.jpg', 'similarity: 82.618')
('target file: 0_0_599_419.jpg', 'file: 56_0_217_116.jpg', 'similarity: 82.058')
('target file: 0_0_599_419.jpg', 'file: 57_245_167_106.jpg', 'similarity: 73.52')
('target file: 0_0_599_419.jpg', 'file: 57_245_167_112.jpg', 'similarity: 71.722')
('target file: 0_0_599_419.jpg', 'file: 57_245_167_134.jpg', 'similarity: 69.116')
('target file: 0_0_599_419.jpg', 'file: 57_45_484_334.jpg', 'similarity: 32.522')
('target file: 0_0_599_419.jpg', 'file: 57_45_496_334.jpg', 'similarity: 31.93')
('target file: 0_0_599_419.jpg', 'file: 59_0_197_113.jpg', 'similarity: 82.124')
('target file: 0_0_599_419.jpg', 'file: 70_268_146_110.jpg', 'similarity: 78.432')
('target file: 137_146_120_74.jpg', 'file: 0_0_553_419.jpg', 'similarity: 0.0')
('target file: 137_146_120_74.jpg', 'file: 0_0_599_419.jpg', 'similarity: 0.0')
('target file: 137_146_120_74.jpg', 'file: 137_45_404_229.jpg', 'similarity: 0.0')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 137_146_120_74.jpg', 'file: 161_184_89_58.jpg', 'similarity: 100000')
('target file: 137_146_120_74.jpg', 'file: 178_121_226_133.jpg', 'similarity: 0.0')
('target file: 137_146_120_74.jpg', 'file: 178_45_363_220.jpg', 'similarity: 0.0')
('target file: 137_146_120_74.jpg', 'file: 178_45_363_229.jpg', 'similarity: 0.0')
('target file: 137_146_120_74.jpg', 'file: 227_285_134_108.jpg', 'similarity: 59.0')
('target file: 137_146_120_74.jpg', 'file: 227_285_135_111.jpg', 'similarity: 54.0')
('target file: 137_146_120_74.jpg', 'file: 229_45_312_220.jpg', 'similarity: 60.0')
('target file: 137_146_120_74.jpg', 'file: 229_49_156_125.jpg', 'similarity: 57.0')
('target file: 137_146_120_74.jpg', 'file: 238_49_147_113.jpg', 'similarity: 72.0')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 137_146_120_74.jpg', 'file: 238_96_63_66.jpg', 'similarity: 100000')
('target file: 137_146_120_74.jpg', 'file: 273_0_326_365.jpg', 'similarity: 65.0')
('target file: 137_146_120_74.jpg', 'file: 273_174_119_91.jpg', 'similarity: 89.0')
('target file: 137_146_120_74.jpg', 'file: 273_8_227_127.jpg', 'similarity: 82.0')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 137_146_120_74.jpg', 'file: 286_208_84_54.jpg', 'similarity: 100000')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 137_146_120_74.jpg', 'file: 286_208_85_55.jpg', 'similarity: 100000')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 137_146_120_74.jpg', 'file: 289_210_81_52.jpg', 'similarity: 100000')
('target file: 137_146_120_74.jpg', 'file: 297_49_88_88.jpg', 'similarity: 72.0')
('target file: 137_146_120_74.jpg', 'file: 301_0_298_268.jpg', 'similarity: 66.0')
('target file: 137_146_120_74.jpg', 'file: 301_0_298_365.jpg', 'similarity: 67.0')
('target file: 137_146_120_74.jpg', 'file: 31_0_100_119.jpg', 'similarity: 71.0')
('target file: 137_146_120_74.jpg', 'file: 31_0_258_143.jpg', 'similarity: 73.0')
('target file: 137_146_120_74.jpg', 'file: 31_0_258_191.jpg', 'similarity: 71.0')
('target file: 137_146_120_74.jpg', 'file: 31_0_529_414.jpg', 'similarity: 0.0')
('target file: 137_146_120_74.jpg', 'file: 31_0_533_416.jpg', 'similarity: 0.0')
('target file: 137_146_120_74.jpg', 'file: 329_45_212_220.jpg', 'similarity: 62.0')
('target file: 137_146_120_74.jpg', 'file: 336_45_205_220.jpg', 'similarity: 62.0')
('target file: 137_146_120_74.jpg', 'file: 379_259_161_122.jpg', 'similarity: 71.0')
('target file: 137_146_120_74.jpg', 'file: 39_112_521_302.jpg', 'similarity: 0.0')
('target file: 137_146_120_74.jpg', 'file: 39_115_521_299.jpg', 'similarity: 0.0')
('target file: 137_146_120_74.jpg', 'file: 405_174_126_94.jpg', 'similarity: 77.0')
('target file: 137_146_120_74.jpg', 'file: 408_303_156_113.jpg', 'similarity: 86.0')
('target file: 137_146_120_74.jpg', 'file: 408_305_156_111.jpg', 'similarity: 85.0')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 137_146_120_74.jpg', 'file: 525_366_74_53.jpg', 'similarity: 100000')
('target file: 137_146_120_74.jpg', 'file: 52_184_224_199.jpg', 'similarity: 65.0')
('target file: 137_146_120_74.jpg', 'file: 52_184_311_211.jpg', 'similarity: 60.0')
('target file: 137_146_120_74.jpg', 'file: 52_230_194_153.jpg', 'similarity: 70.0')
('target file: 137_146_120_74.jpg', 'file: 52_230_224_153.jpg', 'similarity: 70.0')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 137_146_120_74.jpg', 'file: 545_258_54_107.jpg', 'similarity: 100000')
('target file: 137_146_120_74.jpg', 'file: 56_0_200_113.jpg', 'similarity: 68.0')
('target file: 137_146_120_74.jpg', 'file: 56_0_217_116.jpg', 'similarity: 69.0')
('target file: 137_146_120_74.jpg', 'file: 57_245_167_106.jpg', 'similarity: 71.0')
('target file: 137_146_120_74.jpg', 'file: 57_245_167_112.jpg', 'similarity: 71.0')
('target file: 137_146_120_74.jpg', 'file: 57_245_167_134.jpg', 'similarity: 61.0')
('target file: 137_146_120_74.jpg', 'file: 57_45_484_334.jpg', 'similarity: 0.0')
('target file: 137_146_120_74.jpg', 'file: 57_45_496_334.jpg', 'similarity: 0.0')
('target file: 137_146_120_74.jpg', 'file: 59_0_197_113.jpg', 'similarity: 78.0')
('target file: 137_146_120_74.jpg', 'file: 70_268_146_110.jpg', 'similarity: 65.0')
('target file: 137_45_404_229.jpg', 'file: 0_0_553_419.jpg', 'similarity: 56.2456140351')
('target file: 137_45_404_229.jpg', 'file: 0_0_599_419.jpg', 'similarity: 56.298245614')
('target file: 137_45_404_229.jpg', 'file: 137_146_120_74.jpg', 'similarity: 116.833333333')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 137_45_404_229.jpg', 'file: 161_184_89_58.jpg', 'similarity: 100000')
('target file: 137_45_404_229.jpg', 'file: 178_121_226_133.jpg', 'similarity: 70.6513157895')
('target file: 137_45_404_229.jpg', 'file: 178_45_363_220.jpg', 'similarity: 28.8004385965')
('target file: 137_45_404_229.jpg', 'file: 178_45_363_229.jpg', 'similarity: 21.9671052632')
('target file: 137_45_404_229.jpg', 'file: 227_285_134_108.jpg', 'similarity: 80.0021929825')
('target file: 137_45_404_229.jpg', 'file: 227_285_135_111.jpg', 'similarity: 78.4978070175')
('target file: 137_45_404_229.jpg', 'file: 229_45_312_220.jpg', 'similarity: 33.4649122807')
('target file: 137_45_404_229.jpg', 'file: 229_49_156_125.jpg', 'similarity: 65.6907894737')
('target file: 137_45_404_229.jpg', 'file: 238_49_147_113.jpg', 'similarity: 69.0723684211')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 137_45_404_229.jpg', 'file: 238_96_63_66.jpg', 'similarity: 100000')
('target file: 137_45_404_229.jpg', 'file: 273_0_326_365.jpg', 'similarity: 44.8815789474')
('target file: 137_45_404_229.jpg', 'file: 273_174_119_91.jpg', 'similarity: 105.296052632')
('target file: 137_45_404_229.jpg', 'file: 273_8_227_127.jpg', 'similarity: 70.4934210526')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 137_45_404_229.jpg', 'file: 286_208_84_54.jpg', 'similarity: 100000')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 137_45_404_229.jpg', 'file: 286_208_85_55.jpg', 'similarity: 100000')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 137_45_404_229.jpg', 'file: 289_210_81_52.jpg', 'similarity: 100000')
('target file: 137_45_404_229.jpg', 'file: 297_49_88_88.jpg', 'similarity: 90.1622807018')
('target file: 137_45_404_229.jpg', 'file: 301_0_298_268.jpg', 'similarity: 43.5')
('target file: 137_45_404_229.jpg', 'file: 301_0_298_365.jpg', 'similarity: 45.3552631579')
('target file: 137_45_404_229.jpg', 'file: 31_0_100_119.jpg', 'similarity: 84.8530701754')
('target file: 137_45_404_229.jpg', 'file: 31_0_258_143.jpg', 'similarity: 77.9013157895')
('target file: 137_45_404_229.jpg', 'file: 31_0_258_191.jpg', 'similarity: 73.4780701754')
('target file: 137_45_404_229.jpg', 'file: 31_0_529_414.jpg', 'similarity: 54.4583333333')
('target file: 137_45_404_229.jpg', 'file: 31_0_533_416.jpg', 'similarity: 54.9934210526')
('target file: 137_45_404_229.jpg', 'file: 329_45_212_220.jpg', 'similarity: 47.9254385965')
('target file: 137_45_404_229.jpg', 'file: 336_45_205_220.jpg', 'similarity: 49.2609649123')
('target file: 137_45_404_229.jpg', 'file: 379_259_161_122.jpg', 'similarity: 76.2324561404')
('target file: 137_45_404_229.jpg', 'file: 39_112_521_302.jpg', 'similarity: 58.1184210526')
('target file: 137_45_404_229.jpg', 'file: 39_115_521_299.jpg', 'similarity: 58.7565789474')
('target file: 137_45_404_229.jpg', 'file: 405_174_126_94.jpg', 'similarity: 76.0131578947')
('target file: 137_45_404_229.jpg', 'file: 408_303_156_113.jpg', 'similarity: 76.5416666667')
('target file: 137_45_404_229.jpg', 'file: 408_305_156_111.jpg', 'similarity: 76.0592105263')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 137_45_404_229.jpg', 'file: 525_366_74_53.jpg', 'similarity: 100000')
('target file: 137_45_404_229.jpg', 'file: 52_184_224_199.jpg', 'similarity: 69.0285087719')
('target file: 137_45_404_229.jpg', 'file: 52_184_311_211.jpg', 'similarity: 66.6228070175')
('target file: 137_45_404_229.jpg', 'file: 52_230_194_153.jpg', 'similarity: 71.7236842105')
('target file: 137_45_404_229.jpg', 'file: 52_230_224_153.jpg', 'similarity: 70.125')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 137_45_404_229.jpg', 'file: 545_258_54_107.jpg', 'similarity: 100000')
('target file: 137_45_404_229.jpg', 'file: 56_0_200_113.jpg', 'similarity: 82.5307017544')
('target file: 137_45_404_229.jpg', 'file: 56_0_217_116.jpg', 'similarity: 81.9385964912')
('target file: 137_45_404_229.jpg', 'file: 57_245_167_106.jpg', 'similarity: 74.4868421053')
('target file: 137_45_404_229.jpg', 'file: 57_245_167_112.jpg', 'similarity: 73.6162280702')
('target file: 137_45_404_229.jpg', 'file: 57_245_167_134.jpg', 'similarity: 72.1184210526')
('target file: 137_45_404_229.jpg', 'file: 57_45_484_334.jpg', 'similarity: 47.2412280702')
('target file: 137_45_404_229.jpg', 'file: 57_45_496_334.jpg', 'similarity: 47.7478070175')
('target file: 137_45_404_229.jpg', 'file: 59_0_197_113.jpg', 'similarity: 81.8706140351')
('target file: 137_45_404_229.jpg', 'file: 70_268_146_110.jpg', 'similarity: 80.7171052632')
Traceback (most recent call last):
  File "grouping_image2.py", line 159, in <module>
    main()
  File "grouping_image2.py", line 107, in main
    probability = sum(dist) / len(dist)
ZeroDivisionError: integer division or modulo by zero

In the case of AKAZE

('target file: 0_0_553_419.jpg', 'file: 0_0_599_419.jpg', 'similarity: 2.26003824092')
('target file: 0_0_553_419.jpg', 'file: 137_146_120_74.jpg', 'similarity: 206.339388145')
('target file: 0_0_553_419.jpg', 'file: 137_45_404_229.jpg', 'similarity: 82.6625239006')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 0_0_553_419.jpg', 'file: 161_184_89_58.jpg', 'similarity: 100000')
('target file: 0_0_553_419.jpg', 'file: 178_121_226_133.jpg', 'similarity: 147.791586998')
('target file: 0_0_553_419.jpg', 'file: 178_45_363_220.jpg', 'similarity: 89.1338432122')
('target file: 0_0_553_419.jpg', 'file: 178_45_363_229.jpg', 'similarity: 86.3718929254')
('target file: 0_0_553_419.jpg', 'file: 227_285_134_108.jpg', 'similarity: 158.248565966')
('target file: 0_0_553_419.jpg', 'file: 227_285_135_111.jpg', 'similarity: 157.455066922')
('target file: 0_0_553_419.jpg', 'file: 229_45_312_220.jpg', 'similarity: 95.9445506692')
('target file: 0_0_553_419.jpg', 'file: 229_49_156_125.jpg', 'similarity: 142.497131931')
('target file: 0_0_553_419.jpg', 'file: 238_49_147_113.jpg', 'similarity: 145.26959847')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 0_0_553_419.jpg', 'file: 238_96_63_66.jpg', 'similarity: 100000')
('target file: 0_0_553_419.jpg', 'file: 273_0_326_365.jpg', 'similarity: 78.7543021033')
('target file: 0_0_553_419.jpg', 'file: 273_174_119_91.jpg', 'similarity: 195.347036329')
('target file: 0_0_553_419.jpg', 'file: 273_8_227_127.jpg', 'similarity: 132.97418738')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 0_0_553_419.jpg', 'file: 286_208_84_54.jpg', 'similarity: 100000')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 0_0_553_419.jpg', 'file: 286_208_85_55.jpg', 'similarity: 100000')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 0_0_553_419.jpg', 'file: 289_210_81_52.jpg', 'similarity: 100000')
('target file: 0_0_553_419.jpg', 'file: 297_49_88_88.jpg', 'similarity: 175.680688337')
('target file: 0_0_553_419.jpg', 'file: 301_0_298_268.jpg', 'similarity: 95.2007648184')
('target file: 0_0_553_419.jpg', 'file: 301_0_298_365.jpg', 'similarity: 83.5803059273')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 0_0_553_419.jpg', 'file: 31_0_100_119.jpg', 'similarity: 100000')
('target file: 0_0_553_419.jpg', 'file: 31_0_258_143.jpg', 'similarity: 175.152963671')
('target file: 0_0_553_419.jpg', 'file: 31_0_258_191.jpg', 'similarity: 135.792543021')
('target file: 0_0_553_419.jpg', 'file: 31_0_529_414.jpg', 'similarity: 13.2705544933')
('target file: 0_0_553_419.jpg', 'file: 31_0_533_416.jpg', 'similarity: 12.9101338432')
('target file: 0_0_553_419.jpg', 'file: 329_45_212_220.jpg', 'similarity: 109.604206501')
('target file: 0_0_553_419.jpg', 'file: 336_45_205_220.jpg', 'similarity: 111.541108987')
('target file: 0_0_553_419.jpg', 'file: 379_259_161_122.jpg', 'similarity: 153.310707457')
('target file: 0_0_553_419.jpg', 'file: 39_112_521_302.jpg', 'similarity: 54.6357552581')
('target file: 0_0_553_419.jpg', 'file: 39_115_521_299.jpg', 'similarity: 55.6969407266')
('target file: 0_0_553_419.jpg', 'file: 405_174_126_94.jpg', 'similarity: 150.287762906')
('target file: 0_0_553_419.jpg', 'file: 408_303_156_113.jpg', 'similarity: 158.07456979')
('target file: 0_0_553_419.jpg', 'file: 408_305_156_111.jpg', 'similarity: 159.051625239')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 0_0_553_419.jpg', 'file: 525_366_74_53.jpg', 'similarity: 100000')
('target file: 0_0_553_419.jpg', 'file: 52_184_224_199.jpg', 'similarity: 111.787762906')
('target file: 0_0_553_419.jpg', 'file: 52_184_311_211.jpg', 'similarity: 99.9521988528')
('target file: 0_0_553_419.jpg', 'file: 52_230_194_153.jpg', 'similarity: 133.29541109')
('target file: 0_0_553_419.jpg', 'file: 52_230_224_153.jpg', 'similarity: 126.92543021')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 0_0_553_419.jpg', 'file: 545_258_54_107.jpg', 'similarity: 100000')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 0_0_553_419.jpg', 'file: 56_0_200_113.jpg', 'similarity: 100000')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 0_0_553_419.jpg', 'file: 56_0_217_116.jpg', 'similarity: 100000')
('target file: 0_0_553_419.jpg', 'file: 57_245_167_106.jpg', 'similarity: 165.387189293')
('target file: 0_0_553_419.jpg', 'file: 57_245_167_112.jpg', 'similarity: 165.023900574')
('target file: 0_0_553_419.jpg', 'file: 57_245_167_134.jpg', 'similarity: 157.085086042')
('target file: 0_0_553_419.jpg', 'file: 57_45_484_334.jpg', 'similarity: 44.0621414914')
('target file: 0_0_553_419.jpg', 'file: 57_45_496_334.jpg', 'similarity: 42.3288718929')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 0_0_553_419.jpg', 'file: 59_0_197_113.jpg', 'similarity: 100000')
('target file: 0_0_553_419.jpg', 'file: 70_268_146_110.jpg', 'similarity: 189.63001912')
('target file: 0_0_599_419.jpg', 'file: 0_0_553_419.jpg', 'similarity: 7.48818181818')
('target file: 0_0_599_419.jpg', 'file: 137_146_120_74.jpg', 'similarity: 206.030909091')
('target file: 0_0_599_419.jpg', 'file: 137_45_404_229.jpg', 'similarity: 85.08')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 0_0_599_419.jpg', 'file: 161_184_89_58.jpg', 'similarity: 100000')
('target file: 0_0_599_419.jpg', 'file: 178_121_226_133.jpg', 'similarity: 147.759090909')
('target file: 0_0_599_419.jpg', 'file: 178_45_363_220.jpg', 'similarity: 91.2090909091')
('target file: 0_0_599_419.jpg', 'file: 178_45_363_229.jpg', 'similarity: 88.5509090909')
('target file: 0_0_599_419.jpg', 'file: 227_285_134_108.jpg', 'similarity: 157.846363636')
('target file: 0_0_599_419.jpg', 'file: 227_285_135_111.jpg', 'similarity: 157.061818182')
('target file: 0_0_599_419.jpg', 'file: 229_45_312_220.jpg', 'similarity: 97.7390909091')
('target file: 0_0_599_419.jpg', 'file: 229_49_156_125.jpg', 'similarity: 142.54')
('target file: 0_0_599_419.jpg', 'file: 238_49_147_113.jpg', 'similarity: 145.282727273')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 0_0_599_419.jpg', 'file: 238_96_63_66.jpg', 'similarity: 100000')
('target file: 0_0_599_419.jpg', 'file: 273_0_326_365.jpg', 'similarity: 75.7681818182')
('target file: 0_0_599_419.jpg', 'file: 273_174_119_91.jpg', 'similarity: 195.445454545')
('target file: 0_0_599_419.jpg', 'file: 273_8_227_127.jpg', 'similarity: 133.553636364')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 0_0_599_419.jpg', 'file: 286_208_84_54.jpg', 'similarity: 100000')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 0_0_599_419.jpg', 'file: 286_208_85_55.jpg', 'similarity: 100000')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 0_0_599_419.jpg', 'file: 289_210_81_52.jpg', 'similarity: 100000')
('target file: 0_0_599_419.jpg', 'file: 297_49_88_88.jpg', 'similarity: 175.394545455')
('target file: 0_0_599_419.jpg', 'file: 301_0_298_268.jpg', 'similarity: 93.8972727273')
('target file: 0_0_599_419.jpg', 'file: 301_0_298_365.jpg', 'similarity: 80.3890909091')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 0_0_599_419.jpg', 'file: 31_0_100_119.jpg', 'similarity: 100000')
('target file: 0_0_599_419.jpg', 'file: 31_0_258_143.jpg', 'similarity: 175.000909091')
('target file: 0_0_599_419.jpg', 'file: 31_0_258_191.jpg', 'similarity: 136.562727273')
('target file: 0_0_599_419.jpg', 'file: 31_0_529_414.jpg', 'similarity: 16.6936363636')
('target file: 0_0_599_419.jpg', 'file: 31_0_533_416.jpg', 'similarity: 16.3009090909')
('target file: 0_0_599_419.jpg', 'file: 329_45_212_220.jpg', 'similarity: 110.949090909')
('target file: 0_0_599_419.jpg', 'file: 336_45_205_220.jpg', 'similarity: 112.898181818')
('target file: 0_0_599_419.jpg', 'file: 379_259_161_122.jpg', 'similarity: 154.425454545')
('target file: 0_0_599_419.jpg', 'file: 39_112_521_302.jpg', 'similarity: 57.2363636364')
('target file: 0_0_599_419.jpg', 'file: 39_115_521_299.jpg', 'similarity: 58.1736363636')
('target file: 0_0_599_419.jpg', 'file: 405_174_126_94.jpg', 'similarity: 151.476363636')
('target file: 0_0_599_419.jpg', 'file: 408_303_156_113.jpg', 'similarity: 158.858181818')
('target file: 0_0_599_419.jpg', 'file: 408_305_156_111.jpg', 'similarity: 159.827272727')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 0_0_599_419.jpg', 'file: 525_366_74_53.jpg', 'similarity: 100000')
('target file: 0_0_599_419.jpg', 'file: 52_184_224_199.jpg', 'similarity: 112.74')
('target file: 0_0_599_419.jpg', 'file: 52_184_311_211.jpg', 'similarity: 101.282727273')
('target file: 0_0_599_419.jpg', 'file: 52_230_194_153.jpg', 'similarity: 133.879090909')
('target file: 0_0_599_419.jpg', 'file: 52_230_224_153.jpg', 'similarity: 127.479090909')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 0_0_599_419.jpg', 'file: 545_258_54_107.jpg', 'similarity: 100000')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 0_0_599_419.jpg', 'file: 56_0_200_113.jpg', 'similarity: 100000')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 0_0_599_419.jpg', 'file: 56_0_217_116.jpg', 'similarity: 100000')
('target file: 0_0_599_419.jpg', 'file: 57_245_167_106.jpg', 'similarity: 165.609090909')
('target file: 0_0_599_419.jpg', 'file: 57_245_167_112.jpg', 'similarity: 165.373636364')
('target file: 0_0_599_419.jpg', 'file: 57_245_167_134.jpg', 'similarity: 157.214545455')
('target file: 0_0_599_419.jpg', 'file: 57_45_484_334.jpg', 'similarity: 48.1954545455')
('target file: 0_0_599_419.jpg', 'file: 57_45_496_334.jpg', 'similarity: 46.5245454545')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 0_0_599_419.jpg', 'file: 59_0_197_113.jpg', 'similarity: 100000')
('target file: 0_0_599_419.jpg', 'file: 70_268_146_110.jpg', 'similarity: 189.44')
('target file: 137_146_120_74.jpg', 'file: 0_0_553_419.jpg', 'similarity: 76.0')
('target file: 137_146_120_74.jpg', 'file: 0_0_599_419.jpg', 'similarity: 76.0')
('target file: 137_146_120_74.jpg', 'file: 137_45_404_229.jpg', 'similarity: 74.0')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 137_146_120_74.jpg', 'file: 161_184_89_58.jpg', 'similarity: 100000')
('target file: 137_146_120_74.jpg', 'file: 178_121_226_133.jpg', 'similarity: 4.0')
('target file: 137_146_120_74.jpg', 'file: 178_45_363_220.jpg', 'similarity: 2.0')
('target file: 137_146_120_74.jpg', 'file: 178_45_363_229.jpg', 'similarity: 2.0')
('target file: 137_146_120_74.jpg', 'file: 227_285_134_108.jpg', 'similarity: 99.0')
('target file: 137_146_120_74.jpg', 'file: 227_285_135_111.jpg', 'similarity: 99.0')
('target file: 137_146_120_74.jpg', 'file: 229_45_312_220.jpg', 'similarity: 113.0')
('target file: 137_146_120_74.jpg', 'file: 229_49_156_125.jpg', 'similarity: 117.0')
('target file: 137_146_120_74.jpg', 'file: 238_49_147_113.jpg', 'similarity: 141.0')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 137_146_120_74.jpg', 'file: 238_96_63_66.jpg', 'similarity: 100000')
('target file: 137_146_120_74.jpg', 'file: 273_0_326_365.jpg', 'similarity: 98.0')
('target file: 137_146_120_74.jpg', 'file: 273_174_119_91.jpg', 'similarity: 190.0')
('target file: 137_146_120_74.jpg', 'file: 273_8_227_127.jpg', 'similarity: 119.0')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 137_146_120_74.jpg', 'file: 286_208_84_54.jpg', 'similarity: 100000')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 137_146_120_74.jpg', 'file: 286_208_85_55.jpg', 'similarity: 100000')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 137_146_120_74.jpg', 'file: 289_210_81_52.jpg', 'similarity: 100000')
('target file: 137_146_120_74.jpg', 'file: 297_49_88_88.jpg', 'similarity: 144.0')
('target file: 137_146_120_74.jpg', 'file: 301_0_298_268.jpg', 'similarity: 113.0')
('target file: 137_146_120_74.jpg', 'file: 301_0_298_365.jpg', 'similarity: 113.0')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 137_146_120_74.jpg', 'file: 31_0_100_119.jpg', 'similarity: 100000')
('target file: 137_146_120_74.jpg', 'file: 31_0_258_143.jpg', 'similarity: 180.0')
('target file: 137_146_120_74.jpg', 'file: 31_0_258_191.jpg', 'similarity: 134.0')
('target file: 137_146_120_74.jpg', 'file: 31_0_529_414.jpg', 'similarity: 75.0')
('target file: 137_146_120_74.jpg', 'file: 31_0_533_416.jpg', 'similarity: 75.0')
('target file: 137_146_120_74.jpg', 'file: 329_45_212_220.jpg', 'similarity: 104.0')
('target file: 137_146_120_74.jpg', 'file: 336_45_205_220.jpg', 'similarity: 111.0')
('target file: 137_146_120_74.jpg', 'file: 379_259_161_122.jpg', 'similarity: 158.0')
('target file: 137_146_120_74.jpg', 'file: 39_112_521_302.jpg', 'similarity: 75.0')
('target file: 137_146_120_74.jpg', 'file: 39_115_521_299.jpg', 'similarity: 76.0')
('target file: 137_146_120_74.jpg', 'file: 405_174_126_94.jpg', 'similarity: 162.0')
('target file: 137_146_120_74.jpg', 'file: 408_303_156_113.jpg', 'similarity: 168.0')
('target file: 137_146_120_74.jpg', 'file: 408_305_156_111.jpg', 'similarity: 169.0')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 137_146_120_74.jpg', 'file: 525_366_74_53.jpg', 'similarity: 100000')
('target file: 137_146_120_74.jpg', 'file: 52_184_224_199.jpg', 'similarity: 134.0')
('target file: 137_146_120_74.jpg', 'file: 52_184_311_211.jpg', 'similarity: 98.0')
('target file: 137_146_120_74.jpg', 'file: 52_230_194_153.jpg', 'similarity: 149.0')
('target file: 137_146_120_74.jpg', 'file: 52_230_224_153.jpg', 'similarity: 149.0')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 137_146_120_74.jpg', 'file: 545_258_54_107.jpg', 'similarity: 100000')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 137_146_120_74.jpg', 'file: 56_0_200_113.jpg', 'similarity: 100000')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 137_146_120_74.jpg', 'file: 56_0_217_116.jpg', 'similarity: 100000')
('target file: 137_146_120_74.jpg', 'file: 57_245_167_106.jpg', 'similarity: 156.0')
('target file: 137_146_120_74.jpg', 'file: 57_245_167_112.jpg', 'similarity: 156.0')
('target file: 137_146_120_74.jpg', 'file: 57_245_167_134.jpg', 'similarity: 156.0')
('target file: 137_146_120_74.jpg', 'file: 57_45_484_334.jpg', 'similarity: 74.0')
('target file: 137_146_120_74.jpg', 'file: 57_45_496_334.jpg', 'similarity: 74.0')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 137_146_120_74.jpg', 'file: 59_0_197_113.jpg', 'similarity: 100000')
('target file: 137_146_120_74.jpg', 'file: 70_268_146_110.jpg', 'similarity: 191.0')
('target file: 137_45_404_229.jpg', 'file: 0_0_553_419.jpg', 'similarity: 13.8429003021')
('target file: 137_45_404_229.jpg', 'file: 0_0_599_419.jpg', 'similarity: 14.3716012085')
('target file: 137_45_404_229.jpg', 'file: 137_146_120_74.jpg', 'similarity: 204.468277946')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 137_45_404_229.jpg', 'file: 161_184_89_58.jpg', 'similarity: 100000')
('target file: 137_45_404_229.jpg', 'file: 178_121_226_133.jpg', 'similarity: 141.978851964')
('target file: 137_45_404_229.jpg', 'file: 178_45_363_220.jpg', 'similarity: 25.5438066465')
('target file: 137_45_404_229.jpg', 'file: 178_45_363_229.jpg', 'similarity: 19.8972809668')
('target file: 137_45_404_229.jpg', 'file: 227_285_134_108.jpg', 'similarity: 159.196374622')
('target file: 137_45_404_229.jpg', 'file: 227_285_135_111.jpg', 'similarity: 158.528700906')
('target file: 137_45_404_229.jpg', 'file: 229_45_312_220.jpg', 'similarity: 41.6314199396')
('target file: 137_45_404_229.jpg', 'file: 229_49_156_125.jpg', 'similarity: 134.432024169')
('target file: 137_45_404_229.jpg', 'file: 238_49_147_113.jpg', 'similarity: 139.870090634')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 137_45_404_229.jpg', 'file: 238_96_63_66.jpg', 'similarity: 100000')
('target file: 137_45_404_229.jpg', 'file: 273_0_326_365.jpg', 'similarity: 53.2719033233')
('target file: 137_45_404_229.jpg', 'file: 273_174_119_91.jpg', 'similarity: 198.299093656')
('target file: 137_45_404_229.jpg', 'file: 273_8_227_127.jpg', 'similarity: 129.939577039')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 137_45_404_229.jpg', 'file: 286_208_84_54.jpg', 'similarity: 100000')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 137_45_404_229.jpg', 'file: 286_208_85_55.jpg', 'similarity: 100000')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 137_45_404_229.jpg', 'file: 289_210_81_52.jpg', 'similarity: 100000')
('target file: 137_45_404_229.jpg', 'file: 297_49_88_88.jpg', 'similarity: 175.598187311')
('target file: 137_45_404_229.jpg', 'file: 301_0_298_268.jpg', 'similarity: 63.3867069486')
('target file: 137_45_404_229.jpg', 'file: 301_0_298_365.jpg', 'similarity: 60.3141993958')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 137_45_404_229.jpg', 'file: 31_0_100_119.jpg', 'similarity: 100000')
('target file: 137_45_404_229.jpg', 'file: 31_0_258_143.jpg', 'similarity: 175.425981873')
('target file: 137_45_404_229.jpg', 'file: 31_0_258_191.jpg', 'similarity: 140.504531722')
('target file: 137_45_404_229.jpg', 'file: 31_0_529_414.jpg', 'similarity: 12.9818731118')
('target file: 137_45_404_229.jpg', 'file: 31_0_533_416.jpg', 'similarity: 12.9093655589')
('target file: 137_45_404_229.jpg', 'file: 329_45_212_220.jpg', 'similarity: 71.9063444109')
('target file: 137_45_404_229.jpg', 'file: 336_45_205_220.jpg', 'similarity: 78.6616314199')
('target file: 137_45_404_229.jpg', 'file: 379_259_161_122.jpg', 'similarity: 159.262839879')
('target file: 137_45_404_229.jpg', 'file: 39_112_521_302.jpg', 'similarity: 81.9637462236')
('target file: 137_45_404_229.jpg', 'file: 39_115_521_299.jpg', 'similarity: 83.8851963746')
('target file: 137_45_404_229.jpg', 'file: 405_174_126_94.jpg', 'similarity: 155.719033233')
('target file: 137_45_404_229.jpg', 'file: 408_303_156_113.jpg', 'similarity: 164.120845921')
('target file: 137_45_404_229.jpg', 'file: 408_305_156_111.jpg', 'similarity: 165.49244713')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 137_45_404_229.jpg', 'file: 525_366_74_53.jpg', 'similarity: 100000')
('target file: 137_45_404_229.jpg', 'file: 52_184_224_199.jpg', 'similarity: 126.374622356')
('target file: 137_45_404_229.jpg', 'file: 52_184_311_211.jpg', 'similarity: 120.47734139')
('target file: 137_45_404_229.jpg', 'file: 52_230_194_153.jpg', 'similarity: 140.625377644')
('target file: 137_45_404_229.jpg', 'file: 52_230_224_153.jpg', 'similarity: 137.474320242')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 137_45_404_229.jpg', 'file: 545_258_54_107.jpg', 'similarity: 100000')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 137_45_404_229.jpg', 'file: 56_0_200_113.jpg', 'similarity: 100000')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 137_45_404_229.jpg', 'file: 56_0_217_116.jpg', 'similarity: 100000')
('target file: 137_45_404_229.jpg', 'file: 57_245_167_106.jpg', 'similarity: 168.785498489')
('target file: 137_45_404_229.jpg', 'file: 57_245_167_112.jpg', 'similarity: 168.054380665')
('target file: 137_45_404_229.jpg', 'file: 57_245_167_134.jpg', 'similarity: 159.80060423')
('target file: 137_45_404_229.jpg', 'file: 57_45_484_334.jpg', 'similarity: 5.14501510574')
('target file: 137_45_404_229.jpg', 'file: 57_45_496_334.jpg', 'similarity: 5.58006042296')
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/stat.cpp, line 3934
('target file: 137_45_404_229.jpg', 'file: 59_0_197_113.jpg', 'similarity: 100000')
('target file: 137_45_404_229.jpg', 'file: 70_268_146_110.jpg', 'similarity: 189.975830816')
Traceback (most recent call last):
  File "grouping_image2.py", line 159, in <module>
    main()
  File "grouping_image2.py", line 107, in main
    probability = sum(dist) / len(dist)
ZeroDivisionError: integer division or modulo by zero

Summary

――The closer it is to 0, the higher the similarity. ――The result is not good compared to the histogram. --Sometimes an error occurs when reading an image. ――This detection seems to be similar to the distance of the feature points, so I resized the image size, but it didn't work.

All page links

-I tried object detection using Python and OpenCV -I tried to sort out objects from the image of steak set meal-① Object detection -I tried to sort out the objects from the image of the steak set meal-② Overlap number sorting -I tried to sort out the objects from the image of the steak set meal-③ Similar image heat map detection -I tried to sort out the objects from the image of the steak set meal-④ Clustering -I tried to sort out objects from the image of steak set meal-⑤ Similar image feature point detection edition

Recommended Posts

I tried to sort out the objects from the image of the steak set meal-⑤ Similar image feature point detection
I tried to sort out the objects from the image of the steak set meal-① Object detection
I tried to sort out the objects from the image of the steak set meal-② Overlap number sorting
I tried to cut out a still image from the video
I tried to correct the keystone of the image
I tried to detect the iris from the camera image
I tried to find the entropy of the image with python
I tried to transform the face image using sparse_image_warp of TensorFlow Addons
I tried to touch the API of ebay
Change the decimal point of logging from, to.
I tried to predict the number of people infected with coronavirus in consideration of the effect of refraining from going out
I tried to automate the face hiding work of the coordination image for wear
I tried to predict the price of ETF
I tried to vectorize the lyrics of Hinatazaka46!
I tried to put out the frequent word ranking of LINE talk with Python
I tried to extract the text in the image file using Tesseract of the OCR engine
I tried to summarize the basic form of GPLVM
I tried to visualize the spacha information of VTuber
I tried to classify the voices of voice actors
I tried to compress the image using machine learning
I tried to summarize the string operations of Python
I want to cut out only the face from a person image with Python and save it ~ Face detection and trimming with face_recognition ~
I tried to display the point cloud data DB of Shizuoka prefecture with Vue + Leaflet
Implementation of recommendation system ~ I tried to find the similarity from the outline of the movie using TF-IDF ~
I tried using PI Fu to generate a 3D model of a person from one image
I tried to find the trend of the number of ships in Tokyo Bay from satellite images.
I tried to find out the outline about Big Gorilla
I tried "gamma correction" of the image with Python + OpenCV
I tried to get the location information of Odakyu Bus
I tried to find the average of the sequence with TensorFlow
[Python] I tried to visualize the follow relationship of Twitter
[Machine learning] I tried to summarize the theory of Adaboost
I tried to fight the Local Minimum of Goldstein-Price Function
I tried changing the python script from 2.7.11 to 3.6.0 on windows10
I tried to get various information from the codeforces API
[Linux] I tried to summarize the command of resource confirmation system
I tried to get the index of the list using the enumerate function
I tried to automate the watering of the planter with Raspberry Pi
[Python] Try to graph from the image of Ring Fit [OCR]
I tried to process the image in "sketch style" with OpenCV
I tried to process the image in "pencil style" with OpenCV
I tried to expand the size of the logical volume with LVM
I tried to summarize the frequently used implementation method of pytest-mock
I tried to improve the efficiency of daily work with Python
I tried to visualize the common condition of VTuber channel viewers
[Python] I tried to reproduce the emergency escape program to return from the world to return from the modified world of "The disappearance of Haruhi Suzumiya"
I tried to deliver mail from Node.js and Python using the mail delivery service (SendGrid) of IBM Cloud!
I tried to move the ball
I tried to estimate the interval.
[Python] I tried to summarize the set type (set) in an easy-to-understand manner.
I tried to execute SQL from the local environment using Looker SDK
I tried moving the image to the specified folder by right-clicking and left-clicking
I tried to visualize the age group and rate distribution of Atcoder
I tried transcribing the news of the example business integration to Amazon Transcribe
I tried calling the prediction API of the machine learning model from WordPress
zoom I tried to quantify the degree of excitement of the story at the meeting
I tried to estimate the similarity of the question intent using gensim's Doc2Vec
I tried how to improve the accuracy of my own Neural Network
I tried to solve the 2020 version of 100 language processing [Chapter 3: Regular expressions 25-29]
I tried to get the authentication code of Qiita API with Python.
I want to sort a list in the order of other lists