使用 Opencv 打开高分辨率图像 [英] Open high resolution images with Opencv

查看:73
本文介绍了使用 Opencv 打开高分辨率图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法使用 opencv 在 Python 上打开 24MP 图片.它显然只打开左上部分,而不是完整图像.运行代码后内核也会停止.

I can't open a 24MP pictures on Python with opencv. It only opens the upper left part apparently and not the full image. The kernel also stops after running the code.

这是我的代码:导入 cv2将 numpy 导入为 np

Here's my code: import cv2 import numpy as np

PICTURE_PATH_NAME = "IMG.JPG"
img = cv2.imread(PICTURE_PATH_NAME)
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

cv2.imshow("Gray Image", gray)
cv2.waitKey(0)

推荐答案

https://docs.opencv.org/4.1.1/d7/dfc/group__highgui.html4cb60e5723281a89973ee563"

See the documentation for imshow as to how to get it to scale your image to fit the window at https://docs.opencv.org/4.1.1/d7/dfc/group__highgui.html#ga453d42fe4cb60e5723281a89973ee563

"如果您需要显示比屏幕大的图像分辨率,您需要调用 namedWindow("", WINDOW_NORMAL)在 imshow 之前."

"If you need to show an image that is bigger than the screen resolution, you will need to call namedWindow("", WINDOW_NORMAL) before the imshow."

这篇关于使用 Opencv 打开高分辨率图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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