Image transformed with dwImageTransformation is all green

Please provide the following info (check/uncheck the boxes after creating this topic):
Software Version
DRIVE OS Linux 5.2.6
DRIVE OS Linux 5.2.6 and DriveWorks 4.0
DRIVE OS Linux 5.2.0
DRIVE OS Linux 5.2.0 and DriveWorks 3.5
NVIDIA DRIVE™ Software 10.0 (Linux)
NVIDIA DRIVE™ Software 9.0 (Linux)
other DRIVE OS version
other

Target Operating System
Linux
QNX
other

Hardware Platform
NVIDIA DRIVE™ AGX Xavier DevKit (E3550)
NVIDIA DRIVE™ AGX Pegasus DevKit (E3550)
other

SDK Manager Version
1.8.1.10392
other

Host Machine Version
native Ubuntu 18.04
other


Hello, I am trying to resize an NvMedia image using the NVIDIA DriveWorks API: Image Transformation.
But the image that dwImageTransformation_copyFullImage outputs is all green :

The input image looks like this :

Here is how I resize the image :

#include "tools/ImageTransformer.h"

ImageTransformer::ImageTransformer(DriveworksApiWrapper* driveworksApiWrapper, int outputWidth, int outputHeight,
                                   dwImageProperties inputImgProperties)
  : driveworksApiWrapper_(driveworksApiWrapper)
  , outputWidth_(outputWidth)
  , outputHeight_(outputHeight)
  , imgProperties_(inputImgProperties)
{
  imgProperties_.width = outputWidth_;
  imgProperties_.height = outputHeight_;
  params_.ignoreAspectRatio = false;

  dwImageTransformation_initialize(&ImageTransformationEngine_, params_, driveworksApiWrapper_->context_handle_);
  dwImageTransformation_setBorderMode(DW_IMAGEPROCESSING_BORDER_MODE_ZERO, ImageTransformationEngine_);
  dwImageTransformation_setInterpolationMode(DW_IMAGEPROCESSING_INTERPOLATION_LINEAR, ImageTransformationEngine_);
}

ImageTransformer::~ImageTransformer()
{
  dwImageTransformation_release(ImageTransformationEngine_);
}

void ImageTransformer::transform_image(dwImageHandle_t* input, dwImageHandle_t* output)
{
  CHK_DW(dwImageTransformation_copyFullImage(*output, *input, ImageTransformationEngine_));
}

const dwImageProperties& ImageTransformer::getImgProperties() const
{
  return imgProperties_;
}

The image comes directly from the camera, like so :

CHK_DW(dwSensorCamera_getImage(&imageHandleOutOfCamera_, DW_CAMERA_OUTPUT_NATIVE_PROCESSED, cameraFrameHandle_));
dwImageHandle_t imageHandleTransformed_;
CHK_DW(dwImage_create(&imageHandleTransformed_, imageTransformer_->getImgProperties(),
                          driveworksApiWrapper_->context_handle_));
imageTransformer_->transform_image(&imageHandleOutOfCamera_, &imageHandleTransformed_);

Any idea what could cause the issue ?

Thanks !

Dear @maxandre.ogeret,
Is it possible to share a repro code with video has input?

Thanks for your answer.
I will prepare a small example that you can run on the camera.
But you can have a look at the full code here : GitHub - MaxandreOgeret/nvidia_gmsl_driver_ros at feature/2022-08-16_ut_nvidia_drive_resize

Do you have any idea what could be the cause of the issue though ?

Do you have any suggestion or alternative ? anything ?
The format I try to resize is :

  • DW_IMAGE_NVMEDIA
  • DW_IMAGE_FORMAT_YUV420_UINT8_SEMIPLANAR
  • DW_IMAGE_MEMORY_TYPE_PITCH

@SivaRamaKrishnaNV I thought about the code example that you requested and I don’t think it would work. The video would not be a correct équivalent of the camera as it will not have the same encoding.

  • Can you reproduce the issue on your side with the cameras ?
  • Do you have any suggestions at the moment so I can go forward on that issue ?

Thanks

Dear @maxandre.ogeret,
I don’t find ImageTransformer class in the repo. Could you confirm if it has all files?

Dear @maxandre.ogeret,
Please confirm the input and output image properties like pixel type, data type, memory type to check if it is supported?

@SivaRamaKrishnaNV , thanks for your answer.

Input type :

  • DW_IMAGE_NVMEDIA
  • DW_IMAGE_FORMAT_YUV420_UINT8_SEMIPLANAR
  • DW_IMAGE_MEMORY_TYPE_PITCH
  • 1920x1208

Output type:

  • DW_IMAGE_NVMEDIA
  • DW_IMAGE_FORMAT_YUV420_UINT8_SEMIPLANAR
  • DW_IMAGE_MEMORY_TYPE_PITCH
  • 800x600

And the image is all green.

I have found in the samples that the following format should be supported:

  • DW_IMAGE_NVMEDIA
  • DW_IMAGE_FORMAT_RGBA_UINT8
  • DW_IMAGE_MEMORY_TYPE_PITCH

And indeed it works. Please see the working code:

To me it means that DW_IMAGE_FORMAT_YUV420_UINT8_SEMIPLANAR is simply not supported by the image transformer.
It should be written in the documentation, and dwImageTransformation_copyFullImage should check the image properties and outputs DW_INVALID_ARGUMENT if the image type is not supported.

Dear @maxandre.ogeret,
Does that mean, your sample worked when you change the format?

@SivaRamaKrishnaNV Yes it did