nvjpeg
copied
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Readme
Files and versions
26 lines
631 B
26 lines
631 B
import sys
|
|
import numpy as np
|
|
import cv2
|
|
import time
|
|
sys.path.insert(0, '/'.join(sys.argv[1].split('/')[:-1]))
|
|
import pynvjpeg
|
|
|
|
|
|
if __name__ == '__main__':
|
|
decoder = pynvjpeg.Decoder()
|
|
assert(decoder.bind_device(0) is True)
|
|
filename = sys.argv[2]
|
|
image0 = decoder.imread(filename)
|
|
image0 = image0.astype(np.int32)
|
|
h, w, c = image0.shape
|
|
with open(filename, 'rb') as f:
|
|
data = f.read()
|
|
|
|
|
|
image1 = cv2.imread(filename)
|
|
image1 = cv2.cvtColor(image1, cv2.COLOR_BGR2RGB)
|
|
image1 = image1.astype(np.int32)
|
|
if np.sum((image1 - image0)) > h * w * c:
|
|
exit(-1)
|
|
exit(0)
|
|
|