C-API cleanup for OpenCV 5.x (imgproc, highgui)#22754
Conversation
|
|
||
| for (int i = 0; i < GRID_AREA; i++) { | ||
| Size s = Imgproc.getTextSize(Integer.toString(i + 1), 3/* CV_FONT_HERSHEY_COMPLEX */, 1, 2, null); | ||
| Size s = Imgproc.getTextSize(Integer.toString(i + 1), 3/* cv::FONT_HERSHEY_COMPLEX */, 1, 2, null); |
There was a problem hiding this comment.
Size s = Imgproc.getTextSize(Integer.toString(i + 1), Imgproc.FONT_HERSHEY_COMPLEX, 1, 2, null);
| if (mShowTileNumbers) { | ||
| Imgproc.putText(mCells15[i], Integer.toString(1 + idx), new Point((cols / GRID_SIZE - mTextWidths[idx]) / 2, | ||
| (rows / GRID_SIZE + mTextHeights[idx]) / 2), 3/* CV_FONT_HERSHEY_COMPLEX */, 1, new Scalar(255, 0, 0, 255), 2); | ||
| (rows / GRID_SIZE + mTextHeights[idx]) / 2), 3/* cv::FONT_HERSHEY_COMPLEX */, 1, new Scalar(255, 0, 0, 255), 2); |
There was a problem hiding this comment.
(rows / GRID_SIZE + mTextHeights[idx]) / 2), Imgproc.FONT_HERSHEY_COMPLEX, 1, new Scalar(255, 0, 0, 255), 2);
| int depth = test_mat[i][j].depth(); | ||
| // j == 0 is for forward code, j == 1 is for inverse code | ||
| return (depth == CV_8U) ? (srgb ? 32 : 8) : | ||
| return (depth == CV_8U) ? (srgb ? 37 : 8) : |
There was a problem hiding this comment.
I came to conclusion that these thresholds have been chosen experimentally and after changing RNG seeds some tests can fail. We've observed the same problem with these tests in another PR: #16189 (comment)
I specifically moved this fix to separate commit, so it can be backported to 4.x later.
|
I propose to split the PR by the target module. Highgui part could be merged faster as there are not so many changes. |
|
@asmorkalov , while I tried to separate changes for each module it is possible that there could be commits affecting both of them. Thus splitting the PR can take more time and effort than reviewing it in one place. Modifications mostly do a mechanical replacement of one symbol with another. |
modules/calib/src/calibinit.cpp
Outdated
| #else | ||
| Mat binarized_img = thresh_img_new.clone(); // make clone because cvFindContours modifies the source image | ||
| #endif | ||
| detector.generateQuads(binarized_img, flags); |
There was a problem hiding this comment.
maybe deleting Mat binarized_img = thresh_img_new; and detector.generateQuads(thresh_img_new, flags); will be better
modules/calib/src/calibinit.cpp
Outdated
| #else | ||
| Mat binarized_img = (useAdaptive) ? thresh_img : thresh_img.clone(); // make clone because cvFindContours modifies the source image | ||
| #endif | ||
| detector.generateQuads(binarized_img, flags); |
modules/video/test/test_camshift.cpp
Outdated
| cvIsNaN(box.angle) || cvIsInf(box.angle) || box.angle < -180 || box.angle > 180 ) | ||
| { | ||
| ts->printf( cvtest::TS::LOG, "Invalid CvBox2D or CvConnectedComp was returned by cvCamShift\n" ); | ||
| ts->printf( cvtest::TS::LOG, "Invalid Box2D was returned by CamShift\n" ); |
| - Rectangular box: CV_SHAPE_RECT | ||
| - Cross: CV_SHAPE_CROSS | ||
| - Ellipse: CV_SHAPE_ELLIPSE | ||
| - Rectangular box: cv::SHAPE_RECT |
There was a problem hiding this comment.
(it is in Java tab)
Rectangular box: Imgproc.SHAPE_RECT
Cross: Imgproc.SHAPE_CROSS
Ellipse: Imgproc.SHAPE_ELLIPSE
asmorkalov
left a comment
There was a problem hiding this comment.
Great!
Tested manually following combinations on Linux:
- GTK3 no OpenGL + mouse, hot keys
- GTL2 + OpenGL
- QT 5.9 + OpenGL
- QT 5.9, no OpenGL + mouse, hot keys
|
@mshabunin Please squash commits. I'll merge the PR together with contrib. |
Backport some highgui changes from #22754
C-API will be removed completely. This PR covers imgproc and highgui (in progress) modules.
Issues: