def json2fp(json, size, ratio): scene = objs.Scene() utils.loadLabelByJson(json, scene) floorMap = utils.genLayoutFloorMap(scene, size, ratio) return floorMap
def json2scene(json): scene = objs.Scene() utils.loadLabelByJson(json, scene) #scene.normalize(cameraH=1.6) scene.normalize_ceiling(ccH=1.6) return scene
def json2fp(json, size, ratio): scene = objs.Scene() utils.loadLabelByJson(json, scene) scene.normalize(cameraH=1.6) floorMap_down = utils.genLayoutFloorMap(scene, size, ratio) scene = objs.Scene() utils.loadLabelByJson(json, scene) scene.normalize_ceiling(ccH=1.6) floorMap_up = utils.genLayoutFloorMap(scene, size, ratio) return floorMap_down, floorMap_up
for i in range(1, 5): xyz = (float(data[i][0]), 0, -float(data[i][1])) print(xyz) scene.layoutPoints.append(objs.GeoPoint(scene, None, xyz)) scene.genLayoutWallsByPoints(scene.layoutPoints) scene.updateLayoutGeometry() return scene if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('--i', required=True) parser.add_argument('--gt', required=True) args = parser.parse_args() data_path = args.i scene_pred = lnet2scene(data_path) fp_pred = utils.genLayoutFloorMap(scene_pred, (512, 512), 20 / 512) gt_path = args.gt scene_gt = objs.Scene() utils.loadLabelByJson(gt_path, scene_gt) scene_gt.normalize(cameraH=1.6) fp_gt = utils.genLayoutFloorMap(scene_gt, (512, 512), 20 / 512) utils.showImage([fp_pred, fp_gt])
def json2scene(json): scene = objs.Scene() utils.loadLabelByJson(json, scene) return scene
import argparse import objs import utils if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('--i', required=True) 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'))
def loadLabel(self, path): utils.loadLabelByJson(path, self)