nvImageCodec icon indicating copy to clipboard operation
nvImageCodec copied to clipboard

Can decode cv2 image?

Open anhtt20172948 opened this issue 7 months ago • 1 comments

I am trying to decode cv2 image. I read that the decode function receives "Numpy array with bytes to decode" as input. link When try this code below

decoder = nvimgcodec.Decoder()
img = cv2.imread(img_path)
nvimg = decoder.decode(img)

Got: ValueError: array has incorrect number of dimensions: 3; expected When I try

decoder = nvimgcodec.Decoder()
img = cv2.imread(img_path).astype(np.uint8).tobytes()
nvimg = decoder.decode(img)

Got: RuntimeError: nvImageCodec failure: '#4' Where did I go wrong? Thank you very much

anhtt20172948 avatar Jul 02 '24 10:07 anhtt20172948