Please provide complete information as applicable to your setup.
• Hardware Platform (Jetson / GPU) GPU • DeepStream Version6.0.1 • JetPack Version (valid for Jetson only) • TensorRT Version 8.2.3.1 • NVIDIA GPU Driver Version (valid for GPU only) 470.129.06 • Issue Type( questions, new requirements, bugs)
I ran a same image for a comparison in two ways
Using following deepstream pipeline:
GST_DEBUG=3 gst-launch-1.0 uridecodebin uri=file:///home/car.jpg ! m.sink_0 nvstreammux name=m batch-size=1 width=1920 height=1080 ! nvvideoconvert ! “video/x-raw(memory:NVMM), format=RGBA” ! dsexample full-frame=0 pre-process=1 ! …
In dsexample, I read in_mat(input_image) in the pre-process function (in_mat is extracted from Gst_buffer using the reference implementation). As in_mat is in RGBA format I convert it into BGR and save it as ‘deepstream_image.jpg’
In python, I do an cv2.imread of ‘car.jpg’ do a cv2 resize with (1920,1080) and save it as ‘python_image.jpg’
Ideally when I compare both the images (do image subtraction - img2 - img1), I should get a blank image but I get a different image (diff.jpg)
Request your help in resolving issue. Am I doing anything wrong? Where does the issue come up, deepstream or opencv? I shared the images for reference.
For deepstream, this would be the code GST_DEBUG=3 gst-launch-1.0 uridecodebin uri=file:///home/car.jpg ! m.sink_0 nvstreammux name=m batch-size=1 width=1920 height=1080 ! nvvideoconvert ! “video/x-raw(memory:NVMM), format=RGBA” ! dsexample full-frame=0 pre-process=1 ! fakesink. In dsexample, in blur_objects function, we would add the following two lines at the start of the function
In python, the code could be:
“img = cv2.imread(‘car.jpg’)”
“cv2.resize(img,(1920,1080))”
"cv2.imwrite(“python_image.jpg”)
After both the images are generated, I would write a new python file with the following:
“img1 = cv2.imread(‘python_image.jpg’)”
“img2 = cv2.imread(‘deepstream_image.jpg’)”
“diff = img1 - img2”
“cv2.imshow(‘difference’,diff)”
Deepstream pipeline was resized using gstreamer. In python, I do a opencv resize but I don’t think they induce artifacts. Do you want to check RGBA (deepstream) vs RGB (python) ?
there are three steps to generate jpg files, that is jpeg decoding, raw data scale, jpeg encoding, maybe some step use different algorithm,please narrow down this issue by checking every step’s result.
There is no update from you for a period, assuming this is not an issue any more. Hence we are closing this topic. If need further support, please open a new one. Thanks