Merged the trunk r8589:8653 - all changes related to build warnings
This commit is contained in:
@@ -92,8 +92,6 @@ icvHoughLinesStandard( const CvMat* img, float rho, float theta,
|
||||
int step, width, height;
|
||||
int numangle, numrho;
|
||||
int total = 0;
|
||||
float ang;
|
||||
int r, n;
|
||||
int i, j;
|
||||
float irho = 1 / rho;
|
||||
double scale;
|
||||
@@ -114,10 +112,11 @@ icvHoughLinesStandard( const CvMat* img, float rho, float theta,
|
||||
_tabCos.allocate(numangle);
|
||||
int *accum = _accum, *sort_buf = _sort_buf;
|
||||
float *tabSin = _tabSin, *tabCos = _tabCos;
|
||||
|
||||
|
||||
memset( accum, 0, sizeof(accum[0]) * (numangle+2) * (numrho+2) );
|
||||
|
||||
for( ang = 0, n = 0; n < numangle; ang += theta, n++ )
|
||||
float ang = 0;
|
||||
for(int n = 0; n < numangle; ang += theta, n++ )
|
||||
{
|
||||
tabSin[n] = (float)(sin(ang) * irho);
|
||||
tabCos[n] = (float)(cos(ang) * irho);
|
||||
@@ -128,17 +127,17 @@ icvHoughLinesStandard( const CvMat* img, float rho, float theta,
|
||||
for( j = 0; j < width; j++ )
|
||||
{
|
||||
if( image[i * step + j] != 0 )
|
||||
for( n = 0; n < numangle; n++ )
|
||||
for(int n = 0; n < numangle; n++ )
|
||||
{
|
||||
r = cvRound( j * tabCos[n] + i * tabSin[n] );
|
||||
int r = cvRound( j * tabCos[n] + i * tabSin[n] );
|
||||
r += (numrho - 1) / 2;
|
||||
accum[(n+1) * (numrho+2) + r+1]++;
|
||||
}
|
||||
}
|
||||
|
||||
// stage 2. find local maximums
|
||||
for( r = 0; r < numrho; r++ )
|
||||
for( n = 0; n < numangle; n++ )
|
||||
for(int r = 0; r < numrho; r++ )
|
||||
for(int n = 0; n < numangle; n++ )
|
||||
{
|
||||
int base = (n+1) * (numrho+2) + r+1;
|
||||
if( accum[base] > threshold &&
|
||||
@@ -170,10 +169,6 @@ icvHoughLinesStandard( const CvMat* img, float rho, float theta,
|
||||
* Multi-Scale variant of Classical Hough Transform *
|
||||
\****************************************************************************************/
|
||||
|
||||
#if defined _MSC_VER && _MSC_VER >= 1200
|
||||
#pragma warning( disable: 4714 )
|
||||
#endif
|
||||
|
||||
//DECLARE_AND_IMPLEMENT_LIST( _index, h_ );
|
||||
IMPLEMENT_LIST( _index, h_ )
|
||||
|
||||
@@ -249,7 +244,7 @@ icvHoughLinesSDiv( const CvMat* img,
|
||||
/* Precalculating sin */
|
||||
_sinTable.resize( 5 * tn * stn );
|
||||
sinTable = &_sinTable[0];
|
||||
|
||||
|
||||
for( index = 0; index < 5 * tn * stn; index++ )
|
||||
sinTable[index] = (float)cos( stheta * index * 0.2f );
|
||||
|
||||
@@ -449,7 +444,7 @@ icvHoughLinesSDiv( const CvMat* img,
|
||||
h_get_next__index( &pos );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
h_destroy_list__index(list);
|
||||
}
|
||||
|
||||
@@ -529,7 +524,7 @@ icvHoughLinesProbabilistic( CvMat* image,
|
||||
// choose random point out of the remaining ones
|
||||
int idx = cvRandInt(&rng) % count;
|
||||
int max_val = threshold-1, max_n = 0;
|
||||
CvPoint* pt = (CvPoint*)cvGetSeqElem( seq, idx );
|
||||
CvPoint* point = (CvPoint*)cvGetSeqElem( seq, idx );
|
||||
CvPoint line_end[2] = {{0,0}, {0,0}};
|
||||
float a, b;
|
||||
int* adata = (int*)accum.data;
|
||||
@@ -537,11 +532,11 @@ icvHoughLinesProbabilistic( CvMat* image,
|
||||
int good_line;
|
||||
const int shift = 16;
|
||||
|
||||
i = pt->y;
|
||||
j = pt->x;
|
||||
i = point->y;
|
||||
j = point->x;
|
||||
|
||||
// "remove" it by overriding it with the last element
|
||||
*pt = *(CvPoint*)cvGetSeqElem( seq, count-1 );
|
||||
*point = *(CvPoint*)cvGetSeqElem( seq, count-1 );
|
||||
|
||||
// check if it has been excluded already (i.e. belongs to some other line)
|
||||
if( !mdata0[i*width + j] )
|
||||
@@ -756,7 +751,7 @@ cvHoughLines2( CvArr* src_image, void* lineStorage, int method,
|
||||
}
|
||||
else
|
||||
CV_Error( CV_StsBadArg, "Destination is not CvMemStorage* nor CvMat*" );
|
||||
|
||||
|
||||
iparam1 = cvRound(param1);
|
||||
iparam2 = cvRound(param2);
|
||||
|
||||
@@ -842,7 +837,7 @@ icvHoughCirclesGradient( CvMat* img, float dp, float min_dist,
|
||||
acols = accum->cols - 2;
|
||||
adata = accum->data.i;
|
||||
astep = accum->step/sizeof(adata[0]);
|
||||
// Accumulate circle evidence for each edge pixel
|
||||
// Accumulate circle evidence for each edge pixel
|
||||
for( y = 0; y < rows; y++ )
|
||||
{
|
||||
const uchar* edges_row = edges->data.ptr + y*edges->step;
|
||||
@@ -852,7 +847,7 @@ icvHoughCirclesGradient( CvMat* img, float dp, float min_dist,
|
||||
for( x = 0; x < cols; x++ )
|
||||
{
|
||||
float vx, vy;
|
||||
int sx, sy, x0, y0, x1, y1, r, k;
|
||||
int sx, sy, x0, y0, x1, y1, r;
|
||||
CvPoint pt;
|
||||
|
||||
vx = dx_row[x];
|
||||
@@ -868,8 +863,8 @@ icvHoughCirclesGradient( CvMat* img, float dp, float min_dist,
|
||||
|
||||
x0 = cvRound((x*idp)*ONE);
|
||||
y0 = cvRound((y*idp)*ONE);
|
||||
// Step from min_radius to max_radius in both directions of the gradient
|
||||
for( k = 0; k < 2; k++ )
|
||||
// Step from min_radius to max_radius in both directions of the gradient
|
||||
for(int k1 = 0; k1 < 2; k1++ )
|
||||
{
|
||||
x1 = x0 + min_radius * sx;
|
||||
y1 = y0 + min_radius * sy;
|
||||
@@ -894,7 +889,7 @@ icvHoughCirclesGradient( CvMat* img, float dp, float min_dist,
|
||||
nz_count = nz->total;
|
||||
if( !nz_count )
|
||||
return;
|
||||
//Find possible circle centers
|
||||
//Find possible circle centers
|
||||
for( y = 1; y < arows - 1; y++ )
|
||||
{
|
||||
for( x = 1; x < acols - 1; x++ )
|
||||
@@ -924,19 +919,19 @@ icvHoughCirclesGradient( CvMat* img, float dp, float min_dist,
|
||||
dr = dp;
|
||||
min_dist = MAX( min_dist, dp );
|
||||
min_dist *= min_dist;
|
||||
// For each found possible center
|
||||
// Estimate radius and check support
|
||||
// For each found possible center
|
||||
// Estimate radius and check support
|
||||
for( i = 0; i < centers->total; i++ )
|
||||
{
|
||||
int ofs = *(int*)cvGetSeqElem( centers, i );
|
||||
y = ofs/(acols+2);
|
||||
x = ofs - (y)*(acols+2);
|
||||
//Calculate circle's center in pixels
|
||||
//Calculate circle's center in pixels
|
||||
float cx = (float)((x + 0.5f)*dp), cy = (float)(( y + 0.5f )*dp);
|
||||
float start_dist, dist_sum;
|
||||
float r_best = 0, c[3];
|
||||
float r_best = 0;
|
||||
int max_count = 0;
|
||||
// Check distance with previously detected circles
|
||||
// Check distance with previously detected circles
|
||||
for( j = 0; j < circles->total; j++ )
|
||||
{
|
||||
float* c = (float*)cvGetSeqElem( circles, j );
|
||||
@@ -946,7 +941,7 @@ icvHoughCirclesGradient( CvMat* img, float dp, float min_dist,
|
||||
|
||||
if( j < circles->total )
|
||||
continue;
|
||||
// Estimate best radius
|
||||
// Estimate best radius
|
||||
cvStartReadSeq( nz, &reader );
|
||||
for( j = k = 0; j < nz_count; j++ )
|
||||
{
|
||||
@@ -982,7 +977,7 @@ icvHoughCirclesGradient( CvMat* img, float dp, float min_dist,
|
||||
{
|
||||
float r_cur = ddata[sort_buf[(j + start_idx)/2]];
|
||||
if( (start_idx - j)*r_best >= max_count*r_cur ||
|
||||
(r_best < FLT_EPSILON && start_idx - j >= max_count) )
|
||||
(r_best < FLT_EPSILON && start_idx - j >= max_count) )
|
||||
{
|
||||
r_best = r_cur;
|
||||
max_count = start_idx - j;
|
||||
@@ -993,9 +988,10 @@ icvHoughCirclesGradient( CvMat* img, float dp, float min_dist,
|
||||
}
|
||||
dist_sum += d;
|
||||
}
|
||||
// Check if the circle has enough support
|
||||
// Check if the circle has enough support
|
||||
if( max_count > acc_threshold )
|
||||
{
|
||||
float c[3];
|
||||
c[0] = cx;
|
||||
c[1] = cy;
|
||||
c[2] = (float)r_best;
|
||||
@@ -1103,9 +1099,9 @@ static void seqToMat(const CvSeq* seq, OutputArray _arr)
|
||||
else
|
||||
_arr.release();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void cv::HoughLines( InputArray _image, OutputArray _lines,
|
||||
double rho, double theta, int threshold,
|
||||
double srn, double stn )
|
||||
|
||||
Reference in New Issue
Block a user