当前位置: 首页>>代码示例>>Python>>正文


Python cv2.TrackerMOSSE_create方法代码示例

本文整理汇总了Python中cv2.TrackerMOSSE_create方法的典型用法代码示例。如果您正苦于以下问题:Python cv2.TrackerMOSSE_create方法的具体用法?Python cv2.TrackerMOSSE_create怎么用?Python cv2.TrackerMOSSE_create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cv2的用法示例。


在下文中一共展示了cv2.TrackerMOSSE_create方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: predictionCallback

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import TrackerMOSSE_create [as 别名]
def predictionCallback(self, client, userdata, message):
        print('<< predictionCallback() >>')

        data = json.loads(message.payload.decode())

        if len(data['prediction']) > 0 and data['prediction'][0][0] > -1:

            self.last_confidence = round(data['prediction'][0][2]*100,2)
            self.last_detected_class = int(data['prediction'][0][0])
            x1 = data['prediction'][0][2]*self.IMAGE_WIDTH
            y1 = data['prediction'][0][3]*self.IMAGE_HEIGHT
            x2 = data['prediction'][0][4]*self.IMAGE_WIDTH
            y2 = data['prediction'][0][5]*self.IMAGE_HEIGHT
            w = x2-x1
            h = y2-y1

            print("({},{},{},{})".format(x1,x2,y1,y2))
            print("({},{})".format(w,h))

            self.initBB = (int(x1), int(y1), int(w), int(h))
            # self.tracker = cv2.TrackerMOSSE_create()
            # self.tracker = cv2.TrackerKCF_create()
            self.tracker = cv2.TrackerCSRT_create()
            self.tracker.init(self.inferenceFrame, self.initBB)   
            self.trackerInitialized = True 
开发者ID:aws-samples,项目名称:aws-builders-fair-projects,代码行数:27,代码来源:ground-control.py

示例2: call_tracker_constructor

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import TrackerMOSSE_create [as 别名]
def call_tracker_constructor(self, tracker_type):
        # -- TODO: remove this if I assume OpenCV version > 3.4.0
        if int(self.major_ver == 3) and int(self.minor_ver) < 3:
            tracker = cv2.Tracker_create(tracker_type)
        # --
        else:
            if tracker_type == 'CSRT':
                tracker = cv2.TrackerCSRT_create()
            elif tracker_type == 'KCF':
                tracker = cv2.TrackerKCF_create()
            elif tracker_type == 'MOSSE':
                tracker = cv2.TrackerMOSSE_create()
            elif tracker_type == 'MIL':
                tracker = cv2.TrackerMIL_create()
            elif tracker_type == 'BOOSTING':
                tracker = cv2.TrackerBoosting_create()
            elif tracker_type == 'MEDIANFLOW':
                tracker = cv2.TrackerMedianFlow_create()
            elif tracker_type == 'TLD':
                tracker = cv2.TrackerTLD_create()
            elif tracker_type == 'GOTURN':
                tracker = cv2.TrackerGOTURN_create()
        return tracker 
开发者ID:Cartucho,项目名称:OpenLabeling,代码行数:25,代码来源:main_auto.py

示例3: call_tracker_constructor

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import TrackerMOSSE_create [as 别名]
def call_tracker_constructor(self, tracker_type):
        if tracker_type == 'DASIAMRPN':
            tracker = dasiamrpn()
        else:
            # -- TODO: remove this if I assume OpenCV version > 3.4.0
            if int(self.major_ver == 3) and int(self.minor_ver) < 3:
                #tracker = cv2.Tracker_create(tracker_type)
                pass
            # --
            else:
                try:
                    tracker = cv2.TrackerKCF_create()
                except AttributeError as error:
                    print(error)
                    print('\nMake sure that OpenCV contribute is installed: opencv-contrib-python\n')
                if tracker_type == 'CSRT':
                    tracker = cv2.TrackerCSRT_create()
                elif tracker_type == 'KCF':
                    tracker = cv2.TrackerKCF_create()
                elif tracker_type == 'MOSSE':
                    tracker = cv2.TrackerMOSSE_create()
                elif tracker_type == 'MIL':
                    tracker = cv2.TrackerMIL_create()
                elif tracker_type == 'BOOSTING':
                    tracker = cv2.TrackerBoosting_create()
                elif tracker_type == 'MEDIANFLOW':
                    tracker = cv2.TrackerMedianFlow_create()
                elif tracker_type == 'TLD':
                    tracker = cv2.TrackerTLD_create()
                elif tracker_type == 'GOTURN':
                    tracker = cv2.TrackerGOTURN_create()
        return tracker 
开发者ID:Cartucho,项目名称:OpenLabeling,代码行数:34,代码来源:main.py

示例4: init

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import TrackerMOSSE_create [as 别名]
def init(self, first_frame, bbox):
        if self.name == 'KCF':
            self.tracker = cv2.TrackerKCF_create()
        elif self.name == 'MOSSE':
            self.tracker = cv2.TrackerMOSSE_create()
        elif self.name == 'CSRDCF':
            self.tracker = cv2.TrackerCSRT_create()
        else:
            raise NotImplementedError
        self.tracker.init(first_frame, bbox) 
开发者ID:fengyang95,项目名称:pyCFTrackers,代码行数:12,代码来源:opencv_cftracker.py

示例5: mouseReleaseEvent

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import TrackerMOSSE_create [as 别名]
def mouseReleaseEvent(self, _):
        """
        @type event: QMouseEvent
        @param event:
        @return:
        """
        # Prevent draw on video if not started or finished
        if self.parent.player.position() == 0:
            return

        # Censure Draw Interaction
        if self._interaction.censure:
            geom = self.Censure_RubberBand.geometry()
            self.Censure_RubberBand.hide()
            self.drawCesure.append([geom])

        # Object Tracking Interaction
        if self._interaction.objectTracking:
            geom = self.Tracking_Video_RubberBand.geometry()
            offset = self.surface.videoRect()
            bbox = (geom.x() - offset.x(), geom.y() - offset.y(), geom.width(), geom.height())
            img = self.currentFrame()
            frame = convertQImageToMat(img)
            # Remo rubberband on canvas and video
            self.Tracking_Video_RubberBand.hide()
            self.Track_Canvas_RubberBand.reset()

            self.tracker = TrackerMOSSE_create()
            result = resize(frame, (offset.width(), offset.height()))

            try:
                ok = self.tracker.init(result, bbox)
            except Exception:
                return
            if ok:
                self._isinit = True
                # Get Traker center
                xc = bbox[0] + (geom.width() / 2)
                yc = bbox[1] + (geom.height() / 2)
                p = QPoint(xc, yc)
                Longitude, Latitude, _ = vut.GetPointCommonCoords(
                    p, self.surface)
                # Draw Rubber Band on canvas
                self.Track_Canvas_RubberBand.addPoint(QgsPointXY(Longitude, Latitude))
            else:
                self._isinit = False 
开发者ID:All4Gis,项目名称:QGISFMV,代码行数:48,代码来源:QgsVideo.py


注:本文中的cv2.TrackerMOSSE_create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。