Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
vision
Commits
ab0b9a43
Unverified
Commit
ab0b9a43
authored
Jun 03, 2024
by
Nicolas Hug
Committed by
GitHub
Jun 03, 2024
Browse files
Make adjust_hue() work with numpy 2.0 (#8463)
parent
6e18cea3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
torchvision/transforms/_functional_pil.py
torchvision/transforms/_functional_pil.py
+3
-3
No files found.
torchvision/transforms/_functional_pil.py
View file @
ab0b9a43
...
@@ -109,9 +109,9 @@ def adjust_hue(img: Image.Image, hue_factor: float) -> Image.Image:
...
@@ -109,9 +109,9 @@ def adjust_hue(img: Image.Image, hue_factor: float) -> Image.Image:
h
,
s
,
v
=
img
.
convert
(
"HSV"
).
split
()
h
,
s
,
v
=
img
.
convert
(
"HSV"
).
split
()
np_h
=
np
.
array
(
h
,
dtype
=
np
.
uint8
)
np_h
=
np
.
array
(
h
,
dtype
=
np
.
uint8
)
#
uint8 addition take cares of rotation across boundaries
#
This will over/underflow, as desired
with
np
.
e
rr
state
(
over
=
"ignore"
):
np_h
+=
np
.
a
rr
ay
(
hue_factor
*
255
).
astype
(
np
.
uint8
)
np_h
+=
np
.
uint8
(
hue_factor
*
255
)
h
=
Image
.
fromarray
(
np_h
,
"L"
)
h
=
Image
.
fromarray
(
np_h
,
"L"
)
img
=
Image
.
merge
(
"HSV"
,
(
h
,
s
,
v
)).
convert
(
input_mode
)
img
=
Image
.
merge
(
"HSV"
,
(
h
,
s
,
v
)).
convert
(
input_mode
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment