Skip to content

Commit

Permalink
Fixed scaling value in torch rgb2lab
Browse files Browse the repository at this point in the history
  • Loading branch information
andreped authored Aug 11, 2023
1 parent 3a3eb2c commit 11025a2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion torchstain/torch/utils/rgb2lab.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def rgb2lab(rgb):
mask = arr > 0.008856
not_mask = torch.logical_not(mask)
arr.masked_scatter_(mask, torch.pow(torch.masked_select(arr, mask), 1 / 3))
arr.masked_scatter_(not_mask, 7.787 * torch.masked_select(arr, not_mask) + 16 / 166)
arr.masked_scatter_(not_mask, 7.787 * torch.masked_select(arr, not_mask) + 16 / 116)

# get each channel as individual tensors
x, y, z = arr[0], arr[1], arr[2]
Expand Down

0 comments on commit 11025a2

Please sign in to comment.