title: Python Read multiple images from multiple folders
body: <p>I want to read multiple .jpg images, that are in 3 separate folders. The 3 folders are on the same path. I tried to do it like this: </p>
  
  <pre><code>path1 = os.path.abspath('Type_1')
  path2 = os.path.abspath('Type_2')
  path3 = os.path.abspath('Type_3')
  folder = os.path.join(path1, path2, path3)
  
  def load_images_from_folder(folder):
      images = []
      for filename in os.listdir(folder):
          if filename.endswith(".jpg"):
              img = cv2.imread(os.path.join(folder, filename))
              if img is not None:
                  images.append(img)
              return images
  
  print(load_images_from_folder(folder))
  </code></pre>
  
  <p>But it only returns the last path and not all of them. I also tried to use relative paths, such as:</p>
  
  <pre><code>path1 = os.path.relpath('Type_1')
  path2 = os.path.relpath('Type_2')
  path3 = os.path.relpath('Type_3')
  folder = os.path.join(os.path.sep, path1, path2, path3)
  </code></pre>
  
  <p>but still the same problem. Can someone help with this?</p>