OpenCV => 3.1.0 (installed with brew install opencv3)
Operating System / Platform => Mac OSX El Capitan 10.11.6
Compiler => Apple LLVM version 8.0.0 (clang-800.0.38)
Detailed description
I load an image with imread() and display it with imshow(). On the window I set a mouse callback that gives out the coordinates when the image is clicked with the left mouse button.
But when the image is too small (for example 100x100px) there is a gray "filling" area in the window where the image is displayed. The problem is, that this results in wrong coordinates when the image is clicked:
-The window seems to be 200x100px with 100x100px of the real image and 100x100px of gray filling area
-When I click on the right bottom of the image I get the coordinates (49,99) and when I click on the right bottom of the whole window I get the coordinates (99,99)
My teacher compiled the same program on Linux and the image is displayed correctly in a window of 100x100px and correct coordinates in the mouse callback.
Steps to reproduce
I attached a zip file which contains:
-source code
-input image with 100x100px which leads to the error (color_test.jpg)
-input image with 300x300px which works correctly
-screenshot of how the 100x100px image is displayed with the gray filling area (output.jpg)
The issue is investigated and resolved as Apple bug in Cocoa graphics support library related to the function
window setAutosize(boolean)
bugreport is submitted to Apple
System information (version)
Detailed description
I load an image with imread() and display it with imshow(). On the window I set a mouse callback that gives out the coordinates when the image is clicked with the left mouse button. But when the image is too small (for example 100x100px) there is a gray "filling" area in the window where the image is displayed. The problem is, that this results in wrong coordinates when the image is clicked: -The window seems to be 200x100px with 100x100px of the real image and 100x100px of gray filling area -When I click on the right bottom of the image I get the coordinates (49,99) and when I click on the right bottom of the whole window I get the coordinates (99,99)
My teacher compiled the same program on Linux and the image is displayed correctly in a window of 100x100px and correct coordinates in the mouse callback. Steps to reproduce
I attached a zip file which contains: -source code -input image with 100x100px which leads to the error (color_test.jpg) -input image with 300x300px which works correctly -screenshot of how the 100x100px image is displayed with the gray filling area (output.jpg)