Sha256: fe67f75b70c1ec9427a9c5f840f11065dc99fd519f372e3706251c2094d15f80

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

Contents

# typed: strict
require "eikon/version"
require "eikon/comparator"
require "eikon/video_processor"
require "eikon/image_processor"
require "vips"
require "ruby_jard"
require "sorbet-runtime"

module Eikon
  extend T::Sig

  class Error < StandardError; end

  sig { params(filename: T.untyped).returns(String) }
  def self.dhash_for_image(filename)
    image = Eikon::ImageProcessor.new(filename)
    image.preprocess_image
    image.generate_byte_array
    image.byte_array
  end

  sig { params(filename: String).returns(T::Array[T::Hash[String, T.any(Integer, String)]]) }
  def self.dhash_for_video(filename)
    video_processor = Eikon::VideoProcessor.new(filename)
    storage_path = video_processor.split_video_into_images
    dhashes = video_processor.get_frames_dhash(storage_path)
    dhashes
  end

  sig { params(filename_1: String, filename_2: String).returns(Integer) }
  def self.distance_between_files(filename_1, filename_2)
    Eikon::Comparator.compare(dhash_for_image(filename_1), dhash_for_image(filename_2))
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
eikon-0.1.4 lib/eikon.rb
eikon-0.1.3 lib/eikon.rb
eikon-0.1.2 lib/eikon.rb
eikon-0.1.1 lib/eikon.rb