Skip to content

Commit

Permalink
using mkstemp
Browse files Browse the repository at this point in the history
  • Loading branch information
samkit-jain committed Apr 30, 2019
1 parent accd457 commit 1e6b399
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Python/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def idx_to_image(self, image_file: str, label_file: str, label_mapping: Dict[str
# save images to data directory
for label, image in zip(labels, images):
label_folder = osp.abspath(osp.join(self.data_dir_path, label))
image_dest = tempfile.mktemp(dir=label_folder, suffix='.png')
image_dest = tempfile.mkstemp(dir=label_folder, suffix='.png')

cv2.imwrite(f'{image_dest}', image.T)

Expand Down
2 changes: 1 addition & 1 deletion Python/drawer.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def get_contours(self):
main_image = cv2.GaussianBlur(src=main_image, ksize=(5, 5), sigmaX=0)

# threshold the image
ret, main_image = cv2.threshold(src=main_image, thresh=127, maxval=255, type=cv2.THRESH_BINARY)
_, main_image = cv2.threshold(src=main_image, thresh=127, maxval=255, type=cv2.THRESH_BINARY)

# find contours in the image
contours, _ = cv2.findContours(image=main_image.copy(), mode=cv2.RETR_EXTERNAL, method=cv2.CHAIN_APPROX_SIMPLE)
Expand Down

0 comments on commit 1e6b399

Please sign in to comment.