Patent ID: 11972504
Assignee: ZHEJIANG LAB
Field: Computer technology (Electrical engineering)
Classification: CPC G | IPC G

Claim 0:
1. A method for overlapping sliding window segmentation of an original input image based on a field programmable gate array (FPGA), wherein the original input image is m rows×n columns, and a size of a segmented sub-image is k rows×k columns; a step size of an overlapping sliding window process is s, and s<k, the overlapping sliding window process comprises a horizontal overlapping sliding window process and a vertical overlapping sliding window process, and a sequence of the horizontal overlapping sliding window process is horizontal from left to right, and the vertical overlapping sliding window process is vertical from top to bottom; if a boundary is not divisible, expansion is implemented by filling all-zero pixels outwards; the FPGA needs ┌n/s┐ block random access memories (BRAMs) in total, which are numbered as 0,1, 2, . . . , ┌n/s┐−1, where ┌ ┐ means rounding up, where m, n and k are positive integers, l<m, l<n, k<m, and k<n;
the method comprises:
step S1: starting from a first row of the original input image, writing pixel data from (1,1) to (1,s) into BRAM_0 in sequence, wherein BRAM_0 corresponds to a (0,0)th segmented sub-image, (1,s+1) to (1,k) are overlapping areas of the (0,0)th segmented sub-image and a (0,1)th segmented sub-image in the horizontal overlapping sliding window process in the first row; and writing data in the overlapping areas into BRAM_0 and BRAM_1 in synchronous and parallel manner, wherein BRAM_1 corresponds to the (0,1)th segmented sub-image;
step S2: executing the horizontal overlapping sliding window process, and writing pixel data of (1, k+1) to (1,2s) in the first row into BRAM_1; during the horizontal overlapping sliding window process, starting a burst continuous write operation of each BRAM of the BRAMs to an off-chip DDR memory when data received by each BRAM reaches a preset threshold or when a last pixel of each segmented sub-image is written into a BRAM of the BRAMs corresponding to the segmented sub-image;
step S3: (1, 2s+1) to (1,s+k) pixels being overlaps of the (0,1)th segmented sub-image and a (0,2)th segmented sub-images in the horizontal overlapping sliding window process of the first row, and writing overlapped data synchronously into BRAM_1 and BRAM_2, wherein BRAM_2 corresponds to the (0,2)th segmented sub-image;
step S4: executing the horizontal overlapping sliding window process in the first row, until the horizontal overlapping sliding window process and segmentation are performed on all pixels in the first row;
step S5, referring to the first row, sequentially executing the horizontal overlapping sliding window process from a second row to a kth row so that a first complete horizontal overlapping sliding window process is executed and data corresponding to the first complete horizontal overlapping sliding window process is written into the off-chip DDR memory;
step S6: executing the vertical overlapping sliding window process, wherein last (k−s) rows and k columns of pixel data of respective segmented sub-images (0,0), (0,1), . . . , (0, ┌n/s┐−1) are used as starting (k−s) rows and k columns of pixel data in a next batch of segmented sub-images (1,0), (1,1), . . . , (1, ┌n/s┐−1), and are spliced with each row of pixel data written subsequently;
step S7: executing the horizontal overlapping sliding window process from a k+1th row to a s+kth row of the original input image according to steps S1-S5, in such a manner that a second batch of segmented sub-images (1,0), (1,1), . . . , (1, ┌n/s┐−1) has been written to corresponding BRAM_0, BRAM_1, . . . , BRAM_┌n/s┐, respectively, and executing the burst continuous write operation from the BRAMs to the off-chip DDR memory; and
step S8: repeating the horizontal overlapping sliding window process and the vertical overlapping sliding window process until an overlapping sliding window of the entire original input image is segmented and written into the off-chip DDR memory, respectively.