# Error: (-215:Assertion failed) !ssize.empty() in function 'cv::resize'

**URL:** <https://forum.opencv.org/t/error-215-assertion-failed-ssize-empty-in-function-cv-resize/14235>\
**Category:** Python\
**Tags:** programming\
**Created:** [August 13, 2023, 2:21pm UTC](https://forum.opencv.org/t/error-215-assertion-failed-ssize-empty-in-function-cv-resize/14235 "2023-08-13T14:21:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abdul\_Rahmaan](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/abdul_rahmaan/32/8527_2.png) [@Abdul\_Rahmaan](https://forum.opencv.org/u/Abdul_Rahmaan)\
**Post date:** [August 13, 2023, 2:21pm UTC](https://forum.opencv.org/t/error-215-assertion-failed-ssize-empty-in-function-cv-resize/14235/1 "2023-08-13T14:21:54Z")

</div>

import matplotlib.pyplot as plt  
import numpy as np  
import cv2  
import os  
import PIL  
import tensorflow as tf

from tensorflow import keras  
from tensorflow.keras import layers  
from tensorflow.keras.models import Sequential

dataset\_url = “[https://storage.googleapis.com/download.tensorflow.org/example\_images/flower\_photos.tgz](https://storage.googleapis.com/download.tensorflow.org/example_images/flower_photos.tgz)”  
data\_dir = tf.keras.utils.get\_file(‘flower\_photos’, origin=dataset\_url, cache\_dir=‘.’, untar = True)

import pathlib  
data\_dir = pathlib.Path(data\_dir)  
data\_dir

flowers\_images\_dict = {  
‘roses’: list(data\_dir.glob(r’roses/_')),  
‘daisy’: list(data\_dir.glob(r’daisy/_‘)),  
‘dandelion’: list(data\_dir.glob(r’dandelion/_')),  
‘sunflowers’: list(data\_dir.glob(r’sunflowers/_’)),  
‘tulips’: list(data\_dir.glob(r’tulips/\*')),  
}

flowers\_labels\_dict = {  
‘roses’: 0,  
‘daisy’: 1,  
‘dandelion’: 2,  
‘sunflowers’: 3,  
‘tulips’: 4,  
}

X, y = ,

for flower\_name, images in flowers\_images\_dict.items():  
for image in images:  
img = cv2.imread(str(image))  
resized\_img = cv2.resize(img,(180,180))  
X.append(resized\_img)  
y.append(flowers\_labels\_dict[flower\_name])

 ![Screenshot 2023-08-13 181954](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/7/7f98fe4ee466c17667f650010bcaf9771fe35fd0.png)

---

<div class="post-metadata">

**Author:** ![Abdul\_Rahmaan](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/abdul_rahmaan/32/8527_2.png) [@Abdul\_Rahmaan](https://forum.opencv.org/u/Abdul_Rahmaan)\
**Post date:** [August 13, 2023, 2:22pm UTC](https://forum.opencv.org/t/error-215-assertion-failed-ssize-empty-in-function-cv-resize/14235/2 "2023-08-13T14:22:43Z")

</div>

This is what my path looks like

 ![WhatsApp Image 2023-08-13 at 17.35.19](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/c/ce6ba38cbf31f4bee535c243076e6855003b2a61.jpeg)

---

<div class="post-metadata">

**Author:** ![Abdul\_Rahmaan](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/abdul_rahmaan/32/8527_2.png) [@Abdul\_Rahmaan](https://forum.opencv.org/u/Abdul_Rahmaan)\
**Post date:** [August 13, 2023, 2:23pm UTC](https://forum.opencv.org/t/error-215-assertion-failed-ssize-empty-in-function-cv-resize/14235/3 "2023-08-13T14:23:42Z")

</div>

I am able to open the image

 ![Screenshot 2023-08-13 182303](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/6/699079b3f0221ec826c24ce25debd06b3ab38ad4.jpeg)

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [August 13, 2023, 2:23pm UTC](https://forum.opencv.org/t/error-215-assertion-failed-ssize-empty-in-function-cv-resize/14235/4 "2023-08-13T14:23:55Z")

</div>

please , no further useless screenshots

your image was not read. go and debug it.
