title: Cannot fix error: OpenCV(4.1.2) esize.cpp:3720: error: (-215:Assertion failed) !ssize.empty() in function 'resize'
body: <p>I am trying to replicate this code from a <a href="https://github.com/busyyang/COVID-19/blob/master/preprocessing.ipynb" rel="nofollow noreferrer">repository of COVIDNet in Keras</a>.</p>
  <p>I fully ran the first notebook in the repo, but in the second one, I get an error.</p>
  <pre><code>import cv2
  import numpy as np
  import matplotlib.pyplot as plt
  import os
  
  # Set parameters here 
  INPUT_SIZE = (224, 224)
  mapping = {'normal': 0, 'bacteria': 1, 'viral': 2, 'COVID-19': 3}
  train_filepath = 'train_split.txt'
  test_filepath = 'test_split.txt'
  
  # load in the train and test files
  file = open(train_filepath, 'r') 
  trainfiles = file.readlines() 
  file = open(test_filepath, 'r')
  testfiles = file.readlines()
  
  # Print
  print('Total samples for train: ', len(trainfiles))
  print('Total samples for test: ', len(testfiles))
  
  Total samples for train:  72696
  Total samples for test:  6255
  
  # resize to input size and normalize to 0 - 1
  x_train = []
  x_test = []
  y_train = []
  y_test = []
  
  for i in range(len(testfiles)):
      test_i = testfiles[i].split()
      imgpath = test_i[1]
      img = cv2.imread(os.path.join('data', 'test', imgpath))
      img = cv2.resize(img, INPUT_SIZE) # resize
      img = img.astype('float32') / 255.0
      x_test.append(img)
      y_test.append(mapping[test_i[2]])
  
  print('Shape of test images: ', x_test[0].shape)
  
  for i in range(len(trainfiles)):
  train_i = trainfiles[i].split()
  imgpath = train_i[1]
  img = cv2.imread(os.path.join('data', 'train', imgpath))
  img = cv2.resize(img, INPUT_SIZE) # resize
  img = img.astype('float32') / 255.0
  x_train.append(img)
  y_train.append(mapping[train_i[2]])
  
  print('Shape of train images: ', x_train[0].shape)
  </code></pre>
  <p>Error:</p>
  <pre><code>error                                     Traceback (most recent call last)
  &lt;ipython-input-31-5fa13deb65a6&gt; in &lt;module&gt;()
   10     imgpath = test_i[1]
   11     img = cv2.imread(os.path.join('data', 'test', imgpath))
  ---&gt; 12     img = cv2.resize(img, INPUT_SIZE) # resize
   13     img = img.astype('float32') / 255.0
   14     x_test.append(img)
  </code></pre>
  <p>There are multiple questions about similar errors, but I do not see how to fix it. Thanks!</p>