Beispiel #1
0
        def _show_current(self):
            data = self._sets[self._cur_sid]
            img0 = data[0][self._cur_pid]
            img1 = data[1][self._cur_pid]
            output = data[2][self._cur_pid]
            target = data[3][self._cur_pid]

            pixmap0 = QtGui.QPixmap.fromImage(ndarray2qimage(img0))
            pixmap1 = QtGui.QPixmap.fromImage(ndarray2qimage(img1))
            self.image_panel[0].setPixmap(pixmap0)
            self.image_panel[1].setPixmap(pixmap1)

            self.unival_table[0].hide()
            self.multival_table[0].hide()
            self.unival_table[1].hide()
            self.multival_table[1].hide()

            compare_unival(self.unival_table[0], output[:output_offset], target[:target_offset])
            compare_multival(self.multival_table[0], output[:output_offset], target[:target_offset])
            compare_unival(self.unival_table[1], output[output_offset:], target[target_offset:])
            compare_multival(self.multival_table[1], output[output_offset:], target[target_offset:])

            self.unival_table[0].show()
            self.multival_table[0].show()
            self.unival_table[1].show()
            self.multival_table[1].show()

            self.reid_panel.setText('Output: {0:.5f}\nTarget: {1}'.format(output[-1], target[-1]))
Beispiel #2
0
        def _show_current(self):
            data = self._sets[self._cur_sid]
            img0 = data[0][self._cur_pid]
            img1 = data[1][self._cur_pid]
            output = data[2][self._cur_pid]
            target = data[3][self._cur_pid]

            pixmap0 = QtGui.QPixmap.fromImage(ndarray2qimage(img0))
            pixmap1 = QtGui.QPixmap.fromImage(ndarray2qimage(img1))
            self.image_panel[0].setPixmap(pixmap0)
            self.image_panel[1].setPixmap(pixmap1)

            self.unival_table[0].hide()
            self.multival_table[0].hide()
            self.unival_table[1].hide()
            self.multival_table[1].hide()

            compare_unival(self.unival_table[0], output[:output_offset],
                           target[:target_offset])
            compare_multival(self.multival_table[0], output[:output_offset],
                             target[:target_offset])
            compare_unival(self.unival_table[1], output[output_offset:],
                           target[target_offset:])
            compare_multival(self.multival_table[1], output[output_offset:],
                             target[target_offset:])

            self.unival_table[0].show()
            self.multival_table[0].show()
            self.unival_table[1].show()
            self.multival_table[1].show()

            self.reid_panel.setText('Output: {0:.5f}\nTarget: {1}'.format(
                output[-1], target[-1]))
Beispiel #3
0
        def _show_current(self):
            data = self._sets[self._cur_sid]
            img = data[0][self._cur_pid]
            output = data[1][self._cur_pid]
            target = data[2][self._cur_pid]

            pixmap = QtGui.QPixmap.fromImage(ndarray2qimage(img))
            self.image_panel.setPixmap(pixmap)

            self.unival_table.hide()
            self.multival_table.hide()

            compare_unival(self.unival_table, output, target)
            compare_multival(self.multival_table, output, target)

            self.unival_table.show()
            self.multival_table.show()
Beispiel #4
0
    def show_pid(self, pid):
        # Show images
        self._gallery.itemSelectionChanged.disconnect(self.update_attr)
        self._gallery.clear()

        for v in xrange(self.mat_images.shape[1]):
            if self.mat_images[pid, v].size == 0: break
            for k in xrange(self.mat_images[pid, v].shape[1]):
                img = self.mat_images[pid, v][0, k]
                img = ndarray2qimage(imageproc.imresize(img, (256, 96)))
                item = QtGui.QListWidgetItem(
                    QtGui.QIcon(QtGui.QPixmap.fromImage(img)),
                    '{0},{1}'.format(v, k))
                self._gallery.addItem(item)
                item.setSelected(True)

        self._gallery.itemSelectionChanged.connect(self.update_attr)

        # Show attributes
        self.update_attr()

        # Show status
        self._status.setText('{0} / {1}'.format(pid+1, self.mat_images.shape[0]))
    def show_images(self, images):
        """Show images in a flow layout

        Args:
            images: An array of images. Each image is a numpy matrix.
        """

        if type(images) is list:
            nimages = len(images)
        else:
            images = images.squeeze(axis=0)
            nimages = images.shape[0]

        cur_nwidgets = len(self.subwidgets)

        # Expand of shrink the sub widgets list
        if nimages > cur_nwidgets:
            for i in xrange(nimages - cur_nwidgets):
                x = QtGui.QLabel()

                if self.n_cols is None:
                    self.layout.addWidget(x)
                else:
                    r, c = len(self.subwidgets) // self.n_cols, \
                           len(self.subwidgets) % self.n_cols
                    self.layout.addWidget(x, r, c)

                self.subwidgets.append(x)
        else:
            for i in xrange(nimages, cur_nwidgets):
                self.layout.removeWidget(self.subwidgets[i])
                self.subwidgets[i].deleteLater()
            self.subwidgets = self.subwidgets[0:nimages]

        for i, x in enumerate(self.subwidgets):
            qimg = ndarray2qimage(images[i])
            x.setPixmap(QtGui.QPixmap.fromImage(qimg))