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

modified CvChain for speeding up

This commit is contained in:
ser1zw 2011-05-24 00:25:58 +09:00
parent ec18d758fd
commit 1adeec5914

View file

@ -134,10 +134,10 @@ rb_codes(VALUE self)
{
CvChain *chain = CVCHAIN(self);
CvChainPtReader reader;
CvPoint p = chain->origin;
VALUE ary = rb_ary_new2(chain->total);
int total = chain->total;
VALUE ary = rb_ary_new2(total);
cvStartReadChainPoints(chain, &reader);
for (int i = 0; i < chain->total; i++) {
for (int i = 0; i < total; ++i) {
CV_READ_SEQ_ELEM(reader.code, (*((CvSeqReader*)&(reader))));
rb_ary_store(ary, i, CHR2FIX(reader.code));
}
@ -156,9 +156,10 @@ rb_points(VALUE self)
CvChain *chain = CVCHAIN(self);
CvChainPtReader reader;
CvPoint p = chain->origin;
VALUE ary = rb_ary_new2(chain->total);
int total = chain->total;
VALUE ary = rb_ary_new2(total);
cvStartReadChainPoints(chain, &reader);
for (int i = 0; i < chain->total; i++) {
for (int i = 0; i < total; ++i) {
CV_READ_CHAIN_POINT(p, reader);
rb_ary_store(ary, i, cCvPoint::new_object(p));
}