why is imshow window 2:1 scaled on one pc, 1:1 scaled on another with idential code?

asked 2020-05-20 16:32:02 -0500

jp2112 gravatar image

updated 2020-05-20 16:36:15 -0500

I recently updated/rebuilt OpenCV 4.3.0 in ubuntu 18.04 on my Dell 7730. Was previously using 4.1.0 and had built with world option turned on (set to off in 4.3.0). My Dell has a 4K screen and nVidia GPU, am using eclipse with cuda 10.2 toolkit installed and OpenCV built with cuda, though my code is not making use of any cuda features at this time.

I've used this setup for a year with the 4.1.0 compiled c++ code. But something odd is now happening after updating to 4.3.0--all of my imshow windows are created with 2X scaling in width and height. Here is the code for the video window setup which hasn't changed between builds:

  namedWindow(g_capturedwindow, WINDOW_AUTOSIZE);
  resizeWindow(g_capturedwindow, 1920, 1300); // 220 extra height for trackbars
  moveWindow(g_capturedwindow, 1910, 0);  // <-- put image in upper right of 4K display
  imshow(g_capturedwindow, Imageshow); // <-- (this actually occurs within a function call, with the video image passed in as a parameter)

So that 2:1 scaling is one odd thing.

Another odd thing is that I can take this exact same c++ code and compile it on a similar Dell 7740 also with Ubuntu 18.04 and OpenCV 4.3.0 (no cuda), but it does not scale windows by 2X, they come up with 1 image pixel = 1 display pixel, or 1:1 as desired.

What could be different between the systems or versions of OpenCV that causes one compiled version to double the image sizes? (the moveWindow operation acts with a 2X scaling as well).

One final oddity: I can take the compiled code from the 7730 pc giving 2:1 window scaling, and run it directly on the 7740 pc (no recompiling) and it goes back to 1:1 scaling!

edit retag flag offensive close merge delete