Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/data_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ def store_data(filenames, input_path, output_path):
print(error_message)

def main():
if not os.path.exists(sys.argv[1]):
raise ValueError("The image files doesn't Exists. Please review your file path")
dir = sys.argv[1]
input_filepaths = get_file_names(dir)
output_filepath = sys.argv[2]
Expand Down
4 changes: 3 additions & 1 deletion src/image_alignment.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import sys

import os.path
import cv2
import numpy as np
import image_shapes as shapes
Expand Down Expand Up @@ -90,6 +90,8 @@ def align_images(petal_img, vein_img, raw_vein=True):
def main():
if (len(sys.argv) < 3):
raise ValueError("Usage: image_alignment.py <petal image> <vein image>")
if not (os.path.exists(sys.argv[1]) and os.path.exists(sys.argv[2])):
raise ValueError("One of the image files doesn't Exists. Please review your file paths \n Usage: image.alignment.py <correct image path> <correct image path>")
petal_image = cv2.imread(sys.argv[1])
vein_image = cv2.imread(sys.argv[2], cv2.IMREAD_GRAYSCALE)
(petal_shape, vein_aligned) = align_images(petal_image, vein_image)
Expand Down
3 changes: 3 additions & 0 deletions src/imgrab.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import principal_component as p
import sys
import os.path
import cv2
from skimage import io


def main():
if not os.path.exists(sys.argv[1]):
raise ValueError("The image files doesn't Exists. Please review your file path")
image = cv2.imread(sys.argv[1])
im = vein_image = cv2.imread(sys.argv[1], cv2.IMREAD_GRAYSCALE)
i = p.pca_to_grey(image)
Expand Down
5 changes: 4 additions & 1 deletion src/principal_component.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import sys
import cv2
import os.path
import matplotlib.pyplot as plt
import numpy as np
import image_shapes as shapes
Expand Down Expand Up @@ -59,11 +60,13 @@ def create_point_cloud(image):
if len(sys.argv) < 2:
print("Standalone usage: python principal_component.py input_filename.jpg [output_filename.jpg]")
sys.exit(1)
if not os.path.exists(sys.argv[1]):
raise ValueError("One of the image files doesn't Exists. Please review your file paths")
petal_image = cv2.imread(sys.argv[1])
petal_shape = shapes.get_petal_shape(petal_image)
result = pca_to_grey(petal_image, petal_shape, True)
if len(sys.argv) > 2:
cv2.imwrite(sys.argv[2], result)
else:
io.imshow(result)
io.show()
io.show()
4 changes: 3 additions & 1 deletion src/spot_detection.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import sys

import os.path
import matplotlib.pyplot as plt
import numpy as np
from sklearn.mixture import BayesianGaussianMixture
Expand Down Expand Up @@ -56,6 +56,8 @@ def overlay_spotting_events_on_image(image, model):
plt.show()

def main():
if not os.path.exists(sys.argv[1]):
raise ValueError("The image files doesn't Exists. Please review your file path")
image = imread(sys.argv[1])
image = iu.resize_image(image, 400)

Expand Down