# Filtering

- enum FadasFilterPipeline\_e

    - Algorithm pipeline specifying what algorithm pipeline is run by subsequent calls to [FadasFilter\_RunMT()](https://docs.qualcomm.com/doc/80-63309-1/topic/filtering.html#group__filter_1ga0348272f7f86d1c2977b000da5e1fbfa).

- Param FADAS\_FILTER\_PIPELINE\_CONVOLVE\_Y8\_BY\_3x3\_KERNEL:

    - Filter a Y8 image by convolution using 3x3 kernel.

- Param FADAS\_FILTER\_PIPELINE\_CONVOLVE\_Y8\_BY\_5x5\_KERNEL:

    - Filter a Y8 image by convolution using 5x5 kernel.

*Values:*

- enumerator FADAS\_FILTER\_PIPELINE\_CONVOLVE\_Y8\_BY\_3x3\_KERNEL

    - 

- enumerator FADAS\_FILTER\_PIPELINE\_CONVOLVE\_Y8\_BY\_5x5\_KERNEL

    - 

- enumerator FADAS\_FILTER\_PIPELINE\_END

    - To check invalid enum values.

- enumerator FADAS\_FILTER\_PIPELINE\_CONVOLVE\_MAX

    -

- enum FadasFilterThreshold\_e

    - Algorithm pipeline.

- Param FADAS\_FILTER\_THRESHOLD\_FIXED:

    - Thresholds the input grayscale image based on fixed threshold.

- Param FADAS\_FILTER\_THRESHOLD\_OTSU:

    - Thresholds the input grayscale image based on Otsu threshold.

*Values:*

- enumerator FADAS\_FILTER\_THRESHOLD\_FIXED

    - fixed threshold

- enumerator FADAS\_FILTER\_THRESHOLD\_OTSU

    - Otsu threshold.

- enumerator FADAS\_FILTER\_PIPELINE\_MAX

    - **WARNING:** Do not use.

- typedef struct [FadasFilterWorkload](https://docs.qualcomm.com/doc/80-63309-1/topic/struct_fadas_filter_workload.html#_CPPv419FadasFilterWorkload) FadasFilterWorkload\_t

    - [FadasFilterWorkload](https://docs.qualcomm.com/doc/80-63309-1/topic/filtering.html#struct_fadas_filter_workload) structure.

- Param kernel:

    - pointer to kernel properties.

- Param FadasPadBuffer\_t:

    - pointer to pad buffers.

- [FadasError\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#_CPPv412FadasError_e) FadasFilter\_Init(const char \*licenseKey)

    - Initialize the Filter feature. **WARNING:** Must be called once before other FastADAS functions. except [FadasVersion()](https://docs.qualcomm.com/doc/80-63309-1/topic/misc.html#group__misc_1ga55cbdff48d751f2a0227ae4ac106d746).

- Parameters:

    - **licenseKey** – License key string.

- Returns:

    - [FADAS\_ERROR\_NONE](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#fadas_8h_1a280abf443019bfc722ac1158e5fe1013aea09a4171f0866f38326d7e5323f2d12) — Success.

- [FadasError\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#_CPPv412FadasError_e) FadasFilter\_DeInit(void)

    - Deinitialize the Filter feature. **WARNING:** This function must be called once after all other FastADAS functions.

- Returns:

    - [FADAS\_ERROR\_NONE](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#fadas_8h_1a280abf443019bfc722ac1158e5fe1013aea09a4171f0866f38326d7e5323f2d12) — Success.

- void \*FadasFilter\_CreateWorkers(uint32\_t nThreads, int32\_t pThreadsAffinity[], [FadasFilterPipeline\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_group__filter_1ga6f57daa033013c7d682e6abc0fcb8b05.html#_CPPv421FadasFilterPipeline_e) ePipeline)

    - Creates a multithreaded worker pool for the Image convolution feature.

- Parameters:

    - - **nThreads** – Requested number of threads; can be limited to the maximum number of threads if requesting more than that limit. The maximum is the maximum number of physical or logical cores. If requesting 0 threads, use the maximum number.
- **pThreadsAffinity** – Array to set thread affinities.
- **ePipeline** – Execution pipeline to use with this worker pool.

- Returns:

    - Pointer to a worker pool.

- [FadasError\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#_CPPv412FadasError_e) FadasFilter\_DestroyWorkers(void \*wrkrs)

    - destroys a multithreaded worker pool for the Image convolution feature.

- Parameters:

    - **wrkrs** – Pointer to a worker pool.

- Returns:

    - void

- [FadasError\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#_CPPv412FadasError_e) FadasFilter\_RunMT(void \*wrkrs, [FadasImage\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/struct_fadas_image__t.html#_CPPv412FadasImage_t) \*srcImg, [FadasImage\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/struct_fadas_image__t.html#_CPPv412FadasImage_t) \*dstImg, const [FadasKernelProps\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/typedef_fadas_8h_1a8ab6dbace0f719fc44938cbf51b51947.html#_CPPv418FadasKernelProps_t) \*const kernel, [FadasFilterBorderType\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1aeef0d068e7f44f41c505d651a6b3aa66.html#_CPPv423FadasFilterBorderType_e) borderType, const uint8\_t constantValue)

    - Convolve the given srcImg using kernel and writes the output in dstImg **WARNING:** This function must be called once after all other FastADAS functions.

- Parameters:

    - - **wrkrs** – pointer to worker pool for running the multithreaded version of image filter technique.
- **srcImg** – Input Image
- **dstImg** – Output Image
- **kernel** – Object of kernel struct to be used for convolution
- **borderType** – enum of border type to pad the boundary values of the source image before convolution
- **constantValue** – Constant value in case the boundary padding has to be done with a given constant

- Returns:

    - [FADAS\_ERROR\_NONE](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#fadas_8h_1a280abf443019bfc722ac1158e5fe1013aea09a4171f0866f38326d7e5323f2d12) : Success[FADAS\_ERROR\_NULL\_PTR](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#fadas_8h_1a280abf443019bfc722ac1158e5fe1013afed3a42552a75f460b45f0fc210b2b50) : Input/Output pointer is nullptr

- [FadasError\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#_CPPv412FadasError_e) FadasFilter\_Convolve(const [FadasImage\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/struct_fadas_image__t.html#_CPPv412FadasImage_t) \*const srcImg, [FadasImage\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/struct_fadas_image__t.html#_CPPv412FadasImage_t) \*dstImg, const [FadasKernelProps\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/typedef_fadas_8h_1a8ab6dbace0f719fc44938cbf51b51947.html#_CPPv418FadasKernelProps_t) \*const kernel, [FadasFilterBorderType\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1aeef0d068e7f44f41c505d651a6b3aa66.html#_CPPv423FadasFilterBorderType_e) borderType = [FADAS\_FILTER\_BORDER\_TYPE\_ZEROS](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1aeef0d068e7f44f41c505d651a6b3aa66.html#_CPPv4N23FadasFilterBorderType_e30FADAS_FILTER_BORDER_TYPE_ZEROSE), const uint8\_t constantValue = 0)

    - Convolve the given srcImg using kernel and writes the output in dstImg **WARNING:** This function must be called once after all other FastADAS functions.

- Parameters:

    - - **srcImg** – Input Image
- **dstImg** – Output Image
- **kernel** – Object of kernel struct to be used for convolution
- **borderType** – enum of border type to pad the boundary values of the source image before convolution
- **constantValue** – Constant value in case the boundary padding has to be done with a given constant

- Returns:

    - [FADAS\_ERROR\_NONE](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#fadas_8h_1a280abf443019bfc722ac1158e5fe1013aea09a4171f0866f38326d7e5323f2d12) : Success[FADAS\_ERROR\_NULL\_PTR](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#fadas_8h_1a280abf443019bfc722ac1158e5fe1013afed3a42552a75f460b45f0fc210b2b50) : Input/Output pointer is nullptr

- [FadasError\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#_CPPv412FadasError_e) FadasFilter\_Init\_Calib(const char \*licenseKey)

    - Initialize filter module. **WARNING:** Must be called once before other FastADAS functions except [FadasVersion()](https://docs.qualcomm.com/doc/80-63309-1/topic/misc.html#group__misc_1ga55cbdff48d751f2a0227ae4ac106d746).

- Parameters:

    - **licenseKey** – License key string.

- Returns:

    - [FADAS\_ERROR\_NONE](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#fadas_8h_1a280abf443019bfc722ac1158e5fe1013aea09a4171f0866f38326d7e5323f2d12) — Success.

- [FadasError\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#_CPPv412FadasError_e) FadasFilter\_DeInit\_Calib(void)

    - Deinitialize filter module. **WARNING:** Must be called once after all other FastADAS functions.

- Returns:

    - [FADAS\_ERROR\_NONE](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#fadas_8h_1a280abf443019bfc722ac1158e5fe1013aea09a4171f0866f38326d7e5323f2d12) — Success.

- [FadasError\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#_CPPv412FadasError_e) FadasFilter\_Thresholdu8(const [FadasImage\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/struct_fadas_image__t.html#_CPPv412FadasImage_t) \*src, [FadasImage\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/struct_fadas_image__t.html#_CPPv412FadasImage_t) \*dst, uint8\_t thresh = 128, [FadasFilterThreshold\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_group__filter_1ga7984aaac60bc476c175ee77cf2558f7d.html#_CPPv422FadasFilterThreshold_e) eType = [FADAS\_FILTER\_THRESHOLD\_FIXED](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_group__filter_1ga7984aaac60bc476c175ee77cf2558f7d.html#_CPPv4N22FadasFilterThreshold_e28FADAS_FILTER_THRESHOLD_FIXEDE))

    - Converts grayscale image to binary image.

- Parameters:

    - - **src** – Pointer to the input image object.
- **dst** – Pointer to the output image object.
- **thresh** –

    Fixed threshold value to be used for binarization of the grayscale image.

    NOTE: This value is used only if eType is set to

[FADAS\_FILTER\_THRESHOLD\_FIXED](https://docs.qualcomm.com/doc/80-63309-1/topic/filtering.html#group__filter_1gga7984aaac60bc476c175ee77cf2558f7da228586d2d6ce9e9ed87482219654b288)
- **eType** – Threshold method.

- Returns:

    - [FADAS\_ERROR\_NONE](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#fadas_8h_1a280abf443019bfc722ac1158e5fe1013aea09a4171f0866f38326d7e5323f2d12) — Success.

- struct FadasFilterWorkload

    - [FadasFilterWorkload](https://docs.qualcomm.com/doc/80-63309-1/topic/filtering.html#struct_fadas_filter_workload) structure.

- Param kernel:

    - pointer to kernel properties.

- Param FadasPadBuffer\_t:

    - pointer to pad buffers.

Public Members

- const [FadasKernelProps](https://docs.qualcomm.com/doc/80-63309-1/topic/struct_fadas_kernel_props.html#_CPPv416FadasKernelProps) \*kernel

    - 

- const [FadasPadBuffer\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/struct_fadas_pad_buffer__t.html#_CPPv416FadasPadBuffer_t) \*padBuffer

    -

Last Published: Sep 30, 2024

[Previous Topic
Fast Fourier Transform](https://docs.qualcomm.com/bundle/publicresource/80-63309-1/topics/fast-fourier-transform.md) [Next Topic
Feature Point Extraction](https://docs.qualcomm.com/bundle/publicresource/80-63309-1/topics/feature-point-extraction.md)