Skip to content

Instantly share code, notes, and snippets.

@tanviredu
Created August 2, 2020 14:02
Show Gist options
  • Save tanviredu/2d122948d616da9292a75673fd47bfa3 to your computer and use it in GitHub Desktop.
Save tanviredu/2d122948d616da9292a75673fd47bfa3 to your computer and use it in GitHub Desktop.
#### load partial images
import cv2
import os
#### this function will import the data from the folder
def load__partial_images_from_folder(folder,target):
images = []
for filename in os.listdir(folder):
img = cv2.imread(os.path.join(folder,filename),0)
ret2,th2 = cv2.threshold(img,0,255,cv2.THRESH_BINARY+cv2.THRESH_OTSU)
if img is not None:
images.append([th2,target])
return images
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment