The custom CCA
function takes a binary image as input which contains a
fruit on a conveyer belt (black background) and returns the total fruit pixels
minus defect, total defect pixels and defect image which has the defects marked as
‘255’. This function is a custom made solution for defect detection in fruit, which
ideally works with other pre-processing functions.
The custom CCA algorthm works in two-passes. The first pass includes labelling the background, foreground and defect in forward and reverse raster-scan. The second pass to perform an ‘&’ operation over the forward and reverse partial output data.
API Syntax
template <int HEIGHT, int WIDTH>
void ccaCustom(
uint8_t* in_ptr1,
uint8_t* in_ptr2,
uint8_t* tmp_out_ptr1,
uint8_t* tmp_out_ptr2,
uint8_t* out_ptr,
int& obj_pix,
int& def_pix,
int height,
int width)
Parameter Descriptions
The following table describes the template and the function parameters.
Parameter | Description |
---|---|
HEIGHT | Maximum height of input and output image. |
WIDTH | Maximum width of input and output image. |
in_ptr1 | Input 8-bit image pointer for forward pass, binary 8-bit image (‘0’ and ‘255’) |
in_ptr1 | Input 8-bit image pointer for the parallel computation of reverse pass, binary 8-bit image (‘0’ and ‘255’) |
tmp_out_ptr1 | 8-bit pointer to store and read from the temporary buffer in DDR for the forward pass. This memory must be allocated before the kernel call. |
tmp_out_ptr2 | 8-bit pointer to store and read from the temporary buffer in DDR for the reverse pass. This memory must be allocated before the kernel call. |
out_ptr | Output 8-bit image pointer for the which contains the defects image. Defect pixels are marked as ‘255’. |
obj_pix | output - no. of object/foreground pixels without the count of defect pixels. |
def_pix | output - no. of defect pixels in the object/foreground. |
height | Height of the input image |
Width | Width of the input image |
Resource Utilization
The following table summarizes the resource utilization for custom CCA, generated using Vitis HLS 2021.1 tool for the xczu9eg-ffvb1156-1-i-es1, to process a FHD (1080x1920) image.
Operating Mode | Operating Frequency (MHz) | Utilization Estimate | ||||
---|---|---|---|---|---|---|
BRAM_18K | DSP_48Es | FF | LUT | CLB | ||
1 Pixel | 300 | 10 | 10 | 11166 | 7556 | 1757 |
The following table summarizes the resource utilization for custom CCA, generated using Vitis HLS 2021.1 tool for the xczu9eg-ffvb1156-1-i-es1, to process a 4K image.
Operating Mode | Operating Frequency (MHz) | Utilization Estimate | ||||
---|---|---|---|---|---|---|
BRAM_18K | DSP_48Es | FF | LUT | CLB | ||
1 Pixel | 300 | 12 | 10 | 11199 | 7804 | 1748 |
Performance Estimate
The following table summarizes the performance for custom CCA, as generated using Vivado HLS 2019.1 tool for the xczu9eg-ffvb1156-1-i-es1, to process a FHD (1080x1920) image.
Operating Mode | Latency Estimate |
---|---|
Max Latency (ms) | |
1 pixel operation (300 MHz) | 14 |