问题
In Ubuntu, OpenCV's imshow function has a window where different options such as zoom in, zoom out, pan window, etc, are available, like this:
However, in Windows, these features are absent. I have a particular case where I need to deploy my OpenCV code on Windows, where the user needs to zoom into parts of the image.
Is there any way to access/add these functionalities in Windows also?
回答1:
see https://gist.github.com/BartG95/1ce8ba1e9c25ec3698d1
appears to be a longer procedure though, so you could instead switch to matplotlib's pyplot function (uses Qt). you need to apply this oneliner before (see Extracting a region from an image using slicing in Python, OpenCV for details):
import cv2
import matplotlib.pyplot as plt
image = cv2.imread("~\\imagedir\\image.jpg")
plt_image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
imgplot = plt.imshow(plt_image)
来源:https://stackoverflow.com/questions/50533775/zooming-functionality-in-opencv-imshow-in-windows