opencv-cvround-float-patch.diff
modules/core/include/opencv2/core/types_c.h (working copy) | ||
---|---|---|
286 | 286 |
#define CV_CMP(a,b) (((a) > (b)) - ((a) < (b))) |
287 | 287 |
#define CV_SIGN(a) CV_CMP((a),0) |
288 | 288 | |
289 |
CV_INLINE int cvRound( float value ) |
|
290 |
{ |
|
291 |
#if defined HAVE_LRINT || defined CV_ICC || defined __GNUC__ |
|
292 |
return (int)lrint(value); |
|
293 |
#else |
|
294 |
// while this is not IEEE754-compliant rounding, it's usually a good enough approximation |
|
295 |
return (int)(value + (value >= 0 ? 0.5f : -0.5f)); |
|
296 |
#endif |
|
297 |
} |
|
298 | ||
299 | ||
289 | 300 |
CV_INLINE int cvRound( double value ) |
290 | 301 |
{ |
291 | 302 |
#if (defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __x86_64__ && !defined __APPLE__) |
modules/imgproc/src/color.cpp (working copy) | ||
---|---|---|
664 | 664 |
79, 488, 3892 |
665 | 665 |
}; |
666 | 666 |
for( int i = 0; i < 9; i++ ) |
667 |
coeffs[i] = _coeffs ? cvRound(_coeffs[i]*(1 << xyz_shift)) : coeffs0[i];
|
|
667 |
coeffs[i] = _coeffs ? (_coeffs[i]*(1 << xyz_shift)) : coeffs0[i]; |
|
668 | 668 |
if(blueIdx == 0) |
669 | 669 |
{ |
670 | 670 |
std::swap(coeffs[0], coeffs[2]); |
... | ... | |
746 | 746 |
228, -836, 4331 |
747 | 747 |
}; |
748 | 748 |
for(int i = 0; i < 9; i++) |
749 |
coeffs[i] = _coeffs ? cvRound(_coeffs[i]*(1 << xyz_shift)) : coeffs0[i];
|
|
749 |
coeffs[i] = _coeffs ? (_coeffs[i]*(1 << xyz_shift)) : coeffs0[i]; |
|
750 | 750 |
|
751 | 751 |
if(blueIdx == 0) |
752 | 752 |
{ |
modules/calib3d/src/stereobm.cpp (working copy) | ||
---|---|---|
713 | 713 |
void operator()( const BlockedRange& range ) const |
714 | 714 |
{ |
715 | 715 |
int cols = left->cols, rows = left->rows; |
716 |
int _row0 = min(cvRound(range.begin() * rows / nstripes), rows);
|
|
717 |
int _row1 = min(cvRound(range.end() * rows / nstripes), rows);
|
|
716 |
int _row0 = min((range.begin() * rows / nstripes), rows); |
|
717 |
int _row1 = min((range.end() * rows / nstripes), rows); |
|
718 | 718 |
uchar *ptr = state->slidingSumBuf->data.ptr + range.begin() * stripeBufSize; |
719 | 719 |
int FILTERED = (state->minDisparity - 1)*16; |
720 | 720 |
|
modules/legacy/src/face.cpp (working copy) | ||
---|---|---|
151 | 151 |
// ResizeRect(IdealRect,&UpRect,UP_SCALE,7); |
152 | 152 |
// ResizeRect(IdealRect,&DownRect,DOWN_SCALE,7); |
153 | 153 | |
154 |
long x = Rect.x + cvRound(Rect.width/2);
|
|
155 |
long y = Rect.y + cvRound(Rect.height/2);
|
|
154 |
long x = Rect.x + (Rect.width/2); |
|
155 |
long y = Rect.y + (Rect.height/2); |
|
156 | 156 | |
157 | 157 |
if ( isPointInRect(cvPoint(x,y),IdealRect) ) |
158 | 158 |
return true; |
modules/legacy/src/blobtrackanalysistrackdist.cpp (working copy) | ||
---|---|---|
511 | 511 |
p, |
512 | 512 |
s, |
513 | 513 |
0, 0, 360, |
514 |
CV_RGB(c,255-c,0), cvRound(1+(0*c)/255) );
|
|
514 |
CV_RGB(c,255-c,0), (1+(0*c)/255) ); |
|
515 | 515 | |
516 | 516 |
for(j=pF->pTrack->GetPointNum(); j>0; j--) |
517 | 517 |
{ |