我想使用python opencv和pyqt平方图像

时间:2019-05-06 10:54:13

标签: opencv pyqt5

我想使用opencv3.4.0读取图像,并在pyqt5的标签小部件中表示的图像上方绘制一个矩形。 但是,将渲染图像,但不会渲染在opencv中输入的矩形。 帮助

def imgShowLabel(self):
        self.img_list = []
        self.img_idx = 0
        for img_file in self.ex_opFile:
            if img_file.endswith('.jpg'):
                self.img_list.append(img_file)
                self.Imagelabel.setPixmap(QPixmap(open_File + self.img_list[self.img_idx]))

                self.img = cv2.imread(img_file, cv2.IMREAD_COLOR)
                #self.img2.append(self.img)

        pt = self.makeBoxes()
        for ptn in range(len(pt)):
            cv2.putText(self.img, pt[ptn][0], (int(pt[ptn][1]), int(pt[ptn][2])), cv2.FONT_HERSHEY_SIMPLEX, 0.6, (0,0,255))
            cv2.rectangle(self.img,(int(pt[ptn][1]),int(pt[ptn][2])),(int(pt[ptn][3]),int(pt[ptn][4])),(0,255,0),1)

结果是既显示了小部件和图像,但未显示计算出的正方形图像

0 个答案:

没有答案