Пример #1
0
    def set_canvas(self, img, **kwargs):
        """Set the main image canvas with the image to be displayed and the corresponding histogram
        """
        super(TWHNormal, self).set_canvas(img, **kwargs)
        self._csbox_normal = csbox.CSBox(
            self,
            cbox=[["model", "ntype"], [["LS", "TRI", "QUADRIC"], ["xy", "z"]],
                  ["LS", "z"], ["str", "str"]],
            sbox=[["radius", "bins", "log", "alpha", "domain"],
                  [6.0, 16, 1, 0.1, "height"],
                  ["float", "int", "int", "float", "str"]])
        self._csbox_normal.grid(row=2,
                                column=0,
                                rowspan=7,
                                sticky=N + W + E + S)

        self._button_normal = buttonbox.ButtonBox(
            self,
            bbox=[[
                "Open PC", "Open PC Normal", "Normal Image", "Binned Image"
            ],
                  [
                      self.open_normal_cloud, self.open_normal_cloud_rgb,
                      self.set_normal_img, self.set_binned_normal_img
                  ]])
        self._button_normal.grid(row=2,
                                 column=1,
                                 rowspan=4,
                                 sticky=N + W + E + S)

        self._button_quit.grid(row=9, column=0, columnspan=3, sticky=W + E)
Пример #2
0
    def set_canvas(self, img, **kwargs):
        """Set the main image canvas with the image to be displayed and the corresponding histogram
        """
        super(TWHLecture, self).set_canvas(img, **kwargs)

        # set combobox and settingsbox for blurring parameters
        self._csbox_blur = csbox.CSBox(self, cbox=[["Model"], [["Average", "Median", "Binomial", "Gaussian"]], ["Average"], ["str"]], sbox=[["Kernel Size", "Sigma"], [5, 1.], ["int", "float"]], bbox=[["Blur Image", "Gradient Image"], [self.blur_image, self.gradient_image]])
        self._csbox_blur.grid(row=2, column=0, rowspan=5, sticky=N+W+E)

        # set combobox and settingsbox for segmentation methods
        self._csbox_seg = csbox.CSBox(self, cbox=[["Model"], [[ "SLIC",  "Normalized Cuts", "GrabCut",]], ["SLIC"], ["str"]], bbox=[["Image Segmentation"], [self.image_segmentation]]) # "Felzenswalb"
        self._csbox_seg.grid(row=7, column=0, rowspan=2, sticky=N+W+S+E)

        # set combobox and settingsbox for the segmentation method grabcut k-means
        self._csbox_slic = csbox.CSBox(self, sbox=[["compactness", "n_segments", "max_iter"], [10, 300, 25], ["float", "int", "int"]])
        self._csbox_slic.grid(row=9, column=0, rowspan=3, sticky=N+W+S+E)

        # set combobox and settingsbox for the segmentation method grabcut
        self._csbox_grab = csbox.CSBox(self, sbox=[["iterCount"], [5], ["int"]])
        self._csbox_grab.grid(row=12, column=0, rowspan=1, sticky=N+W+S+E)

        # set combobox and settingsbox for thresholding parameters    
        self._csbox_threshold = scalebox.ScaleBox(self, scbox=[["Thresh"], [[0, 255, 2, 0]], ["int"]],  orient=HORIZONTAL, func=self.set_simple_threshold, button="Simple Thresholding") 
        self._csbox_threshold.grid(row=2, column=1, rowspan=2, sticky=N+W+S+E)

        # set combobox and settingsbox for building difference images
        self._csbox_difference = csbox.CSBox(self, bbox=[["Clear Image List", "Add Image to Image List", "Compute Difference (Image)", "Show Image List"], [self.reset_dimage, self.set_dimage, self.compute_dimage, self.show_dimage]])
        self._csbox_difference.grid(row=4, column=1, rowspan=4, sticky=N+W+S+E)        

        # set combobox and settingsbox for adding images boxes
        self._csbox_boxes = csbox.CSBox(self, bbox=[[ "Show Box"], [self.show_box]])
        self._csbox_boxes.grid(row=8, column=1, rowspan=1, sticky=N+W+S+E)  

        self._button_quit.grid(row=13, column=0, columnspan=3, sticky=N+W+S+E)
