當前位置: 首頁>>代碼示例>>Python>>正文


Python cv2.TrackerCSRT_create方法代碼示例

本文整理匯總了Python中cv2.TrackerCSRT_create方法的典型用法代碼示例。如果您正苦於以下問題:Python cv2.TrackerCSRT_create方法的具體用法?Python cv2.TrackerCSRT_create怎麽用?Python cv2.TrackerCSRT_create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在cv2的用法示例。


在下文中一共展示了cv2.TrackerCSRT_create方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: call_tracker_constructor

# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import TrackerCSRT_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

示例2: test_blob_update

# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import TrackerCSRT_create [as 別名]
def test_blob_update():
    _bounding_box = [1, 1, 4, 4]
    _type = 'car'
    _confidence = 0.99
    _tracker = cv2.TrackerKCF_create()
    blob = Blob(_bounding_box, _type, _confidence, _tracker)

    _new_bounding_box = [2, 2, 5, 5]
    _new_type = 'bus'
    _new_confidence = 0.35
    _new_tracker = cv2.TrackerCSRT_create()
    blob.update(_new_bounding_box, _new_type, _new_confidence, _new_tracker)

    assert blob.bounding_box == _new_bounding_box
    assert blob.type == _new_type
    assert blob.type_confidence == _new_confidence
    assert blob.tracker == _new_tracker 
開發者ID:nicholaskajoh,項目名稱:ivy,代碼行數:19,代碼來源:test_blob.py

示例3: process

# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import TrackerCSRT_create [as 別名]
def process(self, image):
        self.detected = False
        self.__face_recognition.put_image(image)
        original_image, coordonates = self.__face_recognition.get_result()
        if original_image is not None:
            x, y, x1, y1 = coordonates
            if not hasattr(cv2, 'TrackerCSRT_create') or not callable(getattr(cv2, 'TrackerCSRT_create')):
                self.circle_coordonates = self.__get_center_radius((x, y, x1, y1))
                self.detected = True
                return
            self.__tracker = cv2.TrackerCSRT_create()
            self.__tracker.init(original_image, (x, y, (x1 - x), abs(y1 - y)))
            return

        if self.__tracker is None:
            return

        (success, box) = self.__tracker.update(image)
        if success:
            (x, y, w, h) = [int(v) for v in box]
            self.circle_coordonates = self.__get_center_radius((x, y, x + w, y + h))
            self.detected = True 
開發者ID:danionescu0,項目名稱:robot-camera-platform,代碼行數:24,代碼來源:SpecificFaceDetector.py

示例4: predictionCallback

# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import TrackerCSRT_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

示例5: call_tracker_constructor

# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import TrackerCSRT_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

示例6: init

# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import TrackerCSRT_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

示例7: _csrt_create

# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import TrackerCSRT_create [as 別名]
def _csrt_create(bounding_box, frame):
    '''
    Create an OpenCV CSRT Tracker object.
    '''
    tracker = cv2.TrackerCSRT_create()
    tracker.init(frame, tuple(bounding_box))
    return tracker 
開發者ID:nicholaskajoh,項目名稱:ivy,代碼行數:9,代碼來源:tracker.py


注:本文中的cv2.TrackerCSRT_create方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。