def setCvImage(self, image) : self.originalHeight, self.originalWidth, _ = image.shape if self._showContour == True : cnt = numpy.array(self._contour, dtype=numpy.int32) cv2.drawContours(image, [cnt], 0, [255, 255, 255], 3) self.qtPixmap = QtCV.cvMatToQPixmap(image); self.qtPixmap.scaled(self.width(), self.height(), Qt.KeepAspectRatio) self.setPixmap(self.qtPixmap)
def setCvImage(self, image): self.originalHeight, self.originalWidth, _ = image.shape if self._showContour == True: cnt = numpy.array(self._contour, dtype=numpy.int32) cv2.drawContours(image, [cnt], 0, [255, 255, 255], 3) self.qtPixmap = QtCV.cvMatToQPixmap(image) self.qtPixmap.scaled(self.width(), self.height(), Qt.KeepAspectRatio) self.setPixmap(self.qtPixmap)
def mainLoop() : if stream.readable() == False : return frame = stream.getFrame(); objects = detector.findObjects(frame, ciw.npLower(), ciw.npUpper()) #debugInfo.setText(str(objects)) tracker.processNewPositions(objects) x, y, r = tracker.objectPosition(); if x >= 0 and y >= 0 and r >= 0 : cv2.circle(frame, (int(x), int(y)), int(r), (0, 0, 255), 3) #imagew.setCvImage(frame) #mask = cv2.inRange(frame, ciw.npLower(), ciw.npUpper()) #result = cv2.bitwise_and(frame, frame, mask = mask) result = frame qpm = QtCV.cvMatToQPixmap(frame) imageLabel.setPixmap(qpm.scaled(qpm.width() * zoom, qpm.height() * zoom, Qt.KeepAspectRatio)) imageLabel.resize(qpm.size())