Skip to content

Commit

Permalink
Add option for BGR conversion.
Browse files Browse the repository at this point in the history
  • Loading branch information
ebezzam committed May 1, 2024
1 parent 79eb8a4 commit 71e43b6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lensless/utils/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def load_image(
shape=None,
dtype=None,
normalize=True,
bgr_input=True,
):
"""
Load image as numpy array.
Expand Down Expand Up @@ -151,7 +152,7 @@ def load_image(
)

else:
if len(img.shape) == 3:
if len(img.shape) == 3 and bgr_input:
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)

original_dtype = img.dtype
Expand Down Expand Up @@ -223,6 +224,7 @@ def load_psf(
single_psf=False,
shape=None,
use_3d=False,
bgr_input=True,
):
"""
Load and process PSF for analysis or for reconstruction.
Expand Down Expand Up @@ -296,6 +298,7 @@ def load_psf(
blue_gain=blue_gain,
red_gain=red_gain,
nbits_out=nbits_out,
bgr_input=bgr_input,
)

original_dtype = psf.dtype
Expand Down Expand Up @@ -391,6 +394,7 @@ def load_data(
torch=False,
torch_device="cpu",
normalize=False,
bgr_input=True,
):
"""
Load data for image reconstruction.
Expand Down Expand Up @@ -471,6 +475,7 @@ def load_data(
single_psf=single_psf,
shape=shape,
use_3d=use_3d,
bgr_input=bgr_input,
)

# load and process raw measurement
Expand All @@ -485,6 +490,7 @@ def load_data(
return_float=return_float,
shape=shape,
normalize=normalize,
bgr_input=bgr_input,
)

if data.shape != psf.shape:
Expand Down

0 comments on commit 71e43b6

Please sign in to comment.