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


Python Point.get_last_seen_coordinates方法代码示例

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


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

示例1: LaserMote

# 需要导入模块: from Point import Point [as 别名]
# 或者: from Point.Point import get_last_seen_coordinates [as 别名]

#.........这里部分代码省略.........
        :param x: dot's x axis value
        :param y: dot's y axis value
        :return: ObjectLocation object
        """
        for o in self.object_locations:
            left_x = min(o.x1, o.x2)
            right_x = max(o.x1, o.x2)

            bottom_y = min(o.y1, o.y2)
            top_y = max(o.y1, o.y2)

            if x < left_x:
                continue
            if x > right_x:
                continue
            if y > top_y:
                continue
            if y < bottom_y:
                continue

            return o

        return None

    def get_distance(self, x2, y2):
        """
        Calculates the Euclidean distance between the given point (x2,y2) and last seen point.

        :param x2: x axis value.
        :param y2: y axis value.
        :return: the Euclidean distance between the given point (x2,y2) and last seen point.
        :rtype : double
        """
        x1, y1 = self.point.get_last_seen_coordinates()
        dist = math.sqrt(math.pow(x2 - x1, 2) + math.pow(y2 - y1, 2))
        print dist
        return dist

    def setup_video(self):
        # create VideoWriter object
        fps = 12
        self.out = cv2.VideoWriter('Tracking'
                                   '.avi', -1, fps, (640, 480), True)
        print self.out

    def setup_capture(self):
        """
        Setups the camera capture.

        :return: camera capture.
        :rtype: VideoCapture object
        """
        self.camera = cv2.VideoCapture(0)
        if not self.camera.isOpened():
            sys.stderr.write("Error capturing camera at location 0. Quitting.\n")
            sys.exit(1)

        return self.camera

    @staticmethod
    def time_in_h_m_s():
        return time.strftime('%H:%M:%S')

    def debug_text(self, cx=None, cy=None, area=None, found=False):
        """
        Returns text describing location and area of laser dot, if found.
开发者ID:seanjensengrey,项目名称:LaserMote,代码行数:70,代码来源:LaserMote.py


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