Somewhat blurry (and not sharp enough) photos created by replicator script editor

This is a followup question on

So, even though I am trying to change the camera properties interactively, I don’t see any changes in the photo. Are you able to create a video to showcase how you achieve it?

current script that produces blurry photos:

# Run this inside Omniverse Code Replicator Script Editor 
import omni.replicator.core as rep
from datetime import datetime
import omni.usd

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

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

    PALLET_URL = "omniverse://localhost/NVIDIA/Assets/ArchVis/Industrial/Pallets/Pallet_B1.usd"
    plane = rep.create.plane(scale=25, visible=True, semantics=[("class", "plane")])
    print('type of plane: ', print(plane))
    # bb_cache = bounds_utils.create_bbox_cache()
    # combined_range_arr = bounds_utils.compute_combined_aabb(bb_cache, prim_paths=plane)
    # print('combined_range_arr: ', combined_range_arr)

    def randomize_pallet():
        pallet = rep.create.from_usd(PALLET_URL, semantics=[('class', 'pallet')])
        with pallet:
                position=rep.distribution.uniform((-1000, 0, -1000), (1000, 0, 1000)),
                rotation=rep.distribution.uniform((-90,-45, 0), (-90, 45, 0)),
        return pallet

    # Register randomization


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

    timestamp ="%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/pallet/" + timestamp , rgb=True, bounding_box_2d_tight=True)

    with rep.trigger.on_frame(num_frames=100):

        pallet = rep.randomizer.randomize_pallet()
        with camera:
            rep.modify.pose(position=rep.distribution.uniform((-1000, 200, 1500), (1000, 400, 2000)), look_at=pallet)

Before commenting this line focal_length=613.634 photos were like below

after commenting that line, photos are visible but still blurry. I want my produced synthetic data to be sharp.

so I was able to have some interactive control over camera params, and I also had to change view from perspective to camera in viewport. I found the following params which yields sharp view

However, upon using it in the script and click start, still blurry images of object of interest (pallet) is created here.

Any thought how I should fix this?

    camera =

@mona.jalal instead of coming from a coding angle, my personal input is going to be from photography. in a real-life scenario, f stop affects how wide the aperture is and will affect the result of depth of field represented in your photo/image. they have a inverse relationship - the smaller the fstop is, the blurrier the image will be; below is a visual representation:

the original value at 0.5 is going to be producing extremely shallow depth of field unless you dial the focus distance to exactly on top of the object. otherwise, increasing the value should reduce the DOF in rendered images.

1 Like

I decided to remove the f_stop altogether and decreased the focal_length and now images are better.

Hi @mona.jalal

Simplychenable has some great advice. That said, this whole topic of controlling focus within SDG needs a tutorial. Thanks for bringing this up, I’ll add it to the (larger by the day) list.

1 Like