当前位置:网站首页>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 :
边栏推荐
- An overview of the latest research progress of "efficient deep segmentation of labels" at Shanghai Jiaotong University, which comprehensively expounds the deep segmentation methods of unsupervised, ro
- What is the reason for the abnormal flow consumption of 4G devices accessing the easygbs platform?
- MinGW MinGW-w64 TDM-GCC等工具链之间的差别与联系「建议收藏」
- Focusing on safety in 1995, Volvo will focus on safety in the field of intelligent driving and electrification in the future
- The latest version of codesonar has improved functional security and supports Misra, c++ parsing and visualization
- Cocos2d-x 游戏存档[通俗易懂]
- A brief understanding of the in arc__ bridge、__ bridge_ Retained and__ bridge_ transfer
- MySQL storage expression error
- 恶魔奶爸 B1 听力最后壁垒,一鼓作气突破
- Problems encountered in installing mysql8 for Ubuntu and the detailed installation process
猜你喜欢

2022 how to evaluate and select low code development platforms?

使用枚举实现英文转盲文

Codesonar Webinar
![Restapi version control strategy [eolink translation]](/img/65/decbc158f467ab8c8923c5947af535.png)
Restapi version control strategy [eolink translation]
SQL注入报错注入函数图文详解
Lex & yacc of Pisa proxy SQL parsing

Virtual machine network configuration in VMWare

How to meet the dual needs of security and confidentiality of medical devices?

解决使用uni-app MediaError MediaError ErrorCode -5

Implement secondary index with Gaussian redis
随机推荐
sqlHelper的增删改查
Details of C language integer and floating-point data storage in memory (including details of original code, inverse code, complement, size end storage, etc.)
Default constraint and zero fill constraint of MySQL constraint
Use camunda to do workflow design and reject operations
npm uninstall和rm直接删除的区别
How to meet the dual needs of security and confidentiality of medical devices?
权限不足
开户还得用身份证银行卡安全吗,我是小白不懂
Devil daddy B1 hearing the last barrier, break through with all his strength
FatMouse' Trade (Hangdian 1009)
Intelligent transportation is full of vitality. What will happen in the future? [easy to understand]
Demon daddy A3 stage near normal speed speech flow initial contact
[UVALive 6663 Count the Regions] (dfs + 离散化)[通俗易懂]
HOJ 2245 浮游三角胞(数学啊 )
[200 opencv routines] 223 Polygon fitting for feature extraction (cv.approxpolydp)
How much does it cost to develop a small program mall?
浅解ARC中的 __bridge、__bridge_retained和__bridge_transfer
Redis - basic use (key, string, list, set, Zset, hash, geo, bitmap, hyperloglog, transaction)
POJ 3140 contents division "suggestions collection"
How to meet the dual needs of security and confidentiality of medical devices?