Skip to content

To decode images immediately into the desired format #7

Open

Description

@SalimMaxHigh

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).

Activity

  1. zeng-qinghui commented on Jun 5, 2021

    @zeng-qinghui
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions