Hi,
I have created nvxcu_pitch_linear_image_t image using the following function:
nvxcu_pitch_linear_image_t createImage(uint32_t width, uint32_t height, nvxcu_df_image_e format)
{
NVXIO_ASSERT(format == NVXCU_DF_IMAGE_U8 ||
format == NVXCU_DF_IMAGE_RGB ||
format == NVXCU_DF_IMAGE_RGBX);
nvxcu_pitch_linear_image_t image = { };
image.base.format = format;
image.base.image_type = NVXCU_PITCH_LINEAR_IMAGE;
image.base.width = width;
image.base.height = height;
size_t pitch = 0ul;
uint32_t cn = format == NVXCU_DF_IMAGE_U8 ? 1u :
format == NVXCU_DF_IMAGE_RGB ? 3u : 4u;
NVXIO_CUDA_SAFE_CALL( cudaMallocPitch(&image.planes[0].dev_ptr, &pitch,
image.base.width * cn, image.base.height) );
image.planes[0].pitch_in_bytes = static_cast<uint32_t>(pitch);
return image;
}
The image is of type NVXCU_DF_IMAGE_RGBX. I want to convert it to vx_image. I have written the following code to convert nvxcu_pitch_linear_image_t to vx_image.
vx_imagepatch_addressing_t src_addr;
src_addr.dim_x = eventData.frame.base.width;
cout<<"Height : "<<src_addr.dim_x<<endl;
cout<<"Height : "<<eventData.frame.base.width<<endl;
src_addr.dim_y = eventData.frame.base.height;
src_addr.stride_x = 4*sizeof( vx_uint8 );
src_addr.stride_y = eventData.frame.planes[0].pitch_in_bytes;
/*src_addr.scale_x = VX_SCALE_UNITY;
src_addr.scale_x = VX_SCALE_UNITY;
src_addr.step_x = 1;
src_addr.step_y = 1;*/
void *src_ptrs[] = { eventData.frame.planes[0].dev_ptr };
vx_image img1 = vxCreateImageFromHandle( context, VX_DF_IMAGE_RGBX, &src_addr,
//(void **)&eventData.frame.planes[0].dev_ptr, VX_MEMORY_TYPE_HOST );
src_ptrs, VX_MEMORY_TYPE_HOST );
renderer1->putImage(img1);
But when I am rendereing the vx_image I am getting a black screen.
Please suggest what I am doing wrong.