Пример #3
0
    def set_canvas(self, img, **kwargs):
        """Set the main image canvas with the image to be displayed and the corresponding histogram
        """        
        super(TWHSeg, self).set_canvas(img, **kwargs)

        self._csbox_threshold.grid_forget()
        self._csbox_edges.grid_forget()
        self._csbox_hough.grid_forget()
        self._csbox_difference.grid_forget()

        # set combobox and settingsbox for segmentation methods
        self._csbox_seg = csbox.CSBox(self, cbox=[["Model"], [[ "SLIC",  "Normalized Cuts", "Felzenswalb"]], ["SLIC"], ["str"]], bbox=[["Image Segmentation"], [self.image_segmentation]]) 
        self._csbox_seg.grid(row=4, column=1, rowspan=2, sticky=N+W+S+E)

       # set combobox and settingsbox for the segmentation method felzenswalb
        self._csbox_felz = csbox.CSBox(self, sbox=[["scale", "sigma", "min_size"], [32, 0.5, 256], ["int", "float", "int"]], )
        self._csbox_felz.grid(row=6, column=1, rowspan=3, sticky=N+W+S+E)

        # set combobox and settingsbox for the segmentation method grabcut k-means
        self._csbox_slic = csbox.CSBox(self, sbox=[["compactness", "n_segments", "max_iter", "convert2lab"], [15, 5000, 250, 1], ["float", "int", "int", "bool"]])
        self._csbox_slic.grid(row=9, column=1, rowspan=4, sticky=N+W+S+E)

        # set combobox and settingsbox for the segmentation method grabcut
        self._csbox_grab = csbox.CSBox(self, sbox=[["iterCount"], [5], ["int"]],  bbox=[["GrabCut Segmentation"], [self.image_segmentation_grabcut]])
        self._csbox_grab.grid(row=13, column=1, rowspan=2, sticky=N+W+S+E)

        # set combobox and settingsbox for the segmentation method grabcut
        self._csbox_bp = csbox.CSBox(self, sbox=[["dim1", "dim2", "min_label", "max_label", "iterCount", "factor", "net"], [32, 64 , 4, 256, 160, 1.0, 1], ["int", "int", "int", "int", "int", "float", "int"]],  bbox=[["Unsupervised Segmentation via BP"], [self.image_segmentation_backpropagation]])
        self._csbox_bp.grid(row=15, column=1, rowspan=7, sticky=N+W+S+E)

        self._button_quit.grid(row=22, column=0, columnspan=3, sticky=N+W+S+E)

        # set combobox and settingsbox for adding images boxes
        self._csbox_boxes = csbox.CSBox(self, bbox=[["Show Box"], [self.show_box]])
        self._csbox_boxes.grid(row=10, column=0, rowspan=1, sticky=N+W+S+E)  
