Harris Corner#

Compute the Harris response for each input pixel in a tile.

This algorithm follows these steps:

1) Apply 3x3 gradient operator filters to determine each of the x and y gradients. The coefficients of the filters are given by [ coeff ]^T * [-1 0 1] for x gradients and [-1 0 1]^T * [ coeff ] for y gradients.

2) Construct M matrix for each pixel. M is computed by summing gradient covariance matrices in a 3x3 block for each pixel.

3) Set each output pixel to R = det(M) - lambdaVal * trace^2(M)

The combination of the 3x3 gradient operator filter with 3x3 block summation means that each output pixel has 5x5 support in the input. The valid output will be 4 pixels less than the input in each width and height dimensions and offset by 2 - i.e. the output at x=0, y=0 is the Harris response of input pixel x=2, y=2.

Macros#

PVAAPL_HARRIS_SCRATCH_SIZE

Determine bytes needed for each scratch buffer in Harris corner detector.

Functions#

void pvaAplExecHarrisCornerS16(PvaAplHarrisCornerS16 *handle)

Execute the Harris Corner algorithm with a given handle.

void pvaAplExecHarrisCornerS16Vpu(PvaAplHarrisCornerS16 *handle)

Execute the Harris Corner algorithm with a given handle.

void pvaAplInitHarrisCornerS16(PvaAplHarrisCornerS16 *handle, int16_t *input, int16_t *coeff, int32_t roundNBits, int32_t lambdaVal, int32_t width, int32_t height, int32_t inputLinePitch, int32_t outputLinePitch, int32_t *output, int16_t *cbStart, int32_t cbSize, void *scratch0, void *scratch1, void *scratch2)

Initialize the Harris Corner Score algorithm parameters .

void pvaAplInitHarrisCornerS16Vpu(PvaAplHarrisCornerS16 *handle, int16_t *input, int16_t *coeff, int32_t roundNBits, int32_t lambdaVal, int32_t width, int32_t height, int32_t inputLinePitch, int32_t outputLinePitch, int32_t *output, int16_t *cbStart, int32_t cbSize, void *scratch0, void *scratch1, void *scratch2)

Initialize the Harris Corner Score algorithm parameters .

void pvaAplUpdateHarrisCornerS16(PvaAplHarrisCornerS16 *handle, int16_t *input, int32_t *output)

Update the input/output buffer pointers and input image size for the Harris Corner Score algorithm.

void pvaAplUpdateHarrisCornerS16Vpu(PvaAplHarrisCornerS16 *handle, int16_t *input, int32_t *output)

Update the input/output buffer pointers and input image size for the Harris Corner Score algorithm.

Functions#

static inline void pvaAplExecHarrisCornerS16(
PvaAplHarrisCornerS16 *handle,
)#

Execute the Harris Corner algorithm with a given handle.

Usage considerations

  • Allowed context for the API call

    • Interrupt handler: No

    • Signal handler: No

    • Thread-safe: No

    • Re-entrant: No

    • Async/Sync: Sync

  • Required privileges: None

  • Allowed execution state

    • Initialization: Yes

    • Operational: Yes

    • Reinit/Deinit Preparation: Yes

  • Maturity: GA

Parameters:

handle – Pointer to the Harris Corner algorithm handle.

Pre:

None

void pvaAplExecHarrisCornerS16Vpu(PvaAplHarrisCornerS16 *handle)#

Execute the Harris Corner algorithm with a given handle.

Usage considerations

  • Allowed context for the API call

    • Interrupt handler: No

    • Signal handler: No

    • Thread-safe: No

    • Re-entrant: No

    • Async/Sync: Sync

  • Required privileges: None

  • Allowed execution state

    • Initialization: Yes

    • Operational: Yes

    • Reinit/Deinit Preparation: Yes

  • Maturity: GA

This variant ensures synchronous execution on VPU, even on platforms supporting asynchronous acceleration. Do not call pvaAplWait() when using this variant.

Usage considerations

  • Allowed context for the API call

    • Interrupt handler: No

    • Signal handler: No

    • Thread-safe: No

    • Re-entrant: No

    • Async/Sync: Sync

  • Required privileges: None

  • Allowed execution state

    • Initialization: Yes

    • Operational: Yes

    • Reinit/Deinit Preparation: Yes

  • Maturity: GA

Parameters:

handle – Pointer to the Harris Corner algorithm handle.

Pre:

None

Pre:

None

