Convert RGBA image to YUV output plane count

Hello,

i try to convert a rgba image into a yuv image. The error message i get is:
“FormatConverter (cuda): wrong output plane count”

i set the plane count in the init of the cuda-yuv image to 3.What do I need to change to make it work?

Hi BjoernFathIPG,
Could you please post the code snippet to show steps you have followed.

Hi SivaRamaKrishna,

init format converter:

// RGBA -> YUV
dwImageProperties yuvImageProperties = displayImageProperties;
yuvImageProperties.pxlFormat = DW_IMAGE_YUV420;
yuvImageProperties.pxlType = DW_TYPE_UINT8;
yuvImageProperties.planeCount = 3;
dwImageFormatConverter_initialize(&gRgba2yuv,&displayImageProperties,&yuvImageProperties,gSdk);

//Setup YUV image
void *dptr1 = nullptr;
size_t pitch1 = 0;
cudaMallocPitch(&dptr1, &pitch1, displayImageProperties.width * 3, displayImageProperties.height);

dwImageCUDA_setFromPitch(&gFrameCUDAyuv, dptr1, displayImageProperties.width,
     displayImageProperties.height,pitch1, DW_IMAGE_YUV420);

not shure if the allocation is correct.

convert:

// RGBA -> YUV
dwImageFormatConverter_copyConvertCUDA(&gFrameCUDAyuv,&gFrameCUDArgba,gRgba2yuv,gCudaStream);

Thanks