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:
parent
ec18d758fd
commit
1adeec5914
1 changed files with 6 additions and 5 deletions
|
@ -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));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue