How to use the imagehash.dhash_vertical function in ImageHash

To help you get started, we’ve selected a few ImageHash examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CIRCL / douglas-quaid / carlhauser_server / FeatureExtractor / picture_hasher.py View on Github external
# Note : @image must be a PIL instance.
            if self.fe_conf.A_HASH.get("is_enabled", False):
                self.logger.debug("A-HASH ... ")
                answer["A_HASH"] = self.check_null_hash(imagehash.average_hash(pil_picture))
            if self.fe_conf.P_HASH.get("is_enabled", False):
                self.logger.debug("P_HASH ... ")
                answer["P_HASH"] = self.check_null_hash(imagehash.phash(pil_picture))
            if self.fe_conf.P_HASH_SIMPLE.get("is_enabled", False):
                self.logger.debug("P_HASH_SIMPLE ... ")
                answer["P_HASH_SIMPLE"] = self.check_null_hash(imagehash.phash_simple(pil_picture))
            if self.fe_conf.D_HASH.get("is_enabled", False):
                self.logger.debug("D_HASH ... ")
                answer["D_HASH"] = self.check_null_hash(imagehash.dhash(pil_picture))
            if self.fe_conf.D_HASH_VERTICAL.get("is_enabled", False):
                self.logger.debug("D_HASH_VERTICAL ... ")
                answer["D_HASH_VERTICAL"] = self.check_null_hash(imagehash.dhash_vertical(pil_picture))
            if self.fe_conf.W_HASH.get("is_enabled", False):
                self.logger.debug("W_HASH ... ")
                answer["W_HASH"] = self.check_null_hash(imagehash.whash(pil_picture))
            if self.fe_conf.TLSH.get("is_enabled", False):
                self.logger.debug("TLSH ... ")
                answer["TLSH"] = self.check_null_hash(tlsh.hash(curr_picture))

        except Exception as e:
            self.logger.error("Error during hashing : " + str(e))

        return answer

ImageHash

Image Hashing library

BSD-2-Clause
Latest version published 2 years ago

Package Health Score

55 / 100
Full package analysis

Similar packages