Zooming functionality in OpenCV imshow in Windows

眉间皱痕 提交于 2020-01-22 02:52:06

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!