1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

Merge pull request #26590 from Kumataro:fix26589

Support C++20 standard #26590

Close https://github.com/opencv/opencv/issues/26589
Related https://github.com/opencv/opencv_contrib/pull/3842
Related: https://github.com/opencv/opencv/issues/20269

- do not arithmetic enums and ( different enums or floating numeric) 
- remove unused variable

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
Kumataro
2024-12-17 13:40:27 +09:00
committed by GitHub
parent 1a1b1901e8
commit 260f511dfb
27 changed files with 143 additions and 178 deletions
+6 -7
View File
@@ -43,7 +43,6 @@ using namespace cv;
namespace cv
{
enum { XY_SHIFT = 16, XY_ONE = 1 << XY_SHIFT, DRAWING_STORAGE_BLOCK = (1<<12) - 256 };
static const int MAX_THICKNESS = 32767;
@@ -1027,8 +1026,8 @@ EllipseEx( Mat& img, Point2l center, Size2l axes,
for (unsigned int i = 0; i < _v.size(); ++i)
{
Point2l pt;
pt.x = (int64)cvRound(_v[i].x / XY_ONE) << XY_SHIFT;
pt.y = (int64)cvRound(_v[i].y / XY_ONE) << XY_SHIFT;
pt.x = (int64)cvRound(_v[i].x / static_cast<double>(XY_ONE)) << XY_SHIFT;
pt.y = (int64)cvRound(_v[i].y / static_cast<double>(XY_ONE)) << XY_SHIFT;
pt.x += cvRound(_v[i].x - pt.x);
pt.y += cvRound(_v[i].y - pt.y);
if (pt != prevPt) {
@@ -1645,7 +1644,7 @@ static void
ThickLine( Mat& img, Point2l p0, Point2l p1, const void* color,
int thickness, int line_type, int flags, int shift )
{
static const double INV_XY_ONE = 1./XY_ONE;
static const double INV_XY_ONE = 1./static_cast<double>(XY_ONE);
p0.x <<= XY_SHIFT - shift;
p0.y <<= XY_SHIFT - shift;
@@ -1981,8 +1980,8 @@ void ellipse(InputOutputArray _img, const RotatedRect& box, const Scalar& color,
int _angle = cvRound(box.angle);
Point2l center(cvRound(box.center.x),
cvRound(box.center.y));
center.x = (center.x << XY_SHIFT) + cvRound((box.center.x - center.x)*XY_ONE);
center.y = (center.y << XY_SHIFT) + cvRound((box.center.y - center.y)*XY_ONE);
center.x = (center.x << XY_SHIFT) + cvRound((box.center.x - center.x)*static_cast<float>(XY_ONE));
center.y = (center.y << XY_SHIFT) + cvRound((box.center.y - center.y)*static_cast<float>(XY_ONE));
Size2l axes(cvRound(box.size.width),
cvRound(box.size.height));
axes.width = (axes.width << (XY_SHIFT - 1)) + cvRound((box.size.width - axes.width)*(XY_ONE>>1));
@@ -2303,7 +2302,7 @@ void putText( InputOutputArray _img, const String& text, Point org,
scalarToRawData(color, buf, img.type(), 0);
int base_line = -(ascii[0] & 15);
int hscale = cvRound(fontScale*XY_ONE), vscale = hscale;
int hscale = cvRound(fontScale * static_cast<double>(XY_ONE)), vscale = hscale;
if( line_type == cv::LINE_AA && img.depth() != CV_8U )
line_type = 8;