Changeset 32620 for lang/cpluspluscli
- Timestamp:
- 04/19/09 12:31:24 (4 years ago)
- Location:
- lang/cpluspluscli/OpenCvSharp2/trunk
- Files:
-
- 5 modified
-
OpenCvSharp.Extern/WCvConDensation.h (modified) (1 diff)
-
OpenCvSharp.Extern/WCvFont.h (modified) (1 diff)
-
OpenCvSharp.Test/Program.cs (modified) (1 diff)
-
OpenCvSharp.Test/Samples/Kalman.cs (modified) (8 diffs)
-
OpenCvSharp/Src/Core/Cv_H-Q.cs (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lang/cpluspluscli/OpenCvSharp2/trunk/OpenCvSharp.Extern/WCvConDensation.h
r32563 r32620 8 8 9 9 namespace KwsmLab { 10 namespace OpenCvSharp { 11 namespace Extern 10 namespace OpenCvSharp { 11 namespace 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) 12 35 { 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 } 20 39 21 public:22 /// <summary>23 /// CvConDensation24 /// </summary>25 initonly IntPtr Ptr;26 /// <summary>27 /// sizeof(CvConDensation)28 /// </summary>29 literal Int32 SizeOf = static_cast<Int32>(sizeof(CvConDensation));30 40 31 /// <summary>32 /// Constructor33 /// </summary>34 WCvConDensation(IntPtr ptr)35 {36 this->_ptr = static_cast<CvConDensation*>(ptr.ToPointer());37 this->Ptr = IntPtr(ptr);38 }39 41 40 41 42 42 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 }; 46 111 } 112 } 113 } -
lang/cpluspluscli/OpenCvSharp2/trunk/OpenCvSharp.Extern/WCvFont.h
r31568 r32620 38 38 } 39 39 40 property int font_face { 40 property int font_face 41 { 41 42 int get(){ return _ptr->font_face; } 42 43 void set(int value){ _ptr->font_face = value; } 43 44 }; 44 property IntPtr ascii{ 45 property IntPtr ascii 46 { 45 47 IntPtr get(){ return IntPtr(const_cast<int*>(_ptr->ascii)); } 46 48 } 47 property IntPtr greek{ 49 property IntPtr greek 50 { 48 51 IntPtr get(){ return IntPtr(const_cast<int*>(_ptr->greek)); } 49 52 } 50 property IntPtr cyrillic{ 53 property IntPtr cyrillic 54 { 51 55 IntPtr get(){ return IntPtr(const_cast<int*>(_ptr->cyrillic)); } 52 56 } 53 property float hscale { 57 property float hscale 58 { 54 59 float get(){ return _ptr->hscale; } 55 60 void set(float value){ _ptr->hscale = value; } 56 61 }; 57 property float vscale { 62 property float vscale 63 { 58 64 float get(){ return _ptr->vscale; } 59 65 void set(float value){ _ptr->vscale = value; } 60 66 }; 61 property float shear { 67 property float shear 68 { 62 69 float get(){ return _ptr->shear; } 63 70 void set(float value){ _ptr->shear = value; } 64 71 }; 65 property int thickness { 72 property int thickness 73 { 66 74 int get(){ return _ptr->thickness; } 67 75 void set(int value){ _ptr->thickness = value; } 68 76 }; 69 property float dx { 77 property float dx 78 { 70 79 float get(){ return _ptr->dx; } 71 80 void set(float value){ _ptr->dx = value; } 72 81 }; 73 property int line_type { 82 property int line_type 83 { 74 84 int get(){ return _ptr->line_type; } 75 85 void set(int value){ _ptr->line_type = value; } -
lang/cpluspluscli/OpenCvSharp2/trunk/OpenCvSharp.Test/Program.cs
r32586 r32620 109 109 110 110 // !TODO : bugfix 111 //new Test.Kalman(); // カルマンフィルタ111 new Test.Kalman(); // カルマンフィルタ 112 112 113 113 //new Test.LineIterator(); // CvLineIterator sample -
lang/cpluspluscli/OpenCvSharp2/trunk/OpenCvSharp.Test/Samples/Kalman.cs
r32568 r32620 17 17 // カルマンフィルタを用いて回転する点を追跡する 18 18 19 / * 行列データ */19 // A matrix data 20 20 float[] A = new float[] { 1, 1, 0, 1 }; 21 21 … … 24 24 using (CvWindow window = new CvWindow("Kalman", WindowMode.AutoSize)) 25 25 { 26 / * 状態(φ, Δφ) - 角度と角度の増加分 */26 // state is (phi, delta_phi) - angle and angle increment 27 27 CvMat state = new CvMat(2, 1, MatrixType.F32C1); 28 28 CvMat process_noise = new CvMat(2, 1, MatrixType.F32C1); 29 / * φ(角度)だけが観測される */29 // only phi (angle) is measured 30 30 CvMat measurement = new CvMat(1, 1, MatrixType.F32C1); 31 31 … … 43 43 kalman.MeasurementNoiseCov.SetIdentity(1e-1); 44 44 kalman.ErrorCovPost.SetIdentity(1); 45 / * 初期状態をランダムに選択 */45 // choose random initial state 46 46 kalman.StatePost.RandArr(rng, DistributionType.Normal, 0, 0.1); 47 47 … … 51 51 CvPoint state_pt = CalcPoint(img, state_angle); 52 52 53 / * 点の位置を予測 */53 // predict point position 54 54 CvMat prediction = kalman.Predict(null); 55 55 float predict_angle = prediction.DataSingle[0]; … … 58 58 measurement.RandArr(rng, DistributionType.Normal, 0, Math.Sqrt(kalman.MeasurementNoiseCov.DataSingle[0])); 59 59 60 / * 観測値を生成 */60 // generate measurement 61 61 Cv.MatMulAdd(kalman.MeasurementMatrix, state, measurement, measurement); 62 62 … … 71 71 img.Line(state_pt, predict_pt, new CvColor(255, 255, 0), 3, LineType.AntiAlias, 0); 72 72 73 / * カルマンフィルタ状態を修正 */73 // adjust Kalman filter state 74 74 kalman.Correct(measurement); 75 75 … … 78 78 79 79 window.ShowImage(img); 80 / * キーを押すと現在のシミュレーションを中止 */80 // break current simulation by pressing a key 81 81 code = CvWindow.WaitKey(100); 82 82 if (code > 0) … … 85 85 } 86 86 } 87 / * ESC キーで終了 */87 // exit by ESCAPE 88 88 if (code == 27) 89 89 { -
lang/cpluspluscli/OpenCvSharp2/trunk/OpenCvSharp/Src/Core/Cv_H-Q.cs
r32617 r32620 1319 1319 IntPtr controlPtr = (control == null) ? IntPtr.Zero : control.CvPtr; 1320 1320 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); 1322 1325 } 1323 1326 #if LANG_JP
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)