|
@ -13,57 +13,69 @@ use std::path::Path; |
|
|
use std::ffi::CStr;
|
|
|
use std::ffi::CStr;
|
|
|
use cache::Cache;
|
|
|
use cache::Cache;
|
|
|
|
|
|
|
|
|
static LIB_CACHE: Cache<'static> = Cache { cache_dir: cache::CACHE_DIR, use_cache: true };
|
|
|
|
|
|
|
|
|
static LIB_CACHE: Cache<'static> = Cache {
|
|
|
|
|
|
cache_dir: cache::CACHE_DIR,
|
|
|
|
|
|
use_cache: true,
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
/**
|
|
|
/**
|
|
|
* Prepare the library for work.
|
|
|
* Prepare the library for work.
|
|
|
*
|
|
|
*
|
|
|
* Not performing this step may cause parts to fail.
|
|
|
* Not performing this step may cause parts to fail.
|
|
|
*/
|
|
|
*/
|
|
|
#[no_mangle]
|
|
|
|
|
|
pub extern "C" fn init() {
|
|
|
|
|
|
|
|
|
#[no_mangle]
|
|
|
|
|
|
pub extern "C" fn init() {
|
|
|
match LIB_CACHE.init() {
|
|
|
match LIB_CACHE.init() {
|
|
|
Ok(_) => {}
|
|
|
Ok(_) => {}
|
|
|
Err(e) => println!("Error: {}", e),
|
|
|
Err(e) => println!("Error: {}", e),
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
/**
|
|
|
* Teardown for the library
|
|
|
* Teardown for the library
|
|
|
*/
|
|
|
*/
|
|
|
#[no_mangle]
|
|
|
|
|
|
pub extern "C" fn teardown() {
|
|
|
|
|
|
|
|
|
#[no_mangle]
|
|
|
|
|
|
pub extern "C" fn teardown() {
|
|
|
match LIB_CACHE.clean() {
|
|
|
match LIB_CACHE.clean() {
|
|
|
Ok(_) => {}
|
|
|
Ok(_) => {}
|
|
|
Err(e) => println!("Error: {}", e),
|
|
|
Err(e) => println!("Error: {}", e),
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
pub fn get_phashes(path: &Path) -> hash::PerceptualHashes {
|
|
|
|
|
|
|
|
|
pub fn get_phashes(path: &Path) -> hash::PerceptualHashes {
|
|
|
hash::get_perceptual_hashes(path, &hash::Precision::Medium, &LIB_CACHE)
|
|
|
hash::get_perceptual_hashes(path, &hash::Precision::Medium, &LIB_CACHE)
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub fn get_ahash(path: &Path) -> u64 {
|
|
|
|
|
|
hash::get_perceptual_hash(&path, &hash::Precision::Medium, &hash::HashType::AHash, &LIB_CACHE)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub fn get_dhash(path: &Path) -> u64 {
|
|
|
|
|
|
hash::get_perceptual_hash(&path, &hash::Precision::Medium, &hash::HashType::DHash, &LIB_CACHE)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub fn get_phash(path: &Path) -> u64 {
|
|
|
|
|
|
hash::get_perceptual_hash(&path, &hash::Precision::Medium, &hash::HashType::DHash, &LIB_CACHE)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub fn get_hamming_distance(hash1: u64, hash2: u64) -> u64 {
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub fn get_ahash(path: &Path) -> u64 {
|
|
|
|
|
|
hash::get_perceptual_hash(&path,
|
|
|
|
|
|
&hash::Precision::Medium,
|
|
|
|
|
|
&hash::HashType::AHash,
|
|
|
|
|
|
&LIB_CACHE)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub fn get_dhash(path: &Path) -> u64 {
|
|
|
|
|
|
hash::get_perceptual_hash(&path,
|
|
|
|
|
|
&hash::Precision::Medium,
|
|
|
|
|
|
&hash::HashType::DHash,
|
|
|
|
|
|
&LIB_CACHE)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub fn get_phash(path: &Path) -> u64 {
|
|
|
|
|
|
hash::get_perceptual_hash(&path,
|
|
|
|
|
|
&hash::Precision::Medium,
|
|
|
|
|
|
&hash::HashType::DHash,
|
|
|
|
|
|
&LIB_CACHE)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub fn get_hamming_distance(hash1: u64, hash2: u64) -> u64 {
|
|
|
hash::calculate_hamming_distance(hash1, hash2)
|
|
|
hash::calculate_hamming_distance(hash1, hash2)
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
// External proxies for the get_*hash methods
|
|
|
|
|
|
|
|
|
// External proxies for the get_*hash methods
|
|
|
|
|
|
|
|
|
#[no_mangle]
|
|
|
|
|
|
pub extern "C" fn ext_get_ahash(path_char: *const libc::c_char) -> libc::uint64_t {
|
|
|
|
|
|
|
|
|
#[no_mangle]
|
|
|
|
|
|
pub extern "C" fn ext_get_ahash(path_char: *const libc::c_char) -> libc::uint64_t {
|
|
|
unsafe {
|
|
|
unsafe {
|
|
|
let path_str = CStr::from_ptr(path_char);
|
|
|
let path_str = CStr::from_ptr(path_char);
|
|
|
let image_path = match path_str.to_str() {
|
|
|
let image_path = match path_str.to_str() {
|
|
@ -78,10 +90,10 @@ static LIB_CACHE: Cache<'static> = Cache { cache_dir: cache::CACHE_DIR, use_cach |
|
|
let path = Path::new(&image_path);
|
|
|
let path = Path::new(&image_path);
|
|
|
get_ahash(&path)
|
|
|
get_ahash(&path)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
#[no_mangle]
|
|
|
|
|
|
pub extern "C" fn ext_get_dhash(path_char: *const libc::c_char) -> libc::uint64_t {
|
|
|
|
|
|
|
|
|
#[no_mangle]
|
|
|
|
|
|
pub extern "C" fn ext_get_dhash(path_char: *const libc::c_char) -> libc::uint64_t {
|
|
|
unsafe {
|
|
|
unsafe {
|
|
|
let path_str = CStr::from_ptr(path_char);
|
|
|
let path_str = CStr::from_ptr(path_char);
|
|
|
let image_path = match path_str.to_str() {
|
|
|
let image_path = match path_str.to_str() {
|
|
@ -96,10 +108,10 @@ static LIB_CACHE: Cache<'static> = Cache { cache_dir: cache::CACHE_DIR, use_cach |
|
|
let path = Path::new(&image_path);
|
|
|
let path = Path::new(&image_path);
|
|
|
get_dhash(&path)
|
|
|
get_dhash(&path)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
#[no_mangle]
|
|
|
|
|
|
pub extern "C" fn ext_get_phash(path_char: *const libc::c_char) -> libc::uint64_t {
|
|
|
|
|
|
|
|
|
#[no_mangle]
|
|
|
|
|
|
pub extern "C" fn ext_get_phash(path_char: *const libc::c_char) -> libc::uint64_t {
|
|
|
unsafe {
|
|
|
unsafe {
|
|
|
let path_str = CStr::from_ptr(path_char);
|
|
|
let path_str = CStr::from_ptr(path_char);
|
|
|
let image_path = match path_str.to_str() {
|
|
|
let image_path = match path_str.to_str() {
|
|
@ -114,9 +126,9 @@ static LIB_CACHE: Cache<'static> = Cache { cache_dir: cache::CACHE_DIR, use_cach |
|
|
let path = Path::new(&image_path);
|
|
|
let path = Path::new(&image_path);
|
|
|
get_phash(&path)
|
|
|
get_phash(&path)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
fn to_hex_string(bytes: &[u8]) -> String {
|
|
|
|
|
|
|
|
|
fn to_hex_string(bytes: &[u8]) -> String {
|
|
|
println!("length: {}", bytes.len());
|
|
|
println!("length: {}", bytes.len());
|
|
|
let mut strs: Vec<String> = Vec::new();
|
|
|
let mut strs: Vec<String> = Vec::new();
|
|
|
for byte in bytes {
|
|
|
for byte in bytes {
|
|
@ -124,12 +136,12 @@ static LIB_CACHE: Cache<'static> = Cache { cache_dir: cache::CACHE_DIR, use_cach |
|
|
strs.push(format!("{:02x}", byte));
|
|
|
strs.push(format!("{:02x}", byte));
|
|
|
}
|
|
|
}
|
|
|
strs.join("\\x")
|
|
|
strs.join("\\x")
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
// Module for the tests
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
// Module for the tests
|
|
|
|
|
|
//
|
|
|
#[cfg(test)]
|
|
|
#[cfg(test)]
|
|
|
mod tests {
|
|
|
|
|
|
|
|
|
mod tests {
|
|
|
|
|
|
|
|
|
use std::fs;
|
|
|
use std::fs;
|
|
|
use std::path::Path;
|
|
|
use std::path::Path;
|
|
@ -170,7 +182,10 @@ static LIB_CACHE: Cache<'static> = Cache { cache_dir: cache::CACHE_DIR, use_cach |
|
|
image_hashes: [u64; 3]) {
|
|
|
image_hashes: [u64; 3]) {
|
|
|
for index in 0..image_paths.len() {
|
|
|
for index in 0..image_paths.len() {
|
|
|
let image_path = image_paths[index];
|
|
|
let image_path = image_paths[index];
|
|
|
let calculated_hash = hash::get_perceptual_hash(&image_path, &hash_precision, &hash_type, &super::LIB_CACHE);
|
|
|
|
|
|
|
|
|
let calculated_hash = hash::get_perceptual_hash(&image_path,
|
|
|
|
|
|
&hash_precision,
|
|
|
|
|
|
&hash_type,
|
|
|
|
|
|
&super::LIB_CACHE);
|
|
|
println!("Image hashes for '{}': expected: {} actual: {}",
|
|
|
println!("Image hashes for '{}': expected: {} actual: {}",
|
|
|
image_path.to_str().unwrap(),
|
|
|
image_path.to_str().unwrap(),
|
|
|
image_hashes[index],
|
|
|
image_hashes[index],
|
|
@ -188,10 +203,11 @@ static LIB_CACHE: Cache<'static> = Cache { cache_dir: cache::CACHE_DIR, use_cach |
|
|
let sample_01_images: [&Path; 3] = [&Path::new("./test_images/sample_01_large.jpg"),
|
|
|
let sample_01_images: [&Path; 3] = [&Path::new("./test_images/sample_01_large.jpg"),
|
|
|
&Path::new("./test_images/sample_01_medium.jpg"),
|
|
|
&Path::new("./test_images/sample_01_medium.jpg"),
|
|
|
&Path::new("./test_images/sample_01_small.jpg")];
|
|
|
&Path::new("./test_images/sample_01_small.jpg")];
|
|
|
let sample_01_hashes: [u64; 3] = [857051991849750,
|
|
|
|
|
|
857051991849750,
|
|
|
|
|
|
857051991849750];
|
|
|
|
|
|
test_imageset_hash(hash::HashType::AHash, hash::Precision::Medium, sample_01_images, sample_01_hashes);
|
|
|
|
|
|
|
|
|
let sample_01_hashes: [u64; 3] = [857051991849750, 857051991849750, 857051991849750];
|
|
|
|
|
|
test_imageset_hash(hash::HashType::AHash,
|
|
|
|
|
|
hash::Precision::Medium,
|
|
|
|
|
|
sample_01_images,
|
|
|
|
|
|
sample_01_hashes);
|
|
|
|
|
|
|
|
|
// Sample_02 tests
|
|
|
// Sample_02 tests
|
|
|
let sample_02_images: [&Path; 3] = [&Path::new("./test_images/sample_02_large.jpg"),
|
|
|
let sample_02_images: [&Path; 3] = [&Path::new("./test_images/sample_02_large.jpg"),
|
|
@ -200,7 +216,10 @@ static LIB_CACHE: Cache<'static> = Cache { cache_dir: cache::CACHE_DIR, use_cach |
|
|
let sample_02_hashes: [u64; 3] = [18446744073441116160,
|
|
|
let sample_02_hashes: [u64; 3] = [18446744073441116160,
|
|
|
18446744073441116160,
|
|
|
18446744073441116160,
|
|
|
18446744073441116160];
|
|
|
18446744073441116160];
|
|
|
test_imageset_hash(hash::HashType::AHash, hash::Precision::Medium, sample_02_images, sample_02_hashes);
|
|
|
|
|
|
|
|
|
test_imageset_hash(hash::HashType::AHash,
|
|
|
|
|
|
hash::Precision::Medium,
|
|
|
|
|
|
sample_02_images,
|
|
|
|
|
|
sample_02_hashes);
|
|
|
|
|
|
|
|
|
// Sample_03 tests
|
|
|
// Sample_03 tests
|
|
|
let sample_03_images: [&Path; 3] = [&Path::new("./test_images/sample_03_large.jpg"),
|
|
|
let sample_03_images: [&Path; 3] = [&Path::new("./test_images/sample_03_large.jpg"),
|
|
@ -209,7 +228,10 @@ static LIB_CACHE: Cache<'static> = Cache { cache_dir: cache::CACHE_DIR, use_cach |
|
|
let sample_03_hashes: [u64; 3] = [135670932300497406,
|
|
|
let sample_03_hashes: [u64; 3] = [135670932300497406,
|
|
|
135670932300497406,
|
|
|
135670932300497406,
|
|
|
135670932300497406];
|
|
|
135670932300497406];
|
|
|
test_imageset_hash(hash::HashType::AHash, hash::Precision::Medium, sample_03_images, sample_03_hashes);
|
|
|
|
|
|
|
|
|
test_imageset_hash(hash::HashType::AHash,
|
|
|
|
|
|
hash::Precision::Medium,
|
|
|
|
|
|
sample_03_images,
|
|
|
|
|
|
sample_03_hashes);
|
|
|
|
|
|
|
|
|
// Sample_04 tests
|
|
|
// Sample_04 tests
|
|
|
let sample_04_images: [&Path; 3] = [&Path::new("./test_images/sample_04_large.jpg"),
|
|
|
let sample_04_images: [&Path; 3] = [&Path::new("./test_images/sample_04_large.jpg"),
|
|
@ -218,7 +240,10 @@ static LIB_CACHE: Cache<'static> = Cache { cache_dir: cache::CACHE_DIR, use_cach |
|
|
let sample_04_hashes: [u64; 3] = [18446460933225054208,
|
|
|
let sample_04_hashes: [u64; 3] = [18446460933225054208,
|
|
|
18446460933090836480,
|
|
|
18446460933090836480,
|
|
|
18446460933090836480];
|
|
|
18446460933090836480];
|
|
|
test_imageset_hash(hash::HashType::AHash, hash::Precision::Medium, sample_04_images, sample_04_hashes);
|
|
|
|
|
|
|
|
|
test_imageset_hash(hash::HashType::AHash,
|
|
|
|
|
|
hash::Precision::Medium,
|
|
|
|
|
|
sample_04_images,
|
|
|
|
|
|
sample_04_hashes);
|
|
|
|
|
|
|
|
|
// Clean_Cache
|
|
|
// Clean_Cache
|
|
|
// super::teardown();
|
|
|
// super::teardown();
|
|
@ -236,7 +261,10 @@ static LIB_CACHE: Cache<'static> = Cache { cache_dir: cache::CACHE_DIR, use_cach |
|
|
let sample_01_hashes: [u64; 3] = [7937395827556495926,
|
|
|
let sample_01_hashes: [u64; 3] = [7937395827556495926,
|
|
|
7937395827556495926,
|
|
|
7937395827556495926,
|
|
|
7939647627370181174];
|
|
|
7939647627370181174];
|
|
|
test_imageset_hash(hash::HashType::DHash, hash::Precision::Medium, sample_01_images, sample_01_hashes);
|
|
|
|
|
|
|
|
|
test_imageset_hash(hash::HashType::DHash,
|
|
|
|
|
|
hash::Precision::Medium,
|
|
|
|
|
|
sample_01_images,
|
|
|
|
|
|
sample_01_hashes);
|
|
|
|
|
|
|
|
|
// Sample_02 tests
|
|
|
// Sample_02 tests
|
|
|
let sample_02_images: [&Path; 3] = [&Path::new("./test_images/sample_02_large.jpg"),
|
|
|
let sample_02_images: [&Path; 3] = [&Path::new("./test_images/sample_02_large.jpg"),
|
|
@ -245,7 +273,10 @@ static LIB_CACHE: Cache<'static> = Cache { cache_dir: cache::CACHE_DIR, use_cach |
|
|
let sample_02_hashes: [u64; 3] = [11009829669713008949,
|
|
|
let sample_02_hashes: [u64; 3] = [11009829669713008949,
|
|
|
11009829670249879861,
|
|
|
11009829670249879861,
|
|
|
11009829669713008949];
|
|
|
11009829669713008949];
|
|
|
test_imageset_hash(hash::HashType::DHash, hash::Precision::Medium, sample_02_images, sample_02_hashes);
|
|
|
|
|
|
|
|
|
test_imageset_hash(hash::HashType::DHash,
|
|
|
|
|
|
hash::Precision::Medium,
|
|
|
|
|
|
sample_02_images,
|
|
|
|
|
|
sample_02_hashes);
|
|
|
|
|
|
|
|
|
// Sample_03 tests
|
|
|
// Sample_03 tests
|
|
|
let sample_03_images: [&Path; 3] = [&Path::new("./test_images/sample_03_large.jpg"),
|
|
|
let sample_03_images: [&Path; 3] = [&Path::new("./test_images/sample_03_large.jpg"),
|
|
@ -254,7 +285,10 @@ static LIB_CACHE: Cache<'static> = Cache { cache_dir: cache::CACHE_DIR, use_cach |
|
|
let sample_03_hashes: [u64; 3] = [225528496439353286,
|
|
|
let sample_03_hashes: [u64; 3] = [225528496439353286,
|
|
|
225528496439353286,
|
|
|
225528496439353286,
|
|
|
226654396346195908];
|
|
|
226654396346195908];
|
|
|
test_imageset_hash(hash::HashType::DHash, hash::Precision::Medium, sample_03_images, sample_03_hashes);
|
|
|
|
|
|
|
|
|
test_imageset_hash(hash::HashType::DHash,
|
|
|
|
|
|
hash::Precision::Medium,
|
|
|
|
|
|
sample_03_images,
|
|
|
|
|
|
sample_03_hashes);
|
|
|
|
|
|
|
|
|
// Sample_04 tests
|
|
|
// Sample_04 tests
|
|
|
let sample_04_images: [&Path; 3] = [&Path::new("./test_images/sample_04_large.jpg"),
|
|
|
let sample_04_images: [&Path; 3] = [&Path::new("./test_images/sample_04_large.jpg"),
|
|
@ -263,7 +297,10 @@ static LIB_CACHE: Cache<'static> = Cache { cache_dir: cache::CACHE_DIR, use_cach |
|
|
let sample_04_hashes: [u64; 3] = [14620651386429567209,
|
|
|
let sample_04_hashes: [u64; 3] = [14620651386429567209,
|
|
|
14620651386429567209,
|
|
|
14620651386429567209,
|
|
|
14620651386429567209];
|
|
|
14620651386429567209];
|
|
|
test_imageset_hash(hash::HashType::DHash, hash::Precision::Medium, sample_04_images, sample_04_hashes);
|
|
|
|
|
|
|
|
|
test_imageset_hash(hash::HashType::DHash,
|
|
|
|
|
|
hash::Precision::Medium,
|
|
|
|
|
|
sample_04_images,
|
|
|
|
|
|
sample_04_hashes);
|
|
|
|
|
|
|
|
|
// Clean_Cache
|
|
|
// Clean_Cache
|
|
|
// super::teardown();
|
|
|
// super::teardown();
|
|
@ -278,10 +315,11 @@ static LIB_CACHE: Cache<'static> = Cache { cache_dir: cache::CACHE_DIR, use_cach |
|
|
let sample_01_images: [&Path; 3] = [&Path::new("./test_images/sample_01_large.jpg"),
|
|
|
let sample_01_images: [&Path; 3] = [&Path::new("./test_images/sample_01_large.jpg"),
|
|
|
&Path::new("./test_images/sample_01_medium.jpg"),
|
|
|
&Path::new("./test_images/sample_01_medium.jpg"),
|
|
|
&Path::new("./test_images/sample_01_small.jpg")];
|
|
|
&Path::new("./test_images/sample_01_small.jpg")];
|
|
|
let sample_01_hashes: [u64; 3] = [72357778504597504,
|
|
|
|
|
|
72357778504597504,
|
|
|
|
|
|
72357778504597504];
|
|
|
|
|
|
test_imageset_hash(hash::HashType::PHash, hash::Precision::Medium, sample_01_images, sample_01_hashes);
|
|
|
|
|
|
|
|
|
let sample_01_hashes: [u64; 3] = [72357778504597504, 72357778504597504, 72357778504597504];
|
|
|
|
|
|
test_imageset_hash(hash::HashType::PHash,
|
|
|
|
|
|
hash::Precision::Medium,
|
|
|
|
|
|
sample_01_images,
|
|
|
|
|
|
sample_01_hashes);
|
|
|
|
|
|
|
|
|
// Sample_02 tests
|
|
|
// Sample_02 tests
|
|
|
let sample_02_images: [&Path; 3] = [&Path::new("./test_images/sample_02_large.jpg"),
|
|
|
let sample_02_images: [&Path; 3] = [&Path::new("./test_images/sample_02_large.jpg"),
|
|
@ -290,7 +328,10 @@ static LIB_CACHE: Cache<'static> = Cache { cache_dir: cache::CACHE_DIR, use_cach |
|
|
let sample_02_hashes: [u64; 3] = [5332332327550844928,
|
|
|
let sample_02_hashes: [u64; 3] = [5332332327550844928,
|
|
|
5332332327550844928,
|
|
|
5332332327550844928,
|
|
|
5332332327550844928];
|
|
|
5332332327550844928];
|
|
|
test_imageset_hash(hash::HashType::PHash, hash::Precision::Medium, sample_02_images, sample_02_hashes);
|
|
|
|
|
|
|
|
|
test_imageset_hash(hash::HashType::PHash,
|
|
|
|
|
|
hash::Precision::Medium,
|
|
|
|
|
|
sample_02_images,
|
|
|
|
|
|
sample_02_hashes);
|
|
|
|
|
|
|
|
|
// Sample_03 tests
|
|
|
// Sample_03 tests
|
|
|
let sample_03_images: [&Path; 3] = [&Path::new("./test_images/sample_03_large.jpg"),
|
|
|
let sample_03_images: [&Path; 3] = [&Path::new("./test_images/sample_03_large.jpg"),
|
|
@ -299,7 +340,10 @@ static LIB_CACHE: Cache<'static> = Cache { cache_dir: cache::CACHE_DIR, use_cach |
|
|
let sample_03_hashes: [u64; 3] = [6917529027641081856,
|
|
|
let sample_03_hashes: [u64; 3] = [6917529027641081856,
|
|
|
6917529027641081856,
|
|
|
6917529027641081856,
|
|
|
6917529027641081856];
|
|
|
6917529027641081856];
|
|
|
test_imageset_hash(hash::HashType::PHash, hash::Precision::Medium, sample_03_images, sample_03_hashes);
|
|
|
|
|
|
|
|
|
test_imageset_hash(hash::HashType::PHash,
|
|
|
|
|
|
hash::Precision::Medium,
|
|
|
|
|
|
sample_03_images,
|
|
|
|
|
|
sample_03_hashes);
|
|
|
|
|
|
|
|
|
// Sample_04 tests
|
|
|
// Sample_04 tests
|
|
|
let sample_04_images: [&Path; 3] = [&Path::new("./test_images/sample_04_large.jpg"),
|
|
|
let sample_04_images: [&Path; 3] = [&Path::new("./test_images/sample_04_large.jpg"),
|
|
@ -308,9 +352,12 @@ static LIB_CACHE: Cache<'static> = Cache { cache_dir: cache::CACHE_DIR, use_cach |
|
|
let sample_04_hashes: [u64; 3] = [10997931646002397184,
|
|
|
let sample_04_hashes: [u64; 3] = [10997931646002397184,
|
|
|
10997931646002397184,
|
|
|
10997931646002397184,
|
|
|
11142046834078253056];
|
|
|
11142046834078253056];
|
|
|
test_imageset_hash(hash::HashType::PHash, hash::Precision::Medium, sample_04_images, sample_04_hashes);
|
|
|
|
|
|
|
|
|
test_imageset_hash(hash::HashType::PHash,
|
|
|
|
|
|
hash::Precision::Medium,
|
|
|
|
|
|
sample_04_images,
|
|
|
|
|
|
sample_04_hashes);
|
|
|
|
|
|
|
|
|
// Clean_Cache
|
|
|
// Clean_Cache
|
|
|
// super::teardown();
|
|
|
// super::teardown();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|