question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ValueError: Could not find a backend to open `50g.exr`` with iomode `wi`

See original GitHub issue

Greetings! I would like to save a 16bit rgb array as .exr file. I use a camera, capturing multiple images for multi exposure fusion (hdr merge). Iam in the Solarpower buisness. I will predict the hitting radiance with SkyCams.

zeitstrahl

Screenshot 2022-09-28 211538

I would like to continue my work with these 16 bit raw bayer array safed as .exr (.tga would also work)

def exposure_bracket():

picam2 = Picamera2()
config = picam2.create_still_configuration(raw={"format": "SRGGB12", "size": (2032, 1520)})
picam2.configure(config)

exposures = [50, 100, 150, 250, 400, 650, 1050, 1700, 2750] # in Microseconds

for exp in exposures:

	picam2.set_controls({"ExposureTime": exp, "AnalogueGain": 1, "ColourGains": (1.0,1.0)})
	picam2.start()
	time.sleep(0.5)
	array = picam2.capture_array("raw")
	picam2.stop()
	
	array16 = array.view(np.uint16)
	array16 *= 16  # Bump 12-bit range up to 16
	arrayX = array16.astype("float32")

        imageio.imwrite(f'{exp}g.exr', arrayX)

	rgb_array = np.zeros((760, 1016, 3), dtype=np.uint16)
	rgb_array[:, :, 0] = array16[1::2, 1::2] # red
	# Must avoid overflowing 16-bits in the addition here:
	rgb_array[:, :, 1] = (array16[0::2, 1::2].astype(int) + array16[1::2, 0::2]) / 2 # green
	rgb_array[:, :, 2] = array16[0::2, 0::2] # blue
	rgb_arrayX = rgb_array.astype("float32")

	imageio.imwrite(f'{exp}rgb.exr', rgb_arrayX)

imageio.plugins.freeimage.download() exposure_bracket()

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
FirefoxMetzgercommented, Sep 30, 2022

@Bra1nsen Did you perform the post-installation step of downloading the FreeImage binary (documentation here)?

Once installed, the following EXR round-trip of writing an image and reading it back works fine on my end:

import imageio.v3 as iio
import numpy as np

expected = np.full((128, 128, 3), 0.42, dtype=np.float32)
buffer = iio.imwrite("<bytes>", expected, extension=".exr")

actual = iio.imread(buffer)

np.allclose(actual, expected)
0reactions
Bra1nsencommented, Oct 5, 2022

hey firefox. I just tried you snippet:

Exception ignored in: <function PluginV3.__del__ at 0xb4f13d18>
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/imageio/core/v3_plugin_api.py", line 367, in __del__
    self.close()
  File "/usr/local/lib/python3.9/dist-packages/imageio/core/v3_plugin_api.py", line 354, in close
    self.request.finish()
  File "/usr/local/lib/python3.9/dist-packages/imageio/core/request.py", line 551, in finish
    bytes = Path(self._filename_local).read_bytes()
  File "/usr/lib/python3.9/pathlib.py", line 1248, in read_bytes
    with self.open(mode='rb') as f:
  File "/usr/lib/python3.9/pathlib.py", line 1241, in open
    return io.open(self, mode, buffering, encoding, errors, newline,
  File "/usr/lib/python3.9/pathlib.py", line 1109, in _opener
    return self._accessor.open(self, flags, mode)
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/imageio_gx2ec4ep.exr'
Read more comments on GitHub >

github_iconTop Results From Across the Web

ValueError: Could not find a backend to open '10.jpeg` with ...
I am new to MaskRCNN. I have added 15 images to the dataset/train folder however, while running the code I am getting error...
Read more >
Improve error message when reading an EXR file ... - GitHub
It's just a minor thing, but if the EXR plugin is not installed, ... OSError: Could not find a backend to open `path`...
Read more >
imageio读取.exr报错ValueError: Could not find a backend to ...
ValueError : Could not find a format to read the specified file in mode 'i' ... Could not find a backend to open...
Read more >
problem with io.imread - Google Groups
but when I want to load my image: I get the error. In [5]: camera = io.imread(filename) ValueError: Could not load "./small.jpg"
Read more >
Imageio Usage Examples — imageio 2.23.0 documentation
png' . The images are automatically downloaded if not already present on your system. Therefore most examples below should just work. Read an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found