当前位置:网站首页>Cv2.resize function reports an error: error: (-215:assertion failed) func= 0 in function ‘cv::hal::resize‘
Cv2.resize function reports an error: error: (-215:assertion failed) func= 0 in function ‘cv::hal::resize‘
2022-07-25 13:07:00 【1 + 1= Wang】
List of articles
Report errors
In the use of cv2.resize() The following error was encountered when resizing the picture .
img_array = cv2.resize(img_array,(1024,1024))
cv2.error: OpenCV(4.5.2) C:\Users\runneradmin\AppData\Local\Temp\pip-req-build-1bq9o88m\opencv\modules\imgproc\src\resize.cpp:3929: error: (-215:Assertion failed) func != 0 in function ‘cv::hal::resize’
Error code
The error code is as follows :
img = Image.open(r'E:\workspace\PyCharmProject\dem_feature\dem\512\label\1.png')
img_array = np.array(img).astype("int32")
print(img_array.shape)
img_array = cv2.resize(img_array,(1024,1024))
print(img_array)
print(img_array.shape)
solve
The reason is that the read image is converted into numpy array It is defined as “int32” type , and cv2.resize Function parameters must be floating point , Therefore, the solution is as follows :
img = Image.open(r'E:\workspace\PyCharmProject\dem_feature\dem\512\label\1.png')
img_array = np.array(img).astype("float")
print(img_array.shape)
img_array = cv2.resize(img_array,(1024,1024))
print(img_array)
print(img_array.shape)
That is, first convert the image array to floating point , It's going on resize Handle .
View printouts :
边栏推荐
- 如何理解Keras中的指标Metrics
- Use of Spirng @conditional conditional conditional annotation
- ECCV 2022 | climb to the top semantickitti! Semantic segmentation of LIDAR point cloud based on two-dimensional prior assistance
- 【CSDN 年终总结】结束与开始,一直在路上—— “1+1=王”的2021总结
- 力扣 83双周赛T4 6131.不可能得到的最短骰子序列、303 周赛T4 6127.优质数对的数目
- Shell常用脚本:判断远程主机的文件是否存在
- Moving Chinese figure liushenglan
- 网络空间安全 渗透攻防9(PKI)
- Oran special series-21: major players (equipment manufacturers) and their respective attitudes and areas of expertise
- [today in history] July 25: IBM obtained the first patent; Verizon acquires Yahoo; Amazon releases fire phone
猜你喜欢

【运维、实施精品】月薪10k+的技术岗位面试技巧

基于JEECG制作一个通用的级联字典选择控件-DictCascadeUniversal

【问题解决】ibatis.binding.BindingException: Type interface xxDao is not known to the MapperRegistry.

Chapter5 : Deep Learning and Computational Chemistry

网络空间安全 渗透攻防9(PKI)

【问题解决】org.apache.ibatis.exceptions.PersistenceException: Error building SqlSession.1 字节的 UTF-8 序列的字

Shell common script: check whether a domain name and IP address are connected

Cyberspace Security penetration attack and defense 9 (PKI)

艰辛的旅程

The larger the convolution kernel, the stronger the performance? An interpretation of replknet model
随机推荐
Shell common script: check whether a domain name and IP address are connected
Force deduction 83 biweekly T4 6131. The shortest dice sequence impossible to get, 303 weeks T4 6127. The number of high-quality pairs
G027-OP-INS-RHEL-04 RedHat OpenStack 创建自定义的QCOW2格式镜像
Summary of Niuke forum project deployment
交换机链路聚合详解【华为eNSP】
B树和B+树
外围系统调用SAP的WebAPI接口
Connotation and application of industrial Internet
JS sorts according to the attributes of the elements in the array
Selenium use -- installation and testing
ECCV 2022 | 登顶SemanticKITTI!基于二维先验辅助的激光雷达点云语义分割
Shell常用脚本:获取网卡IP地址
吕蒙正《破窑赋》
Shell常用脚本:判断远程主机的文件是否存在
B tree and b+ tree
"Wei Lai Cup" 2022 Niuke summer multi school training camp 2 supplementary problem solution (g, J, K, l)
Deployment of Apache website services and implementation of access control
Shell常用脚本:检测某域名、IP地址是否通
零基础学习CANoe Panel(14)——二极管( LED Control )和液晶屏(LCD Control)
【视频】马尔可夫链原理可视化解释与R语言区制转换MRS实例|数据分享