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

To decode images immediately into the desired format #7

Open
SalimMaxHigh opened this issue Jun 2, 2021 · 1 comment
Open

To decode images immediately into the desired format #7

SalimMaxHigh opened this issue Jun 2, 2021 · 1 comment

Comments

@SalimMaxHigh
Copy link

Hey! Thanks for a great library for decoding images.
I would like to know if there is a possibility to decode images
immediately into the desired format. For example in gray, such as in OpenCV:
cv2.imdecode(some_image, cv2.IMREAD_GRAYSCALE).

@zeng-qinghui
Copy link
Contributor

Thanks for using.

If you want to get a gray image. You can try:

from nvjpeg import NvJpeg 
import numpy as np
nj = NvJpeg()
nv_img = nj.read(YOUR_IMG_PATH).dot([0.114,0.587,0.299]).astype(np.uint8)
cv2.imshow("GrayImg", nv_img)
cv2.waitKey(0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants