Difference between revisions of "CUDA ISP for NVIDIA Jetson/Examples/GStreamer usage"

From RidgeRun Developer Connection
Jump to: navigation, search
(GStreamer Elements)
(cudashift)
Line 23: Line 23:
  
 
'''Xavier'''
 
'''Xavier'''
 +
 
In the following images you can see how the bits are organized for a bayer10 image on an Jetson Xavier.  
 
In the following images you can see how the bits are organized for a bayer10 image on an Jetson Xavier.  
  
Line 31: Line 32:
 
<br><br>
 
<br><br>
  
For the previous image,on the LSB we have 6 bits replicated. For this RAW10 image, data is available from bits D9-D0.  
+
For the previous image,on the LSB we have 6 bits replicated. For this RAW10 image, data (D9-D0) is available between bit 15 and bit 6.  
  
 
{{Review|I think what we really want in this section is to illustrate how to use the element. In this case, we want to explain: how to choose a proper value of shift (do you remember the wiki about offsets? we need some of this info here). Then, how to apply this knowledge to this.|lleon95}}
 
{{Review|I think what we really want in this section is to illustrate how to use the element. In this case, we want to explain: how to choose a proper value of shift (do you remember the wiki about offsets? we need some of this info here). Then, how to apply this knowledge to this.|lleon95}}

Revision as of 16:41, 24 March 2023


  Index  






General

CUDA ISP provides GStreamer plugins that facilitate the usage of the library with GStreamer pipelines. CUDA ISP provides three different GStreamer elements for image signal processing. The three elements are:

  • cudashift
  • cudadebayer
  • cudaawb

In the following sections, you can see examples of how to use them. You can see more information about the algorithms these elements apply in CUDA ISP Basics. Take into consideration that a patch must be applied to v4l2src to enable caputres in bayer10. You can see how to apply this patch in this link: Apply patch to v4l2src.

GStreamer Elements

cudashift

This element applies the shifting algorithm. For more information about the element properties and capabilities, check here: cudashift element. On Jetson platforms, the capture subsystem unit (Video Input) has particular formats to pack the RAW data received from the CSI channels. This modifies the RAW Pixel bits organization on the image captured. The values of the MSB have more impact on the image than LSB. Knowing this, to choose a proper value for shifting you should choose where to put the MSBs.

Xavier

In the following images you can see how the bits are organized for a bayer10 image on an Jetson Xavier.




Error creating thumbnail: Unable to save thumbnail to destination




For the previous image,on the LSB we have 6 bits replicated. For this RAW10 image, data (D9-D0) is available between bit 15 and bit 6.


The following pipeline receives a bayer 10 image with 4k resolution from a camera sensor, applies a shifting with a value of 5 and outputs a bayer 8 image.

gst-launch-1.0 -ve v4l2src io-mode=userptr ! 'video/x-bayer, bpp=10, format=rggb' ! cudashift shift=5 ! fakesink




Error creating thumbnail: Unable to save thumbnail to destination




cudadebayer

This element applies the debayering algorithm. For more information about the element properties and capabilities, check here: cudadebayer element

Next, you will see examples on how to use the cudadebayer element.

The following pipeline receives a bayer 10 image with 4K resolution from a camera sensor and outputs an RGB image.

gst-launch-1.0 -ve v4l2src io-mode=userptr ! 'video/x-bayer, bpp=10, width=3840, height=2160' ! cudadebayer ! fakesink

This next pipeline receives a bayer 10 image with 4K resolution and outputs an I420 image. You can see that source caps were added to choose which output format you desire,in this case it would be I420.

gst-launch-1.0 -ve v4l2src io-mode=userptr ! 'video/x-bayer, bpp=10, width=3840, height=2160' ! cudadebayer ! 'video/x-raw, format=I420' ! fakesink

This next pipeline receives a bayer 10 image with 4K resolution and outputs an RGB image with shifting added. In this case the output format is RGB.

gst-launch-1.0 -ve v4l2src io-mode=userptr ! 'video/x-bayer, bpp=10, width=3840, height=2160' ! cudadebayer shift=5 ! 'video/x-raw, format=RGB' ! fakesink




Error creating thumbnail: Unable to save thumbnail to destination




cudaawb

This element applies de auto-white balance algorithm. Next, you will see examples on how to use the cudadebayer element.

The following pipeline receives a RGB image with 4K resolution, applies the auto-white balance algorithm and outputs a RGB image.

gst-launch-1.0 videotestsrc ! 'video/x-raw, width=3840,height=2160' ! cudaawb ! fakesink




Error creating thumbnail: Unable to save thumbnail to destination




The following pipeline receives a bayer10 image with 4K resolution from a camera sensor and outputs an RGB image after applying the auto-white balance algorithm. This element requires an RGB image input. So, when using a camera sensor, before using the cudaawb element, we should add the cudadebayer element to obtain the RGB image that the AWB element will use as input.

gst-launch-1.0 -ve v4l2src io-mode=userptr ! 'video/x-bayer, bpp=10, width=3840, height=2160' ! cudadebayer ! cudaawb ! fakesink




Error creating thumbnail: Unable to save thumbnail to destination





The following pipeline receives a bayer10 image with 4K resolution from a camera sensor, applies debayering and auto-white balance, and outputs an I420 image.

gst-launch-1.0 -ve v4l2src io-mode=userptr ! 'video/x-bayer, bpp=10, width=3840, height=2160' ! cudadebayer ! cudaawb ! 'video/x-raw, format=I420' ! fakesink




Error creating thumbnail: Unable to save thumbnail to destination




Using the three elements

The following pipeline receives a bayer 10 image with 4K resolution and outputs a RGB image, using the three elements.

gst-launch-1.0 -ve v4l2src io-mode=userptr ! 'video/x-bayer, bpp=10, width=3840, height=2160' ! cudashift shift=5 ! cudadebayer ! cudaawb ! fakesink




Error creating thumbnail: Unable to save thumbnail to destination




Use cases

In previous sections were described some examples on the three elements for the CUDA ISP.As you can see in those previous sections, the cudadebayer and cudashift elements both can apply the shifting algorithm. You might be wondering in which cases to use just the cudadebayer or both elements.

cudashift and cudadebayer

  • Higher framerate

If your goal during processing is to maximize the framerate, you should use both elements. Splitting the elements will lead to a higher framerate but does increase the latency of the process.




Error creating thumbnail: Unable to save thumbnail to destination





  • Reduced latency

By just using the cudadebayer element with its own shifting property, the latency of the process is reduced but so does the framerate.




Error creating thumbnail: Unable to save thumbnail to destination








  Index