Пример #4
0
    def set_canvas(self, img, **kwargs):
        """Set the main image canvas with the image to be displayed and the corresponding histogram
        """
        super(TWHFilter, self).set_canvas(img, **kwargs)

        # set combobox and settingsbox for blurring parameters
        self._csbox_blur = csbox.CSBox(
            self,
            cbox=[["Model"],
                  [["Average", "Gaussian", "Median", "Bilateral Filtering"]],
                  ["Bilateral Filtering"], ["str"]],
            sbox=[["Kernel Size", "Sigma", "d", "sigmaColor", "sigmaSpace"],
                  [5, 2.3, 7, 100, 500], ["int", "float", "int", "int",
                                          "int"]],
            bbox=[["Blur Image", "Gradient Image"],
                  [self.blur_image, self.gradient_image]])
        self._csbox_blur.grid(row=2, column=0, rowspan=7, sticky=N + W + E + S)

        # set combobox and settingsbox for edge detection parameters
        self._csbox_edges = csbox.CSBox(
            self,
            bbox=[["Get Edges"], [self.get_edges]],
            sbox=[["Threshold I", "Threshold II", "Aperture Size"],
                  [50, 150, 3], ["int", "int", "int"]])
        self._csbox_edges.grid(row=10,
                               column=0,
                               rowspan=4,
                               sticky=N + W + E + S)

        # set combobox and settingsbox for thresholding parameters
        self._csbox_bthreshold = csbox.CSBox(self,
                                             bbox=[["Simple Thresholding"],
                                                   [self.set_threshold_img]])
        self._csbox_bthreshold.grid(row=2,
                                    column=1,
                                    rowspan=1,
                                    sticky=N + W + S + E)
        self._csbox_threshold = scalebox.ScaleBox(
            self,
            scbox=[["Thresh"], [[0, 255, 2, 0]], ["int"]],
            orient=HORIZONTAL,
            func=self.set_threshold_img_mask)
        self._csbox_threshold.grid(row=3,
                                   column=1,
                                   rowspan=1,
                                   sticky=N + W + S + E)

        self._csbox_athreshold = csbox.CSBox(
            self,
            cbox=[["adaptiveMethod"], [["Mean", "Gaussian"]], ["Gaussian"],
                  ["str"]],
            sbox=[["blockSize", "C"], [5, 2], ["int", "int"]],
            bbox=[["Adaptive Thresholding"], [self.set_adaptive_thresholding]])
        self._csbox_athreshold.grid(row=4,
                                    column=1,
                                    rowspan=3,
                                    sticky=N + W + S + E)

        # set combobox and settingsbox for building difference images
        self._csbox_difference = csbox.CSBox(self,
                                             bbox=[[
                                                 "Clear Image List",
                                                 "Add Image to Image List",
                                                 "Compute Difference (Image)",
                                                 "Show Image List"
                                             ],
                                                   [
                                                       self.reset_dimage,
                                                       self.set_dimage,
                                                       self.compute_dimage,
                                                       self.show_dimage
                                                   ]])
        self._csbox_difference.grid(row=7,
                                    column=1,
                                    rowspan=4,
                                    sticky=N + W + S + E)

        # set combobox and settingsbox for hough transformation
        self._csbox_hough = csbox.CSBox(
            self,
            bbox=[["Hough Transform"], [self.get_hough_transform]],
            sbox=[["Threshold", "Minimum Line Length", "Maximum Line Gap"],
                  [40, 40, 40], ["int", "int", "int"]])
        self._csbox_hough.grid(row=14,
                               column=0,
                               rowspan=4,
                               sticky=N + W + S + E)

        self._button_quit.grid(row=18, column=0, columnspan=3, sticky=W + E)
