dlib 1.1.5 → 1.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
  SHA1:
3
- metadata.gz: cbeddf3b261446f42826e5292e042b73b49e19aa
4
- data.tar.gz: 8faff841b4796da8ae2542205e38f1861790952b
3
+ metadata.gz: f5732ed892e7a16695f3cfbb599b547de3f26854
4
+ data.tar.gz: d4711fbcd095452b4feadd803ab1cc05489fb55b
5
5
  SHA512:
6
- metadata.gz: 842641f113e980beac12e81c0dcee7d4335d85d1c0cdedc4d81a7f4bc05ffea32d50fba260df035e4545f5efd80dd5ee3923b73cec909d2b78e32cbc0cd75e16
7
- data.tar.gz: 9aa7a42e527329be811591f955d632c5f1e533f5b139815603f2d61f7776aea9c6526af52df5c5414952137dfc6a98c5f0f4c3e52bd3ae91433efdcd53147174
6
+ metadata.gz: d2d7cf2af1544fe19b48b09df5b8275751857c0f4d3a1c33496904d5eaa6b79008eb111e31dab59e1126e7ba2fe2e198decdc04ab03a3f7a9adc2e54b31c0b6d
7
+ data.tar.gz: 896a219c1a1667ffdd8c507106261e1335e94c01ad51464fa2f8b5a6027d37735d60d006e3702398fbcdff283c6bbde8c38374cdc1756a99d987d2a60e61b90c
data/Changes.md CHANGED
@@ -3,6 +3,12 @@
3
3
  At first, you can see original Release notes.
4
4
  http://dlib.net/release_notes.html
5
5
 
6
+ ## 1.2.0 (use dlib 19.4)
7
+
8
+ ### New Features
9
+
10
+ * `Dlib::Image.pyramid_up!` make `Dlib::Image` scale up to x2
11
+
6
12
  ## 1.1.5 (use dlib 19.4)
7
13
 
8
14
  ### Bug fixes
@@ -71,6 +71,19 @@ dlib_rb_image_s_load(VALUE klass, VALUE filename)
71
71
  return image;
72
72
  }
73
73
 
74
+ extern "C" VALUE
75
+ dlib_rb_image_s_pyramid_up(VALUE klass, VALUE image)
76
+ {
77
+ if (!rb_typeddata_is_kind_of(image, &rgb_image_container_data_type)) {
78
+ rb_raise(rb_eTypeError, "must give Dlib::Image");
79
+ }
80
+
81
+ rgb_image_container *image_container = dlib_rb_image_get_rgb_image_container(image);
82
+ dlib::pyramid_up(image_container->image);
83
+
84
+ return Qnil;
85
+ }
86
+
74
87
  extern "C" VALUE
75
88
  dlib_rb_image_nr(VALUE image)
76
89
  {
@@ -146,6 +159,8 @@ Init_dlib_image()
146
159
  rb_define_alloc_func(cDlibImage, dlib_rb_image_alloc);
147
160
  rb_define_singleton_method(cDlibImage, "load", RUBY_METHOD_FUNC(dlib_rb_image_s_load), 1);
148
161
 
162
+ rb_define_singleton_method(cDlibImage, "pyramid_up!", RUBY_METHOD_FUNC(dlib_rb_image_s_pyramid_up), 1);
163
+
149
164
  rb_define_method(cDlibImage, "nr", RUBY_METHOD_FUNC(dlib_rb_image_nr), 0);
150
165
  rb_define_method(cDlibImage, "nc", RUBY_METHOD_FUNC(dlib_rb_image_nc), 0);
151
166
 
@@ -1,3 +1,3 @@
1
1
  module Dlib
2
- VERSION = "1.1.5"
2
+ VERSION = "1.2.0"
3
3
  end
@@ -0,0 +1,26 @@
1
+ require 'spec_helper'
2
+
3
+ describe Dlib::Image do
4
+ describe '.pyramid_up!' do
5
+ context 'invalid argument' do
6
+ it 'should raise TypeError' do
7
+ expect { Dlib::Image.pyramid_up!(Object.new) }.to raise_error(TypeError)
8
+ end
9
+ end
10
+
11
+ context 'valid argument' do
12
+ it 'should scale up to 2 times' do
13
+ file = fixture_file('face.jpg')
14
+ image = Dlib::Image.load(file.path)
15
+
16
+ expect(image.nr).to be(500)
17
+ expect(image.nc).to be(400)
18
+
19
+ expect { Dlib::Image.pyramid_up!(image) }.not_to raise_error
20
+
21
+ expect(image.nr).to be(1001)
22
+ expect(image.nc).to be(802)
23
+ end
24
+ end
25
+ end
26
+ end
Binary file
@@ -19,6 +19,11 @@
19
19
 
20
20
  require 'dlib'
21
21
 
22
+ def fixture_file(filename)
23
+ base_dir = File.expand_path(File.join(File.dirname(__FILE__), 'fixture'))
24
+ File.open(File.join(base_dir, filename))
25
+ end
26
+
22
27
  RSpec.configure do |config|
23
28
  # rspec-expectations config goes here. You can use an alternate
24
29
  # assertion/expectation library such as wrong or the stdlib/minitest
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dlib
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenta Murata
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-04-03 00:00:00.000000000 Z
12
+ date: 2017-04-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -3534,7 +3534,9 @@ files:
3534
3534
  - ext/dlib/missing.h
3535
3535
  - ext/dlib/rectangle.inc
3536
3536
  - lib/dlib/version.rb
3537
+ - spec/dlib/image_spec.rb
3537
3538
  - spec/dlib/rectangle_spec.rb
3539
+ - spec/fixture/face.jpg
3538
3540
  - spec/spec_helper.rb
3539
3541
  homepage: https://github.com/ruby-dlib/ruby-dlib
3540
3542
  licenses:
@@ -3556,10 +3558,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
3556
3558
  version: '0'
3557
3559
  requirements: []
3558
3560
  rubyforge_project:
3559
- rubygems_version: 2.4.5.1
3561
+ rubygems_version: 2.4.6
3560
3562
  signing_key:
3561
3563
  specification_version: 4
3562
3564
  summary: Ruby bindings of dlib C++ library.
3563
3565
  test_files:
3566
+ - spec/dlib/image_spec.rb
3564
3567
  - spec/dlib/rectangle_spec.rb
3568
+ - spec/fixture/face.jpg
3565
3569
  - spec/spec_helper.rb