Forums - Value of 'shift' for fcvFilterConvolveMxNu8

3 posts / 0 new
Last post
Value of 'shift' for fcvFilterConvolveMxNu8
sagar.kirtany
Join Date: 6 Jul 20
Posts: 7
Posted: Thu, 2020-12-17 23:52

Hello,

I am attempting to use fcvFilterConvolveMxNu8() to perform convolution of a 320x240 image with a 11x11 kernel. The source image is of type unsigned char, and kernel is of type short, so both are in line with the requirements of the function.

The relevant code snippet is as follows:

fcvStatus  op_status = fcvFilterConvolveMxNu8( (const int16_t *__restrict)myKernel, 11, 11, (int8_t)CONVOL_SHIFT_VALUE, (const uint8_t *__restrict)src, 320, 240, 320, (uint8_t *__restrict)dst, 320, FASTCV_BORDER_CONSTANT, 128 );

Here, CONVOL_SHIFT_VALUE is the 'shift' parameter of the FastCV function. Per the API documentation, "This parameter can be used to normalize the input kernel by converting the data into fixed point values. Shift can be considered as Q factor of kernel." Since my kernel is of type short, I assumed that it does not require any normalization. Therefore, I set this parameter to '1'. But I am getting an output image with completely saturated (255) pixel values.

Is my understanding wrong? What should the value of the 'shift' parameter be in this case?

Thanks and regards,

Sagar Kirtany

  • Up0
  • Down0
hs.chaya
Join Date: 20 Mar 20
Posts: 23
Posted: Wed, 2021-02-03 23:32

Hi,

I used fcvFilterConvolveMxNu8()  function to perform convolution of 64x64 image with 11x11 kernel. Source image is of  type uint8_t and kernel is of type short and shift value is 1 and border value is 128.

The code snippet is as follow       

fcvFilterConvolveMxNu8  ((const int16_t *__restrict)kernel, kernel_width, kernel_height, shift_value, (const uint8_t *__restrict)src, src_width, src_height, src_width, (uint8_t *__restrict)dst, src_width, FASTCV_BORDER_CONSTANT, border_val);

It is working fine and I am getting output image with not completely saturated(255) pixel values.

If you are still facing problem means please send me full code, i will check it

 

 

  • Up0
  • Down0
sagar.kirtany
Join Date: 6 Jul 20
Posts: 7
Posted: Thu, 2021-02-04 00:10

Hello,

I managed to resolve this issue on my own, and got the proper output.

Thank you for your input.

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.