Changeset 32620 for lang/cpluspluscli

Show
Ignore:
Timestamp:
04/19/09 12:31:24 (4 years ago)
Author:
schima
Message:

WCvConDensation

Location:
lang/cpluspluscli/OpenCvSharp2/trunk
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • lang/cpluspluscli/OpenCvSharp2/trunk/OpenCvSharp.Extern/WCvConDensation.h

    r32563 r32620  
    88 
    99namespace KwsmLab { 
    10         namespace OpenCvSharp { 
    11                 namespace Extern 
     10namespace OpenCvSharp { 
     11namespace Extern 
     12{ 
     13        /// <summary> 
     14        /// CvConnectedComp 
     15        /// </summary> 
     16        public ref class WCvConDensation 
     17        { 
     18        private: 
     19                CvConDensation* _ptr; 
     20 
     21        public: 
     22                /// <summary> 
     23                /// pointer (CvConDensation*) 
     24                /// </summary> 
     25                initonly IntPtr Ptr; 
     26                /// <summary> 
     27                /// sizeof(CvConDensation) 
     28                /// </summary> 
     29                literal Int32 SizeOf = static_cast<Int32>(sizeof(CvConDensation));  
     30 
     31                /// <summary> 
     32                /// Constructor 
     33                /// </summary> 
     34                WCvConDensation(IntPtr ptr) 
    1235                { 
    13                         /// <summary> 
    14                         /// CvConnectedComp 
    15                         /// </summary> 
    16                         public ref class WCvConDensation 
    17                         { 
    18                         private: 
    19                                 CvConDensation* _ptr; 
     36                        this->_ptr = static_cast<CvConDensation*>(ptr.ToPointer()); 
     37                        this->Ptr = IntPtr(ptr);                 
     38                } 
    2039 
    21                         public: 
    22                                 /// <summary> 
    23                                 /// CvConDensation 
    24                                 /// </summary> 
    25                                 initonly IntPtr Ptr; 
    26                                 /// <summary> 
    27                                 /// sizeof(CvConDensation) 
    28                                 /// </summary> 
    29                                 literal Int32 SizeOf = static_cast<Int32>(sizeof(CvConDensation));  
    3040 
    31                                 /// <summary> 
    32                                 /// Constructor 
    33                                 /// </summary> 
    34                                 WCvConDensation(IntPtr ptr) 
    35                                 { 
    36                                         this->_ptr = static_cast<CvConDensation*>(ptr.ToPointer()); 
    37                                         this->Ptr = IntPtr(ptr);                 
    38                                 } 
    3941 
    40                                  
    41                                  
    4242 
    43                         }; 
    44                 } 
    45         } 
     43                property int MP  
     44                { 
     45                        int get(){ return _ptr->MP; } 
     46                        void set(int value){ _ptr->MP = value; } 
     47                }; 
     48                property int DP  
     49                { 
     50                        int get(){ return _ptr->DP; } 
     51                        void set(int value){ _ptr->DP = value; } 
     52                }; 
     53 
     54                /* Matrix of the linear Dynamics system  */ 
     55                property float* DynamMatr  
     56                { 
     57                        float* get(){ return _ptr->DynamMatr; } 
     58                }; 
     59                /* Vector of State                       */ 
     60                property float* State  
     61                { 
     62                        float* get(){ return _ptr->State; } 
     63                }; 
     64 
     65                /* Number of the Samples                 */ 
     66                property int SamplesNum  
     67                { 
     68                        int get(){ return _ptr->SamplesNum; } 
     69                        void set(int value){ _ptr->SamplesNum = value; } 
     70                }; 
     71         
     72        /* arr of the Sample Vectors             */ 
     73                property float** flSamples  
     74                { 
     75                        float** get(){ return _ptr->flSamples; } 
     76                }; 
     77                /* temporary array of the Sample Vectors */ 
     78                property float** flNewSamples  
     79                { 
     80                        float** get(){ return _ptr->flNewSamples; } 
     81                }; 
     82 
     83                /* Confidence for each Sample            */ 
     84                property float* flConfidence  
     85                { 
     86                        float* get(){ return _ptr->flConfidence; } 
     87                }; 
     88                /* Cumulative confidence                 */ 
     89                property float* flCumulative  
     90                { 
     91                        float* get(){ return _ptr->flCumulative; } 
     92                }; 
     93                /* Temporary vector                      */ 
     94                property float* Temp  
     95                { 
     96                        float* get(){ return _ptr->Temp; } 
     97                }; 
     98                /* RandomVector to update sample set     */ 
     99                property float* RandomSample  
     100                { 
     101                        float* get(){ return _ptr->RandomSample; } 
     102                }; 
     103   
     104                /* Array of structures to generate random vectors */     
     105                property IntPtr RandS  
     106                { 
     107                        IntPtr get(){ return IntPtr(_ptr->RandS); } 
     108                };       
     109 
     110        }; 
    46111} 
     112} 
     113} 
  • lang/cpluspluscli/OpenCvSharp2/trunk/OpenCvSharp.Extern/WCvFont.h

    r31568 r32620  
    3838                } 
    3939 
    40                 property int font_face { 
     40                property int font_face  
     41                { 
    4142                        int get(){ return _ptr->font_face; } 
    4243                        void set(int value){ _ptr->font_face = value; } 
    4344                }; 
    44                 property IntPtr ascii{ 
     45                property IntPtr ascii 
     46                { 
    4547                        IntPtr get(){ return IntPtr(const_cast<int*>(_ptr->ascii)); } 
    4648                } 
    47                 property IntPtr greek{ 
     49                property IntPtr greek 
     50                { 
    4851                        IntPtr get(){ return IntPtr(const_cast<int*>(_ptr->greek)); } 
    4952                } 
    50                 property IntPtr cyrillic{ 
     53                property IntPtr cyrillic 
     54                { 
    5155                        IntPtr get(){ return IntPtr(const_cast<int*>(_ptr->cyrillic)); } 
    5256                } 
    53                 property float hscale { 
     57                property float hscale  
     58                { 
    5459                        float get(){ return _ptr->hscale; } 
    5560                        void set(float value){ _ptr->hscale = value; } 
    5661                }; 
    57                 property float vscale { 
     62                property float vscale  
     63                { 
    5864                        float get(){ return _ptr->vscale; } 
    5965                        void set(float value){ _ptr->vscale = value; } 
    6066                }; 
    61                 property float shear { 
     67                property float shear  
     68                { 
    6269                        float get(){ return _ptr->shear; } 
    6370                        void set(float value){ _ptr->shear = value; } 
    6471                }; 
    65                 property int thickness { 
     72                property int thickness  
     73                { 
    6674                        int get(){ return _ptr->thickness; } 
    6775                        void set(int value){ _ptr->thickness = value; } 
    6876                }; 
    69                 property float dx { 
     77                property float dx  
     78                { 
    7079                        float get(){ return _ptr->dx; } 
    7180                        void set(float value){ _ptr->dx = value; } 
    7281                }; 
    73                 property int line_type { 
     82                property int line_type  
     83                { 
    7484                        int get(){ return _ptr->line_type; } 
    7585                        void set(int value){ _ptr->line_type = value; } 
  • lang/cpluspluscli/OpenCvSharp2/trunk/OpenCvSharp.Test/Program.cs

    r32586 r32620  
    109109 
    110110            // !TODO : bugfix 
    111             //new Test.Kalman();                      // カルマンフィルタ 
     111            new Test.Kalman();                      // カルマンフィルタ 
    112112 
    113113            //new Test.LineIterator();                // CvLineIterator sample 
  • lang/cpluspluscli/OpenCvSharp2/trunk/OpenCvSharp.Test/Samples/Kalman.cs

    r32568 r32620  
    1717            // カルマンフィルタを用いて回転する点を追跡する 
    1818 
    19             /* 行列データ */ 
     19            // A matrix data 
    2020            float[] A = new float[] { 1, 1, 0, 1 }; 
    2121 
     
    2424            using (CvWindow window = new CvWindow("Kalman", WindowMode.AutoSize)) 
    2525            { 
    26                 /* 状態(φ, Δφ) - 角度と角度の増加分 */ 
     26                // state is (phi, delta_phi) - angle and angle increment 
    2727                CvMat state = new CvMat(2, 1, MatrixType.F32C1); 
    2828                CvMat process_noise = new CvMat(2, 1, MatrixType.F32C1); 
    29                 /* φ(角度)だけが観測される */ 
     29                // only phi (angle) is measured 
    3030                CvMat measurement = new CvMat(1, 1, MatrixType.F32C1); 
    3131 
     
    4343                    kalman.MeasurementNoiseCov.SetIdentity(1e-1); 
    4444                    kalman.ErrorCovPost.SetIdentity(1); 
    45                     /* 初期状態をランダムに選択 */ 
     45                    // choose random initial state 
    4646                    kalman.StatePost.RandArr(rng, DistributionType.Normal, 0, 0.1); 
    4747 
     
    5151                        CvPoint state_pt = CalcPoint(img, state_angle); 
    5252 
    53                         /* 点の位置を予測 */ 
     53                        // predict point position 
    5454                        CvMat prediction = kalman.Predict(null); 
    5555                        float predict_angle = prediction.DataSingle[0]; 
     
    5858                        measurement.RandArr(rng, DistributionType.Normal, 0, Math.Sqrt(kalman.MeasurementNoiseCov.DataSingle[0])); 
    5959 
    60                         /* 観測値を生成 */ 
     60                        // generate measurement 
    6161                        Cv.MatMulAdd(kalman.MeasurementMatrix, state, measurement, measurement); 
    6262 
     
    7171                        img.Line(state_pt, predict_pt, new CvColor(255, 255, 0), 3, LineType.AntiAlias, 0); 
    7272 
    73                         /* カルマンフィルタ状態を修正 */ 
     73                        // adjust Kalman filter state 
    7474                        kalman.Correct(measurement); 
    7575 
     
    7878 
    7979                        window.ShowImage(img); 
    80                         /* キーを押すと現在のシミュレーションを中止 */ 
     80                        // break current simulation by pressing a key 
    8181                        code = CvWindow.WaitKey(100); 
    8282                        if (code > 0) 
     
    8585                        } 
    8686                    } 
    87                     /* ESC キーで終了 */ 
     87                    // exit by ESCAPE 
    8888                    if (code == 27) 
    8989                    { 
  • lang/cpluspluscli/OpenCvSharp2/trunk/OpenCvSharp/Src/Core/Cv_H-Q.cs

    r32617 r32620  
    13191319            IntPtr controlPtr = (control == null) ? IntPtr.Zero : control.CvPtr; 
    13201320            IntPtr result = CvDll.cvKalmanPredict(kalman.CvPtr, controlPtr); 
    1321             return new CvMat(result, false); 
     1321            if (result == IntPtr.Zero) 
     1322                return null; 
     1323            else 
     1324                return new CvMat(result, false); 
    13221325        } 
    13231326#if LANG_JP