static inline void pvaAplInitHarrisCornerS16(
PvaAplHarrisCornerS16 *handle,
int16_t *input,
int16_t *coeff,
int32_t roundNBits,
int32_t lambdaVal,
int32_t width,
int32_t height,
int32_t inputLinePitch,
int32_t outputLinePitch,
int32_t *output,
int16_t *cbStart,
int32_t cbSize,
void *scratch0,
void *scratch1,
void *scratch2,
)#

Initialize the Harris Corner Score algorithm parameters .

This algorithm makes use of scratch buffers if executed on VPU. Each scratch buffer should be aligned to 64B and with size given by PVAAPL_HARRIS_SCRATCH_SIZE. For best performance, place all three scratch buffers in separate superbanks. Scratch buffers can be NULL if VPU is not used.

Usage considerations

  • Allowed context for the API call

    • Interrupt handler: No

    • Signal handler: No

    • Thread-safe: No

    • Re-entrant: No

    • Async/Sync: Sync

  • Required privileges: None

  • Allowed execution state

    • Initialization: Yes

    • Operational: Yes

    • Reinit/Deinit Preparation: Yes

  • Maturity: GA

Parameters:
  • handle – Pointer to the algorithm handle.

  • input – Pointer to the buffer in int16_t pixel format. The recommended input pixel value range is [0, 255] or [-128, 127]. Output may saturate if the input pixel value range is broader.

  • coeff – Coefficients for the averaging part of the gradient operator. These coefficients are combined with a differentiation filter to create the final 3x3 gradient operators. Horizontal Gradient Operator: Gx = [coeff[0], coeff[1], coeff[2]]^T * [-1 0 1] Vertical Gradient Operator: Gy = [-1 0 1]^T * [coeff[0], coeff[1], coeff[2]] Should point to 3 element array of int16_t format.

  • roundNBits – Right shift amount for rounding the output harris corner score. Harris corner score is internally computed in 48-bit registers truncated to 32-bit before storing the result. Recommended value is 5. Can be increased depending on the input data, gradient operator coefficients and the lambdaVal parameter.

  • lambdaVal – Constant value used in the Harris corner score computation. R = det(M) - lambdaVal * trace^2(M) Should be passed as fixed point 16-bit quantized value. For example to pass 0.05: (int32_t)(0.05f * (float)(1 << 16)) Recommended range is 0.04 to 0.06.

  • width – Input image width in pixels.

  • height – Input image height in pixels.

  • inputLinePitch – Input buffer line pitch in pixels.

  • outputLinePitch – Output buffer line pitch in pixels. Must be at least (width - 4)

  • output – Pointer to the output Harris corner score buffer in int32_t format. Output is written in blocks of 16 rows. The buffer must be large enough to hold height - 4 rows, rounded up to a multiple of 16. For example if input height is 136, the buffer should be large enough to hold 144 rows. Only the first height - 4 rows will contain valid data.

  • cbStart – Start address of the input circular buffer. Pass NULL if circular buffer is not used.

  • cbSize – Size of the input circular buffer in bytes. Pass 0 if circular buffer is not used.

  • scratch0 – Scratch buffer. Size needed is given by PVAAPL_HARRIS_SCRATCH_SIZE.

  • scratch1 – Scratch buffer. Size needed is given by PVAAPL_HARRIS_SCRATCH_SIZE.

  • scratch2 – Scratch buffer. Size needed is given by PVAAPL_HARRIS_SCRATCH_SIZE.

Pre:

None

void pvaAplInitHarrisCornerS16Vpu(
PvaAplHarrisCornerS16 *handle,
int16_t *input,
int16_t *coeff,
int32_t roundNBits,
int32_t lambdaVal,
int32_t width,
int32_t height,
int32_t inputLinePitch,
int32_t outputLinePitch,
int32_t *output,
int16_t *cbStart,
int32_t cbSize,
void *scratch0,
void *scratch1,
void *scratch2,
)#

Initialize the Harris Corner Score algorithm parameters .

This algorithm makes use of scratch buffers if executed on VPU. Each scratch buffer should be aligned to 64B and with size given by PVAAPL_HARRIS_SCRATCH_SIZE. For best performance, place all three scratch buffers in separate superbanks. Scratch buffers can be NULL if VPU is not used.

Usage considerations

  • Allowed context for the API call

    • Interrupt handler: No

    • Signal handler: No

    • Thread-safe: No

    • Re-entrant: No

    • Async/Sync: Sync

  • Required privileges: None

  • Allowed execution state

    • Initialization: Yes

    • Operational: Yes

    • Reinit/Deinit Preparation: Yes

  • Maturity: GA

This variant ensures synchronous execution on VPU, even on platforms supporting asynchronous acceleration.

Usage considerations

  • Allowed context for the API call

    • Interrupt handler: No

    • Signal handler: No

    • Thread-safe: No

    • Re-entrant: No

    • Async/Sync: Sync

  • Required privileges: None

  • Allowed execution state

    • Initialization: Yes

    • Operational: Yes

    • Reinit/Deinit Preparation: Yes

  • Maturity: GA

Parameters:
  • handle – Pointer to the algorithm handle.

  • input – Pointer to the buffer in int16_t pixel format. The recommended input pixel value range is [0, 255] or [-128, 127]. Output may saturate if the input pixel value range is broader.

  • coeff – Coefficients for the averaging part of the gradient operator. These coefficients are combined with a differentiation filter to create the final 3x3 gradient operators. Horizontal Gradient Operator: Gx = [coeff[0], coeff[1], coeff[2]]^T * [-1 0 1] Vertical Gradient Operator: Gy = [-1 0 1]^T * [coeff[0], coeff[1], coeff[2]] Should point to 3 element array of int16_t format.

  • roundNBits – Right shift amount for rounding the output harris corner score. Harris corner score is internally computed in 48-bit registers truncated to 32-bit before storing the result. Recommended value is 5. Can be increased depending on the input data, gradient operator coefficients and the lambdaVal parameter.

  • lambdaVal – Constant value used in the Harris corner score computation. R = det(M) - lambdaVal * trace^2(M) Should be passed as fixed point 16-bit quantized value. For example to pass 0.05: (int32_t)(0.05f * (float)(1 << 16)) Recommended range is 0.04 to 0.06.

  • width – Input image width in pixels.

  • height – Input image height in pixels.

  • inputLinePitch – Input buffer line pitch in pixels.

  • outputLinePitch – Output buffer line pitch in pixels. Must be at least (width - 4)

  • output – Pointer to the output Harris corner score buffer in int32_t format. Output is written in blocks of 16 rows. The buffer must be large enough to hold height - 4 rows, rounded up to a multiple of 16. For example if input height is 136, the buffer should be large enough to hold 144 rows. Only the first height - 4 rows will contain valid data.

  • cbStart – Start address of the input circular buffer. Pass NULL if circular buffer is not used.

  • cbSize – Size of the input circular buffer in bytes. Pass 0 if circular buffer is not used.

  • scratch0 – Scratch buffer. Size needed is given by PVAAPL_HARRIS_SCRATCH_SIZE.

  • scratch1 – Scratch buffer. Size needed is given by PVAAPL_HARRIS_SCRATCH_SIZE.

  • scratch2 – Scratch buffer. Size needed is given by PVAAPL_HARRIS_SCRATCH_SIZE.

Pre:

None

Pre:

None

static inline void pvaAplUpdateHarrisCornerS16(
PvaAplHarrisCornerS16 *handle,
int16_t *input,
int32_t *output,
)#

Update the input/output buffer pointers and input image size for the Harris Corner Score algorithm.

Usage considerations

  • Allowed context for the API call

    • Interrupt handler: No

    • Signal handler: No

    • Thread-safe: No

    • Re-entrant: No

    • Async/Sync: Sync

  • Required privileges: None

  • Allowed execution state

    • Initialization: Yes

    • Operational: Yes

    • Reinit/Deinit Preparation: Yes

  • Maturity: GA

Parameters:
  • handle – Pointer to the algorithm handle.

  • input – Pointer to the input image

  • output – Pointer to the output Harris corner score buffer.

Pre:

None

void pvaAplUpdateHarrisCornerS16Vpu(
PvaAplHarrisCornerS16 *handle,
int16_t *input,
int32_t *output,
)#

Update the input/output buffer pointers and input image size for the Harris Corner Score algorithm.

Usage considerations

  • Allowed context for the API call

    • Interrupt handler: No

    • Signal handler: No

    • Thread-safe: No

    • Re-entrant: No

    • Async/Sync: Sync

  • Required privileges: None

  • Allowed execution state

    • Initialization: Yes

    • Operational: Yes

    • Reinit/Deinit Preparation: Yes

  • Maturity: GA

This variant ensures synchronous execution on VPU, even on platforms supporting asynchronous acceleration.

Usage considerations

  • Allowed context for the API call

    • Interrupt handler: No

    • Signal handler: No

    • Thread-safe: No

    • Re-entrant: No

    • Async/Sync: Sync

  • Required privileges: None

  • Allowed execution state

    • Initialization: Yes

    • Operational: Yes

    • Reinit/Deinit Preparation: Yes

  • Maturity: GA

Parameters:
  • handle – Pointer to the algorithm handle.

  • input – Pointer to the input image

  • output – Pointer to the output Harris corner score buffer.

Pre:

None

Pre:

None