Changeset 32533

Show
Ignore:
Timestamp:
04/17/09 18:15:09 (4 years ago)
Author:
schima
Message:

CvLineIterator? sample

Location:
lang/cpluspluscli/OpenCvSharp2/trunk
Files:
1 added
12 modified

Legend:

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

    r32526 r32533  
    1818                        public: 
    1919                                // macro 
    20                                 static bool CV_IS_SET_ELEM_( IntPtr ptr ) { 
     20                                static bool CV_IS_SET_ELEM_( IntPtr ptr )  
     21                                { 
    2122                                        return CV_IS_SET_ELEM( ptr.ToPointer() ); 
    2223                                } 
    2324 
    2425                                //Graph 
    25                                 static IntPtr cvGetGraphVtx_( IntPtr graph, int idx ){ 
     26                                static IntPtr cvGetGraphVtx_( IntPtr graph, int idx ) 
     27                                { 
    2628                                        return IntPtr(cvGetGraphVtx((CvGraph*)graph.ToPointer(), idx)); 
    2729                                } 
    28                                 static int cvGraphVtxIdx_( IntPtr graph, IntPtr vtx ){ 
     30                                static int cvGraphVtxIdx_( IntPtr graph, IntPtr vtx ) 
     31                                { 
    2932                                        return cvGraphVtxIdx((CvGraph*)graph.ToPointer(), (CvGraphVtx*)vtx.ToPointer()); 
    3033                                } 
    31                                 static int cvGraphEdgeIdx_( IntPtr graph, IntPtr edge ){ 
     34                                static int cvGraphEdgeIdx_( IntPtr graph, IntPtr edge ) 
     35                                { 
    3236                                        return cvGraphEdgeIdx((CvGraph*)graph.ToPointer(), (CvGraphEdge*)edge.ToPointer()); 
    3337                                } 
    34                                 static int CV_IS_GRAPH_VERTEX_VISITED_( IntPtr vtx ){ 
     38                                static int CV_IS_GRAPH_VERTEX_VISITED_( IntPtr vtx ) 
     39                                { 
    3540                                        return CV_IS_GRAPH_VERTEX_VISITED((CvGraphVtx*)vtx.ToPointer()); 
    3641                                } 
    37                                 static int CV_IS_GRAPH_EDGE_VISITED_( IntPtr edge ){ 
     42                                static int CV_IS_GRAPH_EDGE_VISITED_( IntPtr edge ) 
     43                                { 
    3844                                        return CV_IS_GRAPH_EDGE_VISITED((CvGraphEdge*)edge.ToPointer()); 
    3945                                } 
     
    4147                                /* 
    4248                                [Obsolete] 
    43                                 static void CV_NEXT_SEQ_ELEM_( int elem_size, IntPtr reader ) { 
     49                                static void CV_NEXT_SEQ_ELEM_( int elem_size, IntPtr reader )  
     50                                { 
    4451                                CvSeqReader sr = *((CvSeqReader*)reader.ToPointer()); 
    4552                                CV_NEXT_SEQ_ELEM(elem_size, sr); 
    4653                                } 
    4754                                [Obsolete] 
    48                                 static void CV_PREV_SEQ_ELEM_( int elem_size, IntPtr reader ) { 
     55                                static void CV_PREV_SEQ_ELEM_( int elem_size, IntPtr reader ) 
     56                                { 
    4957                                CvSeqReader sr = *((CvSeqReader*)reader.ToPointer()); 
    5058                                CV_PREV_SEQ_ELEM(elem_size, sr); 
    5159                                } 
    5260                                //*/ 
    53                                 static bool CV_ARE_TYPES_EQ_CvMat(IntPtr mat1, IntPtr mat2){ 
     61                                static bool CV_ARE_TYPES_EQ_CvMat(IntPtr mat1, IntPtr mat2) 
     62                                { 
    5463                                        CvMat* _mat1 = (CvMat*)mat1.ToPointer(); 
    5564                                        CvMat* _mat2 = (CvMat*)mat2.ToPointer(); 
     
    6271                                } 
    6372                                // cvInc/DecData 
    64                                 static void cvDecRefData( IntPtr arr ){ 
     73                                static void cvDecRefData( IntPtr arr ) 
     74                                { 
    6575                                        ::cvDecRefData(arr.ToPointer()); 
    6676                                } 
    67                                 static int cvIncRefData( IntPtr arr ){ 
     77                                static int cvIncRefData( IntPtr arr ) 
     78                                { 
    6879                                        return ::cvIncRefData(arr.ToPointer()); 
    6980                                } 
    7081                                // CvReadInt/Real/String 
    71                                 static int cvReadInt( IntPtr node )     { 
     82                                static int cvReadInt( IntPtr node )      
     83                                { 
    7284                                        CvFileNode* _node = (CvFileNode*)node.ToPointer(); 
    7385                                        return ::cvReadInt(_node); 
    7486                                } 
    75                                 static int cvReadInt( IntPtr node, int default_value )  { 
     87                                static int cvReadInt( IntPtr node, int default_value )   
     88                                { 
    7689                                        CvFileNode* _node = (CvFileNode*)node.ToPointer(); 
    7790                                        return ::cvReadInt(_node, default_value); 
     
    8194                                        return ::cvReadReal(_node); 
    8295                                } 
    83                                 static double cvReadReal( IntPtr node, double default_value )   { 
     96                                static double cvReadReal( IntPtr node, double default_value )    
     97                                { 
    8498                                        CvFileNode* _node = (CvFileNode*)node.ToPointer(); 
    8599                                        return ::cvReadReal(_node, default_value); 
     
    93107                                                return marshal_as<String^>(result); 
    94108                                } 
    95                                 static String^ cvReadString( IntPtr node, String^ default_value )       { 
     109                                static String^ cvReadString( IntPtr node, String^ default_value )        
     110                                { 
    96111                                        CvFileNode* _node = (CvFileNode*)node.ToPointer(); 
    97112                                        marshal_context context; 
     
    169184                                } 
    170185                                // cvmGet/Set 
    171                                 static double cvmGet( IntPtr mat, int row, int col ){ 
     186                                static double cvmGet( IntPtr mat, int row, int col ) 
     187                                { 
    172188                                        CvMat* matPtr = (CvMat*)mat.ToPointer(); 
    173189                                        return ::cvmGet(matPtr, row, col); 
    174190                                } 
    175                                 static void cvmSet( IntPtr mat, int row, int col, double value ){ 
     191                                static void cvmSet( IntPtr mat, int row, int col, double value ) 
     192                                { 
    176193                                        CvMat* matPtr = (CvMat*)mat.ToPointer(); 
    177194                                        ::cvmSet(matPtr, row, col, value); 
     
    197214                                }*/ 
    198215                                // 算術演算 
    199                                 static int cvRound( double value ) { 
     216                                static int cvRound( double value )  
     217                                { 
    200218                                        return ::cvRound(value); 
    201219                                } 
    202                                 static int cvFloor( double value ){ 
     220                                static int cvFloor( double value ) 
     221                                { 
    203222                                        return ::cvFloor(value); 
    204223                                } 
    205                                 static int cvCeil( double value ){ 
     224                                static int cvCeil( double value ) 
     225                                { 
    206226                                        return ::cvCeil(value); 
    207227                                } 
    208                                 static int cvIsNaN( double value ){ 
     228                                static int cvIsNaN( double value ) 
     229                                { 
    209230                                        return ::cvIsNaN(value); 
    210231                                } 
    211                                 static int cvIsInf( double value ){ 
     232                                static int cvIsInf( double value ) 
     233                                { 
    212234                                        return ::cvIsInf(value); 
    213235                                } 
    214236                                // cvGetHistValue_*D 
    215                                 static IntPtr cvGetHistValue_1D_( IntPtr hist, int idx0 ){ 
     237                                static IntPtr cvGetHistValue_1D_( IntPtr hist, int idx0 ) 
     238                                { 
    216239                                        CvHistogram* _hist = (CvHistogram*)hist.ToPointer(); 
    217240                                        float* result = cvGetHistValue_1D(_hist, idx0); 
    218241                                        return IntPtr(result); 
    219242                                } 
    220                                 static IntPtr  cvGetHistValue_2D_( IntPtr hist, int idx0, int idx1 ) { 
     243                                static IntPtr  cvGetHistValue_2D_( IntPtr hist, int idx0, int idx1 )  
     244                                { 
    221245                                        CvHistogram* _hist = (CvHistogram*)hist.ToPointer(); 
    222246                                        float* result = cvGetHistValue_2D(_hist, idx0, idx1); 
    223247                                        return IntPtr(result); 
    224248                                } 
    225                                 static IntPtr  cvGetHistValue_3D_( IntPtr hist, int idx0, int idx1, int idx2 ) { 
     249                                static IntPtr  cvGetHistValue_3D_( IntPtr hist, int idx0, int idx1, int idx2 ) 
     250                                { 
    226251                                        CvHistogram* _hist = (CvHistogram*)hist.ToPointer(); 
    227252                                        float* result = cvGetHistValue_3D(_hist, idx0, idx1, idx2); 
    228253                                        return IntPtr(result); 
    229254                                } 
    230                                 static IntPtr  cvGetHistValue_nD_( IntPtr hist, array<int>^ idx ) { 
     255                                static IntPtr  cvGetHistValue_nD_( IntPtr hist, array<int>^ idx ) 
     256                                { 
    231257                                        CvHistogram* _hist = (CvHistogram*)hist.ToPointer(); 
    232258                                        pin_ptr<int> idx_ptr = &idx[0]; 
     
    240266                                } 
    241267                                // cvQueryHistValue_*D 
    242                                 static double cvQueryHistValue_1D_( IntPtr hist, int idx0 ) { 
     268                                static double cvQueryHistValue_1D_( IntPtr hist, int idx0 ) 
     269                                { 
    243270                                        CvHistogram* _hist = (CvHistogram*)hist.ToPointer(); 
    244271                                        return cvQueryHistValue_1D(_hist, idx0); 
    245272                                } 
    246                                 static double cvQueryHistValue_2D_( IntPtr hist, int idx0, int idx1 ) { 
     273                                static double cvQueryHistValue_2D_( IntPtr hist, int idx0, int idx1 ) 
     274                                { 
    247275                                        CvHistogram* _hist = (CvHistogram*)hist.ToPointer(); 
    248276                                        return cvQueryHistValue_2D(_hist, idx0, idx1); 
    249277                                } 
    250                                 static double cvQueryHistValue_3D_( IntPtr hist, int idx0, int idx1, int idx2 ) { 
     278                                static double cvQueryHistValue_3D_( IntPtr hist, int idx0, int idx1, int idx2 )  
     279                                { 
    251280                                        CvHistogram* _hist = (CvHistogram*)hist.ToPointer(); 
    252281                                        return cvQueryHistValue_3D(_hist, idx0, idx1, idx2); 
    253282                                } 
    254                                 static double cvQueryHistValue_nD_( IntPtr hist, ... array<int>^ idx ) { 
     283                                static double cvQueryHistValue_nD_( IntPtr hist, ... array<int>^ idx )  
     284                                { 
    255285                                        CvHistogram* _hist = (CvHistogram*)hist.ToPointer(); 
    256286                                        pin_ptr<int> idx_ptr = &idx[0]; 
     
    259289 
    260290                                // cvSeq 
    261                                 static IntPtr cvCloneSeq( IntPtr seq, IntPtr storage ){ 
     291                                static IntPtr cvCloneSeq( IntPtr seq, IntPtr storage ) 
     292                                { 
    262293                                        return IntPtr(::cvCloneSeq((CvSeq*)seq.ToPointer(), (CvMemStorage*)storage.ToPointer())); 
    263294                                } 
    264295                                // Subdiv2D 
    265                                 static CvSubdiv2DEdge cvSubdiv2DNextEdge( CvSubdiv2DEdge edge ) { 
     296                                static CvSubdiv2DEdge cvSubdiv2DNextEdge( CvSubdiv2DEdge edge )  
     297                                { 
    266298                                        return ::cvSubdiv2DNextEdge(edge); 
    267299                                } 
    268                                 static CvSubdiv2DEdge cvSubdiv2DRotateEdge( CvSubdiv2DEdge edge, int rotate )   { 
     300                                static CvSubdiv2DEdge cvSubdiv2DRotateEdge( CvSubdiv2DEdge edge, int rotate )    
     301                                { 
    269302                                        return ::cvSubdiv2DRotateEdge(edge, rotate); 
    270303                                } 
    271                                 static CvSubdiv2DEdge cvSubdiv2DSymEdge( CvSubdiv2DEdge edge )  { 
     304                                static CvSubdiv2DEdge cvSubdiv2DSymEdge( CvSubdiv2DEdge edge ) 
     305                                { 
    272306                                        return ::cvSubdiv2DSymEdge(edge); 
    273307                                } 
    274                                 static CvSubdiv2DEdge cvSubdiv2DGetEdge( CvSubdiv2DEdge edge, int type )        { 
     308                                static CvSubdiv2DEdge cvSubdiv2DGetEdge( CvSubdiv2DEdge edge, int type )         
     309                                { 
    275310                                        return ::cvSubdiv2DGetEdge(edge, (CvNextEdgeType)type); 
    276311                                } 
    277                                 static IntPtr cvSubdiv2DEdgeOrg( CvSubdiv2DEdge edge )  { 
     312                                static IntPtr cvSubdiv2DEdgeOrg( CvSubdiv2DEdge edge ) 
     313                                { 
    278314                                        return IntPtr(::cvSubdiv2DEdgeOrg(edge)); 
    279315                                } 
    280                                 static IntPtr cvSubdiv2DEdgeDst( CvSubdiv2DEdge edge )  { 
     316                                static IntPtr cvSubdiv2DEdgeDst( CvSubdiv2DEdge edge ) 
     317                                { 
    281318                                        return IntPtr(::cvSubdiv2DEdgeDst(edge)); 
    282319                                } 
  • lang/cpluspluscli/OpenCvSharp2/trunk/OpenCvSharp.Extern/WCvLineIterator.h

    r32527 r32533  
    3434                                { 
    3535                                        this->_ptr = static_cast<CvLineIterator*>(ptr.ToPointer()); 
    36                                         this->Ptr = IntPtr(ptr); 
     36                                        this->Ptr = ptr; 
    3737                                } 
    3838 
    39                                 property IntPtr ptr{ 
     39                                property IntPtr ptr 
     40                                { 
    4041                                        IntPtr get(){ return IntPtr(_ptr->ptr); } 
     42                                        void set(IntPtr value){ _ptr->ptr = static_cast<uchar*>(value.ToPointer()); } 
     43                                } 
     44                                property int err 
     45                                { 
     46                                        int get(){ return _ptr->err; } 
     47                                        void set(int value){ _ptr->err = value; } 
     48                                } 
     49                                property int plus_delta 
     50                                { 
     51                                        int get(){ return _ptr->plus_delta; } 
     52                                        void set(int value){ _ptr->plus_delta = value; } 
     53                                } 
     54                                property int minus_delta 
     55                                { 
     56                                        int get(){ return _ptr->minus_delta; } 
     57                                        void set(int value){ _ptr->minus_delta = value; } 
     58                                } 
     59                                property int plus_step 
     60                                { 
     61                                        int get(){ return _ptr->plus_step; } 
     62                                        void set(int value){ _ptr->plus_step = value; } 
     63                                } 
     64                                property int minus_step 
     65                                { 
     66                                        int get(){ return _ptr->minus_step; } 
     67                                        void set(int value){ _ptr->minus_step = value; } 
    4168                                } 
    4269 
  • lang/cpluspluscli/OpenCvSharp2/trunk/OpenCvSharp.MachineLearning/CvStatModel/CvKNearest.cs

    r32359 r32533  
    77{ 
    88#if LANG_JP 
    9         /// <summary> 
    10         ///  
    11         /// </summary> 
     9    /// <summary> 
     10    ///  
     11    /// </summary> 
    1212#else 
    1313    /// <summary> 
    1414    /// K nearest neighbors classifier 
    1515    /// </summary> 
    16     
    17 #endif 
    18     public class CvKNearest: CvStatModel 
     16 
     17#endif 
     18    public class CvKNearest : CvStatModel 
    1919    { 
    2020#if LANG_JP 
     
    2626        /// Access to c++ pointer 
    2727        /// </summary> 
    28  
    2928#endif 
    3029        private readonly Extern.WCvKNearest _data; 
    31         #if LANG_JP 
     30#if LANG_JP 
    3231        /// <summary> 
    3332        /// データポインタ 
    3433        /// </summary> 
    3534#else 
    36     /// <summary> 
    37     /// Pointer 
    38     /// </summary> 
    39     
     35        /// <summary> 
     36        /// Pointer 
     37        /// </summary>    
    4038#endif 
    4139        private readonly IntPtr _ptr; 
     
    4846        /// </summary> 
    4947#else 
    50     /// <summary> 
    51     /// sizeof(CvKNearest) 
    52     /// </summary> 
    53     
    54 #endif         
     48        /// <summary> 
     49        /// sizeof(CvKNearest) 
     50        /// </summary>    
     51#endif 
    5552        public const int SizeOf = Extern.WCvKNearest.SizeOf; 
    5653 
    5754        #endregion 
    5855 
    59          
     56 
    6057        #region Init and Disposal 
    6158#if LANG_JP 
     
    6461        /// </summary> 
    6562#else 
    66     /// <summary> 
    67     /// Constructor 
    68     /// </summary> 
    69     
    70 #endif         
     63        /// <summary> 
     64        /// Constructor 
     65        /// </summary>    
     66#endif 
    7167        public CvKNearest() 
    7268        { 
     
    7773#if LANG_JP 
    7874        /// <summary> 
    79             /// コンストラクタ 
    80             /// </summary> 
    81             /// <param name="train_data"></param> 
    82             /// <param name="responses"></param> 
    83             /// <param name="sample_idx"></param> 
     75        /// コンストラクタ 
     76        /// </summary> 
     77        /// <param name="train_data"></param> 
     78        /// <param name="responses"></param> 
     79        /// <param name="sample_idx"></param> 
    8480        /// <param name="is_regression"></param> 
    8581        /// <param name="max_k"></param> 
     
    9995        /// WCvKNearest(IntPtr _train_data, IntPtr _responses, IntPtr _sample_idx,bool is_regression, int max_k) 
    10096        /// </remarks> 
    101 #endif       
    102          
    103         public CvKNearest(CvMat train_data, CvMat responses, CvMat sample_idx,bool is_regression, int max_k) 
     97#endif 
     98        public CvKNearest(CvMat train_data, CvMat responses, CvMat sample_idx, bool is_regression, int max_k) 
    10499        { 
    105100            if (train_data == null) 
     
    110105            IntPtr responses_ptr = (responses == null) ? IntPtr.Zero : responses.CvPtr; 
    111106            IntPtr sample_idx_ptr = (sample_idx == null) ? IntPtr.Zero : sample_idx.CvPtr; 
    112             this._data = new Extern.WCvKNearest(train_data_ptr, responses_ptr, sample_idx_ptr,is_regression,max_k); 
     107            this._data = new Extern.WCvKNearest(train_data_ptr, responses_ptr, sample_idx_ptr, is_regression, max_k); 
    113108            this._ptr = _data.Ptr; 
    114109            base.NotifyMemoryPressure(SizeOf); 
     
    124119        /// </summary> 
    125120        /// <param name="ptr">CvKNearest*</param> 
    126 #endif       
     121#endif 
    127122        public CvKNearest(IntPtr ptr) 
    128123        { 
     
    180175        /// <returns></returns> 
    181176#endif 
    182         public bool Train(CvMat train_data, CvMat responses,CvMat sample_idx, bool is_regression,int max_k, bool update_base) 
     177        public bool Train(CvMat train_data, CvMat responses, CvMat sample_idx, bool is_regression, int max_k, bool update_base) 
    183178        { 
    184179            if (train_data == null) 
     
    188183            IntPtr sample_idx_ptr = (sample_idx == null) ? IntPtr.Zero : sample_idx.CvPtr; 
    189184 
    190             return _data.train(train_data.CvPtr, responses.CvPtr, sample_idx_ptr, is_regression,max_k, update_base); 
     185            return _data.train(train_data.CvPtr, responses.CvPtr, sample_idx_ptr, is_regression, max_k, update_base); 
    191186 
    192187        } 
     
    215210#endif 
    216211        public float FindNearest(CvMat samples, int k, CvMat results, float[][] neighbors, CvMat neighbor_responses, CvMat dist) 
    217  
    218212        { 
    219213            if (samples == null) 
     
    225219            if (neighbors == null) 
    226220            { 
    227                 neighborsPtr_ptr = new IntPtr[1]{IntPtr.Zero}; 
     221                neighborsPtr_ptr = new IntPtr[1] { IntPtr.Zero }; 
    228222                return _data.find_nearest(samples.CvPtr, k, results_ptr, neighborsPtr_ptr, neighbor_responses_ptr, dist_ptr); 
    229223            } 
  • lang/cpluspluscli/OpenCvSharp2/trunk/OpenCvSharp.Test/OpenCvSharp.Test.csproj

    r32525 r32533  
    178178    <Compile Include="Samples\Kalman.cs" /> 
    179179    <Compile Include="Samples\KMeans.cs" /> 
     180    <Compile Include="Samples\LineIterator.cs" /> 
    180181    <Compile Include="Samples\LogPolar.cs" /> 
    181182    <Compile Include="Samples\MatTest.cs" /> 
  • lang/cpluspluscli/OpenCvSharp2/trunk/OpenCvSharp.Test/Program.cs

    r32432 r32533  
    7777            //new Test.ConvertToWriteableBitmap(); 
    7878            // Building convex hull for a sequence or array of points 
    79             new Test.ConvexHull(); 
     79            //new Test.ConvexHull(); 
    8080            // 境界線の作成  
    8181            //new Test.CopyMakeBorder(); 
     
    110110            // カルマンフィルタ 
    111111            //new Test.Kalman();  
     112            // CvLineIterator sample 
     113            new Test.LineIterator(); 
    112114            // Log-polar 変換 
    113115            //new Test.LogPolar(); 
  • lang/cpluspluscli/OpenCvSharp2/trunk/OpenCvSharp/Src/Class/CvLineIterator.cs

    r32511 r32533  
    22using System.Collections.Generic; 
    33using System.Linq; 
     4using System.Runtime.InteropServices; 
    45using System.Text; 
    56 
    67namespace KwsmLab.OpenCvSharp 
    78{ 
    8     #if LANG_JP 
     9#if LANG_JP 
    910    /// <summary> 
    1011    ///  
     
    1516    /// </summary> 
    1617#endif 
    17     public class CvLineIterator: DisposableObject, ICvPtrHolder 
     18    public class CvLineIterator : DisposableObject, ICvPtrHolder, IEnumerable<byte[]> 
    1819    { 
    1920        /// <summary> 
     
    2526        /// </summary> 
    2627        private IntPtr _ptr; 
    27         private BitDepth depth; 
     28 
     29        private int _count; 
     30        private CvArr _image; 
     31        private CvPoint _pt1; 
     32        private CvPoint _pt2; 
     33        private PixelConnectivity _connectivity; 
     34        private bool _left_to_right; 
     35 
    2836 
    2937        #region Constructors 
    30         /// <summary> 
    31         /// Initialize from pointer 
    32         /// </summary> 
    33         /// <param name="ptr"></param> 
    34         public CvLineIterator(IntPtr ptr) 
    35         { 
    36             if (ptr == IntPtr.Zero) 
     38#if LANG_JP 
     39        /// <summary> 
     40        /// 構造体の分のメモリを割り当てて初期化 
     41        /// </summary> 
     42#else 
     43        /// <summary> 
     44        /// Constructor 
     45        /// </summary> 
     46#endif 
     47        public CvLineIterator() 
     48        { 
     49            this._ptr = base.AllocMemory(SizeOf); 
     50            this._data = new Extern.WCvLineIterator(this._ptr); 
     51            this._count = -1; 
     52        } 
     53 
     54#if LANG_JP 
     55        /// <summary> 
     56        /// ラインイテレータを初期化する 
     57        /// </summary> 
     58        /// <param name="image">対象画像</param> 
     59        /// <param name="pt1">線分の一つ目の端点</param> 
     60        /// <param name="pt2">線分のニつ目の端点</param> 
     61        /// <returns></returns>  
     62#else 
     63        /// <summary> 
     64        /// Initializes line iterator 
     65        /// </summary> 
     66        /// <param name="image">Image to sample the line from.  </param> 
     67        /// <param name="pt1">First ending point of the line segment. </param> 
     68        /// <param name="pt2">Second ending point of the line segment. </param> 
     69        /// <returns>The function cvInitLineIterator initializes the line iterator and returns the number of pixels between two end points. Both points must be inside the image. After the iterator has been initialized, all the points on the raster line that connects the two ending points may be retrieved by successive calls of NextLinePoint point. The points on the line are calculated one by one using 4-connected or 8-connected Bresenham algorithm.</returns>  
     70#endif 
     71        public CvLineIterator(CvArr image, CvPoint pt1, CvPoint pt2) 
     72            : this(image, pt1, pt2, PixelConnectivity.Connectivity_8, false) 
     73        { 
     74        } 
     75#if LANG_JP 
     76        /// <summary> 
     77        /// ラインイテレータを初期化する 
     78        /// </summary> 
     79        /// <param name="image">対象画像</param> 
     80        /// <param name="pt1">線分の一つ目の端点</param> 
     81        /// <param name="pt2">線分のニつ目の端点</param> 
     82        /// <param name="connectivity">走査した線分の接続性.4または8</param> 
     83        /// <returns></returns>  
     84#else 
     85        /// <summary> 
     86        /// Initializes line iterator 
     87        /// </summary> 
     88        /// <param name="image">Image to sample the line from.  </param> 
     89        /// <param name="pt1">First ending point of the line segment. </param> 
     90        /// <param name="pt2">Second ending point of the line segment. </param> 
     91        /// <param name="connectivity">The scanned line connectivity, 4 or 8. </param> 
     92        /// <returns>The function cvInitLineIterator initializes the line iterator and returns the number of pixels between two end points. Both points must be inside the image. After the iterator has been initialized, all the points on the raster line that connects the two ending points may be retrieved by successive calls of NextLinePoint point. The points on the line are calculated one by one using 4-connected or 8-connected Bresenham algorithm.</returns>  
     93#endif 
     94        public CvLineIterator(CvArr image, CvPoint pt1, CvPoint pt2, PixelConnectivity connectivity) 
     95            : this(image, pt1, pt2, connectivity, false) 
     96        { 
     97        } 
     98#if LANG_JP 
     99        /// <summary> 
     100        /// ラインイテレータを初期化する 
     101        /// </summary> 
     102        /// <param name="image">対象画像</param> 
     103        /// <param name="pt1">線分の一つ目の端点</param> 
     104        /// <param name="pt2">線分のニつ目の端点</param> 
     105        /// <param name="connectivity">走査した線分の接続性.4または8</param> 
     106        /// <param name="left_to_right">pt1とpt2とは無関係に線分をいつも左から右に走査する(true)か, pt1からpt2への決まった方向で走査するか(false)を指定するフラグ. </param> 
     107        /// <returns></returns>  
     108#else 
     109        /// <summary> 
     110        /// Initializes line iterator 
     111        /// </summary> 
     112        /// <param name="image">Image to sample the line from.  </param> 
     113        /// <param name="pt1">First ending point of the line segment. </param> 
     114        /// <param name="pt2">Second ending point of the line segment. </param> 
     115        /// <param name="connectivity">The scanned line connectivity, 4 or 8. </param> 
     116        /// <param name="left_to_right">The flag, indicating whether the line should be always scanned from the left-most point to the right-most out of pt1 and pt2 (left_to_right=true), or it is scanned in the specified order, from pt1 to pt2 (left_to_right=false). </param> 
     117        /// <returns>The function cvInitLineIterator initializes the line iterator and returns the number of pixels between two end points. Both points must be inside the image. After the iterator has been initialized, all the points on the raster line that connects the two ending points may be retrieved by successive calls of NextLinePoint point. The points on the line are calculated one by one using 4-connected or 8-connected Bresenham algorithm.</returns>  
     118#endif 
     119        public CvLineIterator(CvArr image, CvPoint pt1, CvPoint pt2, PixelConnectivity connectivity, bool left_to_right) 
     120            : this() 
     121        { 
     122            if (image == null) 
    37123            { 
    38                 throw new ArgumentNullException("ptr"); 
     124                throw new ArgumentNullException("image"); 
    39125            } 
    40             this._ptr = ptr; 
    41             this._data = new Extern.WCvLineIterator(ptr); 
    42         } 
    43  
    44 #if LANG_JP 
    45         /// <summary> 
    46         ///  
     126            Initialize(image, pt1, pt2, connectivity, left_to_right); 
     127        } 
     128 
     129        /// <summary> 
     130        /// Initializes line iterator 
     131        /// </summary> 
     132        /// <param name="image">Image to sample the line from.  </param> 
     133        /// <param name="pt1">First ending point of the line segment. </param> 
     134        /// <param name="pt2">Second ending point of the line segment. </param> 
     135        /// <param name="connectivity">The scanned line connectivity, 4 or 8. </param> 
     136        /// <param name="left_to_right">The flag, indicating whether the line should be always scanned from the left-most point to the right-most out of pt1 and pt2 (left_to_right=true), or it is scanned in the specified order, from pt1 to pt2 (left_to_right=false). </param> 
     137        /// <returns>The function cvInitLineIterator initializes the line iterator and returns the number of pixels between two end points. Both points must be inside the image. After the iterator has been initialized, all the points on the raster line that connects the two ending points may be retrieved by successive calls of NextLinePoint point. The points on the line are calculated one by one using 4-connected or 8-connected Bresenham algorithm.</returns>  
     138        private void Initialize(CvArr image, CvPoint pt1, CvPoint pt2, PixelConnectivity connectivity, bool left_to_right) 
     139        { 
     140            this._image = image; 
     141            this._pt1 = pt1; 
     142            this._pt2 = pt2; 
     143            this._connectivity = connectivity; 
     144            this._left_to_right = left_to_right; 
     145            this._count = CvDll.cvInitLineIterator(image.CvPtr, pt1, pt2, this.CvPtr, connectivity, left_to_right); 
     146        } 
     147        /// <summary> 
     148        /// Initializes line iterator 
     149        /// </summary> 
     150        private void Initialize() 
     151        { 
     152            Initialize(_image, _pt1, _pt2, _connectivity, _left_to_right); 
     153        } 
     154 
     155#if LANG_JP 
     156        /// <summary> 
     157        /// リソースの解放 
    47158        /// </summary> 
    48159#else 
     
    60171#if LANG_JP 
    61172        /// <summary> 
    62         /// データポインタ(CvLineIterator*)を取得する 
     173        /// データポインタ (CvLineIterator*) 
    63174        /// </summary> 
    64175#else 
     
    82193#else 
    83194        /// <summary> 
    84         /// Depth of the image 
    85         /// </summary> 
    86 #endif 
    87         public BitDepth Depth 
    88         { 
    89             get { return depth; } 
    90             set { depth = value; } 
    91         } 
    92  
    93 #if LANG_JP 
    94         /// <summary> 
    95         ///  
    96         /// </summary> 
    97 #else 
    98         /// <summary> 
    99         /// Depth of the image 
    100         /// </summary> 
    101 #endif 
    102         public IntPtr CurrentPointPtr 
     195        ///  
     196        /// </summary> 
     197#endif 
     198        public int Count 
     199        { 
     200            get { return _count; } 
     201            private set { _count = value; } 
     202        } 
     203#if LANG_JP 
     204        /// <summary> 
     205        ///  
     206        /// </summary> 
     207#else 
     208        /// <summary> 
     209        ///  
     210        /// </summary> 
     211#endif 
     212        public IntPtr Ptr 
    103213        { 
    104214            get { return _data.ptr; } 
    105         } 
    106  
    107 #if LANG_JP 
    108         /// <summary> 
    109         ///  
    110         /// </summary> 
    111 #else 
    112         /// <summary> 
    113         /// Depth of the image 
     215            set { _data.ptr = value; } 
     216        } 
     217#if LANG_JP 
     218        /// <summary> 
     219        ///  
     220        /// </summary> 
     221#else 
     222        /// <summary> 
     223        ///  
     224        /// </summary> 
     225#endif 
     226        public int Err 
     227        { 
     228            get { return _data.err; } 
     229            set { _data.err = value; } 
     230        } 
     231#if LANG_JP 
     232        /// <summary> 
     233        ///  
     234        /// </summary> 
     235#else 
     236        /// <summary> 
     237        ///  
     238        /// </summary> 
     239#endif 
     240        public int PlusDelta 
     241        { 
     242            get { return _data.plus_delta; } 
     243            set { _data.plus_delta = value; } 
     244        } 
     245#if LANG_JP 
     246        /// <summary> 
     247        ///  
     248        /// </summary> 
     249#else 
     250        /// <summary> 
     251        ///  
     252        /// </summary> 
     253#endif 
     254        public int MinusDelta 
     255        { 
     256            get { return _data.minus_delta; } 
     257            set { _data.minus_delta = value; } 
     258        } 
     259#if LANG_JP 
     260        /// <summary> 
     261        ///  
     262        /// </summary> 
     263#else 
     264        /// <summary> 
     265        ///  
     266        /// </summary> 
     267#endif 
     268        public int PlusStep 
     269        { 
     270            get { return _data.plus_step; } 
     271            set { _data.plus_step = value; } 
     272        } 
     273#if LANG_JP 
     274        /// <summary> 
     275        ///  
     276        /// </summary> 
     277#else 
     278        /// <summary> 
     279        ///  
     280        /// </summary> 
     281#endif 
     282        public int MinusStep 
     283        { 
     284            get { return _data.minus_step; } 
     285            set { _data.minus_step = value; } 
     286        } 
     287 
     288#if LANG_JP 
     289        /// <summary> 
     290        /// CV_NEXT_LINE_POINT 
     291        /// </summary> 
     292#else 
     293        /// <summary> 
     294        /// CV_NEXT_LINE_POINT 
    114295        /// </summary> 
    115296#endif 
     
    117298        { 
    118299            _data.NextLinePoint(); 
     300        } 
     301        #endregion 
     302 
     303        #region IEnumerable<T> Members 
     304        /// <summary> 
     305        ///  
     306        /// </summary> 
     307        /// <returns></returns> 
     308        public IEnumerator<byte[]> GetEnumerator() 
     309        { 
     310            if (_image == null) 
     311            { 
     312                throw new NotSupportedException("Not initialized iterator"); 
     313            } 
     314 
     315            Initialize(); 
     316            int ch = _image.ElemChannels; 
     317 
     318            for (int i = 0; i < _count; i++) 
     319            { 
     320                byte[] result = new byte[ch]; 
     321                IntPtr ptr = _data.ptr; 
     322                for (int j = 0; j < ch; j++) 
     323                { 
     324                    result[j] = Marshal.ReadByte(ptr, j); 
     325                }               
     326                yield return result; 
     327                _data.NextLinePoint(); 
     328            } 
     329        } 
     330        /// <summary> 
     331        ///  
     332        /// </summary> 
     333        /// <returns></returns> 
     334        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() 
     335        { 
     336            return GetEnumerator(); 
    119337        } 
    120338        #endregion 
  • lang/cpluspluscli/OpenCvSharp2/trunk/OpenCvSharp/Src/Core/CvDll.cs

    r32525 r32533  
    561561        public static extern IntPtr cvInitImageHeader(IntPtr image, CvSize size, BitDepth depth, int channels, int origin, int align); 
    562562        [DllImport(DLL_CXCORE)] 
    563         public static extern int cvInitLineIterator(IntPtr image, CvPoint pt1, CvPoint pt2, IntPtr line_iterator, [MarshalAs(UnmanagedType.I4)] PixelConnectivity connectivity, int left_to_right); 
     563        public static extern int cvInitLineIterator(IntPtr image, CvPoint pt1, CvPoint pt2, IntPtr line_iterator, [MarshalAs(UnmanagedType.I4)] PixelConnectivity connectivity, [MarshalAs(UnmanagedType.Bool)] bool left_to_right); 
    564564        [DllImport(DLL_CXCORE)] 
    565565        public static extern IntPtr cvInitMatHeader(IntPtr mat, int rows, int cols, MatrixType type, IntPtr data, int step); 
  • lang/cpluspluscli/OpenCvSharp2/trunk/OpenCvSharp/Src/Core/Cv_A-C.cs

    r32517 r32533  
    25182518#if LANG_JP 
    25192519        /// <summary> 
    2520         ///  
    2521         /// </summary> 
    2522         /// <param name="img_size"></param> 
    2523         /// <param name="pt1"></param> 
    2524         /// <param name="pt2"></param> 
     2520        /// 線分を画像領域で切り取る 
     2521        /// </summary> 
     2522        /// <param name="img_size">画像の大きさ</param> 
     2523        /// <param name="pt1">線分の1番目の端点.この値はこの関数によって変更される.</param> 
     2524        /// <param name="pt2">線分の2番目の端点.この値はこの関数によって変更される.</param> 
    25252525        /// <returns></returns> 
    25262526#else 
  • lang/cpluspluscli/OpenCvSharp2/trunk/OpenCvSharp/Src/Core/Cv_D-G.cs

    r32527 r32533  
    593593        /// <returns>The function cvEllipse2Poly computes vertices of the polyline that approximates the specified elliptic arc. It is used by cvEllipse. It returns the numbers of output points.</returns> 
    594594#endif 
    595         public static int Ellipse2Poly(CvPoint center, CvSize axes,int angle, int arc_start,int arc_end,out CvPoint[] pts, int delta ) 
     595        public static int Ellipse2Poly(CvPoint center, CvSize axes, int angle, int arc_start, int arc_end, out CvPoint[] pts, int delta) 
    596596        { 
    597597            int nb_pts = (int)Math.Ceiling(((arc_end - arc_start) / (float)delta) + 1); 
  • lang/cpluspluscli/OpenCvSharp2/trunk/OpenCvSharp/Src/Core/Cv_H-Q.cs

    r32526 r32533  
    651651        #region InitLineIterator 
    652652#if LANG_JP 
    653                 /// <summary> 
    654         ///  
    655         /// </summary> 
    656         /// <param name="image"> </param> 
    657         /// <param name="pt1"> </param> 
    658         /// <param name="pt2"></param> 
    659         /// <param name="line_iterator"></param> 
     653        /// <summary> 
     654        /// ラインイテレータを初期化する 
     655        /// </summary> 
     656        /// <param name="image">対象画像</param> 
     657        /// <param name="pt1">線分の一つ目の端点</param> 
     658        /// <param name="pt2">線分のニつ目の端点</param> 
     659        /// <param name="line_iterator">ラインイテレータ状態構造体へのポインタ</param> 
    660660        /// <returns></returns>  
    661661#else 
     
    674674        } 
    675675#if LANG_JP 
    676                 /// <summary> 
    677         ///  
    678         /// </summary> 
    679         /// <param name="image"> </param> 
    680         /// <param name="pt1"> </param> 
    681         /// <param name="pt2"></param> 
    682         /// <param name="line_iterator"></param> 
    683         /// <param name="connectivity"> </param> 
     676        /// <summary> 
     677        /// ラインイテレータを初期化する 
     678        /// </summary> 
     679        /// <param name="image">対象画像</param> 
     680        /// <param name="pt1">線分の一つ目の端点</param> 
     681        /// <param name="pt2">線分のニつ目の端点</param> 
     682        /// <param name="line_iterator">ラインイテレータ状態構造体へのポインタ</param> 
     683        /// <param name="connectivity">走査した線分の接続性.4または8</param> 
    684684        /// <returns></returns>  
    685685#else 
     
    699699        } 
    700700#if LANG_JP 
    701                 /// <summary> 
    702         ///  
    703         /// </summary> 
    704         /// <param name="image"> </param> 
    705         /// <param name="pt1"> </param> 
    706         /// <param name="pt2"></param> 
    707         /// <param name="line_iterator"></param> 
    708         /// <param name="connectivity"> </param> 
    709         /// <param name="left_to_right"> </param> 
     701        /// <summary> 
     702        /// ラインイテレータを初期化する 
     703        /// </summary> 
     704        /// <param name="image">対象画像</param> 
     705        /// <param name="pt1">線分の一つ目の端点</param> 
     706        /// <param name="pt2">線分のニつ目の端点</param> 
     707        /// <param name="line_iterator">ラインイテレータ状態構造体へのポインタ</param> 
     708        /// <param name="connectivity">走査した線分の接続性.4または8</param> 
     709        /// <param name="left_to_right">pt1とpt2とは無関係に線分をいつも左から右に走査する(true)か, pt1からpt2への決まった方向で走査するか(false)を指定するフラグ. </param> 
    710710        /// <returns></returns>  
    711711#else 
     
    721721        /// <returns>The function cvInitLineIterator initializes the line iterator and returns the number of pixels between two end points. Both points must be inside the image. After the iterator has been initialized, all the points on the raster line that connects the two ending points may be retrieved by successive calls of NextLinePoint point. The points on the line are calculated one by one using 4-connected or 8-connected Bresenham algorithm.</returns>  
    722722#endif 
    723         public static int InitLineIterator( CvArr image, CvPoint pt1, CvPoint pt2,out CvLineIterator line_iterator, PixelConnectivity connectivity, bool left_to_right) 
     723        public static int InitLineIterator(CvArr image, CvPoint pt1, CvPoint pt2, out CvLineIterator line_iterator, PixelConnectivity connectivity, bool left_to_right) 
    724724        { 
    725725            if (image == null) 
    726726                throw new ArgumentNullException("image"); 
    727             IntPtr line_iterator_ptr = new IntPtr(); 
    728             int pixels = CvDll.cvInitLineIterator(image.CvPtr, pt1, pt2, line_iterator_ptr, connectivity, System.Convert.ToInt32(left_to_right)); 
    729             line_iterator = new CvLineIterator(line_iterator_ptr); 
    730             return pixels; 
     727            line_iterator = new CvLineIterator(image, pt1, pt2, connectivity, left_to_right); 
     728            return line_iterator.Count; 
    731729        } 
    732730        #endregion 
     
    11501148        #region InvSqrt 
    11511149#if LANG_JP 
    1152 /// <summary> 
     1150        /// <summary> 
    11531151        /// 引数の平方根の逆数を計算する. 
    11541152        /// これは,通常,1./sqrt(value)を計算するよりも高速である. 
     
    12121210                throw new ArgumentNullException("vtx"); 
    12131211            } 
    1214             return CvInline.CV_IS_GRAPH_VERTEX_VISITED_( vtx.CvPtr); 
     1212            return CvInline.CV_IS_GRAPH_VERTEX_VISITED_(vtx.CvPtr); 
    12151213        } 
    12161214        #endregion 
     
    12391237        #region KalmanCorrect 
    12401238#if LANG_JP 
    1241 /// <summary> 
     1239        /// <summary> 
    12421240        /// モデル状態を修正する. 修正された状態を kalman->state_post に保存し,これを出力として返す.cvKalmanCorrectのエイリアス. 
    12431241        /// </summary> 
     
    12611259            IntPtr result = CvDll.cvKalmanPredict(kalman.CvPtr, measurement.CvPtr); 
    12621260            return new CvMat(result, false); 
    1263         }        
    1264 #if LANG_JP 
    1265 /// <summary> 
     1261        } 
     1262#if LANG_JP 
     1263        /// <summary> 
    12661264        /// モデル状態を修正する. 修正された状態を kalman->state_post に保存し,これを出力として返す.cvKalmanCorrectのエイリアス. 
    12671265        /// </summary> 
     
    12841282        #region KalmanPredict 
    12851283#if LANG_JP 
    1286 /// <summary> 
     1284        /// <summary> 
    12871285        /// 次のモデル状態を推定する. cvKalmanPredictのエイリアス. 
    12881286        /// </summary> 
     
    13011299        } 
    13021300#if LANG_JP 
    1303 /// <summary> 
     1301        /// <summary> 
    13041302        /// 次のモデル状態を推定する. cvKalmanPredictのエイリアス. 
    13051303        /// </summary> 
     
    13241322        } 
    13251323#if LANG_JP 
    1326 /// <summary> 
     1324        /// <summary> 
    13271325        /// 次のモデル状態を推定する. cvKalmanPredictのエイリアス. 
    13281326        /// </summary> 
     
    13391337        { 
    13401338            return KalmanPredict(kalman); 
    1341         }        
    1342 #if LANG_JP 
    1343 /// <summary> 
     1339        } 
     1340#if LANG_JP 
     1341        /// <summary> 
    13441342        /// 次のモデル状態を推定する. cvKalmanPredictのエイリアス. 
    13451343        /// </summary> 
     
    21502148        #region MeanShift 
    21512149#if LANG_JP 
    2152 /// <summary> 
     2150        /// <summary> 
    21532151        ///  
    21542152        /// </summary> 
    2155          /// <param name="prob_image"></param> 
     2153        /// <param name="prob_image"></param> 
    21562154        /// <param name="window"></param> 
    21572155        /// <param name="criteria"></param> 
     
    31733171            block = new CvSeqBlock(); 
    31743172            IntPtr result = CvDll.cvPointSeqFromMat(seq_kind, mat.CvPtr, contour_header.CvPtr, block.CvPtr); 
    3175             if(result == IntPtr.Zero) 
     3173            if (result == IntPtr.Zero) 
    31763174                return null; 
    31773175            else 
  • lang/cpluspluscli/OpenCvSharp2/trunk/OpenCvSharp/Src/Core/Cv_Macro.cs

    r32510 r32533  
    238238                } 
    239239        #endregion 
     240        #region NEXT_LINE_POINT 
     241        /// <summary> 
     242        ///  
     243        /// </summary> 
     244        /// <param name="line_iterator"></param> 
     245        public static void NEXT_LINE_POINT(CvLineIterator line_iterator) 
     246        { 
     247            int _line_iterator_mask = line_iterator.Err < 0 ? -1 : 0; 
     248            line_iterator.Err += line_iterator.MinusDelta + (line_iterator.PlusDelta & _line_iterator_mask); 
     249            line_iterator.Ptr = new IntPtr(line_iterator.Ptr.ToInt64() + line_iterator.MinusStep + (line_iterator.PlusStep & _line_iterator_mask)); 
     250        } 
     251        #endregion 
    240252        #region NEXT_SEQ_ELEM 
    241253        /// <summary> 
  • lang/cpluspluscli/OpenCvSharp2/trunk/OpenCvSharp/Src/Struct/CvScalar.cs

    r32510 r32533  
    299299            /// </summary> 
    300300            /// <returns>文字列形式</returns> 
    301             public override string ToString() 
     301            public override string  ToString() 
    302302            { 
    303303                    return string.Format("CvScalar ({0}, {1}, {2}, {3})", Val0, Val1, Val2, Val3);