diff --git a/OSU SARL/Desktop Applications/PnP_Video_Tester/.idea/.name b/OSU SARL/Desktop Applications/PnP_Video_Tester/.idea/.name new file mode 100644 index 0000000..b1a300f --- /dev/null +++ b/OSU SARL/Desktop Applications/PnP_Video_Tester/.idea/.name @@ -0,0 +1 @@ +PnP_Video_Tester \ No newline at end of file diff --git a/OSU SARL/Desktop Applications/PnP_Video_Tester/.idea/PnP_Video_Tester.iml b/OSU SARL/Desktop Applications/PnP_Video_Tester/.idea/PnP_Video_Tester.iml new file mode 100644 index 0000000..0679b3f --- /dev/null +++ b/OSU SARL/Desktop Applications/PnP_Video_Tester/.idea/PnP_Video_Tester.iml @@ -0,0 +1,11 @@ + + + + + + + + + + \ No newline at end of file diff --git a/OSU SARL/Desktop Applications/PnP_Video_Tester/.idea/deployment.xml b/OSU SARL/Desktop Applications/PnP_Video_Tester/.idea/deployment.xml new file mode 100644 index 0000000..4b18e69 --- /dev/null +++ b/OSU SARL/Desktop Applications/PnP_Video_Tester/.idea/deployment.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OSU SARL/Desktop Applications/PnP_Video_Tester/.idea/dictionaries/corwinperren.xml b/OSU SARL/Desktop Applications/PnP_Video_Tester/.idea/dictionaries/corwinperren.xml new file mode 100644 index 0000000..423c889 --- /dev/null +++ b/OSU SARL/Desktop Applications/PnP_Video_Tester/.idea/dictionaries/corwinperren.xml @@ -0,0 +1,7 @@ + + + + pickable + + + \ No newline at end of file diff --git a/OSU SARL/Desktop Applications/PnP_Video_Tester/.idea/encodings.xml b/OSU SARL/Desktop Applications/PnP_Video_Tester/.idea/encodings.xml new file mode 100644 index 0000000..97626ba --- /dev/null +++ b/OSU SARL/Desktop Applications/PnP_Video_Tester/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/OSU SARL/Desktop Applications/PnP_Video_Tester/.idea/misc.xml b/OSU SARL/Desktop Applications/PnP_Video_Tester/.idea/misc.xml new file mode 100644 index 0000000..9eabf49 --- /dev/null +++ b/OSU SARL/Desktop Applications/PnP_Video_Tester/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OSU SARL/Desktop Applications/PnP_Video_Tester/.idea/modules.xml b/OSU SARL/Desktop Applications/PnP_Video_Tester/.idea/modules.xml new file mode 100644 index 0000000..53530d0 --- /dev/null +++ b/OSU SARL/Desktop Applications/PnP_Video_Tester/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/OSU SARL/Desktop Applications/PnP_Video_Tester/.idea/workspace.xml b/OSU SARL/Desktop Applications/PnP_Video_Tester/.idea/workspace.xml new file mode 100644 index 0000000..4e4be10 --- /dev/null +++ b/OSU SARL/Desktop Applications/PnP_Video_Tester/.idea/workspace.xml @@ -0,0 +1,868 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + DEFINITION_ORDER + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + project + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1455693650954 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OSU SARL/Desktop Applications/PnP_Video_Tester/Run 1.png b/OSU SARL/Desktop Applications/PnP_Video_Tester/Run 1.png new file mode 100644 index 0000000..31f0863 Binary files /dev/null and b/OSU SARL/Desktop Applications/PnP_Video_Tester/Run 1.png differ diff --git a/OSU SARL/Desktop Applications/PnP_Video_Tester/VideoCore.py b/OSU SARL/Desktop Applications/PnP_Video_Tester/VideoCore.py new file mode 100644 index 0000000..d61d29d --- /dev/null +++ b/OSU SARL/Desktop Applications/PnP_Video_Tester/VideoCore.py @@ -0,0 +1,289 @@ +""" + This file contains the PickAndPlateVideo sub-class as part of the Framework Class + This class handles initializing and interfacing with the +""" + +__author__ = "Corwin Perren" +__copyright__ = "None" +__credits__ = [""] +__license__ = "GPL (GNU General Public License)" +__version__ = "0.1 Alpha" +__maintainer__ = "Corwin Perren" +__email__ = "caperren@caperren.com" +__status__ = "Development" + +# This file is part of "Pick And Plate". +# +# "Pick And Plate" is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# "Pick And Plate" is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with "Pick And Plate". If not, see . + +##################################### +# Imports +##################################### +# Python native imports +from PyQt4 import QtCore +import cv2 +import numpy +import qimage2ndarray +from math import isnan, pow, sqrt +from datetime import datetime + + +class PickAndPlateVideo(QtCore.QThread): + + requested_image_ready_signal = QtCore.pyqtSignal() + + number_embryos_detected_signal = QtCore.pyqtSignal(int, int, int) + + def __init__(self, main_window): + QtCore.QThread.__init__(self) + + # ########## Reference to highest level window ########## + self.main_window = main_window + + # ########## Thread flags ########## + self.not_abort_flag = True + + self.min_thresh = 0 + self.x_res = 0 + self.y_res = 0 + self.x_center = 0 + self.y_center = 0 + self.crop_dim_half = 0 + self.usable_offset = 95 + + self.raw_frame = None + + self.images_displayed = False + + self.settings_and_cal_qimage = None + self.keypoints = None + + self.current_params = cv2.SimpleBlobDetector_Params() + + self.raw_frame = cv2.imread('chorionated/two/chor2.png', cv2.IMREAD_COLOR) + + # rows, cols, _unused = self.raw_frame.shape + # + # cv2.line(self.raw_frame, (0, rows / 2), (cols, rows / 2), (0, 255, 255), 2) + # cv2.line(self.raw_frame, (cols / 2, 0), (cols / 2, rows), (0, 255, 255), 2) + # + # rotation_matrix = cv2.getRotationMatrix2D((cols / 2, rows / 2), 2, 1) + # self.raw_frame = cv2.warpAffine(self.raw_frame, rotation_matrix, (cols, rows)) + + # ########## Make signal/slot connections ########## + self.connect_signals_to_slots() + + # ########## Start timer ########## + self.start() + + def connect_signals_to_slots(self): + pass + + def run(self): + while self.not_abort_flag: + self.show_detection_calibration() + + def show_detection_calibration(self): + self.setup_blob_params() + + frame = cv2.cvtColor(self.raw_frame, cv2.COLOR_RGB2GRAY) + #return_val, frame = cv2.threshold(frame, self.min_thresh, 255, cv2.cv.CV_THRESH_BINARY) + + mask_frame = numpy.zeros((self.y_res, self.x_res), numpy.uint8) + cv2.circle(mask_frame, (self.x_center, self.y_center), (self.crop_dim_half - self.usable_offset), 255, -1) + + frame = cv2.bitwise_and(frame, mask_frame) + + frame = self.masked_detect_and_overlay(frame, frame) + + frame = self.crop_image(frame) + + + + try: + self.images_displayed = False + resized = cv2.resize(frame, (1000, 1000)) + + # cv2.line(resized, (0, 1000 / 2), (1000, 1000 / 2), (255, 0, 0), 1) + # cv2.line(resized, (1000 / 2, 0), (1000 / 2, 1000), (255, 0, 0), 1) + + self.settings_and_cal_qimage = self.convert_to_qimage(resized) + self.requested_image_ready_signal.emit() + + while not self.images_displayed: + if not self.not_abort_flag: + break + # print "Waiting" + self.msleep(10) + except: + print "Failed to convert" + + def masked_detect_and_overlay(self, input_frame, overlay_frame): + detector = cv2.SimpleBlobDetector(self.current_params) + self.keypoints = detector.detect(input_frame) + #output_frame = cv2.drawKeypoints(overlay_frame, self.keypoints, color=(255, 0, 0)) + + # #### Test algorithm ###### + detected_clean = [] + valid_total = 0 + pickable_total = 0 + + output_frame = cv2.cvtColor(overlay_frame, cv2.COLOR_GRAY2BGR) + + valid_embryos = self.get_valid_embryos(self.keypoints) + pickable_embryos = self.get_pickable_embryos(valid_embryos) + + output_frame = self.draw_found(output_frame, valid_embryos, pickable_embryos) + + valid_total = len(valid_embryos) + pickable_total = len(pickable_embryos) + self.number_embryos_detected_signal.emit(len(self.keypoints), valid_total, pickable_total) + + return output_frame + + @staticmethod + def draw_found(frame, valid, pickable): + + for embryo in valid: + cv2.circle(frame, (int(embryo[0]), int(embryo[1])), int(embryo[2]), (255, 0, 0), -1, cv2.CV_AA) + + for embryo in pickable: + cv2.circle(frame, (int(embryo[0]), int(embryo[1])), int(embryo[2]), (0, 255, 0), -1, cv2.CV_AA) + + return frame + + def get_valid_embryos(self, keypoints): + valid = [] + + for point in self.keypoints: + if (not isnan(point.pt[0])) and (not isnan(point.pt[1])) and (not isnan(point.size)): + valid.append([point.pt[0], point.pt[1], point.size]) + + return valid + + def get_pickable_embryos(self, valid): + pickable = [] + min_between_embryos = self.main_window.detection_seperation_embryos_min_spin_box.value() + max_embryo_dia = self.main_window.detection_embryo_size_max_spin_box.value() + min_embryo_dia = self.main_window.detection_embryo_size_min_spin_box.value() + + for embryo in valid: + x = embryo[0] + y = embryo[1] + dia = embryo[2] + + if (dia >= min_embryo_dia) and (dia <= max_embryo_dia): + found_too_close = False + for comp_embryo in valid: + c_x = comp_embryo[0] + c_y = comp_embryo[1] + c_dia = comp_embryo[2] + + if (x == c_x) and (y == c_y): + pass + elif (sqrt(pow(abs(x-c_x), 2) + pow(abs(y-c_y), 2))-(dia/2)-(c_dia/2)) < min_between_embryos: + found_too_close = True + break + if not found_too_close: + pickable.append(embryo) + + return pickable + + def setup_blob_params(self): + + min_blob_dist = self.main_window.detection_min_distance_between_blobs_spin_box.value() + min_repeat = self.main_window.detection_min_repeatability_spin_box.value() + blob_thresh_min = self.main_window.detection_blob_threshold_min_spin_box.value() + blob_thresh_max = self.main_window.detection_blob_threshold_max_spin_box.value() + blob_thresh_step = self.main_window.detection_blob_threshold_step_spin_box.value() + blob_color_en = self.main_window.detection_blob_color_group_box.isChecked() + blob_color_val = self.main_window.detection_blob_color_spin_box.value() + blob_area_en = self.main_window.detection_blob_area_group_box.isChecked() + blob_area_min = self.main_window.detection_blob_area_min_spin_box.value() + blob_area_max = self.main_window.detection_blob_area_max_spin_box.value() + blob_circ_en = self.main_window.detection_blob_circularity_group_box.isChecked() + blob_circ_min = self.main_window.detection_blob_circularity_min_spin_box.value() + blob_circ_max = self.main_window.detection_blob_circularity_max_spin_box.value() + blob_conv_en = self.main_window.detection_blob_convexity_group_box.isChecked() + blob_conv_min = self.main_window.detection_blob_convexity_min_spin_box.value() + blob_conv_max = self.main_window.detection_blob_convexity_max_spin_box.value() + blob_inertia_en = self.main_window.detection_blob_inertia_group_box.isChecked() + blob_inertia_min = self.main_window.detection_blob_inertia_min_spin_box.value() + blob_inertia_max = self.main_window.detection_blob_inertia_max_spin_box.value() + + self.current_params.minDistBetweenBlobs = min_blob_dist + self.current_params.minRepeatability = min_repeat + self.current_params.minThreshold = blob_thresh_min + self.current_params.maxThreshold = blob_thresh_max + self.current_params.thresholdStep = blob_thresh_step + + if blob_color_en: + self.current_params.filterByColor = True + self.current_params.blobColor = blob_color_val + else: + self.current_params.filterByColor = False + + if blob_area_en: + self.current_params.filterByArea = True + self.current_params.minArea = blob_area_min + self.current_params.maxArea = blob_area_max + else: + self.current_params.filterByArea = False + + if blob_circ_en: + self.current_params.filterByCircularity = True + self.current_params.minCircularity = blob_circ_min + self.current_params.maxCircularity = blob_circ_max + else: + self.current_params.filterByCircularity = False + + if blob_conv_en: + self.current_params.filterByConvexity = True + self.current_params.minConvexity = blob_conv_min + self.current_params.maxConvexity = blob_conv_max + else: + self.current_params.filterByConvexity = False + + if blob_inertia_en: + self.current_params.filterByInertia = True + self.current_params.minInertiaRatio = blob_inertia_min + self.current_params.maxInertiaRatio = blob_inertia_max + else: + self.current_params.filterByInertia = False + + self.min_thresh = self.main_window.detection_min_binary_threshold_spin_box.value() + + self.x_res = 1920 + self.y_res = 1080 + self.x_center = 958 + self.y_center = 559 + self.crop_dim_half = 548/2 + self.usable_offset = 83 + + @staticmethod + def convert_to_qimage(input_matrix): + return qimage2ndarray.array2qimage(input_matrix) + + def crop_image(self, input_matrix): + x1 = self.x_center - self.crop_dim_half + x2 = self.x_center + self.crop_dim_half + y1 = self.y_center - self.crop_dim_half + y2 = self.y_center + self.crop_dim_half + + cropped = input_matrix[y1:y2, x1:x2] + + return cropped + + def images_displayed_slot(self): + self.images_displayed = True \ No newline at end of file diff --git a/OSU SARL/Desktop Applications/PnP_Video_Tester/VideoCore.pyc b/OSU SARL/Desktop Applications/PnP_Video_Tester/VideoCore.pyc new file mode 100644 index 0000000..a3740ac Binary files /dev/null and b/OSU SARL/Desktop Applications/PnP_Video_Tester/VideoCore.pyc differ diff --git a/OSU SARL/Desktop Applications/PnP_Video_Tester/chorionated/chorionated.png b/OSU SARL/Desktop Applications/PnP_Video_Tester/chorionated/chorionated.png new file mode 100644 index 0000000..3010637 Binary files /dev/null and b/OSU SARL/Desktop Applications/PnP_Video_Tester/chorionated/chorionated.png differ diff --git a/OSU SARL/Desktop Applications/PnP_Video_Tester/chorionated/chorionated2.png b/OSU SARL/Desktop Applications/PnP_Video_Tester/chorionated/chorionated2.png new file mode 100644 index 0000000..0968b02 Binary files /dev/null and b/OSU SARL/Desktop Applications/PnP_Video_Tester/chorionated/chorionated2.png differ diff --git a/OSU SARL/Desktop Applications/PnP_Video_Tester/chorionated/chorionated3.png b/OSU SARL/Desktop Applications/PnP_Video_Tester/chorionated/chorionated3.png new file mode 100644 index 0000000..f3af83f Binary files /dev/null and b/OSU SARL/Desktop Applications/PnP_Video_Tester/chorionated/chorionated3.png differ diff --git a/OSU SARL/Desktop Applications/PnP_Video_Tester/chorionated/two/chor1.png b/OSU SARL/Desktop Applications/PnP_Video_Tester/chorionated/two/chor1.png new file mode 100644 index 0000000..6c51779 Binary files /dev/null and b/OSU SARL/Desktop Applications/PnP_Video_Tester/chorionated/two/chor1.png differ diff --git a/OSU SARL/Desktop Applications/PnP_Video_Tester/chorionated/two/chor2.png b/OSU SARL/Desktop Applications/PnP_Video_Tester/chorionated/two/chor2.png new file mode 100644 index 0000000..93c09b4 Binary files /dev/null and b/OSU SARL/Desktop Applications/PnP_Video_Tester/chorionated/two/chor2.png differ diff --git a/OSU SARL/Desktop Applications/PnP_Video_Tester/dechorionated/RawImage__2015-11-12___19-04-54.png b/OSU SARL/Desktop Applications/PnP_Video_Tester/dechorionated/RawImage__2015-11-12___19-04-54.png new file mode 100644 index 0000000..e3e649f Binary files /dev/null and b/OSU SARL/Desktop Applications/PnP_Video_Tester/dechorionated/RawImage__2015-11-12___19-04-54.png differ diff --git a/OSU SARL/Desktop Applications/PnP_Video_Tester/dechorionated/RawImage__2015-11-12___19-16-26.png b/OSU SARL/Desktop Applications/PnP_Video_Tester/dechorionated/RawImage__2015-11-12___19-16-26.png new file mode 100644 index 0000000..dbc9f19 Binary files /dev/null and b/OSU SARL/Desktop Applications/PnP_Video_Tester/dechorionated/RawImage__2015-11-12___19-16-26.png differ diff --git a/OSU SARL/Desktop Applications/PnP_Video_Tester/dechorionated/RawImage__2015-11-12___19-26-19.png b/OSU SARL/Desktop Applications/PnP_Video_Tester/dechorionated/RawImage__2015-11-12___19-26-19.png new file mode 100644 index 0000000..2c7c994 Binary files /dev/null and b/OSU SARL/Desktop Applications/PnP_Video_Tester/dechorionated/RawImage__2015-11-12___19-26-19.png differ diff --git a/OSU SARL/Desktop Applications/PnP_Video_Tester/dechorionated/RawImage__2015-11-12___19-31-48.png b/OSU SARL/Desktop Applications/PnP_Video_Tester/dechorionated/RawImage__2015-11-12___19-31-48.png new file mode 100644 index 0000000..2dd052b Binary files /dev/null and b/OSU SARL/Desktop Applications/PnP_Video_Tester/dechorionated/RawImage__2015-11-12___19-31-48.png differ diff --git a/OSU SARL/Desktop Applications/PnP_Video_Tester/dechorionated/RawImage__2015-11-12___20-03-32.png b/OSU SARL/Desktop Applications/PnP_Video_Tester/dechorionated/RawImage__2015-11-12___20-03-32.png new file mode 100644 index 0000000..2d8d996 Binary files /dev/null and b/OSU SARL/Desktop Applications/PnP_Video_Tester/dechorionated/RawImage__2015-11-12___20-03-32.png differ diff --git a/OSU SARL/Desktop Applications/PnP_Video_Tester/dechorionated/RawImage__2015-11-12___20-07-50.png b/OSU SARL/Desktop Applications/PnP_Video_Tester/dechorionated/RawImage__2015-11-12___20-07-50.png new file mode 100644 index 0000000..34e37fd Binary files /dev/null and b/OSU SARL/Desktop Applications/PnP_Video_Tester/dechorionated/RawImage__2015-11-12___20-07-50.png differ diff --git a/OSU SARL/Desktop Applications/PnP_Video_Tester/dechorionated/RawImage__2015-11-12___20-18-39.png b/OSU SARL/Desktop Applications/PnP_Video_Tester/dechorionated/RawImage__2015-11-12___20-18-39.png new file mode 100644 index 0000000..abce64a Binary files /dev/null and b/OSU SARL/Desktop Applications/PnP_Video_Tester/dechorionated/RawImage__2015-11-12___20-18-39.png differ diff --git a/OSU SARL/Desktop Applications/PnP_Video_Tester/dechorionated/RawImage__2015-11-12___20-31-05.png b/OSU SARL/Desktop Applications/PnP_Video_Tester/dechorionated/RawImage__2015-11-12___20-31-05.png new file mode 100644 index 0000000..f3af83f Binary files /dev/null and b/OSU SARL/Desktop Applications/PnP_Video_Tester/dechorionated/RawImage__2015-11-12___20-31-05.png differ diff --git a/OSU SARL/Desktop Applications/PnP_Video_Tester/dechorionated/RawImage__2015-11-12___20-34-51.png b/OSU SARL/Desktop Applications/PnP_Video_Tester/dechorionated/RawImage__2015-11-12___20-34-51.png new file mode 100644 index 0000000..b629a19 Binary files /dev/null and b/OSU SARL/Desktop Applications/PnP_Video_Tester/dechorionated/RawImage__2015-11-12___20-34-51.png differ diff --git a/OSU SARL/Desktop Applications/PnP_Video_Tester/dechorionated/dech1.png b/OSU SARL/Desktop Applications/PnP_Video_Tester/dechorionated/dech1.png new file mode 100644 index 0000000..0cc27c3 Binary files /dev/null and b/OSU SARL/Desktop Applications/PnP_Video_Tester/dechorionated/dech1.png differ diff --git a/OSU SARL/Desktop Applications/PnP_Video_Tester/exp10/test_image.png b/OSU SARL/Desktop Applications/PnP_Video_Tester/exp10/test_image.png new file mode 100644 index 0000000..2b4a2af Binary files /dev/null and b/OSU SARL/Desktop Applications/PnP_Video_Tester/exp10/test_image.png differ diff --git a/OSU SARL/Desktop Applications/PnP_Video_Tester/exp11/test_image.png b/OSU SARL/Desktop Applications/PnP_Video_Tester/exp11/test_image.png new file mode 100644 index 0000000..f017eb2 Binary files /dev/null and b/OSU SARL/Desktop Applications/PnP_Video_Tester/exp11/test_image.png differ diff --git a/OSU SARL/Desktop Applications/PnP_Video_Tester/exp8/test_image.png b/OSU SARL/Desktop Applications/PnP_Video_Tester/exp8/test_image.png new file mode 100644 index 0000000..ddeedb0 Binary files /dev/null and b/OSU SARL/Desktop Applications/PnP_Video_Tester/exp8/test_image.png differ diff --git a/OSU SARL/Desktop Applications/PnP_Video_Tester/exp9/test_image.png b/OSU SARL/Desktop Applications/PnP_Video_Tester/exp9/test_image.png new file mode 100644 index 0000000..fdcf363 Binary files /dev/null and b/OSU SARL/Desktop Applications/PnP_Video_Tester/exp9/test_image.png differ diff --git a/OSU SARL/Desktop Applications/PnP_Video_Tester/form.ui b/OSU SARL/Desktop Applications/PnP_Video_Tester/form.ui new file mode 100644 index 0000000..c470351 --- /dev/null +++ b/OSU SARL/Desktop Applications/PnP_Video_Tester/form.ui @@ -0,0 +1,1331 @@ + + + MainWindow + + + + 0 + 0 + 1436 + 1039 + + + + MainWindow + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Min -> + + + + + + + Max -> + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + Area + + + true + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 0 + 0 + + + + + 60 + 0 + + + + + + + 1 + + + 1000.000000000000000 + + + 0.100000000000000 + + + 100.000000000000000 + + + + + + + + 0 + 0 + + + + + 60 + 0 + + + + + + + 1 + + + 200.000000000000000 + + + 0.100000000000000 + + + 0.000000000000000 + + + + + + + + + + + + + Circularity + + + true + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 0 + 0 + + + + + 60 + 0 + + + + + + + 2 + + + 1.000000000000000 + + + 0.010000000000000 + + + 0.750000000000000 + + + + + + + + 0 + 0 + + + + + 60 + 0 + + + + + + + 2 + + + 1.000000000000000 + + + 0.010000000000000 + + + 1.000000000000000 + + + + + + + + + + + + + Convexity + + + true + + + false + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 0 + 0 + + + + + 60 + 0 + + + + + + + 2 + + + 1.000000000000000 + + + 0.010000000000000 + + + 1.000000000000000 + + + + + + + + 0 + 0 + + + + + 60 + 0 + + + + + + + 2 + + + 1.000000000000000 + + + 0.010000000000000 + + + 1.000000000000000 + + + + + + + + + + + + + Inertia + + + true + + + false + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 0 + 0 + + + + + 60 + 0 + + + + + + + 2 + + + 1.000000000000000 + + + 0.010000000000000 + + + 1.000000000000000 + + + + + + + + 0 + 0 + + + + + 60 + 0 + + + + + + + 2 + + + 1.000000000000000 + + + 0.010000000000000 + + + 1.000000000000000 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + Embryos Detected: + + + + + + + 0 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + General + + + false + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Min Binary +Threshold + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + 255 + + + 135 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Min Distance +Between Blobs + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + 1 + + + 0.100000000000000 + + + 0.000000000000000 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Min +Repeatability + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + 3 + + + + + + + + + + + + + + + + + Threshold + + + false + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Min + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + 255 + + + 0 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Max + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + 255 + + + 176 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Step + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + 1 + + + 255 + + + 18 + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + true + + + + + + + + + Color + + + true + + + false + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Color + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + 255 + + + 128 + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + Embryos with valid values: + + + + + + + 0 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + Min Embryo Size + + + + + + + + 0 + 0 + + + + + 60 + 0 + + + + + + + 2 + + + 100.000000000000000 + + + 0.010000000000000 + + + 1.000000000000000 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + Min Distance Between Embryos + + + + + + + + 0 + 0 + + + + + 60 + 0 + + + + + + + 2 + + + 100.000000000000000 + + + 0.010000000000000 + + + 1.000000000000000 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + Max Embryo Size + + + + + + + + 0 + 0 + + + + + 60 + 0 + + + + + + + 2 + + + 100.000000000000000 + + + 0.010000000000000 + + + 1.000000000000000 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + Pickable Embryos + + + + + + + 0 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + 0 + 0 + + + + + 1000 + 1000 + + + + + 1000 + 1000 + + + + false + + + border: 1px solid rgb(55,55,55) + + + QFrame::StyledPanel + + + + + + Qt::AlignCenter + + + + + + + + + + diff --git a/OSU SARL/Desktop Applications/PnP_Video_Tester/main.py b/OSU SARL/Desktop Applications/PnP_Video_Tester/main.py new file mode 100644 index 0000000..14c3215 --- /dev/null +++ b/OSU SARL/Desktop Applications/PnP_Video_Tester/main.py @@ -0,0 +1,49 @@ +import sys +from PyQt4 import QtCore, QtGui, uic +import signal + +from VideoCore import PickAndPlateVideo + +form_class = uic.loadUiType("form.ui")[0] # Load the UI + + +##################################### +# PickAndPlateWindow Class Definition +##################################### +class PickAndPlateWindow(QtGui.QMainWindow, form_class): + def __init__(self, parent=None): + QtGui.QMainWindow.__init__(self, parent) + + # ########## Set up QT Application Window ########## + self.setupUi(self) # Has to be first call in class in order to link gui form objects + + # ########## Instantiation of program classes ########## + self.video = PickAndPlateVideo(self) + + self.video.requested_image_ready_signal.connect(self.on_image_ready_slot) + self.video.number_embryos_detected_signal.connect(self.on_detected_embryos_number_changed_slot) + + def on_image_ready_slot(self): + try: + self.detection_calibration_image_preview_label.setPixmap( + QtGui.QPixmap.fromImage(self.video.settings_and_cal_qimage)) + self.video.images_displayed = True + #print "Got here" + except: + print "Failed to show" + + def on_detected_embryos_number_changed_slot(self, detected, valid, pickable): + self.detection_num_detected_label.setText(str(detected)) + self.detection_valid_detected_label.setText(str(valid)) + self.detection_pickable_detected_label.setText(str(pickable)) + +if __name__ == "__main__": + signal.signal(signal.SIGINT, signal.SIG_DFL) # This allows the keyboard interrupt kill to work properly + app = QtGui.QApplication(sys.argv) # Create the base qt gui application + myWindow = PickAndPlateWindow() # Make a window in this application using the pnp MyWindowClass + myWindow.show() # Show the window in the application + + # screenFilter = TouchScreenEventFilter() # Still might be needed if multiple presses from touchscreen breaks stuff + # app.installEventFilter(screenFilter) + + app.exec_() # Execute launching of the application \ No newline at end of file diff --git a/OSU SARL/Desktop Applications/PnP_Video_Tester/test_image.png b/OSU SARL/Desktop Applications/PnP_Video_Tester/test_image.png new file mode 100644 index 0000000..9220f92 Binary files /dev/null and b/OSU SARL/Desktop Applications/PnP_Video_Tester/test_image.png differ