Changeset 32142
- Timestamp:
- 04/08/09 23:37:03 (4 years ago)
- Location:
- lang/cpluspluscli/OpenCvSharp2/trunk
- Files:
-
- 3 added
- 16 modified
-
OpenCvSharp.Extern/OpenCvSharp.Extern.vcproj (modified) (2 diffs)
-
OpenCvSharp.Extern/WCvChainPtReader.cpp (added)
-
OpenCvSharp.Extern/WCvChainPtReader.h (added)
-
OpenCvSharp.Test/Program.cs (modified) (2 diffs)
-
OpenCvSharp.Test/Samples/ContourScanner.cs (modified) (2 diffs)
-
OpenCvSharp.Test/Samples/FindContours.cs (modified) (1 diff)
-
OpenCvSharp.Test/Samples/Squares.cs (modified) (2 diffs)
-
OpenCvSharp.Test/Samples/TreeNodeIterator.cs (modified) (1 diff)
-
OpenCvSharp/Class/CvChainPtReader.cs (added)
-
OpenCvSharp/Class/CvContourScanner.cs (modified) (4 diffs)
-
OpenCvSharp/Core/CvDll.cs (modified) (2 diffs)
-
OpenCvSharp/Core/Cv_A-C.cs (modified) (7 diffs)
-
OpenCvSharp/Core/Cv_D-G.cs (modified) (2 diffs)
-
OpenCvSharp/Core/Cv_R-Z.cs (modified) (3 diffs)
-
OpenCvSharp/CvArr/CvChain.cs (modified) (1 diff)
-
OpenCvSharp/CvArr/CvContour.cs (modified) (1 diff)
-
OpenCvSharp/DisposableObject.cs (modified) (1 diff)
-
OpenCvSharp/OpenCvSharp.csproj (modified) (1 diff)
-
wrapped functions.csv (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/cpluspluscli/OpenCvSharp2/trunk/OpenCvSharp.Extern/OpenCvSharp.Extern.vcproj
r32110 r32142 554 554 </File> 555 555 <File 556 RelativePath=".\WCvChainPtReader.cpp" 557 > 558 </File> 559 <File 556 560 RelativePath=".\WCvConnectedComp.cpp" 557 561 > … … 700 704 </File> 701 705 <File 706 RelativePath=".\WCvChainPtReader.h" 707 > 708 </File> 709 <File 702 710 RelativePath=".\WCvConnectedComp.h" 703 711 > -
lang/cpluspluscli/OpenCvSharp2/trunk/OpenCvSharp.Test/Program.cs
r32022 r32142 67 67 //new Test.Contour(); 68 68 // CvContourScanner Sample 69 //new Test.ContourScanner();69 new Test.ContourScanner(); 70 70 // System.Drawing.Bitmapへの変換 71 71 //new Test.ConvertToBitmap(); … … 133 133 //new Test.Resize(); 134 134 // CvSeqのテスト 135 new Test.SeqTest();135 //new Test.SeqTest(); 136 136 // 輪郭検出 137 137 //new Test.Snake(); -
lang/cpluspluscli/OpenCvSharp2/trunk/OpenCvSharp.Test/Samples/ContourScanner.cs
r32042 r32142 27 27 { 28 28 // find contours by CvContourScanner 29 CvContourScanner scanner = Cv.StartFindContours(canny, storage, CvContour<CvPoint>.SizeOf, ContourRetrieval.Tree, ContourChain.ApproxSimple); 30 //CvContourScanner scanner = new CvContourScanner(canny, storage, CvContour<CvPoint>.SizeOf, ContourRetrieval.Tree, ContourChain.ApproxSimple); 29 30 // native style 31 /* 32 CvContourScanner scanner = Cv.StartFindContours(canny, storage, CvContour.SizeOf, ContourRetrieval.Tree, ContourChain.ApproxSimple); 31 33 while (true) 32 34 { … … 35 37 break; 36 38 else 37 result.DrawContours(c, CvColor.Red, CvColor.Green, 0, 3, LineType.AntiAlias);39 Cv.DrawContours(result, c, CvColor.Red, CvColor.Green, 0, 3, LineType.AntiAlias); 38 40 } 39 41 Cv.EndFindContours(scanner); 40 //scanner.Dispose(); 42 //*/ 43 44 // wrapper style 45 using (CvContourScanner scanner = new CvContourScanner(canny, storage, CvContour.SizeOf, ContourRetrieval.Tree, ContourChain.ApproxSimple)) 46 { 47 foreach (CvSeq<CvPoint> c in scanner) 48 { 49 result.DrawContours(c, CvColor.Red, CvColor.Green, 0, 3, LineType.AntiAlias); 50 } 51 } 41 52 } 42 53 -
lang/cpluspluscli/OpenCvSharp2/trunk/OpenCvSharp.Test/Samples/FindContours.cs
r31604 r32142 53 53 CvMemStorage storage = new CvMemStorage(); 54 54 // native style 55 Cv.FindContours(img, storage, out contours, CvContour <CvPoint>.SizeOf, ContourRetrieval.Tree, ContourChain.ApproxSimple);56 contours = Cv.ApproxPoly(contours, CvContour <CvPoint>.SizeOf, storage, ApproxPolyMethod.DP, 3, true);55 Cv.FindContours(img, storage, out contours, CvContour.SizeOf, ContourRetrieval.Tree, ContourChain.ApproxSimple); 56 contours = Cv.ApproxPoly(contours, CvContour.SizeOf, storage, ApproxPolyMethod.DP, 3, true); 57 57 58 58 // wrapper style -
lang/cpluspluscli/OpenCvSharp2/trunk/OpenCvSharp.Test/Samples/Squares.cs
r31777 r32142 122 122 // find contours and store them all as a list 123 123 CvSeq<CvPoint> contours; 124 Cv.FindContours(gray, storage, out contours, CvContour <CvPoint>.SizeOf, ContourRetrieval.List, ContourChain.ApproxSimple, new CvPoint(0, 0));124 Cv.FindContours(gray, storage, out contours, CvContour.SizeOf, ContourRetrieval.List, ContourChain.ApproxSimple, new CvPoint(0, 0)); 125 125 126 126 // test each contour … … 129 129 // approximate contour with accuracy proportional 130 130 // to the contour perimeter 131 CvSeq<CvPoint> result = Cv.ApproxPoly(contours, CvContour <CvPoint>.SizeOf, storage, ApproxPolyMethod.DP, contours.ContourPerimeter() * 0.02, false);131 CvSeq<CvPoint> result = Cv.ApproxPoly(contours, CvContour.SizeOf, storage, ApproxPolyMethod.DP, contours.ContourPerimeter() * 0.02, false); 132 132 // square contours should have 4 vertices after approximation 133 133 // relatively large area (to filter out noisy contours) -
lang/cpluspluscli/OpenCvSharp2/trunk/OpenCvSharp.Test/Samples/TreeNodeIterator.cs
r31759 r32142 25 25 Cv.Threshold(src_img_gray, tmp_img, 120, 255, ThresholdType.Binary); 26 26 CvSeq<CvPoint> contours; 27 Cv.FindContours(tmp_img, storage, out contours, CvContour <CvPoint>.SizeOf, ContourRetrieval.Tree, ContourChain.ApproxSimple);27 Cv.FindContours(tmp_img, storage, out contours, CvContour.SizeOf, ContourRetrieval.Tree, ContourChain.ApproxSimple); 28 28 /* 輪郭シーケンスから座標を取得 */ 29 29 using (CvFileStorage fs = new CvFileStorage("contours.yaml", null, FileStorageMode.Write)) -
lang/cpluspluscli/OpenCvSharp2/trunk/OpenCvSharp/Class/CvContourScanner.cs
r31945 r32142 16 16 /// </summary> 17 17 #endif 18 public class CvContourScanner : DisposableObject, ICvPtrHolder 18 public class CvContourScanner : DisposableObject, ICvPtrHolder, IEnumerable<CvSeq<CvPoint>> 19 19 { 20 20 /// <summary> … … 47 47 #endif 48 48 public CvContourScanner(CvArr image, CvMemStorage storage) 49 : this(image, storage, CvContour <CvPoint>.SizeOf, ContourRetrieval.List, ContourChain.ApproxSimple, new CvPoint(0, 0))49 : this(image, storage, CvContour.SizeOf, ContourRetrieval.List, ContourChain.ApproxSimple, new CvPoint(0, 0)) 50 50 { 51 51 } … … 163 163 public static CvContourScanner StartFindContours(CvArr image, CvMemStorage storage) 164 164 { 165 return new CvContourScanner(image, storage, CvContour <CvPoint>.SizeOf, ContourRetrieval.List, ContourChain.ApproxSimple, new CvPoint(0, 0));165 return new CvContourScanner(image, storage, CvContour.SizeOf, ContourRetrieval.List, ContourChain.ApproxSimple, new CvPoint(0, 0)); 166 166 } 167 167 #if LANG_JP … … 291 291 } 292 292 #endregion 293 294 #region IEnumerable<CvSeq<CvPoint>> 295 /// <summary> 296 /// 297 /// </summary> 298 /// <returns></returns> 299 public IEnumerator<CvSeq<CvPoint>> GetEnumerator() 300 { 301 while (true) 302 { 303 CvSeq<CvPoint> c = Cv.FindNextContour(this); 304 if (c == null) 305 break; 306 else 307 yield return c; 308 } 309 Cv.EndFindContours(this); 310 } 311 System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() 312 { 313 return GetEnumerator(); 314 } 315 #endregion 293 316 } 294 317 } -
lang/cpluspluscli/OpenCvSharp2/trunk/OpenCvSharp/Core/CvDll.cs
r32138 r32142 227 227 public static extern void cvPyrUp(IntPtr src, IntPtr dst, CvFilter filter); 228 228 [DllImport(DLL_CV)] 229 public static extern CvPoint cvReadChainPoint(IntPtr reader); 230 [DllImport(DLL_CV)] 229 231 public static extern void cvReleaseHaarClassifierCascade(ref IntPtr cascade); 230 232 [DllImport(DLL_CV)] … … 274 276 [DllImport(DLL_CV)] 275 277 public static extern IntPtr cvStartFindContours(IntPtr image, IntPtr storage, int header_size, [MarshalAs(UnmanagedType.U4)] ContourRetrieval mode, [MarshalAs(UnmanagedType.U4)] ContourChain method, CvPoint offset); 278 [DllImport(DLL_CV)] 279 public static extern void cvStartReadChainPoints(IntPtr chain, IntPtr reader); 276 280 [DllImport(DLL_CV)] 277 281 public static extern Subdiv2DPointLocation cvSubdiv2DLocate(IntPtr subdiv, CvPoint2D32f pt, out CvSubdiv2DEdge edge, ref IntPtr vertex); -
lang/cpluspluscli/OpenCvSharp2/trunk/OpenCvSharp/Core/Cv_A-C.cs
r32138 r32142 462 462 /// <returns></returns> 463 463 #endif 464 public static CvSeq<CvPoint> ApproxChains(this CvChain <CvPoint>src_seq, CvMemStorage storage)464 public static CvSeq<CvPoint> ApproxChains(this CvChain src_seq, CvMemStorage storage) 465 465 { 466 466 return ApproxChains(src_seq, storage, ContourChain.ApproxSimple, 0, 0, false); … … 483 483 /// /// <returns></returns> 484 484 #endif 485 public static CvSeq<CvPoint> ApproxChains(this CvChain <CvPoint>src_seq, CvMemStorage storage, ContourChain method)485 public static CvSeq<CvPoint> ApproxChains(this CvChain src_seq, CvMemStorage storage, ContourChain method) 486 486 { 487 487 return ApproxChains(src_seq, storage, method, 0, 0, false); … … 506 506 /// <returns></returns> 507 507 #endif 508 public static CvSeq<CvPoint> ApproxChains(this CvChain <CvPoint>src_seq, CvMemStorage storage, ContourChain method, double parameter)508 public static CvSeq<CvPoint> ApproxChains(this CvChain src_seq, CvMemStorage storage, ContourChain method, double parameter) 509 509 { 510 510 return ApproxChains(src_seq, storage, method, parameter, 0, false); … … 518 518 /// <param name="method">推定手法.</param> 519 519 /// <param name="parameter">メソッドパラメータ(現在は使われていない).</param> 520 /// <param name="minimal_perimeter"> </param>520 /// <param name="minimal_perimeter">minimal_perimeter以上の周囲長をもつ輪郭のみを計算する.その他のチェーンは結果の構造体から削除される.</param> 521 521 /// <returns></returns> 522 522 #else … … 531 531 /// <returns></returns> 532 532 #endif 533 public static CvSeq<CvPoint> ApproxChains(this CvChain <CvPoint>src_seq, CvMemStorage storage, ContourChain method, double parameter, int minimal_perimeter)533 public static CvSeq<CvPoint> ApproxChains(this CvChain src_seq, CvMemStorage storage, ContourChain method, double parameter, int minimal_perimeter) 534 534 { 535 535 return ApproxChains(src_seq, storage, method, parameter, minimal_perimeter, false); … … 543 543 /// <param name="method">推定手法.</param> 544 544 /// <param name="parameter">メソッドパラメータ(現在は使われていない).</param> 545 /// <param name="minimal_perimeter"> </param>546 /// <param name="recursive"> </param>545 /// <param name="minimal_perimeter">minimal_perimeter以上の周囲長をもつ輪郭のみを計算する.その他のチェーンは結果の構造体から削除される.</param> 546 /// <param name="recursive">trueの場合,src_seqからh_nextあるいはv_nextによって辿ることができる全てのチェーンを近似する.falseの場合,単一のチェーンを近似する. </param> 547 547 /// <returns></returns> 548 548 #else … … 558 558 /// <returns></returns> 559 559 #endif 560 public static CvSeq<CvPoint> ApproxChains(this CvChain <CvPoint>src_seq, CvMemStorage storage, ContourChain method, double parameter, int minimal_perimeter, bool recursive)560 public static CvSeq<CvPoint> ApproxChains(this CvChain src_seq, CvMemStorage storage, ContourChain method, double parameter, int minimal_perimeter, bool recursive) 561 561 { 562 562 if (src_seq == null) -
lang/cpluspluscli/OpenCvSharp2/trunk/OpenCvSharp/Core/Cv_D-G.cs
r32022 r32142 919 919 public static int FindContours(this CvArr image, CvMemStorage storage, out CvSeq<CvPoint> first_contour) 920 920 { 921 return FindContours(image, storage, out first_contour, CvContour <CvPoint>.SizeOf, ContourRetrieval.List, ContourChain.ApproxSimple, new CvPoint(0, 0));921 return FindContours(image, storage, out first_contour, CvContour.SizeOf, ContourRetrieval.List, ContourChain.ApproxSimple, new CvPoint(0, 0)); 922 922 } 923 923 #if LANG_JP … … 1041 1041 else if (method == ContourChain.Code) 1042 1042 { 1043 first_contour = new CvChain <CvPoint>(first_contour_ptr);1043 first_contour = new CvChain(first_contour_ptr); 1044 1044 } 1045 1045 else 1046 1046 { 1047 first_contour = new CvContour <CvPoint>(first_contour_ptr);1047 first_contour = new CvContour(first_contour_ptr); 1048 1048 } 1049 1049 return result; -
lang/cpluspluscli/OpenCvSharp2/trunk/OpenCvSharp/Core/Cv_R-Z.cs
r32111 r32142 158 158 } 159 159 #endregion 160 #region ReadChainPoint 161 #if LANG_JP 162 /// <summary> 163 /// チェーン上の次の点を得る 164 /// </summary> 165 /// <param name="reader">チェーンリーダの状態</param> 166 /// <returns>現在のチェーン上の点</returns> 167 #else 168 /// <summary> 169 /// Gets next chain point 170 /// </summary> 171 /// <param name="reader">Chain reader state.</param> 172 /// <returns>Current chain point.</returns> 173 #endif 174 public static CvPoint ReadChainPoint(this CvChainPtReader reader) 175 { 176 if (reader == null) 177 { 178 throw new ArgumentNullException("reader"); 179 } 180 return CvDll.cvReadChainPoint(reader.CvPtr); 181 } 182 #endregion 160 183 #region RandInt 161 184 /// <summary> … … 2628 2651 public static CvContourScanner StartFindContours(this CvArr image, CvMemStorage storage) 2629 2652 { 2630 return StartFindContours(image, storage, CvContour <CvPoint>.SizeOf, ContourRetrieval.List, ContourChain.ApproxSimple, new CvPoint());2653 return StartFindContours(image, storage, CvContour.SizeOf, ContourRetrieval.List, ContourChain.ApproxSimple, new CvPoint()); 2631 2654 } 2632 2655 #if LANG_JP … … 2752 2775 } 2753 2776 #endregion 2777 #region StartReadChainPoints 2778 #if LANG_JP 2779 /// <summary> 2780 /// チェーンリーダを初期化する 2781 /// </summary> 2782 /// <param name="chain">チェーンへのポインタ</param> 2783 /// <param name="reader">チェーンリーダの状態</param> 2784 #else 2785 /// <summary> 2786 /// 2787 /// </summary> 2788 /// <param name="chain">Pointer to chain.</param> 2789 /// <param name="reader">Chain reader state.</param> 2790 #endif 2791 public static void StartReadChainPoints(CvChain chain, CvChainPtReader reader) 2792 { 2793 if (reader == null) 2794 throw new ArgumentNullException("reader"); 2795 if (chain == null) 2796 throw new ArgumentNullException("chain"); 2797 CvDll.cvStartReadChainPoints(chain.CvPtr, reader.CvPtr); 2798 } 2799 #endregion 2754 2800 #region StartReadSeq 2755 2801 /// <summary> -
lang/cpluspluscli/OpenCvSharp2/trunk/OpenCvSharp/CvArr/CvChain.cs
r31460 r32142 9 9 /// 輪郭データ 10 10 /// </summary> 11 public class CvChain <T> : CvSeq<T> where T : struct11 public class CvChain : CvSeq<CvPoint> 12 12 { 13 13 /// <summary> -
lang/cpluspluscli/OpenCvSharp2/trunk/OpenCvSharp/CvArr/CvContour.cs
r31460 r32142 9 9 /// 輪郭データ 10 10 /// </summary> 11 public class CvContour <T> : CvSeq<T> where T : struct11 public class CvContour : CvSeq<CvPoint> 12 12 { 13 13 /// <summary> -
lang/cpluspluscli/OpenCvSharp2/trunk/OpenCvSharp/DisposableObject.cs
r31582 r32142 104 104 protected IntPtr AllocMemory(int size) 105 105 { 106 if (AllocatedMemory != IntPtr.Zero) 107 { 108 Marshal.FreeHGlobal(AllocatedMemory); 109 } 106 110 AllocatedMemory = Marshal.AllocHGlobal(size); 107 111 NotifyMemoryPressure(size); -
lang/cpluspluscli/OpenCvSharp2/trunk/OpenCvSharp/OpenCvSharp.csproj
r32022 r32142 159 159 <ItemGroup> 160 160 <Compile Include="Class\CvBox2D.cs" /> 161 <Compile Include="Class\CvChainPtReader.cs" /> 161 162 <Compile Include="Class\CvHuMoments.cs" /> 162 163 <Compile Include="Class\CvMoments.cs" /> -
lang/cpluspluscli/OpenCvSharp2/trunk/wrapped functions.csv
r32098 r32142 362 362 Read;X 363 363 ReadByName;X 364 ReadChainPoint; 364 ReadChainPoint;X 365 365 ReadInt; 366 366 ReadIntByName;X … … 470 470 StartFindContours;X 471 471 StartNextStream;X 472 StartReadChainPoints; 472 StartReadChainPoints;X 473 473 StartReadRawData; 474 474 StartReadSeq;X
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)