def onDFT(self): im_fft = dip.fft(self.im[1]) if self.actionopencv_window.isChecked(): cv2.destroyAllWindows() cv2.namedWindow('DFT', cv2.WINDOW_NORMAL) cv2.imshow('DFT', im_fft) cv2.waitKey(0) cv2.destroyAllWindows() I = im_fft.copy() self.img.setImage(dip.displayTr(I)) self.vb.addItem(img) self.vb.autoRange()
def onDraw(self): self.im[1] = dip.draw(self.im[1]) if self.actionopencv_window.isChecked(): cv2.destroyAllWindows() cv2.namedWindow('Draw', cv2.WINDOW_NORMAL) cv2.imshow('Draw', self.im[1]) cv2.waitKey(0) cv2.destroyAllWindows() I = self.im[1].copy() self.img.setImage(dip.displayTr(I)) self.vb.addItem(img) self.vb.autoRange()
def onLaplace(self): k = [[0, -1, 0], [-1, 4, -1], [0, -1, 1]] self.im[1] = dip.ImConv(self.im[1], k).astype('uint8') if self.actionopencv_window.isChecked(): cv2.destroyAllWindows() cv2.namedWindow('Laplace', cv2.WINDOW_NORMAL) cv2.imshow('Laplace', self.im[1]) cv2.waitKey(0) cv2.destroyAllWindows() I = self.im[1].copy() self.img.setImage(dip.displayTr(I)) self.vb.addItem(img) self.vb.autoRange()
def onCanny(self): m, n, z = self.im[1].shape img = np.zeros((m, n)) img = cv2.Canny(self.im[1], 50, 150) self.im[1][:, :, 0] = img self.im[1][:, :, 1] = img self.im[1][:, :, 2] = img if self.actionopencv_window.isChecked(): cv2.destroyAllWindows() cv2.namedWindow('Canny', cv2.WINDOW_NORMAL) cv2.imshow('Canny', self.im[1]) cv2.waitKey(0) cv2.destroyAllWindows() I = self.im[1].copy() self.img.setImage(dip.displayTr(I)) self.vb.addItem(img) self.vb.autoRange()
def onOpen(self): qpath = QFileDialog.getOpenFileName(self, 'Open file', '.', "jpg files (*.jpg)") path = unicode(qpath.toUtf8(), 'utf-8', 'ignore') #self.label.setPixmap(QPixmap(qpath)) im0 = cv2.imread(path) self.im = [] self.im.append(im0) self.im.append(im0) I = self.im[1].copy() self.img.setImage(dip.displayTr(I)) if self.actionopencv_window.isChecked(): cv2.namedWindow('origin', cv2.WINDOW_NORMAL) cv2.imshow('origin', self.im[1]) cv2.waitKey(0) cv2.destroyAllWindows()