spyglass 0.0.4 → 0.0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/spyglass/image.cc +14 -0
- data/ext/spyglass/image.h +1 -0
- data/lib/spyglass/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa5d2efe1d75f4c772e76ee0c391e724796a5be9
|
4
|
+
data.tar.gz: ebc53f2c758d1fca38a8e76ae24472eebfd317df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ad7ddc01fe98b6e3625e6570450f65f45ab336539f16a7cbda679a0be0cfa44ab7b1163e276c6c5f03247116338ca017e24c0a562c23276769b788e77090ae0
|
7
|
+
data.tar.gz: bf510a98a7e42ee00a407f3e91bec06b8b9949c905e4e93edd5bd4f6930618684deab57d54d708becf19f000e543c376c3d74881ec37118b5a5bdc24c9b28664
|
data/ext/spyglass/image.cc
CHANGED
@@ -28,6 +28,7 @@ namespace Spyglass {
|
|
28
28
|
rb_define_method(ImageClass, "dilate!", RUBY_METHOD_FUNC(rb_dilate_inplace), -1);
|
29
29
|
rb_define_method(ImageClass, "draw_contours", RUBY_METHOD_FUNC(rb_draw_contours), 2);
|
30
30
|
rb_define_method(ImageClass, "draw_rectangle", RUBY_METHOD_FUNC(rb_draw_rectangle), 2);
|
31
|
+
rb_define_method(ImageClass, "draw_label", RUBY_METHOD_FUNC(rb_draw_label), 2);
|
31
32
|
rb_define_method(ImageClass, "erode", RUBY_METHOD_FUNC(rb_erode), -1);
|
32
33
|
rb_define_method(ImageClass, "erode!", RUBY_METHOD_FUNC(rb_erode_inplace), -1);
|
33
34
|
rb_define_method(ImageClass, "fill", RUBY_METHOD_FUNC(rb_fill), -1);
|
@@ -228,6 +229,19 @@ namespace Spyglass {
|
|
228
229
|
return self;
|
229
230
|
}
|
230
231
|
|
232
|
+
static VALUE rb_draw_label(VALUE self, VALUE string, VALUE point) {
|
233
|
+
cv::Mat *img = SG_GET_IMAGE(self);
|
234
|
+
cv::Point *pt = SG_GET_POINT(point);
|
235
|
+
std::string label(StringValueCStr(string));
|
236
|
+
|
237
|
+
const int fontface = cv::FONT_HERSHEY_SIMPLEX;
|
238
|
+
int baseline = 0;
|
239
|
+
cv::Size size = cv::getTextSize(label, fontface, 0.4, 1, &baseline);
|
240
|
+
cv::rectangle(*img, *pt + cv::Point(0, baseline), *pt + cv::Point(size.width, -size.height), CV_RGB(255,255,255), CV_FILLED);
|
241
|
+
cv::putText(*img, label, *pt, fontface, 0.4, CV_RGB(0,0,0), 1, 8);
|
242
|
+
return self;
|
243
|
+
}
|
244
|
+
|
231
245
|
cv::Mat *_do_erode(int argc, VALUE *argv, VALUE self, bool inplace) {
|
232
246
|
VALUE iterations;
|
233
247
|
rb_scan_args(argc, argv, "01", &iterations);
|
data/ext/spyglass/image.h
CHANGED
@@ -22,6 +22,7 @@ namespace Spyglass {
|
|
22
22
|
static VALUE rb_dilate_inplace(int argc, VALUE *argv, VALUE self);
|
23
23
|
static VALUE rb_draw_contours(VALUE self, VALUE contours, VALUE color);
|
24
24
|
static VALUE rb_draw_rectangle(VALUE self, VALUE rect, VALUE color);
|
25
|
+
static VALUE rb_draw_label(VALUE self, VALUE string, VALUE point);
|
25
26
|
static VALUE rb_erode(int argc, VALUE *argv, VALUE self);
|
26
27
|
static VALUE rb_erode_inplace(int argc, VALUE *argv, VALUE self);
|
27
28
|
static VALUE rb_fill(int argc, VALUE *argv, VALUE self);
|
data/lib/spyglass/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spyglass
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.4
|
4
|
+
version: 0.0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- André Medeiros
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|