dhash 1.0.1
dhash: ^1.0.1 copied to clipboard

Dart native js
Flutter Android iOS web

dHash (compare similarity between images)

dhash #

Platform Pub Package License: MIT Donate Issue Forks Stars

dhash is a dart library which is used to calculate similarity between images based on dhash algorithm.

Lets Get Started #

1. Depend on it #

Add this to your package's pubspec.yaml file:

dependencies:
  dhash:

2. Install it #

You can install packages from the command line:

with pub:

$  pub get

with Flutter:

$  flutter packages get

3. Import it #

Now in your Dart code, you can use:

    import 'package:dhash/dhash.dart';

Usage #

Imports #

    import 'dart:io';
    import 'package:dhash/dhash.dart';

Read image File #

    var imageBytes = File('path_to_image_file.jpg').readAsBytesSync();

Calculate dhash of the image #

    var dhashOfImage = DHASH.calculateHash(imageBytes);
    

Create Hamming between two images #

    /// Image 1 bytes
    var imageBytes1 = File('path_to_image_file1.jpg').readAsBytesSync();
    
    /// Image 2 bytes
    var imageBytes2 = File('path_to_image_file2.jpg').readAsBytesSync();
    
    /// dhash of Image 1
    var hashOfImage1 = DHASH.calculateHash(imageBytes1);
    
    /// dhash of Image 2
    var hashOfImage2 = DHASH.calculateHash(imageBytes2);
    
    /// Hamming between image 1 and image 2
    var hamming = DHASH.hamming(hashOfImage1, hashOfImage2);
    
0
likes
90
pub points
0%
popularity

dHash (compare similarity between images)

Homepage

Documentation

API reference

Uploader

kawal741536@gmail.com

License

MIT (LICENSE)

Dependencies

image

More

Packages that depend on dhash