From ec18d758fdd3561137052bc4bbf7902b0a8be61a Mon Sep 17 00:00:00 2001 From: ser1zw Date: Tue, 24 May 2011 00:08:51 +0900 Subject: [PATCH] removed CvChainCode --- Manifest.txt | 2 -- ext/opencv/cvchain.cpp | 4 ++-- ext/opencv/cvchaincode.cpp | 49 -------------------------------------- ext/opencv/cvchaincode.h | 43 --------------------------------- ext/opencv/cvmat.cpp | 10 ++++---- ext/opencv/opencv.cpp | 1 - ext/opencv/opencv.h | 1 - opencv.gemspec | 2 +- 8 files changed, 7 insertions(+), 105 deletions(-) delete mode 100644 ext/opencv/cvchaincode.cpp delete mode 100644 ext/opencv/cvchaincode.h diff --git a/Manifest.txt b/Manifest.txt index 83f58f4..2ff160a 100644 --- a/Manifest.txt +++ b/Manifest.txt @@ -22,8 +22,6 @@ ext/opencv/cvcapture.cpp ext/opencv/cvcapture.h ext/opencv/cvchain.cpp ext/opencv/cvchain.h -ext/opencv/cvchaincode.cpp -ext/opencv/cvchaincode.h ext/opencv/cvcircle32f.cpp ext/opencv/cvcircle32f.h ext/opencv/cvcondensation.cpp diff --git a/ext/opencv/cvchain.cpp b/ext/opencv/cvchain.cpp index 5560cf6..1d5abbd 100644 --- a/ext/opencv/cvchain.cpp +++ b/ext/opencv/cvchain.cpp @@ -210,8 +210,8 @@ VALUE new_object() { VALUE storage = cCvMemStorage::new_object(); - CvSeq *seq = cvCreateSeq(CV_SEQ_CHAIN_CONTOUR, sizeof(CvChain), sizeof(CvChainCode), CVMEMSTORAGE(storage)); - VALUE object = cCvSeq::new_sequence(cCvChain::rb_class(), seq, cCvChainCode::rb_class(), storage); + CvSeq *seq = cvCreateSeq(CV_SEQ_CHAIN_CONTOUR, sizeof(CvChain), sizeof(char), CVMEMSTORAGE(storage)); + VALUE object = cCvSeq::new_sequence(cCvChain::rb_class(), seq, T_FIXNUM, storage); return object; } diff --git a/ext/opencv/cvchaincode.cpp b/ext/opencv/cvchaincode.cpp deleted file mode 100644 index f7e26b9..0000000 --- a/ext/opencv/cvchaincode.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/************************************************************ - - cvchaincode.cpp - - - $Author: lsxi $ - - Copyright (C) 2007 Masakazu Yonekura - -************************************************************/ -#include "cvchaincode.h" -/* - * Document-class: OpenCV::CvChainCode - * - * Freeman chain code. - */ -__NAMESPACE_BEGIN_OPENCV -__NAMESPACE_BEGIN_CVCHAINCODE - -VALUE rb_klass; - -VALUE -rb_class() -{ - return rb_klass; -} - -void -define_ruby_class() -{ - if (rb_klass) - return; - /* - * opencv = rb_define_module("OpenCV"); - * - * note: this comment is used by rdoc. - */ - VALUE opencv = rb_module_opencv(); - - rb_klass = rb_define_class_under(opencv, "CvChainCode", rb_cObject); -} - -VALUE -rb_to_i(VALUE self) -{ - return CHR2FIX(CVCHAINCODE(self)->code); -} - -__NAMESPACE_END_CVCHAINCODE -__NAMESPACE_END_OPENCV diff --git a/ext/opencv/cvchaincode.h b/ext/opencv/cvchaincode.h deleted file mode 100644 index be32663..0000000 --- a/ext/opencv/cvchaincode.h +++ /dev/null @@ -1,43 +0,0 @@ -/************************************************************ - - opchaincode.h - - - $Author: lsxi $ - - Copyright (C) 2008 Masakazu Yonekura - - ************************************************************/ -#ifndef RUBY_OPENCV_CVCHAINCODE_H -#define RUBY_OPENCV_CVCHAINCODE_H - -#include "opencv.h" - -#define __NAMESPACE_BEGIN_CVCHAINCODE namespace cCvChainCode{ -#define __NAMESPACE_END_CVCHAINCODE } - -typedef struct CvChainCode{ - char code; -}CvChainCode; - -__NAMESPACE_BEGIN_OPENCV -__NAMESPACE_BEGIN_CVCHAINCODE - -VALUE rb_class(); - -void define_ruby_class(); - -VALUE rb_to_i(VALUE self); - -__NAMESPACE_END_CVCHAINCODE - -inline CvChainCode* -CVCHAINCODE(VALUE object){ - CvChainCode *ptr; - Data_Get_Struct(object, CvChainCode, ptr); - return ptr; -} - - -__NAMESPACE_END_OPENCV - -#endif // RUBY_OPENCV_CVCHAINCODE_H diff --git a/ext/opencv/cvmat.cpp b/ext/opencv/cvmat.cpp index 3f55b59..e5237ba 100644 --- a/ext/opencv/cvmat.cpp +++ b/ext/opencv/cvmat.cpp @@ -4247,7 +4247,6 @@ rb_flood_fill_bang(int argc, VALUE *argv, VALUE self) VALUE rb_find_contours(int argc, VALUE *argv, VALUE self) { - SUPPORT_8UC1_ONLY(self); return rb_find_contours_bang(argc, argv, copy(self)); } @@ -4273,23 +4272,22 @@ rb_find_contours_bang(int argc, VALUE *argv, VALUE self) find_contours_option = FIND_CONTOURS_OPTION(find_contours_option); int mode = FC_MODE(find_contours_option); int method = FC_METHOD(find_contours_option); - int header_size, element_size; + int header_size; if (method == CV_CHAIN_CODE) { klass = cCvChain::rb_class(); - element_klass = cCvChainCode::rb_class(); + element_klass = T_FIXNUM; header_size = sizeof(CvChain); - element_size = sizeof(CvChainCode); } else { klass = cCvContour::rb_class(); element_klass = cCvPoint::rb_class(); header_size = sizeof(CvContour); - element_size = sizeof(CvPoint); } storage = cCvMemStorage::new_object(); if(cvFindContours(CVARR(self), CVMEMSTORAGE(storage), - &contour, header_size, mode, method, FC_OFFSET(find_contours_option)) == 0) + &contour, header_size, mode, method, FC_OFFSET(find_contours_option)) == 0) { return Qnil; + } return cCvSeq::new_sequence(klass, contour, element_klass, storage); } diff --git a/ext/opencv/opencv.cpp b/ext/opencv/opencv.cpp index 28eb604..3e8d737 100644 --- a/ext/opencv/opencv.cpp +++ b/ext/opencv/opencv.cpp @@ -756,7 +756,6 @@ extern "C"{ mOpenCV::mPoint3DSet::define_ruby_module(); mOpenCV::cCvSet::define_ruby_class(); mOpenCV::cCvChain::define_ruby_class(); - mOpenCV::cCvChainCode::define_ruby_class(); mOpenCV::cCvContour::define_ruby_class(); mOpenCV::cCvContourTree::define_ruby_class(); diff --git a/ext/opencv/opencv.h b/ext/opencv/opencv.h index ccec36a..e91df50 100644 --- a/ext/opencv/opencv.h +++ b/ext/opencv/opencv.h @@ -106,7 +106,6 @@ extern "C"{ #include "point3dset.h" #include "cvset.h" #include "cvchain.h" -#include "cvchaincode.h" #include "cvcontour.h" #include "cvcontourtree.h" diff --git a/opencv.gemspec b/opencv.gemspec index d9e87c0..82b2746 100644 --- a/opencv.gemspec +++ b/opencv.gemspec @@ -12,7 +12,7 @@ Gem::Specification.new do |s| s.email = ["masakazu.yonekura@gmail.com", "", "pcting@gmail.com"] s.extensions = ["extconf.rb"] s.extra_rdoc_files = ["History.txt", "License.txt", "Manifest.txt"] - s.files = ["History.txt", "License.txt", "Manifest.txt", "README.rdoc", "Rakefile", "examples/convexhull.rb", "examples/face_detect.rb", "examples/houghcircle.rb", "examples/inpaint.png", "examples/inpaint.rb", "examples/paint.rb", "examples/snake.rb", "examples/stuff.jpg", "ext/opencv/curve.cpp", "ext/opencv/curve.h", "ext/opencv/cvavgcomp.cpp", "ext/opencv/cvavgcomp.h", "ext/opencv/cvbox2d.cpp", "ext/opencv/cvbox2d.h", "ext/opencv/cvcapture.cpp", "ext/opencv/cvcapture.h", "ext/opencv/cvchain.cpp", "ext/opencv/cvchain.h", "ext/opencv/cvchaincode.cpp", "ext/opencv/cvchaincode.h", "ext/opencv/cvcircle32f.cpp", "ext/opencv/cvcircle32f.h", "ext/opencv/cvcondensation.cpp", "ext/opencv/cvcondensation.h", "ext/opencv/cvconnectedcomp.cpp", "ext/opencv/cvconnectedcomp.h", "ext/opencv/cvcontour.cpp", "ext/opencv/cvcontour.h", "ext/opencv/cvcontourtree.cpp", "ext/opencv/cvcontourtree.h", "ext/opencv/cvconvexitydefect.cpp", "ext/opencv/cvconvexitydefect.h", "ext/opencv/cverror.cpp", "ext/opencv/cverror.h", "ext/opencv/cvfont.cpp", "ext/opencv/cvfont.h", "ext/opencv/cvhaarclassifiercascade.cpp", "ext/opencv/cvhaarclassifiercascade.h", "ext/opencv/cvhistogram.cpp", "ext/opencv/cvhistogram.h", "ext/opencv/cvhumoments.cpp", "ext/opencv/cvhumoments.h", "ext/opencv/cvline.cpp", "ext/opencv/cvline.h", "ext/opencv/cvmat.cpp", "ext/opencv/cvmat.h", "ext/opencv/cvmatnd.cpp", "ext/opencv/cvmatnd.h", "ext/opencv/cvmemstorage.cpp", "ext/opencv/cvmemstorage.h", "ext/opencv/cvmoments.cpp", "ext/opencv/cvmoments.h", "ext/opencv/cvpoint.cpp", "ext/opencv/cvpoint.h", "ext/opencv/cvpoint2d32f.cpp", "ext/opencv/cvpoint2d32f.h", "ext/opencv/cvpoint3d32f.cpp", "ext/opencv/cvpoint3d32f.h", "ext/opencv/cvrect.cpp", "ext/opencv/cvrect.h", "ext/opencv/cvscalar.cpp", "ext/opencv/cvscalar.h", "ext/opencv/cvseq.cpp", "ext/opencv/cvseq.h", "ext/opencv/cvset.cpp", "ext/opencv/cvset.h", "ext/opencv/cvsize.cpp", "ext/opencv/cvsize.h", "ext/opencv/cvsize2d32f.cpp", "ext/opencv/cvsize2d32f.h", "ext/opencv/cvslice.cpp", "ext/opencv/cvslice.h", "ext/opencv/cvsparsemat.cpp", "ext/opencv/cvsparsemat.h", "ext/opencv/cvtermcriteria.cpp", "ext/opencv/cvtermcriteria.h", "ext/opencv/cvtwopoints.cpp", "ext/opencv/cvtwopoints.h", "ext/opencv/cvvideowriter.cpp", "ext/opencv/cvvideowriter.h", "extconf.rb", "ext/opencv/gui.cpp", "ext/opencv/gui.h", "ext/opencv/iplconvkernel.cpp", "ext/opencv/iplconvkernel.h", "ext/opencv/iplimage.cpp", "ext/opencv/iplimage.h", "ext/opencv/mouseevent.cpp", "ext/opencv/mouseevent.h", "ext/opencv/opencv.cpp", "ext/opencv/opencv.h", "ext/opencv/point3dset.cpp", "ext/opencv/point3dset.h", "ext/opencv/pointset.cpp", "ext/opencv/pointset.h", "ext/opencv/trackbar.cpp", "ext/opencv/trackbar.h", "ext/opencv/window.cpp", "ext/opencv/window.h", "images/CvMat_sobel.png", "images/CvMat_sub_rect.png", "images/CvSeq_relationmap.png", "images/face_detect_from_lena.jpg", "lib/opencv.rb", "lib/version.rb", "setup/setup.cygwin.rb", "setup/setup.mingw.rb", "setup/setup.mswin32.rb", "test/helper.rb", "test/runner.rb", "test/samples/airplane.jpg", "test/samples/baboon.jpg", "test/samples/baboon200.jpg", "test/samples/baboon200_rotated.jpg", "test/samples/cat.jpg", "test/samples/contours.jpg", "test/samples/fruits.jpg", "test/samples/inpaint-mask.bmp", "test/samples/lena-256x256.jpg", "test/samples/lena-32x32.jpg", "test/samples/lena-eyes.jpg", "test/samples/lena-inpaint.jpg", "test/samples/lena.jpg", "test/samples/lines.jpg", "test/samples/one_way_train_0000.jpg", "test/samples/one_way_train_0001.jpg", "test/samples/str-cv-rotated.jpg", "test/samples/str-cv.jpg", "test/samples/str-ov.jpg", "test/samples/stuff.jpg", "test/test_cvbox2d.rb", "test/test_cvchain.rb", "test/test_cvcircle32f.rb", "test/test_cvconnectedcomp.rb", "test/test_cvcontour.rb", "test/test_cvfont.rb", "test/test_cvhumoments.rb", "test/test_cvline.rb", "test/test_cvmat.rb", "test/test_cvmat_drawing.rb", "test/test_cvmat_dxt.rb", "test/test_cvmat_imageprocessing.rb", "test/test_cvmoments.rb", "test/test_cvpoint.rb", "test/test_cvpoint2d32f.rb", "test/test_cvpoint3d32f.rb", "test/test_cvrect.rb", "test/test_cvscalar.rb", "test/test_cvseq.rb", "test/test_cvsize.rb", "test/test_cvsize2d32f.rb", "test/test_cvtermcriteria.rb", "test/test_cvtwopoints.rb", "test/test_iplconvkernel.rb", "test/test_iplimage.rb", "test/test_opencv.rb", "test/test_preliminary.rb"] + s.files = ["History.txt", "License.txt", "Manifest.txt", "README.rdoc", "Rakefile", "examples/convexhull.rb", "examples/face_detect.rb", "examples/houghcircle.rb", "examples/inpaint.png", "examples/inpaint.rb", "examples/paint.rb", "examples/snake.rb", "examples/stuff.jpg", "ext/opencv/curve.cpp", "ext/opencv/curve.h", "ext/opencv/cvavgcomp.cpp", "ext/opencv/cvavgcomp.h", "ext/opencv/cvbox2d.cpp", "ext/opencv/cvbox2d.h", "ext/opencv/cvcapture.cpp", "ext/opencv/cvcapture.h", "ext/opencv/cvchain.cpp", "ext/opencv/cvchain.h", "ext/opencv/cvcircle32f.cpp", "ext/opencv/cvcircle32f.h", "ext/opencv/cvcondensation.cpp", "ext/opencv/cvcondensation.h", "ext/opencv/cvconnectedcomp.cpp", "ext/opencv/cvconnectedcomp.h", "ext/opencv/cvcontour.cpp", "ext/opencv/cvcontour.h", "ext/opencv/cvcontourtree.cpp", "ext/opencv/cvcontourtree.h", "ext/opencv/cvconvexitydefect.cpp", "ext/opencv/cvconvexitydefect.h", "ext/opencv/cverror.cpp", "ext/opencv/cverror.h", "ext/opencv/cvfont.cpp", "ext/opencv/cvfont.h", "ext/opencv/cvhaarclassifiercascade.cpp", "ext/opencv/cvhaarclassifiercascade.h", "ext/opencv/cvhistogram.cpp", "ext/opencv/cvhistogram.h", "ext/opencv/cvhumoments.cpp", "ext/opencv/cvhumoments.h", "ext/opencv/cvline.cpp", "ext/opencv/cvline.h", "ext/opencv/cvmat.cpp", "ext/opencv/cvmat.h", "ext/opencv/cvmatnd.cpp", "ext/opencv/cvmatnd.h", "ext/opencv/cvmemstorage.cpp", "ext/opencv/cvmemstorage.h", "ext/opencv/cvmoments.cpp", "ext/opencv/cvmoments.h", "ext/opencv/cvpoint.cpp", "ext/opencv/cvpoint.h", "ext/opencv/cvpoint2d32f.cpp", "ext/opencv/cvpoint2d32f.h", "ext/opencv/cvpoint3d32f.cpp", "ext/opencv/cvpoint3d32f.h", "ext/opencv/cvrect.cpp", "ext/opencv/cvrect.h", "ext/opencv/cvscalar.cpp", "ext/opencv/cvscalar.h", "ext/opencv/cvseq.cpp", "ext/opencv/cvseq.h", "ext/opencv/cvset.cpp", "ext/opencv/cvset.h", "ext/opencv/cvsize.cpp", "ext/opencv/cvsize.h", "ext/opencv/cvsize2d32f.cpp", "ext/opencv/cvsize2d32f.h", "ext/opencv/cvslice.cpp", "ext/opencv/cvslice.h", "ext/opencv/cvsparsemat.cpp", "ext/opencv/cvsparsemat.h", "ext/opencv/cvtermcriteria.cpp", "ext/opencv/cvtermcriteria.h", "ext/opencv/cvtwopoints.cpp", "ext/opencv/cvtwopoints.h", "ext/opencv/cvvideowriter.cpp", "ext/opencv/cvvideowriter.h", "extconf.rb", "ext/opencv/gui.cpp", "ext/opencv/gui.h", "ext/opencv/iplconvkernel.cpp", "ext/opencv/iplconvkernel.h", "ext/opencv/iplimage.cpp", "ext/opencv/iplimage.h", "ext/opencv/mouseevent.cpp", "ext/opencv/mouseevent.h", "ext/opencv/opencv.cpp", "ext/opencv/opencv.h", "ext/opencv/point3dset.cpp", "ext/opencv/point3dset.h", "ext/opencv/pointset.cpp", "ext/opencv/pointset.h", "ext/opencv/trackbar.cpp", "ext/opencv/trackbar.h", "ext/opencv/window.cpp", "ext/opencv/window.h", "images/CvMat_sobel.png", "images/CvMat_sub_rect.png", "images/CvSeq_relationmap.png", "images/face_detect_from_lena.jpg", "lib/opencv.rb", "lib/version.rb", "setup/setup.cygwin.rb", "setup/setup.mingw.rb", "setup/setup.mswin32.rb", "test/helper.rb", "test/runner.rb", "test/samples/airplane.jpg", "test/samples/baboon.jpg", "test/samples/baboon200.jpg", "test/samples/baboon200_rotated.jpg", "test/samples/cat.jpg", "test/samples/contours.jpg", "test/samples/fruits.jpg", "test/samples/inpaint-mask.bmp", "test/samples/lena-256x256.jpg", "test/samples/lena-32x32.jpg", "test/samples/lena-eyes.jpg", "test/samples/lena-inpaint.jpg", "test/samples/lena.jpg", "test/samples/lines.jpg", "test/samples/one_way_train_0000.jpg", "test/samples/one_way_train_0001.jpg", "test/samples/str-cv-rotated.jpg", "test/samples/str-cv.jpg", "test/samples/str-ov.jpg", "test/samples/stuff.jpg", "test/test_cvbox2d.rb", "test/test_cvchain.rb", "test/test_cvcircle32f.rb", "test/test_cvconnectedcomp.rb", "test/test_cvcontour.rb", "test/test_cvfont.rb", "test/test_cvhumoments.rb", "test/test_cvline.rb", "test/test_cvmat.rb", "test/test_cvmat_drawing.rb", "test/test_cvmat_dxt.rb", "test/test_cvmat_imageprocessing.rb", "test/test_cvmoments.rb", "test/test_cvpoint.rb", "test/test_cvpoint2d32f.rb", "test/test_cvpoint3d32f.rb", "test/test_cvrect.rb", "test/test_cvscalar.rb", "test/test_cvseq.rb", "test/test_cvsize.rb", "test/test_cvsize2d32f.rb", "test/test_cvtermcriteria.rb", "test/test_cvtwopoints.rb", "test/test_iplconvkernel.rb", "test/test_iplimage.rb", "test/test_opencv.rb", "test/test_preliminary.rb"] s.homepage = %q{http://blueruby.mydns.jp/opencv} s.rdoc_options = ["--main", "README.rdoc"] s.require_paths = ["lib"]