Example #1
0
 def videoFrame1(self, image):
     self.cv_image = self.cv.imgmsg_to_cv2(image, "rgb8")
     self.cv_image = cv2.cvtColor(self.cv_image, cv2.COLOR_BGR2RGB)
     self.cv_image = cv2.resize(self.cv_image, (self.cv_image.shape[1]/2, self.cv_image.shape[0]/2))
     lab_img, cont_image, center_mass, cont_area = find_car(self.cv_image, self.trackingColor, self.hsThreshold.value()/100.0)
     self.cv_image = find_rectangles(self.cv_image)
     qi = QImage(cont_image.data, cont_image.shape[1], cont_image.shape[0], QImage.Format_RGB888).rgbSwapped()
     self.lbVideo1.setFixedHeight(cont_image.shape[0])
     self.lbVideo1.setFixedWidth(cont_image.shape[1])
     self.lbVideo1.setPixmap(QPixmap.fromImage(qi))
Example #2
0
    def videoFrame(self, image):
        self.cv_image = self.cv.imgmsg_to_cv2(image, "rgb8")
        self.cv_image = cv2.cvtColor(self.cv_image, cv2.COLOR_BGR2RGB)
        self.cv_image = cv2.resize(self.cv_image, (self.cv_image.shape[1]/2, self.cv_image.shape[0]/2))
        lab_img, cont_image, center_mass, cont_area = find_car(self.cv_image, self.trackingColor, self.hsThreshold.value()/100.0)
        self.cv_image = find_rectangles(self.cv_image)
        qi = QImage(cont_image.data, cont_image.shape[1], cont_image.shape[0], QImage.Format_RGB888).rgbSwapped()
        self.lbVideo.setFixedHeight(cont_image.shape[0])
        self.lbVideo.setFixedWidth(cont_image.shape[1])
        self.lbVideo.setPixmap(QPixmap.fromImage(qi))
        

        x_center = center_mass[0]
        y_center = center_mass[1]

        self.handle(cont_area)

        if self.cbAuto.isChecked():
            self.fly(x_center, y_center, cont_area)
        else:
            self.lbAuto.setText('Disabled.')