当前位置:网站首页>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 :
边栏推荐
- 恶魔奶爸 B3 少量泛读,完成两万词汇量+
- Is it safe to open an account online now? I want to know where I can open an account in Nanning now?
- uva 12230 – Crossing Rivers(概率)「建议收藏」
- Codeforces round 275 (Div. 2) C – diverse permutation (construction) [easy to understand]
- Use camunda to do workflow design and reject operations
- Use br to back up tidb cluster data to azure blob storage
- easyui 日期控件清空值
- [C language] advanced pointer --- do you really understand pointer?
- 国家正规的股票交易app有哪些?使用安不安全
- What stocks can a new account holder buy? Is the stock trading account safe
猜你喜欢
Debugging and handling the problem of jamming for about 30s during SSH login
Ten thousand word summary data storage, three knowledge points
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
Demon daddy B3 read extensively in a small amount, and completed 20000 vocabulary+
Magic weapon - sensitive file discovery tool
ISO 26262 - considerations other than requirements based testing
Dry goods sharing | devaxpress v22.1 original help document download collection
SQL injection error report injection function graphic explanation
恶魔奶爸 B3 少量泛读,完成两万词汇量+
MySQL storage expression error
随机推荐
A brief understanding of the in arc__ bridge、__ bridge_ Retained and__ bridge_ transfer
How to meet the dual needs of security and confidentiality of medical devices?
Is it safe to open an account of BOC shares in kainiu in 2022?
object-c编程tips-timer「建议收藏」
[200 opencv routines] 223 Polygon fitting for feature extraction (cv.approxpolydp)
Backup tidb cluster to persistent volume
Codeforces round 296 (Div. 2) A. playing with paper[easy to understand]
部署、收回和删除解决方式—-STSADM和PowerShell「建议收藏」
Problems encountered in installing mysql8 for Ubuntu and the detailed installation process
Is private equity legal in China? Is it safe?
How much does it cost to develop a small program mall?
Restore backup data on persistent volumes
Develop those things: go plus c.free to free memory, and what are the reasons for compilation errors?
Can Huatai Securities achieve Commission in case of any accident? Is it safe to open an account
[function recursion] do you know all five classic examples of simple recursion?
UVA 11080 – place the guards
uva 12230 – Crossing Rivers(概率)「建议收藏」
恶魔奶爸 A3阶段 近常速语流初接触
Feature generation
Addition, deletion, modification and query of sqlhelper