Subversion Repositories seema-scanner

Rev

Rev 49 | Rev 74 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 49 Rev 50
Line 7... Line 7...
7
#include <stdio.h>
7
#include <stdio.h>
8
 
8
 
9
namespace cvtools{
9
namespace cvtools{
10
 
10
 
11
// Lightly modified OpenCV function which accepts a line width argument
11
// Lightly modified OpenCV function which accepts a line width argument
12
void drawChessboardCorners(cv::InputOutputArray _image, Size patternSize, cv::InputArray _corners, bool patternWasFound, int line_width=1){
12
void drawChessboardCorners(cv::InputOutputArray _image, cv::Size patternSize, cv::InputArray _corners, bool patternWasFound, int line_width){
13
    Mat corners = _corners.getMat();
13
    cv::Mat corners = _corners.getMat();
14
    if( corners.empty() )
14
    if( corners.empty() )
15
        return;
15
        return;
16
    Mat image = _image.getMat(); CvMat c_image = _image.getMat();
16
    cv::Mat image = _image.getMat(); CvMat c_image = _image.getMat();
17
    int nelems = corners.checkVector(2, CV_32F, true);
17
    int nelems = corners.checkVector(2, CV_32F, true);
18
    CV_Assert(nelems >= 0);
18
    CV_Assert(nelems >= 0);
19
    cvDrawChessboardCorners( &c_image, patternSize, (CvPoint2D32f*)corners.data,
19
    cvDrawChessboardCorners( &c_image, patternSize, (CvPoint2D32f*)corners.data,
20
                             nelems, patternWasFound, line_width);
20
                             nelems, patternWasFound, line_width);
21
}
21
}
22
 
22
 
23
void cvDrawChessboardCorners(CvArr* _image, CvSize pattern_size, CvPoint2D32f* corners, int count, int found, int line_width=1){
23
void cvDrawChessboardCorners(CvArr* _image, CvSize pattern_size, CvPoint2D32f* corners, int count, int found, int line_width){
24
    const int shift = 0;
24
    const int shift = 0;
25
    const int radius = 4;
25
    const int radius = 12;
26
    const int r = radius*(1 << shift);
26
    const int r = radius*(1 << shift);
27
    int i;
27
    int i;
28
    CvMat stub, *image;
28
    CvMat stub, *image;
29
    double scale = 1;
29
    double scale = 1;
30
    int type, cn, line_type;
30
    int type, cn, line_type;
Line 68... Line 68...
68
        {
68
        {
69
            CvPoint pt;
69
            CvPoint pt;
70
            pt.x = cvRound(corners[i].x*(1 << shift));
70
            pt.x = cvRound(corners[i].x*(1 << shift));
71
            pt.y = cvRound(corners[i].y*(1 << shift));
71
            pt.y = cvRound(corners[i].y*(1 << shift));
72
            cvLine( image, cvPoint( pt.x - r, pt.y - r ),
72
            cvLine( image, cvPoint( pt.x - r, pt.y - r ),
73
                    cvPoint( pt.x + r, pt.y + r ), color, 1, line_type, shift );
73
                    cvPoint( pt.x + r, pt.y + r ), color, line_width, line_type, shift );
74
            cvLine( image, cvPoint( pt.x - r, pt.y + r),
74
            cvLine( image, cvPoint( pt.x - r, pt.y + r),
75
                    cvPoint( pt.x + r, pt.y - r), color, 1, line_type, shift );
75
                    cvPoint( pt.x + r, pt.y - r), color, line_width, line_type, shift );
76
            cvCircle( image, pt, r+(1<<shift), color, 1, line_type, shift );
76
            cvCircle( image, pt, r+(1<<shift), color, line_width, line_type, shift );
77
        }
77
        }
78
    }
78
    }
79
    else
79
    else
80
    {
80
    {
81
        int x, y;
81
        int x, y;
Line 110... Line 110...
110
 
110
 
111
                if( i != 0 )
111
                if( i != 0 )
112
                    cvLine( image, prev_pt, pt, color, 1, line_type, shift );
112
                    cvLine( image, prev_pt, pt, color, 1, line_type, shift );
113
 
113
 
114
                cvLine( image, cvPoint(pt.x - r, pt.y - r),
114
                cvLine( image, cvPoint(pt.x - r, pt.y - r),
115
                        cvPoint(pt.x + r, pt.y + r), color, 1, line_type, shift );
115
                        cvPoint(pt.x + r, pt.y + r), color, line_width, line_type, shift );
116
                cvLine( image, cvPoint(pt.x - r, pt.y + r),
116
                cvLine( image, cvPoint(pt.x - r, pt.y + r),
117
                        cvPoint(pt.x + r, pt.y - r), color, 1, line_type, shift );
117
                        cvPoint(pt.x + r, pt.y - r), color, line_width, line_type, shift );
118
                cvCircle( image, pt, r+(1<<shift), color, 1, line_type, shift );
118
                cvCircle( image, pt, r+(1<<shift), color, line_width, line_type, shift );
119
                prev_pt = pt;
119
                prev_pt = pt;
120
            }
120
            }
121
        }
121
        }
122
    }
122
    }
123
}
123
}