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 restrict camera view with bproc.sampler.upper_region() ? #1044

Closed
Varatharajan-Raja opened this issue Jan 19, 2024 · 1 comment
Closed
Labels
duplicate This issue or pull request already exists question Question, not yet a bug ;)

Comments

@Varatharajan-Raja
Copy link

Varatharajan-Raja commented Jan 19, 2024

Describe the issue

I'm sampling locations above the plane to capute images of it. However, I wish to restrict the camera view within the plane region. How could I achieve it? Similar to #1036

19 01 2024_10 13 35_REC-ezgif com-video-to-gif-converter

Screenshot 2024-01-19 105217

Minimal code example

while poses < num_frames:
    # Sample location
    location=bproc.sampler.upper_region(objects_to_sample_on=[soil],
                                        min_height=19,
                                        max_height=20,
                                        use_ray_trace_check=True)
    rotation_matrix = bproc.camera.rotation_from_forward_vec(poi)
    cam2world_matrix = bproc.math.build_transformation_mat(location,rotation_matrix)
    bproc.camera.add_camera_pose(cam2world_matrix)

    light_location = bproc.sampler.shell(
        center=[1, 2, 21],
        radius_min=4,
        radius_max=7,
        elevation_min=15,
        elevation_max=70
    )
    light.set_rotation_euler([0, random.uniform(-math.pi/2, math.pi/2), 0],poses)
    light.set_energy(random.uniform(1,10), poses)
    light.set_color(np.random.uniform([1, 0.4, 0.3], [1, 0.6, 0.6]), poses)
    light.set_location(light_location, poses)
    
    poses +=1

Files required to run the code

No response

Expected behavior

Not to capture the world region.

BlenderProc version

Latest

@Varatharajan-Raja Varatharajan-Raja added the question Question, not yet a bug ;) label Jan 19, 2024
@cornerfarmer
Copy link
Member

Same as #1036. Please do not open duplicate issues.

@cornerfarmer cornerfarmer added the duplicate This issue or pull request already exists label Jan 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists question Question, not yet a bug ;)
Projects
None yet
Development

No branches or pull requests

2 participants