Skip to content

Is it possible to programmatically change the sensor size to fit the scene object #1393

Closed Answered by shinyoung-yi
aantg asked this question in Q&A
Discussion options

You must be logged in to vote

Hi,
I found that mi.Scene class has a bounding box attribute.
Is it what you are looking for?

import mitsuba as mi
mi.set_variant('cuda_ad_rgb', 'llvm_ad_rgb')
print(f"{mi.__version__ = }")
print(f"{mi.variant() = }")
# mi.__version__ = '3.5.2'
# mi.variant() = 'cuda_ad_rgb'

scene = mi.load_dict(mi.cornell_box())
bbox = scene.bbox()
print(f"{bbox = }")

print(f"{bbox.min = }")
print(f"{bbox.max = }")
print(f"{bbox.center() = }")

Result

bbox = BoundingBox3f[
  min = [-1, -1.01, -1],
  max = [1, 1, 1]
]
bbox.min = [-1.0, -1.0099999904632568, -1.0]
bbox.max = [1.0, 1.0, 1.0]
bbox.center() = [0.0, -0.004999995231628418, 0.0]

Then you can project it onto the image plane as...

cam2world = scene.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@aantg
Comment options

@shinyoung-yi
Comment options

Answer selected by merlinND
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants