1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
--- ext/objectdetect.c.orig 2013-05-04 21:19:44.000000000 +0900
+++ ext/objectdetect.c 2013-05-04 21:53:21.000000000 +0900
@@ -5,7 +5,15 @@
#include "cv.h"
#include "highgui.h"
-#include "ruby.h"
+#ifdef HAVE_RUBY_ST_H
+# include "ruby/ruby.h"
+#else
+# include "ruby.h"
+#endif
+
+#ifndef RSTRING_PTR
+# define RSTRING_PTR(str) (RSTRING(str)->ptr)
+#endif
/*
call-seq:
@@ -25,13 +33,13 @@
Check_Type(target_path, T_STRING);
/* load the model */
- CvHaarClassifierCascade* cascade = cvLoad(RSTRING(model_path)->ptr, 0, 0, 0);
+ CvHaarClassifierCascade* cascade = cvLoad(RSTRING_PTR(model_path), 0, 0, 0);
if( cascade == 0 ) {
rb_raise(rb_eArgError, "Can't load the cascade file");
}
/* load the target picture */
- IplImage *img = cvLoadImage(RSTRING(target_path)->ptr, 1);
+ IplImage *img = cvLoadImage(RSTRING_PTR(target_path), 1);
if( !img ) {
cvReleaseHaarClassifierCascade(&cascade);
rb_raise(rb_eArgError, "Can't load the image file");
@@ -62,7 +70,7 @@
CvMemStorage* storage = cvCreateMemStorage(0);
CvSeq *faces = cvHaarDetectObjects(small_img, cascade, storage,
1.1, 2, CV_HAAR_DO_CANNY_PRUNING,
- cvSize(0,0) );
+ cvSize(0,0), cvSize(0,0) );
/* output */
VALUE results = rb_ary_new();
|