Esempio n. 1
0
def saveSceneAsMaps(path, scene):
    path = path[:-1]
    file_name = os.path.basename(path)

    edgeMap, corners = utils.genLayoutEdgeMap(scene, pm.layoutMapSize)
    # utils.saveImage(edgeMap, path + '/label_edge_vp.png')
    utils.saveImage(edgeMap, os.path.join(path, "{}_EM.jpg".format(file_name)))

    corner_file = os.path.join(path, "{}.txt".format(file_name))
    with open(corner_file, 'w') as f:
        print('Write {} corners to  file at: {}'.format(
            len(corners), corner_file))
        for corner in corners.keys():
            f.write('{} {}\n'.format(corner[0], corner[1]))

    oMap = utils.genLayoutOMap(scene, pm.layoutMapSize)
    utils.saveImage(oMap, path + '/label_omap.png')

    normalMap = utils.genLayoutNormalMap(scene, pm.layoutMapSize)
    utils.saveImage(normalMap, path + '/label_normal.png')

    depthMap = utils.genLayoutDepthMap(scene, pm.layoutMapSize)
    utils.saveDepth(depthMap, path + '/label_depth.png')

    obj2dMap = utils.genLayoutObj2dMap(scene, pm.layoutMapSize)
    utils.saveImage(obj2dMap, path + '/label_object2d.png')
Esempio n. 2
0
def showLayoutMaps(scene, color=None):

    edgeMap, _ = utils.genLayoutEdgeMap(scene, pm.layoutMapSize)
    if color is not None:
        color = utils.imageResize(color, [512, 1024])
        edgeMap = edgeMap * 0.5 + color * 0.5
    utils.showImage(edgeMap)

    obj2dMap = utils.genLayoutObj2dMap(scene, pm.layoutMapSize)
    obj2dMap = obj2dMap * 0.7 + color * 0.3
    utils.showImage(obj2dMap)
Esempio n. 3
0
def saveSceneAsMaps(path, scene, size):

    edgeMap = utils.genLayoutEdgeMap(scene, size)
    utils.saveImage(edgeMap, path + '/edge.png')

    oMap = utils.genLayoutOMap(scene, size)
    utils.saveImage(oMap, path + '/omap.png')

    normalMap = utils.genLayoutNormalMap(scene, size)
    utils.saveImage(normalMap, path + '/normal.png')

    depthMap = utils.genLayoutDepthMap(scene, size)
    utils.saveDepth(depthMap, path + '/depth.png')
Esempio n. 4
0
        def calcMapError(self):
            #self.__scene.getMainWindows().refleshProcessEvent() #1.5sec

            normalMap = utils.genLayoutNormalMap(self.__scene, self.__size)
            omapMSE = utils.imagesMSE(normalMap, self.__oMapR)

            edgeMap = utils.genLayoutEdgeMap(self.__scene, self.__size)
            edgeMap = utils.imageDilation(edgeMap, 1)
            edgeMap = utils.imageGaussianBlur(edgeMap, 2)
            lineMSE = utils.imagesMSE(edgeMap, self.__linesMapR)
            #print('MSE lines:{0:.3f}  normal:{1:.3f}'.format(lineMSE,omapMSE))

            mix = omapMSE + lineMSE * 20
            return mix
Esempio n. 5
0
def saveSceneAsMaps(path, scene):

    edgeMap = utils.genLayoutEdgeMap(scene, pm.layoutMapSize)
    utils.saveImage(edgeMap, path + '/label_edge_vp.png')

    oMap = utils.genLayoutOMap(scene, pm.layoutMapSize)
    utils.saveImage(oMap, path + '/label_omap.png')

    normalMap = utils.genLayoutNormalMap(scene, pm.layoutMapSize)
    utils.saveImage(normalMap, path + '/label_normal.png')

    depthMap = utils.genLayoutDepthMap(scene, pm.layoutMapSize)
    utils.saveDepth(depthMap, path + '/label_depth.png')

    obj2dMap = utils.genLayoutObj2dMap(scene, pm.layoutMapSize)
    utils.saveImage(obj2dMap, path + '/label_object2d.png')
Esempio n. 6
0
    args = parser.parse_args()

    labelPath = args.i
    outputPath = os.path.dirname(args.i)

    scene = objs.Scene()
    utils.loadLabelByJson(labelPath, scene)
    scene.normalize()

    mapSize = [512, 1024, 3]

    #edgeMap = utils.genLayoutEdgeMap(scene, mapSize)
    #utils.saveImage(edgeMap, os.path.join(outputPath, 'edge.png'))

    #normalMap = utils.genLayoutNormalMap(scene, mapSize)
    #utils.saveImage(normalMap, os.path.join(outputPath, 'normal.png'))

    #depthMap = utils.genLayoutDepthMap(scene, mapSize)
    #utils.saveDepth(depthMap, os.path.join(outputPath, 'depth.png'))

    #obj2dMap = utils.genLayoutObj2dMap(scene, mapSize)
    #utils.saveImage(obj2dMap, os.path.join(outputPath, 'obj2d.png'))

    fcMap = utils.genLayoutFloorCeilingMap(scene, [512, 1024])
    utils.saveImage(fcMap, os.path.join(outputPath, 'fcmap.png'))

    corMap = utils.genLayoutCornerMap(scene, [512, 1024], dilat=4, blur=20)
    utils.saveImage(corMap, os.path.join(outputPath, 'cor.png'))

    edgMap = utils.genLayoutEdgeMap(scene, [512, 1024, 3], dilat=4, blur=20)
    utils.saveImage(edgMap, os.path.join(outputPath, 'edg_b.png'))