Windows中OpenCV imshow中的缩放功能 [英] Zooming functionality in OpenCV imshow in Windows

查看:1272
本文介绍了Windows中OpenCV imshow中的缩放功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Ubuntu中,OpenCV的imshow函数具有一个窗口,其中提供了不同的选项,例如放大,缩小,平移窗口等,

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:

但是,在Windows中,这些功能不存在.在特殊情况下,我需要在Windows上部署OpenCV代码,而用户则需要放大图像的一部分.

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.

在Windows中也可以访问/添加这些功能吗?

Is there any way to access/add these functionalities in Windows also?

推荐答案

请参见 https://gist. github.com/BartG95/1ce8ba1e9c25ec3698d1

似乎是一个较长的过程,因此您可以改用matplotlib的pyplot函数(使用Qt).您需要先应用此oneliner(请参见

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)

这篇关于Windows中OpenCV imshow中的缩放功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