Unlock this feature

This feature isn’t part of your plan yet

Contact sales to get upgraded to the full DevStudio experience.

Unlock this feature

This feature isn't part of your plan yet.

Image Transformations

Crop

cropfunction
File: /src/image.hppLines 905–989

Crops a sub-section of an image. Crop coordinates can be specified at runtime.

                                  Figure: Crop area with top-left corner unaligned
     --------------------------------------------------------------------------------------------------------
 TopLeftCorner:(xTopLeft, yTopLeft)                                                                         |
     |       \          !                                                                                   |
     |        \|<-----------------------Width of sub region---------------------------->|                   |
     |         *********!****************************************************************--                 |
     |         *        !                                                               * ^                 |
     |         *        !                                                               * |                 |
     |         *        !                                                               * |                 |
     |         *        !                                                               * |                 |
     |         *        !                                                               * |                 |
     |         *        !                     Crop Area                                 * Height            |
     |         *        !                                                               * of sub            |
     |         *        !                                                               * region            |
     |         *        !                                                               *                   |
     |         *        !                                                               * |                 |
     |         *        !                                                               * |                 |
     |         *        !                                                               * |                 |
     |         *        !                                                               * v                 |
     |         *********!****************************************************************--                 |
     |                  !                                                                                   |
     |                  !                                                                                   |
     |                  !                                                                                   |
     |                  !                                                                                   |
     |                  !                                                                                   |
     --------------------------------------------------------------------------------------------------------
template <typename DdrInTensor, typename DdrOutTensor>
INLINE void crop(DdrInTensor& ddrInp,
                 std::uint32_t xTopLeft,
                 std::uint32_t yTopLeft,
                 DdrOutTensor& ddrOut)
NameTypeDefaultDescription
DdrInTensortypenameInput DDR tensor shape.
DdrOutTensortypenameOutput DDR tensor shape.
NameTypeDescription
ddrInpDdrInTensor&Pointer to input DDR tensor.
xTopLeftstd::uint32_tx coordinate of top left corner of crop area.
yTopLeftstd::uint32_ty coordinate of top left corner of crop area.
ddrOutDdrOutTensor&Pointer to output DDR tensor.

INLINE void

Resize

For the general-purpose tensor resize API (chimera::image::resize, including DDR/multicore variants), see Image Resize. The overload below resizes 3-channel planar images with optional fused color conversion.

resizeImagefunction
File: /src/image.hppLines 2857–2877

Resize a 3-channel planar image.

Input tensor shape must be of form (1, channels, height, width). Output tensor shape must be of form (1, channels, resized_height, num_channels).

template <ResizeMethod resizeMethod,
          CoordinateTransform coordinateTransform = CoordinateTransform::HALF_PIXEL,
          ColorConversionMethod convertMethod = ColorConversionMethod::NO_CONVERSION,
          typename OcmAllocatorType = EmptyType,
          typename OcmInputImageShape,
          typename OcmOutputImageShape,
          std::enable_if_t<resizeMethod != ResizeMethod::BILINEAR_INTERPOLATION_MULTISTEP &&
            resizeMethod != ResizeMethod::BILINEAR_INTERPOLATION_ASYMMETRIC &&
            resizeMethod != ResizeMethod::BILINEAR_INTERPOLATION_HALF_PIXEL, int> = 0>
INLINE void resizeImage(OcmInputImageShape& ocmInputImage,
                        OcmOutputImageShape& ocmOutputImage,
                        const OcmAllocatorType& ocmMemAlloc = EmptyType())
NameTypeDefaultDescription
resizeMethodResizeMethodSelection of resize method.
coordinateTransformCoordinateTransformCoordinateTransform::HALF_PIXELSelection of coordinate transform method.
convertMethodColorConversionMethodColorConversionMethod::NO_CONVERSIONColor conversion method used is `ColorConversionMethod::NO_CONVERSION`.
OcmAllocatorTypetypenameEmptyTypeType of ocm allocator.
OcmInputImageShapetypenameThe shape of the input image.
OcmOutputImageShapetypenameThe shape of the output image.
NameTypeDescription
ocmInputImageOcmInputImageShape&The input image tensor.
ocmOutputImageOcmOutputImageShape&The output image tensor.
ocmMemAllocconst OcmAllocatorType&ocm allocator to be used locally.

INLINE void — void

Sign in to your account

Don't have an account? 
By signing in, you are agreeing to our Terms of Use and Privacy Policy.
Quadric // One architecture. Every algorithm.

Develop.

Simulate.

Profile.

Collaborate.