Skip to content

Instantly share code, notes, and snippets.

img_path = outDirPath + 'images/' + imgName
img = cv2.imread(img_path, cv2.IMREAD_COLOR)
'''FIRST VERSION'''
mask = cv2.cvtColor(mask, cv2.COLOR_RGB2GRAY)
dest = cv2.bitwise_and(img, img, mask = mask)
for coordinates in coordinatesList:
coords = coordinates[:len(coordinates)-1]
#ANCIEN
from os import walk
f = []
for (dirpath, dirnames, filenames) in walk(mypath):
f.extend(filenames)
break
try:
os.chdir(datasetPath)
zipf = zipfile.ZipFile('./../pascal_voc_dataset.zip', 'a', zipfile.ZIP_DEFLATED)
zipdir('ImageSets/', zipf)
zipdir('JPEGImages/', zipf)
zipdir('SegmentationClass/', zipf)
zipf.close()
os.chdir('../')
print('[INFO] Archive successfully built.')
except:
base = os.path.basename(imagePath)
fileName = os.path.splitext(base)[0]
os.path.isdir(dataPath)
shutil.copyfile(imagePath, newImgPath)
os.makedirs(datasetPath)
if os.path.isdir(datasetPath):
shutil.rmtree(datasetPath, ignore_errors=True)
if __name__ == "__main__":
with open('somefile.txt', 'a') as the_file:
the_file.write('Hello\n')
import argparse
def manage_args():
parser = argparse.ArgumentParser()
#positional args
parser.add_argument("input_img", help="input image which mask has been computed", type=str)
parser.add_argument("input_mask", help="semantic segmentation mask computed from the input image", type=str)
parser.add_argument("output_dir", help="output directory where the result will be saved", type=str)
'''