当前位置:网站首页>错误解决:Clipping input data to the valid range for imshow with RGB data ([0..1] for floats or [0..255]
错误解决:Clipping input data to the valid range for imshow with RGB data ([0..1] for floats or [0..255]
2022-07-29 20:16:00 【旅途中的宽~】
今天又是快乐改错误的经历:
在做k-means进行图片压缩的实战项目中,我遇到了这样一个pyplot显示图像报错问题:Clipping input data to the valid range for imshow with RGB data ([0..1] for floats or [0..255] for i
错误的原因
1. matplotlib.pyplot.imshow()函数在处理灰度图像时,自动将其值做归一化处理
2. 而在处理彩色图像时则不会,而是将浮点值变换至[0,1],整数值变换到[0, 255]范围
因为使用的是彩色的照片,所以我们需要对数据集进行归一化处理:
A=(A-mean(A))/std(A)
但是这样还是会出现这样的警告,并且生成的图像严重不符合要求。因为我们上面的方法是讲浮点数变换到【-1,1】
正确的解决方法
A=A/255.
这样错误消灭!
边栏推荐
- 如何进入董事会:给CIO的十条建议
- Safe Browser will have these hidden features that will let you play around with your browser
- 单壁碳纳米管-DNA复合物(SWCNT-DNA)|作用机理
- JSP Servlet JDBC MySQL CRUD Sample Tutorial
- siRNA-S-S-PEG-LMWP|M-MSN-siRNA介孔二氧化硅修饰RNA(齐岳RNA功能化修饰)
- 海量数据查询方案mysql_Mysql海量数据存储和解决方案之二—-Mysql分表查询海量数据…[通俗易懂]
- 单核浏览器和双核浏览器有什么区别,哪个好用?
- Omni-channel e-commerce | How can well-known domestic cosmeceuticals seize the opportunity to achieve rapid growth?
- [Mathematical Foundation] Learning about concepts related to linear algebra
- ds1302——斌哥51
猜你喜欢

使用IDEA连接mysql

Omni-channel e-commerce | How can well-known domestic cosmeceuticals seize the opportunity to achieve rapid growth?

leetcode:952. 按公因数计算最大组件大小【并查集】
![[GXYCTF2019]禁止套娃](/img/91/3f64bebd13a8b13fbb387c2acf8618.png)
[GXYCTF2019]禁止套娃

JUC Concurrent Programming Basics AQS

Verilog的时间格式系统任务----$printtimescale、$timeformat

正则表达式

单核浏览器和双核浏览器有什么区别,哪个好用?

JMeter使用教程(二)

Detailed explanation of design ideas of webUI test framework
随机推荐
Chrome——插件推荐
华为笔记本键盘锁住了(笔记本电脑键盘怎么亮起来)
JMeter使用教程(二)
RNA修饰技术介绍|介孔二氧化硅纳米颗粒(MSN)搭载的微小RNA-24(miR-24)纳米载体复合物
LeetCode_474_ one and zero
regular expression
include用法及搭配(include相关短语)
Verilog的时间格式系统任务----$printtimescale、$timeformat
聚丙烯微孔膜的等离子体改性及DNA|有机自由基改性DNA-阳离子脂质复合体的应用
ds1302——斌哥51
ESP8266-Arduino programming example-I2C device address scan
Kubernetes: (4) Common commands
优惠券系统设计思想
进程间六种通信方式
朴素贝叶斯“朴素”在哪里?
软件开发模式有哪些(软件工程开发模式)
mysql 获取字段注释 和获取表字段
常用电源符号含义分享
C语言学习书籍(提高篇)
手写dialog弹框