cherry_picking_moments 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0371a6dc6012d3c47ac466aaaab55a4efae9f8e029d8175103ec095850f60669
4
- data.tar.gz: b5bdce31eaf889eef270b9e825630347c7a5ea26810303ea7bd967ebcc63982f
3
+ metadata.gz: '063860681797e56b9ead05f784706d74efe9566919df2610b21a80225be83849'
4
+ data.tar.gz: 66eb2e97d5c94a4383b5a5c8b6d48b9554321df637519067fcac546f7e3cf40c
5
5
  SHA512:
6
- metadata.gz: 2e118ac6c83692c8fa64e7ac5f73fe7e2f61567c646de1c07641de413705c49d993ed6d65d24df15c199ac5ce05239f2057c2cfa2fafe9f99ce4c8e7f21ad8f1
7
- data.tar.gz: 72bdddd9aac20294424e73da5e27cd17bc70b382dd428726ddb3a921a3164b88d89d32dfd3bb6288ce78721906c60677a55088475925a50983410dcd154a9035
6
+ metadata.gz: 360f890e80361ebbf064e94dc004339143f92d5153ee69fd8b6744392452b75f4308228e5885e357514164ed7d74e447cc191718a24bb998e48c93fc0a4eb776
7
+ data.tar.gz: a2151ff400a4579511a38dfaedb0392d500d4397637ea8c756f080a7e3cf0d1eb4acc689f6829ba3c901b3841dcbf911076f7df854f7ff1ae4d3d1b66f93d3f0
@@ -1,17 +1,15 @@
1
- sudo: false
1
+ sudo: required
2
2
  language: ruby
3
+ os: linux
3
4
  rvm:
4
5
  - 2.6.3
5
6
  before_install:
6
- - export PATH="$(pyenv root)/bin:$PATH"
7
- - eval "$(pyenv init -)"
8
- - gem install bundler -v 2.0.1
7
+ - sudo add-apt-repository ppa:mc3man/trusty-media -y
8
+ - sudo apt-get update -q
9
+ - sudo apt-get install ffmpeg -y
10
+ - gem update --system
11
+ - gem update bundler
9
12
  install:
10
- - pyenv install -f miniconda-3.7.0
11
- - conda config --set always_yes yes --set changeps1 no
12
- - conda update -q conda
13
- - conda info -a
14
- - conda create -q -n test-environment python=3.7 imagehash
15
- - source $(pyenv prefix)/bin/activate test-environment
16
- - pip install --user imagehash
17
- - bundle install
13
+ - bundle install
14
+ script:
15
+ - bundle exec rspec
data/README.md CHANGED
@@ -2,24 +2,15 @@
2
2
 
3
3
  [![Build Status](https://travis-ci.org/yensaki/cherry_picking_moments.svg?branch=master)](https://travis-ci.org/yensaki/cherry_picking_moments)
4
4
 
5
- This generates uniquish images from a movie file.
5
+ This generates sliced images with hamming_distance from a movie file.
6
6
 
7
7
  ## Installation
8
8
 
9
9
  1. Install ffmpeg
10
- 1. Install python
11
- ```
12
- $ CONFIGURE_OPTS="--enable-shared" pyenv install 3.7.1
13
- ```
14
- 1. Install imagehash from pip
15
- ```
16
- $ pip install ImageHash
17
- ```
18
-
19
10
  1. gem install this
20
11
  Add this line to your application's Gemfile:
21
12
  ```ruby
22
- gem 'cherry_picking_moments', github: 'yensaki/cherry_picking_moments'
13
+ gem 'cherry_picking_moments'
23
14
  ```
24
15
  And then execute:
25
16
  ```
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
23
  spec.require_paths = ["lib"]
24
24
 
25
- spec.add_dependency "pycall", "1.2.1"
25
+ spec.add_dependency "phashion"
26
26
 
27
27
  spec.add_development_dependency "bundler", ">=1.17.2"
28
28
  spec.add_development_dependency "rake", "~> 10.0"
@@ -1,27 +1,18 @@
1
- require 'pycall/import'
2
- include PyCall::Import
1
+ require 'phashion'
3
2
 
4
3
  class CherryPickingMoments::Image
5
4
  attr_reader :filepath
6
5
  attr_accessor :following_distance
7
- pyfrom :PIL, import: :Image
8
6
 
9
7
  def initialize(filepath)
10
8
  @filepath = filepath
11
- pyimport :imagehash
12
9
  end
13
10
 
14
- def phash
15
- @phash ||= imagehash.phash(pyimage).to_s
11
+ def distance_from(image)
12
+ phashion_image.distance_from(image.phashion_image)
16
13
  end
17
14
 
18
- def to_binary
19
- sprintf("%064b", phash.to_i(16))
20
- end
21
-
22
- private
23
-
24
- def pyimage
25
- @pyimage ||= Image.open(@filepath)
15
+ def phashion_image
16
+ @phashion_image ||= Phashion::Image.new(@filepath)
26
17
  end
27
18
  end
@@ -13,8 +13,9 @@ class CherryPickingMoments::Movie
13
13
  @images = []
14
14
  Dir.glob(File.join(parapara!.output_path, '*.png')).sort.each do |filepath|
15
15
  image = CherryPickingMoments::Image.new(filepath)
16
- prev_image = @images.last
17
- prev_image.following_distance = CherryPickingMoments::HammingDistance.new(prev_image, image).hamming_distance if prev_image
16
+ if (prev_image = @images.last)
17
+ prev_image.following_distance = prev_image.distance_from(image)
18
+ end
18
19
 
19
20
  @images << image
20
21
  end
@@ -1,3 +1,3 @@
1
1
  module CherryPickingMoments
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cherry_picking_moments
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - yensaki
@@ -11,19 +11,19 @@ cert_chain: []
11
11
  date: 2019-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: pycall
14
+ name: phashion
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 1.2.1
19
+ version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 1.2.1
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement