|
Line 0
Link Here
|
|
|
1 |
--- modules/legacy/src/calibfilter.cpp.orig 2014-04-11 10:15:26 UTC |
| 2 |
+++ modules/legacy/src/calibfilter.cpp |
| 3 |
@@ -95,11 +95,8 @@ bool CvCalibFilter::SetEtalon( CvCalibEt |
| 4 |
|
| 5 |
Stop(); |
| 6 |
|
| 7 |
- if (latestPoints != NULL) |
| 8 |
- { |
| 9 |
- for( i = 0; i < MAX_CAMERAS; i++ ) |
| 10 |
- cvFree( latestPoints + i ); |
| 11 |
- } |
| 12 |
+ for( i = 0; i < MAX_CAMERAS; i++ ) |
| 13 |
+ cvFree( latestPoints + i ); |
| 14 |
|
| 15 |
if( type == CV_CALIB_ETALON_USER || type != etalonType ) |
| 16 |
{ |
| 17 |
@@ -529,64 +526,61 @@ void CvCalibFilter::DrawPoints( CvMat** |
| 18 |
return; |
| 19 |
} |
| 20 |
|
| 21 |
- if( latestCounts ) |
| 22 |
+ for( i = 0; i < cameraCount; i++ ) |
| 23 |
{ |
| 24 |
- for( i = 0; i < cameraCount; i++ ) |
| 25 |
+ if( dstarr[i] && latestCounts[i] ) |
| 26 |
{ |
| 27 |
- if( dstarr[i] && latestCounts[i] ) |
| 28 |
- { |
| 29 |
- CvMat dst_stub, *dst; |
| 30 |
- int count = 0; |
| 31 |
- bool found = false; |
| 32 |
- CvPoint2D32f* pts = 0; |
| 33 |
+ CvMat dst_stub, *dst; |
| 34 |
+ int count = 0; |
| 35 |
+ bool found = false; |
| 36 |
+ CvPoint2D32f* pts = 0; |
| 37 |
|
| 38 |
- GetLatestPoints( i, &pts, &count, &found ); |
| 39 |
+ GetLatestPoints( i, &pts, &count, &found ); |
| 40 |
|
| 41 |
- dst = cvGetMat( dstarr[i], &dst_stub ); |
| 42 |
+ dst = cvGetMat( dstarr[i], &dst_stub ); |
| 43 |
|
| 44 |
- static const CvScalar line_colors[] = |
| 45 |
- { |
| 46 |
- {{0,0,255}}, |
| 47 |
- {{0,128,255}}, |
| 48 |
- {{0,200,200}}, |
| 49 |
- {{0,255,0}}, |
| 50 |
- {{200,200,0}}, |
| 51 |
- {{255,0,0}}, |
| 52 |
- {{255,0,255}} |
| 53 |
- }; |
| 54 |
+ static const CvScalar line_colors[] = |
| 55 |
+ { |
| 56 |
+ {{0,0,255}}, |
| 57 |
+ {{0,128,255}}, |
| 58 |
+ {{0,200,200}}, |
| 59 |
+ {{0,255,0}}, |
| 60 |
+ {{200,200,0}}, |
| 61 |
+ {{255,0,0}}, |
| 62 |
+ {{255,0,255}} |
| 63 |
+ }; |
| 64 |
|
| 65 |
- const int colorCount = sizeof(line_colors)/sizeof(line_colors[0]); |
| 66 |
- const int r = 4; |
| 67 |
- CvScalar color = line_colors[0]; |
| 68 |
- CvPoint prev_pt = { 0, 0}; |
| 69 |
+ const int colorCount = sizeof(line_colors)/sizeof(line_colors[0]); |
| 70 |
+ const int r = 4; |
| 71 |
+ CvScalar color = line_colors[0]; |
| 72 |
+ CvPoint prev_pt = { 0, 0}; |
| 73 |
|
| 74 |
- for( j = 0; j < count; j++ ) |
| 75 |
- { |
| 76 |
- CvPoint pt; |
| 77 |
- pt.x = cvRound(pts[j].x); |
| 78 |
- pt.y = cvRound(pts[j].y); |
| 79 |
+ for( j = 0; j < count; j++ ) |
| 80 |
+ { |
| 81 |
+ CvPoint pt; |
| 82 |
+ pt.x = cvRound(pts[j].x); |
| 83 |
+ pt.y = cvRound(pts[j].y); |
| 84 |
|
| 85 |
- if( found ) |
| 86 |
- { |
| 87 |
- if( etalonType == CV_CALIB_ETALON_CHESSBOARD ) |
| 88 |
- color = line_colors[(j/cvRound(etalonParams[0]))%colorCount]; |
| 89 |
- else |
| 90 |
- color = CV_RGB(0,255,0); |
| 91 |
+ if( found ) |
| 92 |
+ { |
| 93 |
+ if( etalonType == CV_CALIB_ETALON_CHESSBOARD ) |
| 94 |
+ color = line_colors[(j/cvRound(etalonParams[0]))%colorCount]; |
| 95 |
+ else |
| 96 |
+ color = CV_RGB(0,255,0); |
| 97 |
|
| 98 |
- if( j != 0 ) |
| 99 |
- cvLine( dst, prev_pt, pt, color, 1, CV_AA ); |
| 100 |
- } |
| 101 |
+ if( j != 0 ) |
| 102 |
+ cvLine( dst, prev_pt, pt, color, 1, CV_AA ); |
| 103 |
+ } |
| 104 |
|
| 105 |
- cvLine( dst, cvPoint( pt.x - r, pt.y - r ), |
| 106 |
- cvPoint( pt.x + r, pt.y + r ), color, 1, CV_AA ); |
| 107 |
+ cvLine( dst, cvPoint( pt.x - r, pt.y - r ), |
| 108 |
+ cvPoint( pt.x + r, pt.y + r ), color, 1, CV_AA ); |
| 109 |
|
| 110 |
- cvLine( dst, cvPoint( pt.x - r, pt.y + r), |
| 111 |
- cvPoint( pt.x + r, pt.y - r), color, 1, CV_AA ); |
| 112 |
+ cvLine( dst, cvPoint( pt.x - r, pt.y + r), |
| 113 |
+ cvPoint( pt.x + r, pt.y - r), color, 1, CV_AA ); |
| 114 |
|
| 115 |
- cvCircle( dst, pt, r+1, color, 1, CV_AA ); |
| 116 |
+ cvCircle( dst, pt, r+1, color, 1, CV_AA ); |
| 117 |
|
| 118 |
- prev_pt = pt; |
| 119 |
- } |
| 120 |
+ prev_pt = pt; |
| 121 |
} |
| 122 |
} |
| 123 |
} |