当前位置:网站首页>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-07 21:37: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 :
边栏推荐
- Codeforces Round #275 (Div. 2) C – Diverse Permutation (构造)[通俗易懂]
- 95年专注安全这一件事 沃尔沃未来聚焦智能驾驶与电气化领域安全
- A brief understanding of the in arc__ bridge、__ bridge_ Retained and__ bridge_ transfer
- L2:ZK-Rollup的现状,前景和痛点
- MySQL storage expression error
- 恶魔奶爸 A1 语音听力初挑战
- Navicat connect 2002 - can't connect to local MySQL server through socket '/var/lib/mysql/mysql Sock 'solve
- uva 12230 – Crossing Rivers(概率)「建议收藏」
- 201215-03-19 - cocos2dx memory management - specific explanation "recommended collection"
- Reinforcement learning - learning notes 8 | Q-learning
猜你喜欢

Using enumeration to realize English to braille

Implement secondary index with Gaussian redis

Focusing on safety in 1995, Volvo will focus on safety in the field of intelligent driving and electrification in the future

L2:ZK-Rollup的现状,前景和痛点
![[C language] advanced pointer --- do you really understand pointer?](/img/ee/79c0646d4f1bfda9543345b9da0f25.png)
[C language] advanced pointer --- do you really understand pointer?

Automatic classification of defective photovoltaic module cells in electronic images

Debugging and handling the problem of jamming for about 30s during SSH login

Validutil, "Rethinking the setting of semi supervised learning on graphs"

Onespin | solve the problems of hardware Trojan horse and security trust in IC Design

Jenkins user rights management
随机推荐
How to meet the dual needs of security and confidentiality of medical devices?
[uvalive 6663 count the regions] (DFS + discretization) [easy to understand]
刚开户的能买什么股票呢?炒股账户安全吗
Demon daddy B3 read extensively in a small amount, and completed 20000 vocabulary+
Devil daddy B1 hearing the last barrier, break through with all his strength
Tupu digital twin coal mining system to create "hard power" of coal mining
华泰证券可以做到万一佣金吗,万一开户安全嘛
UVA 11080 – Place the Guards(二分图判定)
Redis - basic use (key, string, list, set, Zset, hash, geo, bitmap, hyperloglog, transaction)
Jetty: configure connector [easy to understand]
Mysql子查询关键字的使用方式(exists)
Numerical method for solving optimal control problem (0) -- Definition
NVR硬盘录像机通过国标GB28181协议接入EasyCVR,设备通道信息不显示是什么原因?
死锁的产生条件和预防处理[通俗易懂]
Implementation of mahout Pearson correlation
What stocks can a new account holder buy? Is the stock trading account safe
Unity3d 4.3.4f1执行项目
[matrix multiplication] [noi 2012] [cogs963] random number generator
Jetty:配置连接器[通俗易懂]
现在网上开户安全么?想知道我现在在南宁,到哪里开户比较好?