1
0
Fork 0
mirror of https://github.com/ruby-opencv/ruby-opencv synced 2023-03-27 23:22:12 -04:00

fix for Windows

This commit is contained in:
ser1zw 2011-12-27 23:47:08 +09:00
parent d643b7533f
commit fadad7f893
13 changed files with 39 additions and 23 deletions

View file

@ -69,16 +69,17 @@ VALUE
rb_initialize(int argc, VALUE *argv, VALUE self)
{
VALUE center, size, angle;
CvBox2D* self_ptr = CVBOX2D(self);
rb_scan_args(argc, argv, "03", &center, &size, &angle);
if (!NIL_P(center))
CVBOX2D(self)->center = VALUE_TO_CVPOINT2D32F(center);
if (!NIL_P(size))
CVBOX2D(self)->size = VALUE_TO_CVSIZE2D32F(size);
if (!NIL_P(size))
CVBOX2D(self)->angle = NUM2DBL(angle);
if (!NIL_P(center)) {
self_ptr->center = VALUE_TO_CVPOINT2D32F(center);
}
if (!NIL_P(size)) {
self_ptr->size = VALUE_TO_CVSIZE2D32F(size);
self_ptr->angle = NUM2DBL(angle);
}
return self;
}
@ -172,8 +173,9 @@ rb_points(VALUE self)
raise_cverror(e);
}
VALUE points = rb_ary_new2(n);
for (int i = 0; i < n; ++i)
rb_ary_store(points, i, cCvPoint2D32f::new_object(p[i]));
for (int i = 0; i < n; ++i) {
rb_ary_store(points, i, cCvPoint2D32f::new_object(p[i]));
}
return points;
}

View file

@ -53,6 +53,7 @@ VALUE_TO_CVBOX2D(VALUE object){
else {
raise_typeerror(object, cCvBox2D::rb_class());
}
throw "Should never reach here";
}
__NAMESPACE_END_OPENCV

View file

