当前位置:网站首页>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 :
边栏推荐
- UVA 11080 – Place the Guards(二分图判定)
- Do you have to make money in the account to open an account? Is the fund safe?
- A brief understanding of the in arc__ bridge、__ bridge_ Retained and__ bridge_ transfer
- margin 等高布局
- 恶魔奶爸 B1 听力最后壁垒,一鼓作气突破
- Use br to back up tidb cluster data to azure blob storage
- Devil daddy B1 hearing the last barrier, break through with all his strength
- The new version of onespin 360 DV has been released, refreshing the experience of FPGA formal verification function
- The maximum number of meetings you can attend [greedy + priority queue]
- Reinforcement learning - learning notes 8 | Q-learning
猜你喜欢
MySQL storage expression error
![Restapi version control strategy [eolink translation]](/img/65/decbc158f467ab8c8923c5947af535.png)
Restapi version control strategy [eolink translation]

South China x99 platform chicken blood tutorial

Ad domain group policy management

The new version of onespin 360 DV has been released, refreshing the experience of FPGA formal verification function

ISO 26262 - considerations other than requirements based testing

The little money made by the program ape is a P!

Jenkins user rights management

Using enumeration to realize English to braille

Solve the problem of using uni app mediaerror mediaerror errorcode -5
随机推荐
Contour layout of margin
Mysql子查询关键字的使用方式(exists)
Demon daddy A1 speech listening initial challenge
Datatable data conversion to entity
The difference between NPM uninstall and RM direct deletion
Awk processing JSON processing
openGl超级宝典学习笔记 (1)第一个三角形「建议收藏」
Intelligent software analysis platform embold
现在网上开户安全么?想知道我现在在南宁,到哪里开户比较好?
Deadlock conditions and preventive treatment [easy to understand]
Goal: do not exclude yaml syntax. Try to get started quickly
The little money made by the program ape is a P!
Code of "digital image processing principle and Practice (matlab version)" part2[easy to understand]
Feature generation
Word inversion implements "suggestions collection"
Problems encountered in installing mysql8 for Ubuntu and the detailed installation process
The latest version of codesonar has improved functional security and supports Misra, c++ parsing and visualization
Redis - basic use (key, string, list, set, Zset, hash, geo, bitmap, hyperloglog, transaction)
Ubuntu安装mysql8遇到的问题以及详细安装过程
Debugging and handling the problem of jamming for about 30s during SSH login