windows opencv imshow图片报错解决

python 复制代码
import cv2

# 检查版本
print(cv2.__version__)

# 加载一张图片(确保你有一个名为'test.jpg'的文件在当前目录)
image = cv2.imread('C:\\test1.jpg')

# 显示图片
cv2.imshow('image', image)
cv2.waitKey(0)
cv2.destroyAllWindows()

cv2意思是opencv c++ o(* ̄︶ ̄*)o

建议使用Anaconda

这段代码报错,显示

cv2.imshow('image', image)

cv2.error: OpenCV(4.10.0) D:\a\opencv-python\opencv-python\opencv\modules\highgui\src\window.cpp:1301: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvShowImage'

在你觉得环境配置没问题的情况下,可以尝试以下办法处理下:

卸载 pip uninstall opencv-contrib-python

安装 pip install opencv-contrib-python

相关推荐
23遇见3 分钟前
探索CANN:开源AI计算底座的关键组件与技术思想
人工智能
jl48638218 分钟前
变比测试仪显示屏的“标杆“配置!如何兼顾30000小时寿命与六角矢量图精准显示?
人工智能·经验分享·嵌入式硬件·物联网·人机交互
2301_8187305618 分钟前
transformer(上)
人工智能·深度学习·transformer
木枷25 分钟前
Online Process Reward Learning for Agentic Reinforcement Learning
人工智能·深度学习·机器学习
m0_5637451134 分钟前
误差卡尔曼滤波在VINS-mono中的应用
人工智能·机器学习
恣逍信点1 小时前
《凌微经 · 理悖相涵》第六章 理悖相涵——关系构型之模因
人工智能·科技·程序人生·生活·交友·哲学
晚霞的不甘1 小时前
Flutter for OpenHarmony 可视化教学:A* 寻路算法的交互式演示
人工智能·算法·flutter·架构·开源·音视频
小程故事多_801 小时前
Agent Infra核心技术解析:Sandbox sandbox技术原理、选型逻辑与主流方案全景
java·开发语言·人工智能·aigc
陈天伟教授1 小时前
人工智能应用- 语言处理:02.机器翻译:规则方法
人工智能·深度学习·神经网络·语言模型·自然语言处理·机器翻译
Dfreedom.1 小时前
图像直方图完全解析:从原理到实战应用
图像处理·python·opencv·直方图·直方图均衡化