Example #1
0
    def __init__(self):
        super(Window, self).__init__()

        self.image_path = None
        self.etalon_path = '/src/v2/Etalon.png'

        self.viewer = DoubleViewer(self)
        self.viewer.setUpdatesEnabled(True)
        # 'Load image' button
        self.btnLoad = QToolButton()
        self.btnLoad.setText('Load image')
        self.btnLoad.clicked.connect(self.loadImage)

        self.radio_image = QRadioButton("One object")
        self.radio_image.setChecked(True)
        self.radio_image.setEnabled(True)
        self.radio_image_all = QRadioButton("All objects")
        self.radio_image_all.setChecked(False)
        self.radio_image_all.setEnabled(True)

        self.brush_size_box = QSpinBox()
        self.brush_size_box.setMinimum(1)
        self.brush_size_box.setMaximum(255)
        self.brush_size_box.setValue(30)
        self.threshold = QLabel("    Threshold:")

        self.step_pixels = QSpinBox()
        self.step_pixels.setMinimum(1)
        self.step_pixels.setMaximum(15)
        self.step_pixels.setValue(1)
        self.step_pixels_text = QLabel("    Step pixels:")

        self.btnClear = QToolButton()
        self.btnClear.setText('Clear')
        self.btnClear.clicked.connect(self.clear)

        #instruments panel
        instrument_layout = QHBoxLayout()
        instrument_layout.addWidget(self.btnLoad)
        instrument_layout.addWidget(self.radio_image)
        instrument_layout.addWidget(self.radio_image_all)
        instrument_layout.addWidget(self.threshold)
        instrument_layout.addWidget(self.brush_size_box)
        instrument_layout.addWidget(self.step_pixels_text)
        instrument_layout.addWidget(self.step_pixels)
        instrument_layout.addWidget(self.btnClear)
        instrument_layout.addStretch(
            10000)  #-------------------------------------  button place

        # Arrange layout
        VBlayout = QVBoxLayout()
        VBlayout.addLayout(instrument_layout)
        VBlayout.addWidget(self.viewer)

        self.setLayout(VBlayout)
Example #2
0
    def __init__(self):
        super(Window, self).__init__()

        self.image_path = None

        self.viewer = DoubleViewer(self)
        self.viewer.setUpdatesEnabled(True)

        # 'Load image' button
        self.btnLoad = QToolButton()
        self.btnLoad.setText('Load image')
        self.btnLoad.clicked.connect(self.loadImage)

        self.btnClear = QToolButton()
        self.btnClear.setText('Clear')
        self.btnClear.clicked.connect(self.clear)

        self.radio_image = QRadioButton("One object")
        self.radio_image.setChecked(True)
        self.radio_image.setEnabled(True)
        self.radio_image_all = QRadioButton("All objects")
        self.radio_image_all.setChecked(False)
        self.radio_image_all.setEnabled(True)

        select_wand = QHBoxLayout()
        select_wand.addWidget(self.radio_image)
        select_wand.addWidget(self.radio_image_all)
        wand_group = QGroupBox("Select wand")
        wand_group.setLayout(select_wand)

        # tools group
        self.show_feather_edges = QLabel("Feather edges:")

        line_00 = QFrame()
        line_00.setFrameShape(QFrame.VLine)
        self.show_smooth_edges = QLabel("Antialiasing:")
        self.smooth_edges = QCheckBox()
        self.smooth_edges.setChecked(True)

        line_01 = QFrame()
        line_01.setFrameShape(QFrame.VLine)

        self.threshold = QSpinBox()
        self.threshold.setMinimum(1)
        self.threshold.setMaximum(255)
        self.threshold.setValue(30)

        threshold = QHBoxLayout()
        threshold.addWidget(QLabel("Threshold: "))
        threshold.addWidget(self.threshold)

        line_02 = QFrame()
        line_02.setFrameShape(QFrame.VLine)

        self.replace = QRadioButton("Replace")
        self.add = QRadioButton("Add")
        self.add.setChecked(True)
        self.substract = QRadioButton("Subtract")
        self.intersect = QRadioButton("Intersect")

        fuzzy_modes = QHBoxLayout()
        fuzzy_modes.addWidget(QLabel("Mode: "))
        fuzzy_modes.addWidget(self.replace)
        fuzzy_modes.addWidget(self.add)
        fuzzy_modes.addWidget(self.substract)
        fuzzy_modes.addWidget(self.intersect)

        line_03 = QFrame()
        line_03.setFrameShape(QFrame.VLine)


        self.feather_edges = QSpinBox()
        self.feather_edges.setMinimum(1)
        self.feather_edges.setMaximum(33)
        self.feather_edges.setValue(21)
        self.feather_edges.setDisabled(True)
        self.feather_edges.setDisabled(False)


        tool_options = QHBoxLayout()
        tool_options.addWidget(self.show_smooth_edges)
        tool_options.addWidget(self.smooth_edges)
        tool_options.addWidget(line_00)
        tool_options.addWidget(self.show_feather_edges)
        tool_options.addWidget(self.feather_edges)
        tool_options.addWidget(line_01)
        tool_options.addLayout(threshold)
        tool_options.addWidget(line_02)
        tool_options.addLayout(fuzzy_modes)
        tool_options.addWidget(line_03)
        tool_options.addWidget(self.btnClear)

        trimap_group = QGroupBox("Tool options")
        trimap_group.setLayout(tool_options)


        self.selection_criterion = QComboBox(self)
        self.selection_criterion.addItems(['composite', 'red', 'green', 'blue', 'hue', 'lightness', 'saturation'])


        predict_layout = QHBoxLayout()
        predict_layout.addWidget(self.selection_criterion)
        predict_group = QGroupBox("Selection criterion")
        predict_group.setLayout(predict_layout)


        # instruments panel
        instrument_layout = QHBoxLayout()
        instrument_layout.addWidget(wand_group)
        instrument_layout.addWidget(trimap_group)
        instrument_layout.addWidget(predict_group)
        instrument_layout.addWidget(self.btnLoad)
        instrument_layout.addStretch(10000)

        # Arrange layout
        VBlayout = QVBoxLayout()
        VBlayout.addLayout(instrument_layout)
        VBlayout.addWidget(self.viewer)

        self.setLayout(VBlayout)
Example #3
0
class Window(QWidget):
    def __init__(self):
        super(Window, self).__init__()

        self.image_path = None

        self.viewer = DoubleViewer(self)
        self.viewer.setUpdatesEnabled(True)

        # 'Load image' button
        self.btnLoad = QToolButton()
        self.btnLoad.setText('Load image')
        self.btnLoad.clicked.connect(self.loadImage)

        self.btnClear = QToolButton()
        self.btnClear.setText('Clear')
        self.btnClear.clicked.connect(self.clear)

        self.radio_image = QRadioButton("One object")
        self.radio_image.setChecked(True)
        self.radio_image.setEnabled(True)
        self.radio_image_all = QRadioButton("All objects")
        self.radio_image_all.setChecked(False)
        self.radio_image_all.setEnabled(True)

        select_wand = QHBoxLayout()
        select_wand.addWidget(self.radio_image)
        select_wand.addWidget(self.radio_image_all)
        wand_group = QGroupBox("Select wand")
        wand_group.setLayout(select_wand)

        # tools group
        self.show_feather_edges = QLabel("Feather edges:")

        line_00 = QFrame()
        line_00.setFrameShape(QFrame.VLine)
        self.show_smooth_edges = QLabel("Antialiasing:")
        self.smooth_edges = QCheckBox()
        self.smooth_edges.setChecked(True)

        line_01 = QFrame()
        line_01.setFrameShape(QFrame.VLine)

        self.threshold = QSpinBox()
        self.threshold.setMinimum(1)
        self.threshold.setMaximum(255)
        self.threshold.setValue(30)

        threshold = QHBoxLayout()
        threshold.addWidget(QLabel("Threshold: "))
        threshold.addWidget(self.threshold)

        line_02 = QFrame()
        line_02.setFrameShape(QFrame.VLine)

        self.replace = QRadioButton("Replace")
        self.add = QRadioButton("Add")
        self.add.setChecked(True)
        self.substract = QRadioButton("Subtract")
        self.intersect = QRadioButton("Intersect")

        fuzzy_modes = QHBoxLayout()
        fuzzy_modes.addWidget(QLabel("Mode: "))
        fuzzy_modes.addWidget(self.replace)
        fuzzy_modes.addWidget(self.add)
        fuzzy_modes.addWidget(self.substract)
        fuzzy_modes.addWidget(self.intersect)

        line_03 = QFrame()
        line_03.setFrameShape(QFrame.VLine)


        self.feather_edges = QSpinBox()
        self.feather_edges.setMinimum(1)
        self.feather_edges.setMaximum(33)
        self.feather_edges.setValue(21)
        self.feather_edges.setDisabled(True)
        self.feather_edges.setDisabled(False)


        tool_options = QHBoxLayout()
        tool_options.addWidget(self.show_smooth_edges)
        tool_options.addWidget(self.smooth_edges)
        tool_options.addWidget(line_00)
        tool_options.addWidget(self.show_feather_edges)
        tool_options.addWidget(self.feather_edges)
        tool_options.addWidget(line_01)
        tool_options.addLayout(threshold)
        tool_options.addWidget(line_02)
        tool_options.addLayout(fuzzy_modes)
        tool_options.addWidget(line_03)
        tool_options.addWidget(self.btnClear)

        trimap_group = QGroupBox("Tool options")
        trimap_group.setLayout(tool_options)


        self.selection_criterion = QComboBox(self)
        self.selection_criterion.addItems(['composite', 'red', 'green', 'blue', 'hue', 'lightness', 'saturation'])


        predict_layout = QHBoxLayout()
        predict_layout.addWidget(self.selection_criterion)
        predict_group = QGroupBox("Selection criterion")
        predict_group.setLayout(predict_layout)


        # instruments panel
        instrument_layout = QHBoxLayout()
        instrument_layout.addWidget(wand_group)
        instrument_layout.addWidget(trimap_group)
        instrument_layout.addWidget(predict_group)
        instrument_layout.addWidget(self.btnLoad)
        instrument_layout.addStretch(10000)

        # Arrange layout
        VBlayout = QVBoxLayout()
        VBlayout.addLayout(instrument_layout)
        VBlayout.addWidget(self.viewer)

        self.setLayout(VBlayout)

    def loadImage(self):
        new_image_path = QFileDialog.getOpenFileName(self, "Pick an image")[0]
        self.image_path = new_image_path
        if utils.check_image_path(str(new_image_path)):
            #image_name = new_image_path.split('/')[-1].split('.')[0]
            self.viewer.setPhoto(utils.load_image(new_image_path))
            self.viewer.update()

    def clear(self):
        if self.image_path is None:
            image_path = QMessageBox()
            image_path.setIcon(QMessageBox.Critical)
            image_path.setWindowTitle("Warning")
            image_path.setText("Please, choise the image!")
            image_path.exec_()
        else:
            self.viewer.setPhoto(utils.load_image(self.image_path))
            self.viewer.update()
Example #4
0
class Window(QWidget):
    def __init__(self):
        super(Window, self).__init__()

        self.image_path = None
        self.etalon_path = '/src/v2/Etalon.png'

        self.viewer = DoubleViewer(self)
        self.viewer.setUpdatesEnabled(True)
        # 'Load image' button
        self.btnLoad = QToolButton()
        self.btnLoad.setText('Load image')
        self.btnLoad.clicked.connect(self.loadImage)

        self.radio_image = QRadioButton("One object")
        self.radio_image.setChecked(True)
        self.radio_image.setEnabled(True)
        self.radio_image_all = QRadioButton("All objects")
        self.radio_image_all.setChecked(False)
        self.radio_image_all.setEnabled(True)

        self.brush_size_box = QSpinBox()
        self.brush_size_box.setMinimum(1)
        self.brush_size_box.setMaximum(255)
        self.brush_size_box.setValue(30)
        self.threshold = QLabel("    Threshold:")

        self.step_pixels = QSpinBox()
        self.step_pixels.setMinimum(1)
        self.step_pixels.setMaximum(15)
        self.step_pixels.setValue(1)
        self.step_pixels_text = QLabel("    Step pixels:")

        self.btnClear = QToolButton()
        self.btnClear.setText('Clear')
        self.btnClear.clicked.connect(self.clear)

        #instruments panel
        instrument_layout = QHBoxLayout()
        instrument_layout.addWidget(self.btnLoad)
        instrument_layout.addWidget(self.radio_image)
        instrument_layout.addWidget(self.radio_image_all)
        instrument_layout.addWidget(self.threshold)
        instrument_layout.addWidget(self.brush_size_box)
        instrument_layout.addWidget(self.step_pixels_text)
        instrument_layout.addWidget(self.step_pixels)
        instrument_layout.addWidget(self.btnClear)
        instrument_layout.addStretch(
            10000)  #-------------------------------------  button place

        # Arrange layout
        VBlayout = QVBoxLayout()
        VBlayout.addLayout(instrument_layout)
        VBlayout.addWidget(self.viewer)

        self.setLayout(VBlayout)

    def loadImage(self):
        new_image_path = QFileDialog.getOpenFileName(self, "Pick an image")[0]
        self.image_path = new_image_path
        if utils.check_image_path(str(new_image_path)):
            image_name = new_image_path.split('/')[-1].split('.')[0]
            self.viewer.setPhoto(utils.load_image(new_image_path), image_name)
            self.viewer.update()

    def clear(self):
        self.viewer.setPhoto1(utils.load_image(self.etalon_path))
        self.viewer.update()
        image_name = self.image_path.split('/')[-1].split('.')[0]
        self.viewer.setPhoto(utils.load_image(self.image_path), image_name)
        self.viewer.update()
Example #5
0
    def __init__(self):
        super(Window, self).__init__()

        self.image_path = None
        self.transp = 10
        self.number_of_parts = 48

        self.viewer = DoubleViewer(self)
        self.viewer.setUpdatesEnabled(True)

        # 'Load image' button
        self.btnLoad = QToolButton()
        self.btnLoad.setText('Load image')
        self.btnLoad.clicked.connect(self.loadImage)

        #self.btnClear = QToolButton()
        #self.btnClear.setText('Clear')
        #self.btnClear.clicked.connect(self.clear)

        self.add_zoom = QToolButton()
        self.add_zoom.setText('+')
        self.add_zoom.clicked.connect(self.increase_zoom)
        self.decrease_zoom = QToolButton()
        self.decrease_zoom.setText('-')
        self.decrease_zoom.clicked.connect(self.reduce_zoom)

        select_wand = QHBoxLayout()
        select_wand.addWidget(self.add_zoom)
        select_wand.addWidget(self.decrease_zoom)
        zoom_group = QGroupBox("Zoom")
        zoom_group.setLayout(select_wand)

        self.show_denoise = QLabel("Denoise:")
        self.denoise = QCheckBox()
        self.denoise.setChecked(True)

        line_00 = QFrame()
        line_00.setFrameShape(QFrame.VLine)

        self.reduce_boundary = QToolButton()
        self.reduce_boundary.setText('-')
        self.reduce_boundary.clicked.connect(self.reduce_bound)

        self.boundary = QPushButton('Boundary', self)
        self.boundary.setCheckable(True)
        self.boundary.setChecked(False)
        self.boundary.clicked[bool].connect(self.show_boundary)

        self.increase_boundary = QToolButton()
        self.increase_boundary.setText('+')
        self.increase_boundary.clicked.connect(self.increase_bound)

        line_01 = QFrame()
        line_01.setFrameShape(QFrame.VLine)

        self.reduce_transparency = QToolButton()
        self.reduce_transparency.setText('-')
        self.reduce_transparency.clicked.connect(self.reduce_transp)

        self.image = QPushButton('Image', self)
        self.image.setCheckable(True)
        self.image.setChecked(True)
        self.image.clicked[bool].connect(self.show_image)

        self.increase_transparency = QToolButton()
        self.increase_transparency.setText('+')
        self.increase_transparency.clicked.connect(self.increase_transp)

        line_02 = QFrame()
        line_02.setFrameShape(QFrame.VLine)


        tool_options = QHBoxLayout()
        tool_options.addWidget(self.show_denoise)
        tool_options.addWidget(self.denoise)
        tool_options.addWidget(line_00)
        tool_options.addWidget(self.reduce_boundary)
        tool_options.addWidget(self.boundary)
        tool_options.addWidget(self.increase_boundary)
        tool_options.addWidget(line_01)
        tool_options.addWidget(self.reduce_transparency)
        tool_options.addWidget(self.image)
        tool_options.addWidget(self.increase_transparency)
        tool_options.addWidget(line_02)
        #tool_options.addWidget(self.btnClear)

        options_group = QGroupBox("Options")
        options_group.setLayout(tool_options)

        undo = QToolButton()
        undo.setText('Undo')
        undo.clicked.connect(self.undo)
        redo = QToolButton()
        redo.setText('Redo')
        redo.clicked.connect(self.redo)

        undo_redo = QHBoxLayout()
        undo_redo.addWidget(undo)
        undo_redo.addWidget(redo)
        edit_group = QGroupBox("Edit")
        edit_group.setLayout(undo_redo)

        self.selection_criterion = QComboBox(self)
        self.selection_criterion.addItems(['background', 'green', 'blue', 'yellow', 'black', 'red'])

        change_color = QToolButton()
        change_color.setText('Change color to:')
        change_color.clicked.connect(self.change_color)

        self.change_criterion = QComboBox(self)
        self.change_criterion.addItems(['background', 'green', 'blue', 'yellow', 'black', 'red'])

        color_option = QHBoxLayout()
        color_option.addWidget(self.selection_criterion)
        color_option.addWidget(change_color)
        color_option.addWidget(self.change_criterion)
        color_group = QGroupBox("Color option")
        color_group.setLayout(color_option)

        self.btnSave = QToolButton()
        self.btnSave.setText('Save mask')
        self.btnSave.clicked.connect(self.save_mask)

        # instruments panel
        instrument_layout = QHBoxLayout()
        instrument_layout.addWidget(zoom_group)
        instrument_layout.addWidget(options_group)
        instrument_layout.addWidget(edit_group)
        instrument_layout.addWidget(color_group)
        instrument_layout.addWidget(self.btnLoad)
        instrument_layout.addWidget(self.btnSave)
        instrument_layout.addStretch(10000)

        # Arrange layout
        VBlayout = QVBoxLayout()
        VBlayout.addLayout(instrument_layout)
        VBlayout.addWidget(self.viewer)

        self.setLayout(VBlayout)
Example #6
0
class Window(QWidget):
    def __init__(self):
        super(Window, self).__init__()

        self.image_path = None
        self.transp = 10
        self.number_of_parts = 48

        self.viewer = DoubleViewer(self)
        self.viewer.setUpdatesEnabled(True)

        # 'Load image' button
        self.btnLoad = QToolButton()
        self.btnLoad.setText('Load image')
        self.btnLoad.clicked.connect(self.loadImage)

        #self.btnClear = QToolButton()
        #self.btnClear.setText('Clear')
        #self.btnClear.clicked.connect(self.clear)

        self.add_zoom = QToolButton()
        self.add_zoom.setText('+')
        self.add_zoom.clicked.connect(self.increase_zoom)
        self.decrease_zoom = QToolButton()
        self.decrease_zoom.setText('-')
        self.decrease_zoom.clicked.connect(self.reduce_zoom)

        select_wand = QHBoxLayout()
        select_wand.addWidget(self.add_zoom)
        select_wand.addWidget(self.decrease_zoom)
        zoom_group = QGroupBox("Zoom")
        zoom_group.setLayout(select_wand)

        self.show_denoise = QLabel("Denoise:")
        self.denoise = QCheckBox()
        self.denoise.setChecked(True)

        line_00 = QFrame()
        line_00.setFrameShape(QFrame.VLine)

        self.reduce_boundary = QToolButton()
        self.reduce_boundary.setText('-')
        self.reduce_boundary.clicked.connect(self.reduce_bound)

        self.boundary = QPushButton('Boundary', self)
        self.boundary.setCheckable(True)
        self.boundary.setChecked(False)
        self.boundary.clicked[bool].connect(self.show_boundary)

        self.increase_boundary = QToolButton()
        self.increase_boundary.setText('+')
        self.increase_boundary.clicked.connect(self.increase_bound)

        line_01 = QFrame()
        line_01.setFrameShape(QFrame.VLine)

        self.reduce_transparency = QToolButton()
        self.reduce_transparency.setText('-')
        self.reduce_transparency.clicked.connect(self.reduce_transp)

        self.image = QPushButton('Image', self)
        self.image.setCheckable(True)
        self.image.setChecked(True)
        self.image.clicked[bool].connect(self.show_image)

        self.increase_transparency = QToolButton()
        self.increase_transparency.setText('+')
        self.increase_transparency.clicked.connect(self.increase_transp)

        line_02 = QFrame()
        line_02.setFrameShape(QFrame.VLine)


        tool_options = QHBoxLayout()
        tool_options.addWidget(self.show_denoise)
        tool_options.addWidget(self.denoise)
        tool_options.addWidget(line_00)
        tool_options.addWidget(self.reduce_boundary)
        tool_options.addWidget(self.boundary)
        tool_options.addWidget(self.increase_boundary)
        tool_options.addWidget(line_01)
        tool_options.addWidget(self.reduce_transparency)
        tool_options.addWidget(self.image)
        tool_options.addWidget(self.increase_transparency)
        tool_options.addWidget(line_02)
        #tool_options.addWidget(self.btnClear)

        options_group = QGroupBox("Options")
        options_group.setLayout(tool_options)

        undo = QToolButton()
        undo.setText('Undo')
        undo.clicked.connect(self.undo)
        redo = QToolButton()
        redo.setText('Redo')
        redo.clicked.connect(self.redo)

        undo_redo = QHBoxLayout()
        undo_redo.addWidget(undo)
        undo_redo.addWidget(redo)
        edit_group = QGroupBox("Edit")
        edit_group.setLayout(undo_redo)

        self.selection_criterion = QComboBox(self)
        self.selection_criterion.addItems(['background', 'green', 'blue', 'yellow', 'black', 'red'])

        change_color = QToolButton()
        change_color.setText('Change color to:')
        change_color.clicked.connect(self.change_color)

        self.change_criterion = QComboBox(self)
        self.change_criterion.addItems(['background', 'green', 'blue', 'yellow', 'black', 'red'])

        color_option = QHBoxLayout()
        color_option.addWidget(self.selection_criterion)
        color_option.addWidget(change_color)
        color_option.addWidget(self.change_criterion)
        color_group = QGroupBox("Color option")
        color_group.setLayout(color_option)

        self.btnSave = QToolButton()
        self.btnSave.setText('Save mask')
        self.btnSave.clicked.connect(self.save_mask)

        # instruments panel
        instrument_layout = QHBoxLayout()
        instrument_layout.addWidget(zoom_group)
        instrument_layout.addWidget(options_group)
        instrument_layout.addWidget(edit_group)
        instrument_layout.addWidget(color_group)
        instrument_layout.addWidget(self.btnLoad)
        instrument_layout.addWidget(self.btnSave)
        instrument_layout.addStretch(10000)

        # Arrange layout
        VBlayout = QVBoxLayout()
        VBlayout.addLayout(instrument_layout)
        VBlayout.addWidget(self.viewer)

        self.setLayout(VBlayout)


    def loadImage(self):
        new_image_path = QFileDialog.getOpenFileName(self, "Pick an image")[0]
        self.image_path = new_image_path
        print(new_image_path)
        if utils.check_image_path(str(new_image_path)):
            #image_name = new_image_path.split('/')[-1].split('.')[0]
            self.viewer.setPhoto(utils.load_image(new_image_path))
            self.viewer.boundary()
            self.viewer.update()


    def save_mask(self):
        save_path = QFileDialog.getSaveFileName(self, "Save mask as:")[0]
        print('save_path = ', save_path)
        self.viewer.save_mask(save_path)


    '''
    def clear(self):
        if self.image_path is None:
            image_path = QMessageBox()
            image_path.setIcon(QMessageBox.Critical)
            image_path.setWindowTitle("Warning")
            image_path.setText("Please, choise the image!")
            image_path.exec_()
        else:
            self.viewer.setPhoto(utils.load_image(self.image_path))
            self.viewer.update()
    '''

    def show_image(self):
        if self.image_path is None:
            pass
        else:
            self.viewer.updatePhoto(utils.load_image(self.image_path))
            self.viewer.update()


    def reduce_transp(self):
        if self.transp < 100:
            self.transp += 10
            self.viewer.updatePhoto(utils.load_image(self.image_path))
            self.viewer.update()


    def increase_transp(self):
        if self.transp > 0:
            self.transp -= 10
            self.viewer.updatePhoto(utils.load_image(self.image_path))
            self.viewer.update()


    def show_boundary(self):
        if self.image_path is None:
            pass
        else:
            self.viewer.updatePhoto(utils.load_image(self.image_path))
            self.viewer.update()


    def reduce_bound(self):
        if self.number_of_parts > 1:
                self.number_of_parts //= 2
                self.viewer.boundary()
                self.show_boundary()


    def increase_bound(self):
        self.number_of_parts *= 2
        self.viewer.boundary()
        self.show_boundary()


    def undo(self):
        self.viewer.undo()


    def redo(self):
        self.viewer.redo()


    def increase_zoom(self):
        pass


    def reduce_zoom(self):
        pass


    def change_color(self):
        if self.image_path is None:
            pass
        else:
            self.viewer.change_color()