Update the trunk to the OpenCV's CVS (2008-07-14)
[opencv] / interfaces / swig / general / extensions.i
index 81d6881..0cb01de 100644 (file)
@@ -42,6 +42,7 @@
 
 // 2004-03-23, Mark Asbach       <asbach@ient.rwth-aachen.de>
 //             Institute of Communications Engineering, RWTH Aachen University
+// 2008-05-15, Xavier Delacour   <xavier.delacour@gmail.com>
 
 
 %extend IplImage       { ~IplImage       () { IplImage       * dummy = self; cvReleaseImage              (& dummy); } }
@@ -57,6 +58,7 @@
 %extend CvHistogram    { ~CvHistogram    () { CvHistogram    * dummy = self; cvReleaseHist               (& dummy); } }
 %extend CvHaarClassifierCascade { ~CvHaarClassifierCascade () { CvHaarClassifierCascade * dummy = self; cvReleaseHaarClassifierCascade  (& dummy); } }
 %extend CvPOSITObject  { ~CvPOSITObject  () { CvPOSITObject  * dummy = self; cvReleasePOSITObject        (& dummy); } }
+%extend CvFeatureTree  { ~CvFeatureTree  () { CvFeatureTree  * dummy = self; cvReleaseFeatureTree        (& dummy); } }
 
 // string operators for some OpenCV types
 
        }
     const double __getitem__ (int index) {
         if (index >= 4) {
+#ifdef defined(SWIGPYTHON)
             PyErr_SetString (PyExc_IndexError, "indice must be lower than 4");
+#elif defined(SWIGOCTAVE)
+            error("indice must be lower than 4");
+#endif
             return 0;
         }
         if (index < -4) {
+#ifdef defined(SWIGPYTHON)
             PyErr_SetString (PyExc_IndexError, "indice must be bigger or egal to -4");
+#elif defined(SWIGOCTAVE)
+           error("indice must be bigger or egal to -4");
+#endif
             return 0;
         }
         if (index < 0) {
     }
     void __setitem__ (int index, double value) {
         if (index >= 4) {
+#ifdef defined(SWIGPYTHON)
             PyErr_SetString (PyExc_IndexError, "indice must be lower than 4");
+#elif defined(SWIGOCTAVE)
+           error("indice must be lower than 4");
+#endif
             return;
         }
         if (index < -4) {
+#ifdef defined(SWIGPYTHON)
             PyErr_SetString (PyExc_IndexError, "indice must be bigger or egal to -4");
+#elif defined(SWIGOCTAVE)
+           error("indice must be bigger or egal to -4");
+#endif
             return;
         }
         if (index < 0) {
@@ -159,7 +177,9 @@ int CvMat_dataOrder_get(CvMat * m){
        return 0;
 }
 int CvMat_imageSize_get(CvMat * m){
-       return m->step*m->rows;
+       int step = m->step ? m->step : 
+         step = CV_ELEM_SIZE(m->type) * m->cols;
+       return step*m->rows;
 }
 int CvMat_widthStep_get(CvMat * m){
        return m->step;