Skip to content
Snippets Groups Projects
Commit 731c5e4f authored by ssibirtsev's avatar ssibirtsev
Browse files

Update process_automated_droplet.py

parent 6182c2f6
No related branches found
No related tags found
No related merge requests found
......@@ -289,6 +289,7 @@ images_mean_pixel = []
images_path = glob.glob(DATASET_DIR + "/*.jpg")
for img_path in images_path:
img = cv2.imread(img_path)
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
if CONTRAST == 1:
# adaptive Equalization
img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
......@@ -583,8 +584,6 @@ def pre_processing(image, crop=None, size_y=1024, size_x=1024, contrast=0):
# contrast stretching
p2, p98 = np.percentile(image, (2, 98))
image = exposure.rescale_intensity(image, in_range=(p2, p98))
if CONTRAST != 0:
image = cv2.cvtColor(image, cv2.COLOR_GRAY2BGR)
return image
......@@ -598,6 +597,7 @@ counter_1 = SAVE_NTH_IMAGE
for filename in os.listdir(DATASET_DIR):
if not filename.endswith('.json'):
image = cv2.imread(os.path.join(DATASET_DIR, filename))
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
# pre process image
if IMAGE_CROP or CONTRAST != 0:
image = pre_processing(image, crop=IMAGE_CROP, contrast=CONTRAST)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment