Set pixel_value in vxCreateUniformImage

I am trying to create an uniform image using the function vxCreateUniformImage() in this way:

const vx_pixel_value_t pixel_value = 10;
vx_image testMultipl = vxCreateUniformImage(context, width, height, VX_DF_IMAGE_U8, &pixel_value);

But I get, of course the error:

error: no suitable constructor exists to convert from "int" to "_vx_pixel_value_t"

How can I create an uniform image with a pixel value of 10?

Thank you in advance.

I managed to solve it in this way:

vx_float32 scale = 1;
vx_pixel_value_t pixel_value;
pixel_value.U8 = 30;
vx_image testMultipl = vxCreateUniformImage(context, width, height, VX_DF_IMAGE_U8, &pixel_value);
vxuMultiply(context, inputImage, testMultipl, scale, VX_CONVERT_POLICY_WRAP, VX_ROUND_POLICY_TO_NEAREST_EVEN, outputImage);

The only problem is that I would like to set the pixel value to 1/255 in order to divide the whole image by 255, but if I do so the only result is a black image and strange values.

1 Like