Пример #5
0
    def set_canvas(self, img, **kwargs):
        """Set the main image canvas with the image to be displayed and the corresponding histogram
        """
        super(TWSeg, self).set_canvas(img, **kwargs)

        self._frame = Frame(self)
        self._frame.grid(row=2, column=0, sticky=N + W + S + E)

        self._imgio = imgiogui.ImgIOGUI(self)
        self._imgio.grid(row=1, column=0, sticky=N + W + S + E)

        self._button_attempt = ttk.Button(
            self,
            text="Attempt",
            command=lambda x=self.attempt: x(self.image_segmentation))
        self._button_attempt.grid(row=3, column=0, columnspan=1)
        self._button_quit.grid(row=4, column=0, sticky=N + W + S + E)

        # set combobox and settingsbox for segmentation methods
        self._csbox_seg = csbox.CSBox(
            self._frame,
            cbox=[["Model"], [["SLIC", "Normalized Cuts", "Felzenswalb"]],
                  ["SLIC"], ["str"]],
            bbox=[["Image Segmentation"], [self.image_segmentation]])
        self._csbox_seg.grid(row=1, column=0, rowspan=2, sticky=N + W + S + E)

        # set combobox and settingsbox for segmentation methods
        self._csbox_bound = csbox.CSBox(self._frame,
                                        cbox=[["boundaries"],
                                              [["mark", "find"]], ["find"],
                                              ["str"]])
        self._csbox_bound.grid(row=3,
                               column=0,
                               rowspan=1,
                               sticky=N + W + S + E)

        # set combobox and settingsbox for the segmentation method felzenswalb
        self._csbox_felz = csbox.CSBox(self._frame,
                                       sbox=[["scale", "sigma", "min_size"],
                                             [16, 0.5, 16],
                                             ["int", "float", "int"]])
        self._csbox_felz.grid(row=4, column=0, rowspan=3, sticky=N + W + S + E)

        # set combobox and settingsbox for the segmentation method grabcut k-means
        self._csbox_slic = csbox.CSBox(
            self._frame,
            sbox=[["compactness", "n_segments", "max_iter", "convert2lab"],
                  [10, 5000, 15, 1], ["float", "int", "int", "bool"]])
        self._csbox_slic.grid(row=7, column=0, rowspan=4, sticky=N + W + S + E)

        # set combobox and settingsbox for the segmentation method grabcut
        self._csbox_grab = csbox.CSBox(self._frame,
                                       sbox=[["iterCount"], [5], ["int"]],
                                       bbox=[["GrabCut Segmentation"],
                                             [self.image_segmentation_grabcut]
                                             ])
        self._csbox_grab.grid(row=11,
                              column=0,
                              rowspan=2,
                              sticky=N + W + S + E)

        # set combobox and settingsbox for the segmentation method grabcut
        self._csbox_bp = csbox.CSBox(
            self._frame,
            sbox=[[
                "dim1", "dim2", "min_label", "max_label", "iterCount",
                "factor", "net"
            ], [32, 64, 4, 256, 160, 1.0, 1],
                  ["int", "int", "int", "int", "int", "float", "int"]],
            bbox=[["Unsupervised Segmentation via BP"],
                  [self.image_segmentation_backpropagation]])
        self._csbox_bp.grid(row=1, column=1, rowspan=7, sticky=N + W + S + E)

        self._button_quit.grid(row=2, column=0, sticky=N + W + S + E)
