Giter Site home page Giter Site logo

Comments (4)

merlinND avatar merlinND commented on August 17, 2024

Hello @vucenovic,

I've transferred your issue to the Mitsuba 3 repo, hopefully this is correct. If not, I strongly encourage you to upgrade, as Mitsuba 3 has many improvements and bugfixes over Mitsuba 2.

Here's a good way to do it with the Python API:

>>> b
Bitmap[
  pixel_format = rgba,
  component_format = uint8,
  size = [500, 656],
  srgb_gamma = 1,
  struct = Struct<4>[
    uint8 R; // @0, normalized, gamma
    uint8 G; // @1, normalized, gamma
    uint8 B; // @2, normalized, gamma
    uint8 A; // @3, normalized, alpha
  ],
  data = [ 1.25 MiB of image data ]
]
>>> mi.TensorXf(b)
TensorXf(shape=(656, 500, 4))
>>> mi.TensorXf(b).array
[0.0, 0.0, 0.0, 0.0, 0.0, .. 1311990 skipped .., 0.0, 0.0, 0.0, 0.0, 0.0]
>>>

On the last line, you can see that the tensor is just a wrapper around a Float object. We recommend keeping the TensorXf though, since it maintains the shape of the data as well.

from mitsuba2.

vucenovic avatar vucenovic commented on August 17, 2024

Thanks for the quick response! Sadly I am not able to upgrade for the time being, would this also work on Mitsuba2? And could you maybe add the required imports to the solution (what is 'mi')?

from mitsuba2.

merlinND avatar merlinND commented on August 17, 2024

Here would be an option for Mitsuba 2:

>>> import numpy as np
>>> import mitsuba
>>> mitsuba.set_variant('cuda_ad_rgb')
>>> b = mitsuba.core.Bitmap('path/to/image.exr')
>>> mitsuba.core.Float(np.array(b).ravel())
KeyboardInterrupt
>>> mitsuba.core.Float(np.array(b).ravel())
[0.0, 0.0, 0.0, 0.0, 0.0, .. 1311990 skipped .., 0.0, 0.0, 0.0, 0.0, 0.0]

mi is just the recommended alias we use in Mitsuba 3.
Unfortunately, we most likely won't have the bandwidth to provide support for Mitsuba 2. The migration shouldn't be too hard (majority of changes are components having moved around and some renames), and would be well worth it.

from mitsuba2.

vucenovic avatar vucenovic commented on August 17, 2024

Thank you! I will look into Mitsuba3 and the migration process soon :)

Kind regards

from mitsuba2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.