Module: Eikon

Extended by:
T::Sig
Defined in:
lib/eikon/version.rb,
lib/eikon.rb,
lib/eikon/comparator.rb,
lib/eikon/image_processor.rb,
lib/eikon/video_processor.rb

Overview

typed: true

Defined Under Namespace

Classes: Comparator, Error, ImageProcessor, VideoProcessor

Constant Summary collapse

VERSION =
"0.1.12".freeze

Class Method Summary collapse

Class Method Details

.dhash_for_image(filename) ⇒ Object



17
18
19
20
21
22
# File 'lib/eikon.rb', line 17

def self.dhash_for_image(filename)
  image = Eikon::ImageProcessor.new(filename)
  image.preprocess_image
  image.generate_byte_array
  image.byte_array
end

.dhash_for_video(filename, number_of_frames = 0) ⇒ Object



25
26
27
28
29
30
# File 'lib/eikon.rb', line 25

def self.dhash_for_video(filename, number_of_frames = 0)
  video_processor = Eikon::VideoProcessor.new(filename)
  storage_path = video_processor.split_video_into_images(number_of_frames)
  dhashes = video_processor.get_frames_dhash(storage_path)
  dhashes
end

.distance_between_files(filename_1, filename_2) ⇒ Object



33
34
35
# File 'lib/eikon.rb', line 33

def self.distance_between_files(filename_1, filename_2)
  Eikon::Comparator.compare(dhash_for_image(filename_1), dhash_for_image(filename_2))
end