Changeset 32863 for lang/cpluspluscli
- Timestamp:
- 04/27/09 22:51:04 (4 years ago)
- Location:
- lang/cpluspluscli/OpenCvSharp2/trunk
- Files:
-
- 4 modified
-
OpenCvSharp.Test/Program.cs (modified) (1 diff)
-
OpenCvSharp/Src/Class/CvContourScanner.cs (modified) (5 diffs)
-
OpenCvSharp/Src/Core/Cv_R-Z.cs (modified) (1 diff)
-
OpenCvSharp/Src/DisposableCvObject.cs (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/cpluspluscli/OpenCvSharp2/trunk/OpenCvSharp.Test/Program.cs
r32859 r32863 70 70 //new Test.Contour(); // 輪郭領域の面積と輪郭の長さ 71 71 72 //new Test.ContourScanner(); // CvContourScanner Sample72 new Test.ContourScanner(); // CvContourScanner Sample 73 73 74 74 //new Test.ConvertToBitmap(); // System.Drawing.Bitmapへの変換 -
lang/cpluspluscli/OpenCvSharp2/trunk/OpenCvSharp/Src/Class/CvContourScanner.cs
r32859 r32863 23 23 public class CvContourScanner : DisposableCvObject, IEnumerable<CvSeq<CvPoint>> 24 24 { 25 #region Fields 26 private CvArr _image; 27 private CvMemStorage _storage; 28 private int _header_size; 29 private ContourRetrieval _mode; 30 private ContourChain _method; 31 private CvPoint _offset; 32 #endregion 33 34 25 35 #region Constructors 26 /// <summary>27 /// Initialize from pointer28 /// </summary>29 /// <param name="ptr"></param>30 public CvContourScanner(IntPtr ptr)31 {32 this._ptr = ptr;33 }34 35 36 #if LANG_JP 36 37 /// <summary> … … 142 143 if (storage == null) 143 144 throw new ArgumentNullException("storage"); 145 Initialize(image, storage, header_size, mode, method, offset); 146 } 147 148 /// <summary> 149 /// Initializes contour scanning process 150 /// </summary> 151 /// <param name="image">The source 8-bit single channel binary image. </param> 152 /// <param name="storage">Container of the retrieved contours.</param> 153 /// <param name="header_size">Size of the sequence header, >=sizeof(CvChain) if method=CV_CHAIN_CODE, and >=sizeof(CvContour) otherwise. </param> 154 /// <param name="mode">Retrieval mode; see cvFindContours. </param> 155 /// <param name="method">Approximation method. It has the same meaning as in cvFindContours, but CV_LINK_RUNS can not be used here. </param> 156 /// <param name="offset">ROI offset; see cvFindContours. </param> 157 /// <returns>CvContourScanner</returns> 158 private void Initialize(CvArr image, CvMemStorage storage, int header_size, ContourRetrieval mode, ContourChain method, CvPoint offset) 159 { 160 this._image = image; 161 this._storage = storage; 162 this._header_size = header_size; 163 this._mode = mode; 164 this._method = method; 165 this._offset = offset; 166 if (this._ptr != IntPtr.Zero) 167 { 168 CvDll.cvEndFindContours(ref this._ptr); 169 } 144 170 this._ptr = CvDll.cvStartFindContours(image.CvPtr, storage.CvPtr, header_size, mode, method, offset); 171 } 172 /// <summary> 173 /// Initializes contour scanning process 174 /// </summary> 175 private void Initialize() 176 { 177 Initialize(_image, _storage, _header_size, _mode, _method, _offset); 145 178 } 146 179 … … 264 297 265 298 /// <summary> 266 /// =cvEndFindContours299 /// cvEndFindContours 267 300 /// </summary> 268 301 public override void Dispose() … … 278 311 #region IEnumerable<CvSeq<CvPoint>> 279 312 /// <summary> 280 /// 281 /// </summary> 282 /// <returns> </returns>313 /// Returns an enumerator that iterates through the collection. 314 /// </summary> 315 /// <returns> A System.Collections.Generic.IEnumerator<T> that can be used to iterate through the collection.</returns> 283 316 public IEnumerator<CvSeq<CvPoint>> GetEnumerator() 284 317 { 318 Initialize(); 285 319 while (true) 286 320 { … … 293 327 Cv.EndFindContours(this); 294 328 } 329 /// <summary> 330 /// 331 /// </summary> 332 /// <returns></returns> 295 333 System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() 296 334 { -
lang/cpluspluscli/OpenCvSharp2/trunk/OpenCvSharp/Src/Core/Cv_R-Z.cs
r32848 r32863 4302 4302 throw new ArgumentNullException("storage"); 4303 4303 4304 IntPtr result = CvDll.cvStartFindContours(image.CvPtr, storage.CvPtr, header_size, mode, method, offset); 4305 4306 if (result == IntPtr.Zero) 4307 return null; 4308 else 4309 return new CvContourScanner(result); 4304 return new CvContourScanner(image, storage, header_size, mode, method, offset); 4310 4305 } 4311 4306 #endregion -
lang/cpluspluscli/OpenCvSharp2/trunk/OpenCvSharp/Src/DisposableCvObject.cs
r32859 r32863 34 34 #endif 35 35 protected DisposableCvObject() 36 : base()36 : this(true) 37 37 { 38 38 } … … 49 49 #endif 50 50 protected DisposableCvObject(IntPtr ptr) 51 : base()51 : this(ptr, true) 52 52 { 53 this._ptr = ptr;54 53 } 55 54 #if LANG_JP … … 67 66 : base(isEnabledDispose) 68 67 { 68 this._ptr = IntPtr.Zero; 69 69 } 70 70 #if LANG_JP
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)