当前位置:网站首页>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 :
边栏推荐
- 恶魔奶爸 A1 语音听力初挑战
- The maximum number of meetings you can attend [greedy + priority queue]
- AADL inspector fault tree safety analysis module
- The difference between NPM uninstall and RM direct deletion
- Implementation of mahout Pearson correlation
- Arlo's troubles
- 2022 how to evaluate and select low code development platforms?
- 私募基金在中國合法嗎?安全嗎?
- Use br to back up tidb cluster data to azure blob storage
- UVA 11080 – Place the Guards(二分图判定)
猜你喜欢
ISO 26262 - considerations other than requirements based testing
Virtual machine network configuration in VMWare
C language helps you understand pointers from multiple perspectives (1. Character pointers 2. Array pointers and pointer arrays, array parameter passing and pointer parameter passing 3. Function point
Solve the problem of using uni app mediaerror mediaerror errorcode -5
Navicat connect 2002 - can't connect to local MySQL server through socket '/var/lib/mysql/mysql Sock 'solve
Details of C language integer and floating-point data storage in memory (including details of original code, inverse code, complement, size end storage, etc.)
Helix QAC 2020.2 new static test tool maximizes the coverage of standard compliance
Google SEO external chain backlinks research tool recommendation
Lex & yacc of Pisa proxy SQL parsing
使用枚举实现英文转盲文
随机推荐
npm uninstall和rm直接删除的区别
Intelligent software analysis platform embold
[200 opencv routines] 223 Polygon fitting for feature extraction (cv.approxpolydp)
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]
权限不足
恶魔奶爸 A1 语音听力初挑战
How to meet the dual needs of security and confidentiality of medical devices?
Backup tidb cluster to persistent volume
The new version of onespin 360 DV has been released, refreshing the experience of FPGA formal verification function
Jetty: configure connector [easy to understand]
UVA 11080 – place the guards
Unity3d 4.3.4f1 execution project
A brief understanding of the in arc__ bridge、__ bridge_ Retained and__ bridge_ transfer
FatMouse' Trade (Hangdian 1009)
Take the intersection of two sets
The latest version of codesonar has improved functional security and supports Misra, c++ parsing and visualization
Can Huatai Securities achieve Commission in case of any accident? Is it safe to open an account
Solve the problem of using uni app mediaerror mediaerror errorcode -5
2022年在启牛开中银股票的账户安全吗?