What’s the proper way to open one single image given a full path??
I found get_image_files
but this seems to work only with folders!!
My original problem is I’m trying to generate similar images but with different brightness level like this
from fastai2.vision.transform import brightness
image = PILImage.create(imgs[idx])
fig, axs = plt.subplots(1,5,figsize=(12,4))
for change, ax in zip(np.linspace(0.1,0.9,5), axs):
brightness(image, change).show(ax=ax, title=f'change={change:.1f}')
But. the above fails with the following error
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-14-1ddac5f7ce63> in <module>()
2 fig, axs = plt.subplots(1,5,figsize=(12,4))
3 for change, ax in zip(np.linspace(0.1,0.9,5), axs):
----> 4 brightness(image, change).show(ax=ax, title=f'change={change:.1f}')
1 frames
/usr/local/lib/python3.6/dist-packages/fastai/vision/image.py in calc(self, x, *args, **kwargs)
473 def calc(self, x:Image, *args:Any, **kwargs:Any)->Image:
474 "Apply to image `x`, wrapping it if necessary."
--> 475 if self._wrap: return getattr(x, self._wrap)(self.func, *args, **kwargs)
476 else: return self.func(x, *args, **kwargs)
477
AttributeError: 'PILImage' object has no attribute 'lighting'
The above fails because my image was a PIL image not a fastai2 Image, so that’s why I’m trying to open the image with fastai2 API.