Hi there,
seems to work just fine for me, here is a script you can test in the script editor:
import asyncio
import os
import omni.replicator.core as rep
import omni.usd
omni.usd.get_context().new_stage()
dome = rep.create.light(light_type = "dome")
texture_path = os.path.join(rep.example.TEXTURES_DIR, "smiley_albedo.png")
projection_asset = rep.create.plane(
position=(0, 0, 0),
rotation=(0, 90, 0),
semantics = [('class', 'projection_asset')],
name = "projection_asset",
) # asset to project on
proxy_cube = rep.create.cube(
position=(1, 0, 0),
rotation=(0, 0, 0),
scale=(0.2, 0.2, 0.2),
visible = False,
semantics = [('class', 'proxy_cube')],
name = "proxy_cube",
#parent = projection_asset
)
with projection_asset:
rep.create.projection_material(proxy_prim = proxy_cube, semantics = [('class', 'projection_material')])
projection = rep.get.prims(semantics = [('class', 'projection_material')])
with projection:
rep.modify.projection_material(diffuse=texture_path)
async def get_data_async():
rp = rep.create.render_product("/OmniverseKit_Persp", (512, 512))
annot = rep.AnnotatorRegistry.get_annotator("bounding_box_2d_tight")
annot.attach(rp)
await rep.orchestrator.step_async()
data = annot.get_data()
print(data)
asyncio.ensure_future(get_data_async())
Here is the ouput with the two bounding boxes:
{'data': array([(0, 238, 225, 274, 286, -1.), (1, 252, 252, 258, 260, 0.)],
dtype=[('semanticId', '<u4'), ('x_min', '<i4'), ('y_min', '<i4'), ('x_max', '<i4'), ('y_max', '<i4'), ('occlusionRatio', '<f4')]), 'info': {'bboxIds': array([0, 1], dtype=uint32), 'idToLabels': {'0': {'class': 'projection_asset'}, '1': {'class': 'projection_asset,projection_material'}}, 'primPaths': ['/Replicator/projection_asset_Xform', '/Replicator/projection_asset_Xform/Projection/proxy_cube_Xform']}}