Skip to content

Window resizing no longer works after 4.8.0 #26761

@dustsigns

Description

@dustsigns

System Information

OpenCV version: 4.11.0 (but also 4.10.0 is affected)
Operating system: Debian bullseye with Xfce
Compiler: gcc 10.2.1

Detailed description

Window resizing broke after 4.8.0, i.e., the image within the window is no longer resized correctly.

Using the sample code below, 4.8.0 still works fine:

48

The issue appears in later versions, e.g., 4.10.0 and 4.11.0:

411

As can be seen, there are gray borders around the image. The image does not touch the inner window borders as it did in previous versions (which is what is expected).

The documentation says

[..] the image is scaled to fit the window [..]

Thus, it seems that versions after 4.8.0 broke window resizing.

Steps to reproduce

Sample code to reproduce:

#include <iostream>
#include <opencv2/highgui.hpp>

int main()
{
  const auto size = 20;
  const auto zoom = 10;
  cv::namedWindow("Test window", cv::WINDOW_GUI_EXPANDED);
  const cv::Mat image(size, size, CV_8UC1, cv::Scalar(128));
  cv::imshow("Test window", image);
  cv::resizeWindow("Test window", zoom * size, zoom * size);
  cv::waitKey(0);
  return 0;
}

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)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions