def acceptCB(self, feedback):
     (row1, col1) = im_utils.pixelsFromMeters(self.x1, self.y1, self.ppm, self.image.rows, self.image.cols)
     (row2, col2) = im_utils.pixelsFromMeters(self.x2, self.y2, self.ppm, self.image.rows, self.image.cols)
     
     min_row = max(0, min(row1, row2))
     max_row = min(self.image.rows-1, max(row1, row2))
     min_col = max(0, min(col1, col2))
     max_col = min(self.image.cols-1, max(col1, col2))
     
     self.result = (min_row, max_row, min_col, max_col)
     self.im_server.clear()
     self.im_server.applyChanges()
     self.hmi_callback()
Ejemplo n.º 2
0
 def foreground_cb(self, feedback):
     if feedback.mouse_point_valid:
         (row, col) = im_utils.pixelsFromMeters(feedback.mouse_point.x,
                                                feedback.mouse_point.y,
                                                self.ppm, self.image.rows,
                                                self.image.cols)
         self.fg.append(Pixel(col, row))
    def acceptCB(self, feedback):
        (row1, col1) = im_utils.pixelsFromMeters(self.x1, self.y1, self.ppm,
                                                 self.image.rows,
                                                 self.image.cols)
        (row2, col2) = im_utils.pixelsFromMeters(self.x2, self.y2, self.ppm,
                                                 self.image.rows,
                                                 self.image.cols)

        min_row = max(0, min(row1, row2))
        max_row = min(self.image.rows - 1, max(row1, row2))
        min_col = max(0, min(col1, col2))
        max_col = min(self.image.cols - 1, max(col1, col2))

        self.result = (min_row, max_row, min_col, max_col)
        self.im_server.clear()
        self.im_server.applyChanges()
        self.hmi_callback()
 def background_cb(self, feedback):
     if feedback.mouse_point_valid:
         (row, col) = im_utils.pixelsFromMeters(feedback.mouse_point.x, feedback.mouse_point.y,
                                                self.ppm, self.image.rows, self.image.cols)
         self.bg.append(Pixel(col, row))