mirror of
https://github.com/ruby-opencv/ruby-opencv
synced 2023-03-27 23:22:12 -04:00
fix CvContour for enabling to call CvSeq's methods
This commit is contained in:
parent
2e82111ee0
commit
ae94135979
2 changed files with 7 additions and 6 deletions
|
@ -80,8 +80,7 @@ define_ruby_class()
|
|||
VALUE
|
||||
rb_allocate(VALUE klass)
|
||||
{
|
||||
CvContour *ptr;
|
||||
return Data_Make_Struct(klass, CvContour, mark_root_object, unregister_object, ptr);
|
||||
return Data_Wrap_Struct(klass, mark_root_object, unregister_object, NULL);
|
||||
}
|
||||
|
||||
VALUE
|
||||
|
@ -95,15 +94,15 @@ rb_initialize(int argc, VALUE *argv, VALUE self)
|
|||
else
|
||||
storage = CHECK_CVMEMSTORAGE(storage);
|
||||
|
||||
CvContour* contour = (CvContour*)DATA_PTR(self);
|
||||
try {
|
||||
contour = (CvContour*)cvCreateSeq(CV_SEQ_ELTYPE_POINT, sizeof(CvContour),
|
||||
sizeof(CvPoint), CVMEMSTORAGE(storage));
|
||||
DATA_PTR(self) = (CvContour*)cvCreateSeq(CV_SEQ_ELTYPE_POINT, sizeof(CvContour),
|
||||
sizeof(CvPoint), CVMEMSTORAGE(storage));
|
||||
}
|
||||
catch (cv::Exception& e) {
|
||||
raise_cverror(e);
|
||||
}
|
||||
register_root_object((CvSeq*)contour, storage);
|
||||
cCvSeq::register_elem_class(CVSEQ(self), cCvPoint::rb_class());
|
||||
register_root_object(CVSEQ(self), storage);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
|
|
@ -22,6 +22,8 @@ VALUE rb_class();
|
|||
void define_ruby_class();
|
||||
|
||||
VALUE seqblock_class(void *ptr);
|
||||
void register_elem_class(CvSeq *seq, VALUE klass);
|
||||
void unregister_elem_class(void *ptr);
|
||||
|
||||
VALUE rb_allocate(VALUE klass);
|
||||
|
||||
|
|
Loading…
Reference in a new issue