window_w32.cpp: remove “gutter”

I would like to remove the 1-pixel “gutter” that sits between the displayed image and the window’s border in win32 imshow. the function icvCalcWindowRect could either get its gutter constant set to 0 or the entire calculation could be simplified (my preference).

static RECT icvCalcWindowRect( CvWindow* window )
const int gutter = 1;
RECT crect = { 0 }, trect = { 0 } , rect = { 0 };
GetClientRect(window->frame, &crect);
GetWindowRect(window->toolbar.toolbar, &trect);
icvScreenToClient(window->frame, &trect);
SubtractRect( &rect, &crect, &trect);
rect = crect; += gutter;
rect.left += gutter;
rect.bottom -= gutter;
rect.right -= gutter;
return rect;

reason: when you send the window into fullscreen, you’d expect the image area to be the precise resolution of your screen, right? with that gutter, it’s not. it’s smaller by two pixels (window decoration disappears, the gutter stays). a precisely screen-sized image shown will be slightly off, which either causes rows and columns of the picture to disappear (GDI: nearest neighbor) or the whole picture gets resampled and turned into mush (OpenGL: bilinear). the gutter also has no function that I can see.

import numpy as np
import cv2 as cv
im = np.eye(200)
cv.imshow("gutter?", im)

observe the gray gutter:
close up

my question: would you like the pull request to be against 3.4 or master? I ask because last time I had a pull request against the wrong branch, having to rebase overwhelmed me and I’d like to avoid repeated embarrassment.

1 possible answer(s) on “window_w32.cpp: remove “gutter”