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


Python Texture.putTexture方法代码示例

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


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

示例1: generateVideoButton

# 需要导入模块: from texture import Texture [as 别名]
# 或者: from texture.Texture import putTexture [as 别名]
    def generateVideoButton(self):
        # for i in range(len(self.shapes)):
        #     print " "
        #     print self.shapes[i].name
        #     for j in range(len(self.shapes[i].faces)):
        #         print self.shapes[i].faces[j].faceOrientation, " : ", self.shapes[i].faces[j].facePoints
        
        mb = ModelBuilder()
        Models = []
        for i in self.shapes:
            each_model = mb.BuildModel(i)
            # Print out the 3D model's vertex and texel coordinate
            # print "Print out the 3D model's vertex and texel coordinate---------------------------"
            # for j in each_model:
            #     # j is one polygon
            #     print "Vertex is:"
            #     for k in j.Vertex:
            #         print k.x, k.y, k.z
            #     print "Texel is:"
            #     for n in j.Texel:
            #         print n.u, n.v
            Models.append(each_model)
        print "Models list size: ", len(Models)
        img = cv2.imread("project.png",cv2.CV_LOAD_IMAGE_COLOR)
        texture = Texture(img)
        points = []
        
        for i in range(0,len(Models),1):
            
            pointsOfEachModel = []
            if (i<5): # for single model building 4,11,12,13 and ground
                fileIndex = i
                for j in range(len(Models[i])): # j is surfaces of each model
                    pointsOfEachFace = texture.putTexture(Models[i][j])
                    pointsOfEachModel.extend(pointsOfEachFace)
                
            elif i==5: #5-6 compound building 10
                fileIndex = 5
                for j in range(5, 7):
                    for k in range(len(Models[j])): 
                        pointsOfEachFace = texture.putTexture(Models[j][k])
                        pointsOfEachModel.extend(pointsOfEachFace)

            elif i==7: #7-12 compound building 9
                fileIndex = 6
                for j in range(7, 13):
                    for k in range(len(Models[j])): 
                        pointsOfEachFace = texture.putTexture(Models[j][k])
                        pointsOfEachModel.extend(pointsOfEachFace)

            elif (i-13)>=0 and (i-13)%2==0: #compound buildings 1-8
                multiple = (i-13)/2
                fileIndex = 7 + multiple
                for j in range(i, i+2):
                    for k in range(len(Models[j])): 
                        pointsOfEachFace = texture.putTexture(Models[j][k])
                        pointsOfEachModel.extend(pointsOfEachFace)

            else:
                continue

            points = pointsOfEachModel
            fileRGB = open("Models/model_"+str(fileIndex)+".dat", "w+")
            for k in range(len(pointsOfEachModel)):
                point = "{0},{1},{2},{r},{g},{b}\n".format(points[k].x, points[k].y,points[k].z,r=points[k].r, g=points[k].g, b=points[k].b)
                fileRGB.write(point)
            print "Model "+str(fileIndex)+":"+str(k)+" points generated"

        print "----------UI Phase Finished----------"
        print "All models have been generated, please use main.py to generate fraems of video"
开发者ID:WuPei,项目名称:cv_reconstructor,代码行数:72,代码来源:ui.py


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