@ -87,6 +87,7 @@ rb_initialize(VALUE self, VALUE desc)
raise_cverror(e);
}
self_ptr->desc = desc;
return self;
}
/*

View file

@ -47,7 +47,8 @@ CVPOINT(VALUE object){
}
inline CvPoint
VALUE_TO_CVPOINT(VALUE object){
VALUE_TO_CVPOINT(VALUE object)
{
if (cCvPoint::rb_compatible_q(cCvPoint::rb_class(), object)) {
return cvPoint(NUM2INT(rb_funcall(object, rb_intern("x"), 0)),
NUM2INT(rb_funcall(object, rb_intern("y"), 0)));
@ -55,6 +56,7 @@ VALUE_TO_CVPOINT(VALUE object){
else {
raise_compatible_typeerror(object, cCvPoint::rb_class());
}
throw "Should never reach here";
}
__NAMESPACE_END_OPENCV

View file

@ -56,6 +56,7 @@ VALUE_TO_CVPOINT2D32F(VALUE object)
else {
raise_compatible_typeerror(object, cCvPoint2D32f::rb_class());
}
throw "Should never reach here";
}
__NAMESPACE_END_OPENCV

View file

@ -59,6 +59,7 @@ VALUE_TO_CVPOINT3D32F(VALUE object)
else {
raise_compatible_typeerror(object, cCvPoint3D32f::rb_class());
}
throw "Should never reach here";
}
__NAMESPACE_END_OPENCV

View file

@ -71,6 +71,7 @@ VALUE_TO_CVRECT(VALUE object)
else {
raise_compatible_typeerror(object, cCvRect::rb_class());
}
throw "Should never reach here";
}
__NAMESPACE_END_OPENCV

View file

@ -51,15 +51,19 @@ inline CvScalar
VALUE_TO_CVSCALAR(VALUE object)
{
ID aref_id;
if (FIXNUM_P(object))
if (FIXNUM_P(object)) {
return cvScalarAll(FIX2INT(object));
else if (rb_respond_to(object, (aref_id = rb_intern("[]"))))
}
else if (rb_respond_to(object, (aref_id = rb_intern("[]")))) {
return cvScalar(NUM2DBL(rb_funcall(object, aref_id, 1, INT2FIX(0))),
NUM2DBL(rb_funcall(object, aref_id, 1, INT2FIX(1))),
NUM2DBL(rb_funcall(object, aref_id, 1, INT2FIX(2))),
NUM2DBL(rb_funcall(object, aref_id, 1, INT2FIX(3))));
else
}
else {
raise_compatible_typeerror(object, cCvScalar::rb_class());
}
throw "Should never reach here";
}
__NAMESPACE_END_OPENCV

View file

@ -57,6 +57,7 @@ VALUE_TO_CVSIZE(VALUE object)
else {
raise_compatible_typeerror(object, cCvSize::rb_class());
}
throw "Should never reach here";
}
__NAMESPACE_END_OPENCV

View file

@ -56,6 +56,7 @@ VALUE_TO_CVSIZE2D32F(VALUE object)
else {
raise_compatible_typeerror(object, cCvSize2D32f::rb_class());
}
throw "Should never reach here";
}
__NAMESPACE_END_OPENCV

View file

@ -53,6 +53,7 @@ VALUE_TO_CVSLICE(VALUE object)
else {
raise_compatible_typeerror(object, cCvSlice::rb_class());
}
throw "Should never reach here";
}
__NAMESPACE_END_OPENCV

View file

@ -358,7 +358,7 @@ compute_smoothness(const IplImage *pFourierImage, const double lowFreqRatio, con
filteredFourierImage = create_frequency_filtered_image(pFourierImage, low, high);
scalar = cvSum(filteredFourierImage);
totalIntensity = scalar.val[0];
totalIntensity = (int)scalar.val[0];
cvReleaseImage(&filteredFourierImage);
outLowDensity = den = totalIntensity / totalArea;
@ -370,7 +370,7 @@ compute_smoothness(const IplImage *pFourierImage, const double lowFreqRatio, con
filteredFourierImage = create_frequency_filtered_image(pFourierImage, low, high);
scalar = cvSum(filteredFourierImage);
totalIntensity = scalar.val[0];
totalIntensity = (int)scalar.val[0];
cvReleaseImage(&filteredFourierImage);
outHighDensity = den = totalIntensity / totalArea;
@ -516,13 +516,13 @@ create_frequency_filtered_image(const IplImage *pImage, int low, int high)
{
CvPoint2D32f center;
center.x = pImage->width / 2;
center.y = pImage->height / 2;
center.x = (float)(pImage->width / 2);
center.y = (float)(pImage->height / 2);
CvBox2D box;
box.center = center;
box.size.width = high;
box.size.height = high;
box.size.width = (float)high;
box.size.height = (float)high;
IplImage *pFilterMask = rb_cvCreateImage(cvGetSize(pImage), IPL_DEPTH_64F, 1);
IplImage *pFiltered = rb_cvCreateImage(cvGetSize(pImage), IPL_DEPTH_64F, 1);
@ -533,8 +533,8 @@ create_frequency_filtered_image(const IplImage *pImage, int low, int high)
if (high > 0)
cvEllipseBox(pFilterMask, box, cvScalar(255, 255, 255, 255), CV_FILLED, 8, 0);
box.size.width = low;
box.size.height = low;
box.size.width = (float)low;
box.size.height = (float)low;
if (low > 0)
cvEllipseBox(pFilterMask, box, cvScalar(0, 0, 0, 0), CV_FILLED, 8, 0);

View file

@ -41,7 +41,7 @@ when /mswin32/
opencv_libraries.map! {|lib| lib + OPENCV_VERSION_SUFFIX }
have_library("msvcrt")
opencv_libraries.each{|lib|
raise "lib#{lib} not found." unless have_library(lib)
raise "#{lib}.lib not found." unless have_library(lib)
}
$CFLAGS << ' /EHsc'
else