bonanza-ruby-opencv 0.0.13.20170125170729 → 0.0.13.20200923185241
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/ext/opencv/cvhistogram.cpp +11 -11
- data/ext/opencv/cvmat.cpp +28 -19
- data/ext/opencv/iplconvkernel.cpp +1 -1
- metadata +6 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b1e5119a7a5d2271845769949eddcaccd0a519c3afd373f967b4b7c6a19880a6
|
4
|
+
data.tar.gz: 05c6480bfdc0f25d07fdc6e4e1d79ee6be8a1ddf94f2d9aabcc7654bd3f6598e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 645336822d5bed3ce63d416646bfa96fe040d4f868af99546e0247abdbc1103be5fac7009340a759271bb2c2be16a7ec4d5e74328e50a9f7fe055c641906da6d
|
7
|
+
data.tar.gz: 9ecc114298d4f79d2d57f30bb8630125c089104d9a7aee0c14dd3b95826f6cc19c590e64b5eae380a56397e7143f81749c7e0227e4a9f2ffd92d4a5180e4d25d
|
data/ext/opencv/cvhistogram.cpp
CHANGED
@@ -95,19 +95,19 @@ rb_initialize(int argc, VALUE *argv, VALUE self)
|
|
95
95
|
|
96
96
|
rb_scan_args(argc, argv, "32", &_dims, &_sizes, &_type, &_ranges, &_uniform);
|
97
97
|
int sizes_len = RARRAY_LEN(_sizes);
|
98
|
-
sizes =
|
98
|
+
sizes = RB_ALLOC_N(int, sizes_len);
|
99
99
|
|
100
100
|
if (NIL_P(_ranges)) {
|
101
101
|
sizes = ary2intptr(_sizes, sizes);
|
102
102
|
ranges = NULL;
|
103
103
|
}
|
104
104
|
else {
|
105
|
-
ranges =
|
105
|
+
ranges = RB_ALLOC_N(float*, sizes_len);
|
106
106
|
VALUE* range_ptr = RARRAY_PTR(_ranges);
|
107
107
|
int i;
|
108
108
|
for (i = 0; i < sizes_len; i++) {
|
109
109
|
sizes[i] = NUM2INT(RARRAY_PTR(_sizes)[i]);
|
110
|
-
ranges[i] = ary2fltptr(range_ptr[i],
|
110
|
+
ranges[i] = ary2fltptr(range_ptr[i], RB_ALLOC_N(float, 2));
|
111
111
|
}
|
112
112
|
}
|
113
113
|
uniform = TRUE_OR_FALSE(_uniform, 1);
|
@@ -193,7 +193,7 @@ rb_calc_hist_bang(int argc, VALUE* argv, VALUE self)
|
|
193
193
|
rb_scan_args(argc, argv, "12", &images, &accumulate, &mask);
|
194
194
|
Check_Type(images, T_ARRAY);
|
195
195
|
int num_images = RARRAY_LEN(images);
|
196
|
-
IplImage** img =
|
196
|
+
IplImage** img = RB_ALLOC_N(IplImage*, num_images);
|
197
197
|
VALUE* images_ptr = RARRAY_PTR(images);
|
198
198
|
for (int i = 0; i < num_images; i++) {
|
199
199
|
img[i] = IPLIMAGE_WITH_CHECK(images_ptr[i]);
|
@@ -226,7 +226,7 @@ VALUE
|
|
226
226
|
rb_aref(VALUE self, VALUE args)
|
227
227
|
{
|
228
228
|
int num_idx = RARRAY_LEN(args);
|
229
|
-
int* idx =
|
229
|
+
int* idx = RB_ALLOC_N(int, num_idx);
|
230
230
|
VALUE* args_ptr = RARRAY_PTR(args);
|
231
231
|
for (int i = 0; i < num_idx; i++) {
|
232
232
|
idx[i] = NUM2INT(args_ptr[i]);
|
@@ -309,8 +309,8 @@ rb_min_max_value(VALUE self)
|
|
309
309
|
int *max_idx = NULL;
|
310
310
|
try {
|
311
311
|
dims = cvGetDims(self_ptr->bins, NULL);
|
312
|
-
min_idx =
|
313
|
-
max_idx =
|
312
|
+
min_idx = RB_ALLOC_N(int, dims);
|
313
|
+
max_idx = RB_ALLOC_N(int, dims);
|
314
314
|
cvGetMinMaxHistValue(CVHISTOGRAM(self), &min_value, &max_value, min_idx, max_idx);
|
315
315
|
}
|
316
316
|
catch (cv::Exception& e) {
|
@@ -523,10 +523,10 @@ rb_set_hist_bin_ranges_bang(int argc, VALUE* argv, VALUE self)
|
|
523
523
|
Check_Type(_ranges, T_ARRAY);
|
524
524
|
|
525
525
|
int ranges_size = RARRAY_LEN(_ranges);
|
526
|
-
float** ranges =
|
526
|
+
float** ranges = RB_ALLOC_N(float*, ranges_size);
|
527
527
|
VALUE* range_ptr = RARRAY_PTR(_ranges);
|
528
528
|
for (int i = 0; i < ranges_size; ++i) {
|
529
|
-
ranges[i] = ary2fltptr(range_ptr[i],
|
529
|
+
ranges[i] = ary2fltptr(range_ptr[i], RB_ALLOC_N(float, 2));
|
530
530
|
}
|
531
531
|
int uniform = TRUE_OR_FALSE(_uniform, 1);
|
532
532
|
|
@@ -560,7 +560,7 @@ rb_calc_back_project(VALUE self, VALUE image)
|
|
560
560
|
return Qnil;
|
561
561
|
}
|
562
562
|
|
563
|
-
IplImage** img =
|
563
|
+
IplImage** img = RB_ALLOC_N(IplImage*, num_images);
|
564
564
|
VALUE* image_ptr = RARRAY_PTR(image);
|
565
565
|
for (int i = 0; i < num_images; ++i) {
|
566
566
|
img[i] = IPLIMAGE_WITH_CHECK(image_ptr[i]);
|
@@ -607,7 +607,7 @@ rb_calc_back_project_patch(VALUE self, VALUE image, VALUE patch_size, VALUE meth
|
|
607
607
|
return Qnil;
|
608
608
|
}
|
609
609
|
|
610
|
-
IplImage** img =
|
610
|
+
IplImage** img = RB_ALLOC_N(IplImage*, num_images);
|
611
611
|
VALUE* image_ptr = RARRAY_PTR(image);
|
612
612
|
for (int i = 0; i < num_images; ++i) {
|
613
613
|
img[i] = IPLIMAGE_WITH_CHECK(image_ptr[i]);
|
data/ext/opencv/cvmat.cpp
CHANGED
@@ -2098,12 +2098,21 @@ VALUE
|
|
2098
2098
|
rb_cmp_internal(VALUE self, VALUE val, VALUE dest, int operand)
|
2099
2099
|
{
|
2100
2100
|
CvArr* self_ptr = CVARR(self);
|
2101
|
+
|
2102
|
+
if (CV_MAT_CN(cvGetElemType(self_ptr)) != 1) {
|
2103
|
+
rb_raise(rb_eArgError, "self should be a single-channel CvMat.");
|
2104
|
+
}
|
2105
|
+
|
2101
2106
|
try {
|
2102
|
-
if (rb_obj_is_kind_of(val, rb_klass))
|
2103
|
-
|
2104
|
-
|
2107
|
+
if (rb_obj_is_kind_of(val, rb_klass)) {
|
2108
|
+
CvArr* val_ptr = CVARR(val);
|
2109
|
+
if (CV_MAT_CN(cvGetElemType(val_ptr)) != 1) {
|
2110
|
+
rb_raise(rb_eArgError, "val should be a single-channel CvMat.");
|
2111
|
+
}
|
2112
|
+
cvCmp(self_ptr, val_ptr, CVARR(dest), operand);
|
2113
|
+
} else if (rb_obj_is_kind_of(val, rb_cNumeric)) {
|
2105
2114
|
cvCmpS(self_ptr, NUM2DBL(val), CVARR(dest), operand);
|
2106
|
-
else {
|
2115
|
+
} else {
|
2107
2116
|
VALUE mat = new_mat_kind_object(cvGetSize(CVARR(self)), self);
|
2108
2117
|
cvSet(CVARR(mat), VALUE_TO_CVSCALAR(val));
|
2109
2118
|
cvCmp(self_ptr, CVARR(mat), CVARR(dest), operand);
|
@@ -3412,14 +3421,14 @@ rb_fill_poly_bang(int argc, VALUE *argv, VALUE self)
|
|
3412
3421
|
Check_Type(polygons, T_ARRAY);
|
3413
3422
|
drawing_option = DRAWING_OPTION(drawing_option);
|
3414
3423
|
num_polygons = RARRAY_LEN(polygons);
|
3415
|
-
num_points =
|
3424
|
+
num_points = RB_ALLOC_N(int, num_polygons);
|
3416
3425
|
|
3417
|
-
p =
|
3426
|
+
p = RB_ALLOC_N(CvPoint*, num_polygons);
|
3418
3427
|
for (j = 0; j < num_polygons; ++j) {
|
3419
3428
|
points = rb_ary_entry(polygons, j);
|
3420
3429
|
Check_Type(points, T_ARRAY);
|
3421
3430
|
num_points[j] = RARRAY_LEN(points);
|
3422
|
-
p[j] =
|
3431
|
+
p[j] = RB_ALLOC_N(CvPoint, num_points[j]);
|
3423
3432
|
for (i = 0; i < num_points[j]; ++i) {
|
3424
3433
|
p[j][i] = VALUE_TO_CVPOINT(rb_ary_entry(points, i));
|
3425
3434
|
}
|
@@ -3485,7 +3494,7 @@ rb_fill_convex_poly_bang(int argc, VALUE *argv, VALUE self)
|
|
3485
3494
|
Check_Type(points, T_ARRAY);
|
3486
3495
|
drawing_option = DRAWING_OPTION(drawing_option);
|
3487
3496
|
num_points = RARRAY_LEN(points);
|
3488
|
-
p =
|
3497
|
+
p = RB_ALLOC_N(CvPoint, num_points);
|
3489
3498
|
for (i = 0; i < num_points; ++i)
|
3490
3499
|
p[i] = VALUE_TO_CVPOINT(rb_ary_entry(points, i));
|
3491
3500
|
|
@@ -3561,14 +3570,14 @@ rb_poly_line_bang(int argc, VALUE *argv, VALUE self)
|
|
3561
3570
|
Check_Type(polygons, T_ARRAY);
|
3562
3571
|
drawing_option = DRAWING_OPTION(drawing_option);
|
3563
3572
|
num_polygons = RARRAY_LEN(polygons);
|
3564
|
-
num_points =
|
3565
|
-
p =
|
3573
|
+
num_points = RB_ALLOC_N(int, num_polygons);
|
3574
|
+
p = RB_ALLOC_N(CvPoint*, num_polygons);
|
3566
3575
|
|
3567
3576
|
for (j = 0; j < num_polygons; ++j) {
|
3568
3577
|
points = rb_ary_entry(polygons, j);
|
3569
3578
|
Check_Type(points, T_ARRAY);
|
3570
3579
|
num_points[j] = RARRAY_LEN(points);
|
3571
|
-
p[j] =
|
3580
|
+
p[j] = RB_ALLOC_N(CvPoint, num_points[j]);
|
3572
3581
|
for (i = 0; i < num_points[j]; ++i) {
|
3573
3582
|
p[j][i] = VALUE_TO_CVPOINT(rb_ary_entry(points, i));
|
3574
3583
|
}
|
@@ -3977,7 +3986,7 @@ rb_find_chessboard_corners(int argc, VALUE *argv, VALUE self)
|
|
3977
3986
|
|
3978
3987
|
int flag = NIL_P(flag_val) ? CV_CALIB_CB_ADAPTIVE_THRESH : NUM2INT(flag_val);
|
3979
3988
|
CvSize pattern_size = VALUE_TO_CVSIZE(pattern_size_val);
|
3980
|
-
CvPoint2D32f* corners =
|
3989
|
+
CvPoint2D32f* corners = RB_ALLOC_N(CvPoint2D32f, pattern_size.width * pattern_size.height);
|
3981
3990
|
int num_found_corners = 0;
|
3982
3991
|
int pattern_was_found = 0;
|
3983
3992
|
try {
|
@@ -4013,7 +4022,7 @@ rb_find_corner_sub_pix(VALUE self, VALUE corners, VALUE win_size, VALUE zero_zon
|
|
4013
4022
|
{
|
4014
4023
|
Check_Type(corners, T_ARRAY);
|
4015
4024
|
int count = RARRAY_LEN(corners);
|
4016
|
-
CvPoint2D32f* corners_buff =
|
4025
|
+
CvPoint2D32f* corners_buff = RB_ALLOC_N(CvPoint2D32f, count);
|
4017
4026
|
VALUE* corners_ptr = RARRAY_PTR(corners);
|
4018
4027
|
|
4019
4028
|
for (int i = 0; i < count; i++) {
|
@@ -4322,8 +4331,8 @@ rb_get_perspective_transform(VALUE self, VALUE source, VALUE dest)
|
|
4322
4331
|
|
4323
4332
|
int count = RARRAY_LEN(source);
|
4324
4333
|
|
4325
|
-
CvPoint2D32f* source_buff =
|
4326
|
-
CvPoint2D32f* dest_buff =
|
4334
|
+
CvPoint2D32f* source_buff = RB_ALLOC_N(CvPoint2D32f, count);
|
4335
|
+
CvPoint2D32f* dest_buff = RB_ALLOC_N(CvPoint2D32f, count);
|
4327
4336
|
|
4328
4337
|
for (int i = 0; i < count; i++) {
|
4329
4338
|
source_buff[i] = *(CVPOINT2D32F(RARRAY_PTR(source)[i]));
|
@@ -5366,7 +5375,7 @@ rb_draw_chessboard_corners_bang(VALUE self, VALUE pattern_size, VALUE corners, V
|
|
5366
5375
|
{
|
5367
5376
|
Check_Type(corners, T_ARRAY);
|
5368
5377
|
int count = RARRAY_LEN(corners);
|
5369
|
-
CvPoint2D32f* corners_buff =
|
5378
|
+
CvPoint2D32f* corners_buff = RB_ALLOC_N(CvPoint2D32f, count);
|
5370
5379
|
VALUE* corners_ptr = RARRAY_PTR(corners);
|
5371
5380
|
for (int i = 0; i < count; i++) {
|
5372
5381
|
corners_buff[i] = *(CVPOINT2D32F(corners_ptr[i]));
|
@@ -6057,9 +6066,9 @@ rb_snake_image(int argc, VALUE *argv, VALUE self)
|
|
6057
6066
|
(RARRAY_LEN(beta) != length) ||
|
6058
6067
|
(RARRAY_LEN(gamma) != length))
|
6059
6068
|
rb_raise(rb_eArgError, "alpha, beta, gamma should be same size of points");
|
6060
|
-
a =
|
6061
|
-
b =
|
6062
|
-
c =
|
6069
|
+
a = RB_ALLOC_N(float, length);
|
6070
|
+
b = RB_ALLOC_N(float, length);
|
6071
|
+
c = RB_ALLOC_N(float, length);
|
6063
6072
|
for (i = 0; i < length; ++i) {
|
6064
6073
|
a[i] = (float)NUM2DBL(RARRAY_PTR(alpha)[i]);
|
6065
6074
|
b[i] = (float)NUM2DBL(RARRAY_PTR(beta)[i]);
|
@@ -75,7 +75,7 @@ rb_initialize(int argc, VALUE *argv, VALUE self)
|
|
75
75
|
if (NIL_P(values))
|
76
76
|
rb_raise(rb_eArgError, "argument 6 (values) should not be nil when the shape is :custom.");
|
77
77
|
num_values = RARRAY_LEN(values);
|
78
|
-
_values =
|
78
|
+
_values = RB_ALLOC_N(int, num_values);
|
79
79
|
VALUE *values_ptr = RARRAY_PTR(values);
|
80
80
|
for (int i = 0; i < num_values; ++i)
|
81
81
|
_values[i] = NUM2INT(values_ptr[i]);
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bonanza-ruby-opencv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.13.
|
4
|
+
version: 0.0.13.20200923185241
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- lsxi
|
8
8
|
- ser1zw
|
9
9
|
- pcting
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2020-09-23 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rdoc
|
@@ -328,7 +328,7 @@ homepage: https://github.com/ruby-opencv/ruby-opencv/
|
|
328
328
|
licenses:
|
329
329
|
- The BSD License
|
330
330
|
metadata: {}
|
331
|
-
post_install_message:
|
331
|
+
post_install_message:
|
332
332
|
rdoc_options:
|
333
333
|
- "--main"
|
334
334
|
- README.md
|
@@ -345,9 +345,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
345
345
|
- !ruby/object:Gem::Version
|
346
346
|
version: '0'
|
347
347
|
requirements: []
|
348
|
-
|
349
|
-
|
350
|
-
signing_key:
|
348
|
+
rubygems_version: 3.0.8
|
349
|
+
signing_key:
|
351
350
|
specification_version: 4
|
352
351
|
summary: OpenCV wrapper for Ruby
|
353
352
|
test_files:
|