This is part 4 in a series of articles related to a demo that will perform classical image processing in the Lattice ICE40 UltraPlus FPGA. The system that will be used is the Lattice ICE40 FPGA UltraPlus Breakout Board.
Please refer to the previous articles, part 1, part 2,, part 3 before proceeding with this article. The following function is used in this demo,
//use gradient kernels
void test_simple_edge_detection(uint8_t *image_input, uint8_t *image_output, Image_processing *img_proc){
img_proc->send_params(image_width, image_height);
img_proc->send_image(image_input);
//top gradient
{
uint8_t conv_kernel[9] = {(1)<<3, (1)<<4, (1)<<3, (0)<<4, ((0)<<4), (0)<<4, (-1)<<3, (-1)<<4, (-1)<<3};
img_proc->send_convolution(conv_kernel, true, true, false);
}
img_proc->wait_end_busy();
//bottom gradient
{
uint8_t conv_kernel[9] = {(-1)<<3, (-1)<<4, (-1)<<3, (0)<<4, ((0)<<4), (0)<<4, (1)<<3, (1)<<4, (1)<<3};
img_proc->send_convolution(conv_kernel, true, true, true);
}
img_proc->wait_end_busy();
//left gradient
{
uint8_t conv_kernel[9] = {(1)<<3, (0)<<4, (-1)<<3, (1)<<4, ((0)<<4), (-1)<<4, (1)<<3, (0)<<4, (-1)<<3};
img_proc->send_convolution(conv_kernel, true, true, true);
}
img_proc->wait_end_busy();
//right gradient
{
uint8_t conv_kernel[9] = {(-1)<<3, (0)<<4, (1)<<3, (-1)<<4, ((0)<<4), (1)<<4, (-1)<<3, (0)<<4, (1)<<3};
img_proc->send_convolution(conv_kernel, true, true, true);
}
img_proc->wait_end_busy();
img_proc->switch_buffers();
img_proc->read_image(image_output);
}
and the result of this image processing demo is shown below,
Here is a close up of the edge detection algorithm implemented inside the FPGA,
In the next article we will be describing more image processing demos in this platform as well as more details, stay tuned. The Lattice ICE40 FPGA UltraPlus Breakout Board is an excellent, low cost, but powerful enough to even tackle image processing applications and is available at DigiKey.
Have a wonderful day!
This article is available in spanish here.
Este artículo está disponible en español aquí.



