当前位置:网站首页>错误解决: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.
这样错误消灭!
边栏推荐
- C语言学习书籍 零基础入门篇
- JS实现百叶窗特效
- Unity判断字符串是否可以转为float类型
- 七个易犯的 IT 管理错误—以及如何避免
- MSNs-SS-siRNA二氧化硅-二硫键-核酸RNA|HA-SS-siRNA,hyaluronic acid透明质酸修饰RNA(RNA修饰剂)
- 单核浏览器和双核浏览器有什么区别,哪个好用?
- [mathematical foundation] probability and mathematical statistics related concept learning
- [GXYCTF2019] ban dolls
- mos管闩锁效应理解学习
- R language for airbnb data nlp text mining, geography, word cloud visualization, regression GAM model, cross-validation analysis
猜你喜欢

Hyaluronic acid-siRNA透明质酸修饰核糖核酸|peptide–siRNA 多肽偶连RNA/DNA核酸(齐岳PNA修饰物)

Thesis writing strategy | how to write an academic research paper

C language learning books (improvement)

JMeter使用教程(一)

MSNs-SS-siRNA二氧化硅-二硫键-核酸RNA|HA-SS-siRNA,hyaluronic acid透明质酸修饰RNA(RNA修饰剂)

EasyExce template filling generation of Excel of actual operation, many processing sheet page

分布式限流 redission RRateLimiter 的使用及原理

Single-core browser and what is the difference between dual-core browser, which to use?

Kubernetes:(四)常用命令

LOG4J Learning
随机推荐
C language learning books zero-based introductory articles
The difference between uri and url is simple to understand (what is the difference between uri and url)
JUC Concurrent Programming Basics AQS
Expert advice | How to formulate a growth strategy for survival in an economic downturn
聚丙烯微孔膜的等离子体改性及DNA|有机自由基改性DNA-阳离子脂质复合体的应用
探索创客教育在线管理实施体系
回归——岭回归
用对象字面量或Map替代Switch/if语句
R language for airbnb data nlp text mining, geography, word cloud visualization, regression GAM model, cross-validation analysis
PEG-siRNA-PCL|siRNA-PEG-LHRH|MPEG-siRNA 甲氧基聚乙二醇修饰核酸
The difference between analog, digital and switching
include用法及搭配(include相关短语)
JMeter tutorial (a)
Chrome - Plugin Recommendations
MSNs-SS-siRNA二氧化硅-二硫键-核酸RNA|HA-SS-siRNA,hyaluronic acid透明质酸修饰RNA(RNA修饰剂)
scratch programming + elementary math
优惠券系统设计思想
Experience Sharing | Tips for Writing Easy-to-Use Online Product Manuals
JMeter usage tutorial (2)
Verilog的时间格式系统任务----$printtimescale、$timeformat