allenai / ai2thor

An open-source platform for Visual AI.

Home Page:http://ai2thor.allenai.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to get a top view of a room in ai2thor

suha4227 opened this issue · comments

Hello, I would like to ask a question.
In the newly released procthor scene, I can get a panoramic view of the entire house through action="AddThirdPartyCamera".
Why is the exported picture in ai2thor white and nothing?

You can write it like this
event = controller.step(action="GetMapViewCameraProperties")
controller.step(
action="AddThirdPartyCamera",
**event.metadata["actionReturn"]
)

This snippet comes from this link #814

@wanhaozhangxiaorui Thank you very much, this problem has been solved, but I have a new problem. What I want to know is how to adjust the camera parameters to get a high-definition photo.

Can you try this

def get_top_down_frame():
    # Setup the top-down camera
    event = controller.step(action="GetMapViewCameraProperties", raise_for_failure=True)
    pose = copy.deepcopy(event.metadata["actionReturn"])

    bounds = event.metadata["sceneBounds"]["size"]
    max_bound = max(bounds["x"], bounds["z"])

    pose["fieldOfView"] = 50
    pose["position"]["y"] += 1.1 * max_bound
    pose["orthographic"] = False
    pose["farClippingPlane"] = 50
    del pose["orthographicSize"]

    # add the camera to the scene
    event = controller.step(
        action="AddThirdPartyCamera",
        **pose,
        skyboxColor="white",
        raise_for_failure=True,
    )
    top_down_frame = event.third_party_camera_frames[-1]
    return Image.fromarray(top_down_frame)


get_top_down_frame()

Maybe while creating the controller, give the quality to be "very high".
controller = Controller(platform=CloudRendering, scene=house, quality= "Very High")