Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] The result of cvtColor RGB2YUV is not same with opencv #160

Open
hezeli123 opened this issue May 22, 2024 · 0 comments
Open

[BUG] The result of cvtColor RGB2YUV is not same with opencv #160

hezeli123 opened this issue May 22, 2024 · 0 comments
Assignees
Labels
bug Something isn't working as expected (software, install, documentation)

Comments

@hezeli123
Copy link

opencv code:

from pathlib import Path
import numpy as np
import cv2
import cvcuda
import logging
import torch
from PIL import Image

img = cv2.imread('./0.jpg', cv2.IMREAD_UNCHANGED)
pil_img = Image.fromarray(img.astype(np.uint8))
image1 = np.array(pil_img)
image2 = cv2.cvtColor(image1, cv2.COLOR_RGB2BGR).astype(np.float32)
cv_YUV = cv2.cvtColor(image2, cv2.COLOR_BGR2YUV)

cvcuda

image = torch.from_numpy(image1).to(torch.uint8).cuda()
frame_hwc = cvcuda.as_tensor(image .cuda(), "HWC")
cvcuda_YUV = cvcuda.cvtcolor(frame_hwc, cvcuda.ColorConversion.RGB2YUV)

Describe the bug
cv_YUV != cvcuda_YUV

Expected behavior
cv_YUV == cvcuda_YUV

@hezeli123 hezeli123 added the bug Something isn't working as expected (software, install, documentation) label May 22, 2024
@milesp-nvidia milesp-nvidia self-assigned this May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as expected (software, install, documentation)
Projects
None yet
Development

No branches or pull requests

3 participants