{"id":20366739,"url":"https://github.com/kapilyadav-dev/phasher","last_synced_at":"2025-04-12T05:11:31.991Z","repository":{"id":58459521,"uuid":"531987827","full_name":"KapilYadav-dev/Phasher","owner":"KapilYadav-dev","description":"A perceptual hash is a fingerprint of a multimedia file derived from various features from its content. Unlike cryptographic hash functions which rely on the avalanche effect of small changes in input leading to drastic changes in the output, perceptual hashes are \"close\" to one another if the features are similar.","archived":false,"fork":false,"pushed_at":"2022-09-28T09:16:21.000Z","size":273,"stargazers_count":28,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-26T00:41:26.300Z","etag":null,"topics":["android","androidlibrary","image","imageprocessing","imagesimilarity","javaphash","kotlin","kotlinphash","phash","phash-similarity","similarity-score"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KapilYadav-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-09-02T15:49:06.000Z","updated_at":"2025-01-21T02:22:33.000Z","dependencies_parsed_at":"2023-01-18T23:31:03.669Z","dependency_job_id":null,"html_url":"https://github.com/KapilYadav-dev/Phasher","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KapilYadav-dev%2FPhasher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KapilYadav-dev%2FPhasher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KapilYadav-dev%2FPhasher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KapilYadav-dev%2FPhasher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KapilYadav-dev","download_url":"https://codeload.github.com/KapilYadav-dev/Phasher/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248519545,"owners_count":21117761,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","androidlibrary","image","imageprocessing","imagesimilarity","javaphash","kotlin","kotlinphash","phash","phash-similarity","similarity-score"],"created_at":"2024-11-15T00:26:42.585Z","updated_at":"2025-04-12T05:11:31.964Z","avatar_url":"https://github.com/KapilYadav-dev.png","language":"Java","readme":"# Phasher ✅\n\n\u003e So, around a week ago I was struggling to compare similarities between two images and found a way i.e Phash (perceptual hash) algorithm. It's based upon https://www.phash.org/.❤️\n\n## ⌨️ Usage\n\n![latestVersion](https://img.shields.io/github/v/release/KapilYadav-dev/Phasher)\n\n### 1. Add dependency.\n```groovy\nrepositories {\n  maven { url 'https://jitpack.io' } // Add jitpack\n}\n\ndependencies {\n  implementation 'com.github.KapilYadav-dev:Phasher:Tag'\n}\n\n```\n\n### 2. Use Phash() function.\n#### 1st way using file path.\n```kotlin\nfun Phash(\n    fileOnePath: String?, // path of Image one \n    fileTwoPath: String?, // path of Image two\n    bitSize: Int = 8  // This is the size you want to resize, can play with it for more accuracy and its best with the value 8\n)\n```\n#### 2nd way using file uri.\n```kotlin\nfun Phash(\n    uriOne: Uri?, // Uri for Image one\n    uriTwo: Uri?, // Uri for Image two\n    context: Context\n)\n```\n#### Finally use ```getSimilarityScore()``` method which will return % of confidence.\n#### i.e.\n```kotlin\nval score = Phash(path1,path2).getSimilarityScore()\n// score = 70 %\nval scoreTwo = Phash(uri1,uri2,context).getSimilarityScore()\n// score = 70%\n```\n\n## Results\n| Image 1 | Image 2 |\n| :---: | :---: |\n| \u003cimg src=\"/img1.jpeg\" width=\"200\"/\u003e | \u003cimg src=\"/img2.jpeg\" width=\"200\" /\u003e |\n## Result 89 % match ✅\n\n## Important Note ✍️\nChoose your threasold for your image as per your usecase. \u003cbr\u003e\nFor a standard one, we use 75 % threasold that means above its image are similar.\n## ✍️ Author\n\n👤 **mrkaydev**\n\n* Linkedin: \u003ca href=\"https://www.linkedin.com/in/mrkaydev/\" target=\"_blank\"\u003e@mrkaydev\u003c/a\u003e\n* Email: infokaydev@gmail.com\n\nFeel free to ping me 😉\n\n## 🤝 Contributing\n\nContributions are what make the open source community such an amazing place to be learn, inspire, and create. Any\ncontributions you make are **greatly appreciated**.\n\n1. Open an issue first to discuss what you would like to change.\n1. Fork the Project\n1. Create your feature branch (`git checkout -b feature/amazing-feature`)\n1. Commit your changes (`git commit -m 'Add some amazing feature'`)\n1. Push to the branch (`git push origin feature/amazing-feature`)\n1. Open a pull request\n\nPlease make sure to update tests as appropriate.\n\n## ❤ Show your support\n\nGive a ⭐️ if this project helped you!\n\n\u003ca href=\"https://www.buymeacoffee.com/mrkaydev\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png\" alt=\"Buy Me A Coffee\" width=\"160\"\u003e\n\u003c/a\u003e\n\n\n## 📝 License\n\n```\nCopyright © 2022 - mrkaydev\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","funding_links":["https://www.buymeacoffee.com/mrkaydev"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkapilyadav-dev%2Fphasher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkapilyadav-dev%2Fphasher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkapilyadav-dev%2Fphasher/lists"}