Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get a top view of a room in ai2thor #1196

Open
suha4227 opened this issue Mar 15, 2024 · 3 comments
Open

How to get a top view of a room in ai2thor #1196

suha4227 opened this issue Mar 15, 2024 · 3 comments

Comments

@suha4227
Copy link

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?

@wanhaozhangxiaorui
Copy link

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

@suha4227
Copy link
Author

@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.

@prathishpratt
Copy link

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")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants