Photos taken by the simulated camera are all blurry

I have this script

## State of code: Throwing errors (incompatible types)
# This needs to be run inside Isaac Sim Script Editor not Omniverse Code Script Editor

import omni.replicator.core as rep
from datetime import datetime
import omni.usd
from omni.isaac.core.utils.stage import get_current_stage, open_stage

import omni.isaac.core.utils.bounds as bounds_utils
import omni.isaac.core.utils.prims as prims_utils

import numpy as np


# with rep.new_layer():
# Define paths for the character, the props, the environment and the surface where the assets will be scattered in.


FORKLIFT_URL = "omniverse://localhost/NVIDIA/Assets/Isaac/2022.2.1/Isaac/Props/Forklift/forklift.usd"
ENV_URL ="omniverse://localhost/NVIDIA/Assets/Isaac/2022.2.0/Isaac/Samples/Replicator/Stage/full_warehouse_worker_and_anim_cameras.usd"


open_stage(ENV_URL)
stage =get_current_stage()

floor_prims = [x.GetPath() for x in stage.Traverse() if "SM_floor" in x.GetName() and prims_utils.get_prim_type_name(x.GetPath()) == "Xform"]
print('dir floor_prims: ', dir(floor_prims))
bb_cache = bounds_utils.create_bbox_cache()
combined_range_arr = bounds_utils.compute_combined_aabb(bb_cache, prim_paths=floor_prims)

print('combined_range_arr: ', combined_range_arr)

margin = 2
min_x, min_y, min_z, max_x, max_y, max_z = combined_range_arr


def randomize_forklift():
    forklift = rep.create.from_usd(FORKLIFT_URL, semantics=[('class', 'forklift')])
    with forklift:
        rep.physics.collider()
        rep.modify.pose(
            position=rep.distribution.uniform((min_x + margin, min_y + margin, 0), (max_x - margin, max_y - margin, 0)),
            rotation=rep.distribution.uniform((-90, 0, 0), (90, 0, 0)),
            #scale=100
        )
    return forklift

# Register randomization

rep.randomizer.register(randomize_forklift)


# Setup camera and attach it to render product
camera = rep.create.camera(
    focus_distance=800,
    f_stop=0.5,
    #focal_length=613.634
)
render_product = rep.create.render_product(camera, resolution=(640, 480))


timestamp = datetime.now().strftime("%Y_%m_%d-%I_%M_%S_%p")
# Initialize and attach writer
writer = rep.WriterRegistry.get("BasicWriter")
writer.initialize(output_dir="/home/mona/Desktop/Isaac_Sim_Dummy_Out/forklift_warehouse/" + timestamp , rgb=True, bounding_box_2d_tight=True)
writer.attach([render_product])

with rep.trigger.on_frame(num_frames=100):
    print('inside trigger frame')
    forklift = rep.randomizer.randomize_forklift()
    print("forklift is: ", forklift)
    print("type(forklift): ", type(forklift))
    with camera:
        print('camera: ', camera)
        rep.modify.pose(position=rep.distribution.uniform((min_x + margin, min_y + margin, 5), (max_x - margin, max_y - margin, 12)),
                        look_at=forklift)

That I run inside Isaac Sim Script Editor. When I click Run and then from Replicator menu I click Start, I observe the taken photos are all blurry. I have used same parameters, same forklift, but a simple plane instead of warehouse in Omniverse Code Script Editor and none of the photos were blurry.

How can I fix this situation?

Please note I am using libraries from isaac sim for calculating bounding box because of which I am not able to use Omniverse Code Script Editor.

rgb_0089

and
rgb_0082

are two examples of such blurry photos.

This is because of the f_stop of the camera, you will need to set the correct parameters for your camera (focus_distance etc.), or look at the scene from the right distance when using real camera values (or use the default values which will have everything in focus (f_stop being 0 i.e. infinity)). You can also play with these values live in the editor to get a feeling on how they work.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.