Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

highgui: wayland: Exception when showing too small width image #25560

Closed
4 tasks done
Kumataro opened this issue May 8, 2024 · 0 comments · Fixed by #25561
Closed
4 tasks done

highgui: wayland: Exception when showing too small width image #25560

Kumataro opened this issue May 8, 2024 · 0 comments · Fixed by #25561

Comments

@Kumataro
Copy link
Contributor

Kumataro commented May 8, 2024

System Information

OpenCV version: 4.x ( ba65d2e )
Operating System / Platform: Ubuntu 24.04
Compiler & compiler version: GCC 13.2

Detailed description

When imshow() with small width image, exception is happen.
Because window view width is too small enogh to show title bar.
(In this case, roi is used to fill area. but it has negative position).

kmtr@kmtr-VMware-Virtual-Platform:~/work/build4-main$ ./bin/opencv_test_highgui --gtest_filter="*small*"
:
: 
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from Highgui_GUI
[ RUN      ] Highgui_GUI.small_width_image
[ INFO:0@0.007] global registry.impl.hpp:114 UIBackendRegistry UI: Enabled backends(3, sorted by priority): GTK(1000); GTK3(990); GTK2(980) + BUILTIN(Wayland)
[*] DEBUG: handle_toplevel_configure: maximized=0 fullscreen=0 resizing=0 focused=0 size=[0 x 0]
Exception message: OpenCV(4.9.0-dev) /home/kmtr/work/opencv4/modules/core/src/matrix.cpp:808: error: (-215:Assertion failed) 0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows in function 'Mat'

/home/kmtr/work/opencv4/modules/highgui/test/test_gui.cpp:221: Failure
Expected: waitKey(1000) doesn't throw an exception.
  Actual: it throws.
[  FAILED  ] Highgui_GUI.small_width_image (59 ms)
[----------] 1 test from Highgui_GUI (59 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (59 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] Highgui_GUI.small_width_image

Steps to reproduce

diff --git a/modules/highgui/test/test_gui.cpp b/modules/highgui/test/test_gui.cpp
index 8991e8072b..7821346a99 100644
--- a/modules/highgui/test/test_gui.cpp
+++ b/modules/highgui/test/test_gui.cpp
@@ -205,6 +205,22 @@ TEST(Highgui_GUI, trackbar)
     EXPECT_NO_THROW(destroyAllWindows());
 }

+// See XXXX
+#if (!defined(ENABLE_PLUGINS) \
+      && !defined HAVE_WAYLAND )
+TEST(Highgui_GUI, DISABLED_small_width_image)
+#else
+TEST(Highgui_GUI, small_width_image)
+#endif
+{
+    const std::string window_name("trackbar_test_window");
+    cv::Mat src(1,1,CV_8UC3,cv::Scalar(0));
+    EXPECT_NO_THROW(destroyAllWindows());
+    ASSERT_NO_THROW(namedWindow(window_name));
+    ASSERT_NO_THROW(imshow(window_name, src));
+    ASSERT_NO_THROW(waitKey(1000));
+    EXPECT_NO_THROW(destroyAllWindows());
+}

Issue submission checklist

  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files (videos, images, onnx, etc)
@Kumataro Kumataro added the bug label May 8, 2024
@opencv-alalek opencv-alalek added this to the 4.10.0 milestone May 8, 2024
asmorkalov pushed a commit that referenced this issue May 15, 2024
highgui: wayland: expand image width if title bar cannot be shown

Close #25560

### 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.
- [ ] The feature is well documented and sample code can be built with the project CMake
klatism pushed a commit to klatism/opencv that referenced this issue May 17, 2024
highgui: wayland: expand image width if title bar cannot be shown

Close opencv#25560

### 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.
- [ ] The feature is well documented and sample code can be built with the project CMake
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants