Example #1
0
    def search(self, dst_thum, debug=False):
        phash_list = self.match(dst_thum, self.phash, phash, hamming)
        ohash_list = self.match(dst_thum, self.ohash, otsu_hash, hamming)
        ohash_list2 = self.match(dst_thum, self.ohash2, otsu_hash2, hamming)
        hash_list = blending([
            (phash_list, 1),
            (ohash_list, 1),
            (ohash_list2, 1),
        ], 1, 6)

        ghisto_list = self.match(dst_thum, self.grayhisto, gray_histo,
                                 abs_dist)
        rhisto_list = self.match(dst_thum, self.rgbhisto, rgb_histo, abs_dist)
        yhisto_list = self.match(dst_thum, self.yuvhisto, yuv_histo, abs_dist)
        hhisto_list = self.match(dst_thum, self.hsvhisto, hsv_histo, abs_dist)
        histo_list = blending([
            (ghisto_list, 4),
            (rhisto_list, 1),
            (yhisto_list, 1),
            (hhisto_list, 1),
        ], 5, 2)
        histo_list2 = ensembling([
            (ghisto_list, 3),
            (rhisto_list, 1),
            (yhisto_list, 1),
            (hhisto_list, 1),
        ], 5, 6)

        gist_list = self.match(dst_thum, self.gist, gist, eculidean_dist)
        texture_list = blending([
            (gist_list, 1),
        ], 5, 0.8)

        if debug:
            return [
                ('duplicate images', hash_list),
                ('gray', ghisto_list),
                ('rgb', rhisto_list),
                ('hsv', hhisto_list),
                ('yuv', yhisto_list),
                ('similar images (color histogram)', histo_list),
                ('similar images (texture)', texture_list),
            ]
        else:
            return [
                ('duplicate images', hash_list),
                ('similar images (color histogram)', histo_list),
                ('similar images (texture)', texture_list),
            ]
Example #2
0
 def search(self, dst_thum, debug=False):
     hog_list = self.match(dst_thum, self.hog_index, hog3, LSH_hog,
                           eculidean_dist)
     #hog_list2 = self.match2(dst_thum, self.hog_index, hog3, LSH_hog, eculidean_dist)
     sift_list = self.match(dst_thum, self.sift_index, sift2, LSH_sift,
                            eculidean_dist)
     #sift_list2 = self.match2(dst_thum, self.sift_index, sift2, LSH_sift, eculidean_dist)
     local_list = blending([
         (hog_list, 0.8),
         (sift_list, 1),
     ], 5, 2)
     local_list2 = ensembling([
         (hog_list, 1),
         (sift_list, 1),
     ], 5, 2)
     if debug:
         return [
             ('hog lsh', hog_list),
             ('sift lsh', sift_list),
             ('similar images (local similarity)', local_list),
             ('local ensembing', local_list2),
         ]
     else:
         return [
             ('similar images (local similarity)', local_list),
         ]
Example #3
0
    def search(self, dst_thum, debug=False):
        phash_list = self.match(dst_thum, self.phash, phash, hamming)
        ohash_list = self.match(dst_thum, self.ohash, otsu_hash, hamming)
        ohash_list2 = self.match(dst_thum, self.ohash2, otsu_hash2, hamming)
        hash_list = blending([(phash_list, 1), 
                              (ohash_list, 1),
                              (ohash_list2, 1),
                              ], 1, 6)

        ghisto_list = self.match(dst_thum, self.grayhisto, gray_histo, abs_dist)
        rhisto_list = self.match(dst_thum, self.rgbhisto, rgb_histo, abs_dist)
        yhisto_list = self.match(dst_thum, self.yuvhisto, yuv_histo, abs_dist)
        hhisto_list = self.match(dst_thum, self.hsvhisto, hsv_histo, abs_dist)
        histo_list = blending([(ghisto_list, 4),
                               (rhisto_list, 1),
                               (yhisto_list, 1),
                               (hhisto_list, 1),
                               ], 5, 2)
        histo_list2 = ensembling([(ghisto_list, 3),
                               (rhisto_list, 1),
                               (yhisto_list, 1),
                               (hhisto_list, 1),
                               ], 5, 6)

        gist_list = self.match(dst_thum, self.gist, gist, eculidean_dist)
        texture_list = blending([(gist_list, 1),
                                 ], 5, 0.8)

        if debug:
            return [('duplicate images', hash_list), 
                ('gray', ghisto_list),
                ('rgb', rhisto_list),
                ('hsv', hhisto_list),
                ('yuv', yhisto_list),
                ('similar images (color histogram)', histo_list), 
                ('similar images (texture)', texture_list),
                ]
        else:
            return [('duplicate images', hash_list), 
                ('similar images (color histogram)', histo_list), 
                ('similar images (texture)', texture_list),
                ]
 def search(self, dst_thum, debug=False):
     hog_list = self.match(dst_thum, self.hog_index, hog3, LSH_hog, eculidean_dist)
     #hog_list2 = self.match2(dst_thum, self.hog_index, hog3, LSH_hog, eculidean_dist)
     sift_list = self.match(dst_thum, self.sift_index, sift2, LSH_sift, eculidean_dist)
     #sift_list2 = self.match2(dst_thum, self.sift_index, sift2, LSH_sift, eculidean_dist)
     local_list = blending([(hog_list, 0.8),
                            (sift_list, 1),
                            ], 5, 2)
     local_list2 = ensembling([(hog_list, 1),
                            (sift_list, 1),
                            ], 5, 2)
     if debug:
         return [
             ('hog lsh', hog_list),
             ('sift lsh', sift_list),
             ('similar images (local similarity)', local_list),
             ('local ensembing', local_list2),
             ]
     else:
         return [
             ('similar images (local similarity)', local_list),
             ]