Perceptual hash using dHash (difference hash) algorithm. Compares structural similarity between images regardless of minor pixel differences.
More...
#include <PerceptualHash.hpp>
|
| static Hash | ComputeHash (const std::filesystem::path &imagePath) |
| | Computes perceptual hash for an image file.
|
| static unsigned | HammingDistance (Hash hash1, Hash hash2) |
| | Calculates Hamming distance between two hashes (number of differing bits). Lower distance = more similar images.
|
| static bool | AreImagesSimilar (const std::filesystem::path &imagePath1, const std::filesystem::path &imagePath2, unsigned threshold=5) |
| | Checks if two images are perceptually similar.
|
Perceptual hash using dHash (difference hash) algorithm. Compares structural similarity between images regardless of minor pixel differences.
◆ Hash
◆ AreImagesSimilar()
| bool Engine3DRadSpace::Testing::PerceptualHash::AreImagesSimilar |
( |
const std::filesystem::path & | imagePath1, |
|
|
const std::filesystem::path & | imagePath2, |
|
|
unsigned | threshold = 5 ) |
|
static |
Checks if two images are perceptually similar.
- Parameters
-
| imagePath1 | Path to first image |
| imagePath2 | Path to second image |
| threshold | Maximum allowed Hamming distance (default: 5, typically 0-10 for similar images) |
- Returns
- True if images are similar within threshold
◆ ComputeHash()
| PerceptualHash::Hash Engine3DRadSpace::Testing::PerceptualHash::ComputeHash |
( |
const std::filesystem::path & | imagePath | ) |
|
|
static |
Computes perceptual hash for an image file.
- Parameters
-
| imagePath | Path to the image file |
- Returns
- 64-bit perceptual hash
◆ HammingDistance()
| unsigned Engine3DRadSpace::Testing::PerceptualHash::HammingDistance |
( |
Hash | hash1, |
|
|
Hash | hash2 ) |
|
static |
Calculates Hamming distance between two hashes (number of differing bits). Lower distance = more similar images.
- Parameters
-
| hash1 | First hash |
| hash2 | Second hash |
- Returns
- Hamming distance (0-64)
The documentation for this class was generated from the following files: