Difference between revisions of "Video crop and scaling with DM816x and DM814x"

From RidgeRun Developer Connection
Jump to: navigation, search
(Created page with '= Introduction = This document presents a brief overview of the crop and scaling features available for the DM816x and DM814x platforms. Crop is oriented to the capability of '...')
 
(Video capture crop and scaling)
Line 9: Line 9:
 
The capture's crop and scaling features are part of the '''v4l2src'' GStreamer plugin and are exposed trough the ''crop-area'' property. This property is set following the next format:
 
The capture's crop and scaling features are part of the '''v4l2src'' GStreamer plugin and are exposed trough the ''crop-area'' property. This property is set following the next format:
  
  <left>,<top>@<width>x<height>
+
  crop-area=<left>,<top>@<width>x<height>
  
 
where ''left'' and ''top'' are the coordinates for the upper left corner of the crop region and the ''width'' and ''height'' values set its size. The figure 1 shows this concept.  
 
where ''left'' and ''top'' are the coordinates for the upper left corner of the crop region and the ''width'' and ''height'' values set its size. The figure 1 shows this concept.  
Line 62: Line 62:
  
 
[[File:Crop_feature_02.png|400px|thumb|center|Figure 1. Crop-area working model]]
 
[[File:Crop_feature_02.png|400px|thumb|center|Figure 1. Crop-area working model]]
 
 
  
 
= Video display crop and scaling =
 
= Video display crop and scaling =
  
 
[[Category:BoardDocumentation]] [[Category:DM8168]] [[Category:HowTo]] [[Category:Whitepaper]]
 
[[Category:BoardDocumentation]] [[Category:DM8168]] [[Category:HowTo]] [[Category:Whitepaper]]

Revision as of 17:09, 16 August 2013

Introduction

This document presents a brief overview of the crop and scaling features available for the DM816x and DM814x platforms.

Crop is oriented to the capability of cut a region of an image and just process this section in the next processing units whereas scaling is just referred to resize an image's size to fit a target width and height values. Those features can be done in the at either the capture stage or the display stage.

Video capture crop and scaling

The capture's crop and scaling features are part of the 'v4l2src GStreamer plugin and are exposed trough the crop-area property. This property is set following the next format:

crop-area=<left>,<top>@<width>x<height>

where left and top are the coordinates for the upper left corner of the crop region and the width and height values set its size. The figure 1 shows this concept.

NOTE: The left, top, width and height values MUST be set avoiding to request a region out of the input image's boundaries. <\blockquote>

Figure 1. Crop-area basic concept

The crop-area feature was added together with a resizing feature where together execute the following actions:

  • The crop feature cuts the input buffer and just considers the data from an specific region as shown in the figure 2.
  • If the capabilities after the v4l2src element are of the same size of the input buffer (the case shown) or just bigger than the cropped area, the output buffer will look such as "Output buffer (a)", the remaining space will be basically old data in memory. The following pipeline is an example of this setup.
VIDEO_STD=720P_60

gst-launch -e v4l2src videoStd=$VIDEO_STD device=/dev/video0 always-copy=false queue-size=8 crop-area=20,30@640x480 ! \
'video/x-raw-yuv, format=(fourcc)NV12, width=1280, height=720, framerate=60/1' ! \
omxbufferalloc numBuffers=12 ! \
omx_scaler ! \
v4l2sink sync=false
  • The resize feature is the one that actually determines the size of the output buffer, not the crop feature. It is worth to mention that the resizer is only able to do a downscaling process, upscaling is not supported by the architecture.
  • If the width and height of the capabilities is the same that the ones specified in the crop-area parameter the output should look like "Output buffer (b)" where we have cropped the input video and the scaling feature has resized the output buffer to fit the cropped region. The following pipeline is an example of this setup.
VIDEO_STD=720P_60

gst-launch -e v4l2src videoStd=$VIDEO_STD device=/dev/video0 always-copy=false queue-size=8 crop-area=20,30@640x480 ! \
'video/x-raw-yuv, format=(fourcc)NV12, width=640, height=480, framerate=60/1' ! \
omxbufferalloc numBuffers=12 ! \
omx_scaler ! \
v4l2sink sync=false
  • If the crop-area parameter is omitted, v4l2src will use the width and height values from the pipeline capabilities and the left and top values will be set to 0. The following pipeline is an example of this setup.
VIDEO_STD=720P_60

gst-launch -e v4l2src videoStd=$VIDEO_STD device=/dev/video0 always-copy=false queue-size=8 ! \
'video/x-raw-yuv, format=(fourcc)NV12, width=640, height=480, framerate=60/1' ! \
omxbufferalloc numBuffers=12 ! \
omx_scaler ! \
v4l2sink sync=false
Figure 1. Crop-area working model

Video display crop and scaling