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


Python Box.to_tuple方法代码示例

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


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

示例1: Scanner

# 需要导入模块: from models import Box [as 别名]
# 或者: from models.Box import to_tuple [as 别名]

#.........这里部分代码省略.........
            v = self.get_laser_plane_intersection(v)

            # Ignore any vertices that have negative z coordinates (pre scaling)
            if v[2] < 0:
                continue

            x,y,z = v*self.scale
            x,y,z = rotate('z', v, self.rotation_angle)

            vertex = Vertex(x, y, z)
            processed_frame.append(vertex)

        self.processed_frames.append(processed_frame)

    def show_frame(self):
        cv2.line(self.display_image, (self.width/2, 0), (self.width/2, self.height), (255, 255, 255))
        cv2.line(self.display_image, (0, self.height/2), (self.width, self.height/2), (255, 255, 255))

        if self.platform_middle:
            cv2.line(
                self.display_image,
                (self.platform_middle[0]-10, self.platform_middle[1]),
                (self.platform_middle[0]+10, self.platform_middle[1]),
                (255, 0, 0)
            )
            cv2.line(
                self.display_image,
                (self.platform_middle[0], self.platform_middle[1]-10),
                (self.platform_middle[0], self.platform_middle[1]+10),
                (255, 0, 0)
            )

        if self.area and self.area.is_complete():
            x1, y1, x2, y2 = [int(c) for c in self.area.to_tuple()]
            cv2.rectangle(self.display_image, (x1, y1), (x2, y2), (255, 100, 0))

        for index, (timestamp, message) in enumerate(self.ui_messages):
            cv2.putText(self.display_image, message, (10, self.height-10-15*index), cv2.FONT_HERSHEY_COMPLEX_SMALL, 0.8, (255, 255, 255))

        cv2.imshow(self.window_name, self.display_image)

    def rotate(self):
        self.rotation_angle += self.rotation_step
        self.send_command('s')

    def closest_vertex_y(self, y, frame):
        """ Finds vertex in frame the y coordinate of which is closest to y """

        'Find rightmost value less than or equal to x'
        return max(0, bisect_right([v.y for v in frame], y)-1)

    def save_image(self):
        f = open('output.obj', 'w')
        print "writing to file..."

        for frame in self.processed_frames:
            for vertex in frame:
                f.write('v %s %s %s\n' % vertex.to_tuple())

        f.close()
        self.processed_frames = []
        print "Done writing output file."

    def red_filter(self, image):
        begin_lower_border = numpy.array([0, 50, 20])
        begin_upper_border = numpy.array([35, 255, 255])
开发者ID:kirberich,项目名称:3dscanner,代码行数:70,代码来源:scanner.py


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