OpenCV-Fehler: (-215:Assertion fehlgeschlagen) inv_scale_x > 0 in Funktion „cv::resize“Python

Python-Programme
Guest
 OpenCV-Fehler: (-215:Assertion fehlgeschlagen) inv_scale_x > 0 in Funktion „cv::resize“

Post by Guest »

Code: Select all

import numpy as np
import cv2

img = cv2.imread(r"C:\Users\User\Documents\sypder\try\bird.jpg", cv2.IMREAD_UNCHANGED)
print('Original Dimension:',img.shape)

scale_percentage = 30
width = int(img.shape[0] * scale_percentage/100)
height = int(img.shape[0] * scale_percentage/100)
dim = (width,height)
resized = cv2.resize(img,dim,interpolation = cv2.INTER_AREA)
print('Resized image',resized.shape)

cv2.imwrite('resized.jpg',resized)
cv2.imshow("Resized image",resized)

cv2.waitKey(0)
error:ile „C:/Users/User/Documents/sypder/try/resize.py“, Zeile 18, in
resized = cv2.resize( img,dim,interpolation = cv2.INTER_AREA)
Fehler: OpenCV(4.5.5) D:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\resize.cpp:4055: Fehler: (-215:Assertion fehlgeschlagen) inv_scale_x > 0 in Funktion 'cv::resize'

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post