Пример #6
0
    def set_canvas(self, img, **kwargs):
        """Set the main image canvas with the image to be displayed and the corresponding histogram
        """
        super(TWHSeg, self).set_canvas(img, **kwargs)

        self._csbox_athreshold.grid_forget()
        self._csbox_edges.grid_forget()
        self._csbox_hough.grid_forget()
        self._csbox_difference.grid_forget()

        # set combobox and settingsbox for segmentation methods
        self._csbox_seg = csbox.CSBox(
            self,
            cbox=[["mode", "kind", "boundaries", "domain", "reference"],
                  [[
                      "SLIC", "SLIC-0", "Normalized Cuts", "Felzenswalb",
                      "SLIC+Felzenswalb", "KMeans"
                  ], ["avg", "overlay", "min", "max"], ["mark", "find"],
                   ["image", "height", "label"], ["image", "height", "label"]],
                  ["SLIC-0", "avg", "mark", "image", "image"],
                  ["str", "str", "str", "str", "str"]],
            sbox=[["convert2lab", "color", "position"], [1, 1, 0],
                  ["int", "int", "int"]],
            bbox=[["Image Segmentation", "Distance Transform"],
                  [self.image_segmentation, self.distance_transform]])
        self._csbox_seg.grid(row=4, column=1, rowspan=10, sticky=N + W + S + E)

        # set combobox and settingsbox for the segmentation method felzenswalb
        self._csbox_felz = csbox.CSBox(
            self,
            sbox=[["scale", "sigma", "min_size"], [32, 0.5, 256],
                  ["int", "float", "int"]],
        )
        self._csbox_felz.grid(row=14,
                              column=1,
                              rowspan=3,
                              sticky=N + W + S + E)

        # set combobox and settingsbox for the segmentation method grabcut k-means
        self._csbox_slic = csbox.CSBox(
            self,
            sbox=[["compactness", "n_segments", "max_iter"], [10, 250, 15],
                  ["float", "int", "int"]])
        self._csbox_slic.grid(row=17,
                              column=1,
                              rowspan=3,
                              sticky=N + W + S + E)

        # set combobox and settingsbox for the segmentation method grabcut k-means
        self._csbox_kmeans = csbox.CSBox(self,
                                         sbox=[["n_clusters"], [6], ["int"]])
        self._csbox_kmeans.grid(row=20,
                                column=1,
                                rowspan=1,
                                sticky=N + W + S + E)

        # # set combobox and settingsbox for the segmentation method grabcut
        # self._csbox_grab = csbox.CSBox(self, sbox=[["iterCount"], [5], ["int"]],  bbox=[["GrabCut Segmentation"], [self.image_segmentation_grabcut]])
        # self._csbox_grab.grid(row=20, column=1, rowspan=2, sticky=N+W+S+E)

        # # set combobox and settingsbox for the segmentation method grabcut
        # self._csbox_bp = csbox.CSBox(self, sbox=[["dim1", "dim2", "min_label", "max_label", "iterCount", "factor", "net"], [32, 64 , 4, 256, 160, 1.0, 1], ["int", "int", "int", "int", "int", "float", "int"]],  bbox=[["Unsupervised Segmentation via BP"], [self.image_segmentation_backpropagation]])
        # self._csbox_bp.grid(row=21, column=1, rowspan=7, sticky=N+W+S+E)

        self._button_quit.grid(row=27,
                               column=0,
                               columnspan=3,
                               sticky=N + W + S + E)

        # set combobox and settingsbox for adding images boxes
        self._csbox_resize = csbox.CSBox(self,
                                         sbox=[["factor"], [1.0], ["float"]],
                                         bbox=[["Resize Image"],
                                               [self.resize_image]])
        self._csbox_resize.grid(row=9,
                                column=0,
                                rowspan=2,
                                sticky=N + W + S + E)

        # self._csbox_seg_mt = csbox.CSBox(self, sbox=[["factor", "n_filters"], [1.0, 3], ["float", "int"]], bbox=[["MTARSI Segmentation"], [self.mtarsi_segmentation]])
        # self._csbox_seg_mt.grid(row=12, column=0, rowspan=3, sticky=N+W+S+E)
        self._csbox_shdw_mt = csbox.CSBox(
            self,
            sbox=[["min_size", "n_filters", "quantize"], [50, 3, 16],
                  ["int", "int", "int"]],
            bbox=[["MTARSI Shadow"], [self.mtarsi_shadow]])
        self._csbox_shdw_mt.grid(row=11,
                                 column=0,
                                 rowspan=4,
                                 sticky=N + W + S + E)

        # self._csbox_lthreshold = scalebox.ScaleBox(self, scbox=[["Thresh"], [[0, 100, 1, 0]], ["int"]],  orient=HORIZONTAL, func=self.set_lthreshold)
        # self._csbox_lthreshold.grid(row=16, column=0, rowspan=2, sticky=N+W+S+E)

        # set combobox and settingsbox for the segmentation method grabcut
        self._csbox_bp = csbox.CSBox(
            self,
            sbox=[[
                "dim1", "dim2", "min_label", "max_label", "iterCount",
                "factor", "height"
            ], [64, 128, 4, 32, 250, 1.0, 0],
                  ["int", "int", "int", "int", "int", "float", "int", "bool"]],
            bbox=[["Unsupervised Segmentation via BP"],
                  [self.image_segmentation_backpropagation]])
        self._csbox_bp.grid(row=21, column=1, rowspan=6, sticky=N + W + S + E)

        self._csbox_blubb = csbox.CSBox(self, bbox=[["Blubb"], [self.blubb]])
        self._csbox_blubb.grid(row=15,
                               column=0,
                               rowspan=1,
                               sticky=N + W + S + E)