Skip to content

Commit

Permalink
Merge pull request #51 from andreped/rgb2lab
Browse files Browse the repository at this point in the history
Fixed scaling value in torch rgb2lab
  • Loading branch information
carloalbertobarbano authored Jan 8, 2025
2 parents 841e89e + 11025a2 commit 3111cd8
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 3111cd8

Please sign in to comment.