Skip to content

Commit

Permalink
convert color from bgr to rgb
Browse files Browse the repository at this point in the history
  • Loading branch information
stereomatchingkiss committed Apr 21, 2021
1 parent 11e6612 commit 9ed79f2
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions yolort/utils/image_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ def read_image_to_tensor(
image (np.ndarray): the candidate ndarray image to be parsed to Tensor.
is_half (bool): whether to transfer image to half. Default: False.
"""
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
image = np.ascontiguousarray(image, dtype=np.float32) # uint8 to float32
image = np.transpose(image / 255.0, [2, 0, 1])

Expand Down

0 comments on commit 9ed79f2

Please sign in to comment.