A method and system for fast wide-window filtering of spatial surveillance images
By sorting the image by rows, columns, and diagonals and removing non-median elements, combined with FPGA parallel processing, the problem of large computational load in wide window median filtering is solved, realizing fast and accurate image preprocessing, suitable for median filtering with large window sizes such as 5×5 and 7×7.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-12
- Publication Date
- 2026-03-13
AI Technical Summary
In existing technologies, wide-window median filtering methods involve large computational loads and are difficult to apply to median filtering in image preprocessing with large window sizes such as 5×5 and 7×7.
Employing the concept of parallel computing, the original filtering window is sorted by row, column, and diagonal to remove non-median elements. Parallel pipelined processing is then performed using programmable logic circuits such as FPGAs. The parallel processing architecture is designed, including 7-element, 5-element, and 3-element sorting modules, and registers are inserted to shorten the timing path.
It enables fast output of median filtering results in a wide window, reduces computational load, improves processing efficiency and accuracy, and supports median filtering with arbitrary window size. The hardware architecture is flexible and easy to expand.
Smart Images

Figure CN117132485B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of image processing technology, and in particular relates to a method and system for fast wide-window filtering of spatial surveillance images. Background Technology
[0002] Generally, image signals are interfered with by various types of noise during generation, propagation, and recording. Noise significantly impacts image quality, complicating image analysis. To improve image clarity, noise must be eliminated, and distorted areas must be addressed. Noise reduction typically occurs before edge testing, image segmentation, feature extraction, and pattern recognition. The process of eliminating interference while preserving relevant information is commonly called image preprocessing, and image noise reduction is also known as image smoothing. This is usually achieved through filtering methods, including linear and nonlinear filtering. Linear filtering boasts advantages such as a well-established theoretical foundation, simple mathematical processing, and ease of implementation using FFT and hardware, making it effective at smoothing additive Gaussian noise. However, it is less effective at suppressing impulse signals and other forms of high-frequency components. Nonlinear filtering, based on a nonlinear mapping of the input signal sequence, can typically approximate a specific type of noise to zero while preserving important signal characteristics, overcoming the limitations of linear filtering.
[0003] Median filtering is one of the most commonly used nonlinear filters, first proposed by image scientist Turky in 1971. Based on permutation statistics theory, median filtering is a nonlinear signal processing technique that effectively suppresses noise. As a nonlinear filter, median filtering replaces each pixel in an image with the median of the sorted gray values of all pixels within a sampling window, effectively removing impulse noise. Summary of the Invention
[0004] To address the issue of high computational complexity caused by wide-window median filtering, this invention provides a fast wide-window filtering method and system for spatial surveillance images, which rapidly achieves median filtering value selection in image preprocessing based on the concept of parallel computing.
[0005] A method for fast wide-window filtering of spatial surveillance images includes the following steps:
[0006] Sort the elements in each row of the original filter window A from left to right in descending order of size to obtain the row-sorted filter window B.
[0007] Sort the elements in each column of the filter window B from top to bottom in descending order to obtain the sorted filter window C.
[0008] Remove the non-median elements in the upper left and lower right corners of the filter window C, and sort the remaining diagonal elements from top to bottom in descending order to obtain the filter window D;
[0009] Remove the non-median elements from the filter window D, and sort the remaining diagonal elements from top to bottom in descending order to obtain the filter window E;
[0010] Remove the non-median elements from the filter window E to obtain the filter window F. Use the median of the filter window F as the median of the original filter window A to complete the median filtering.
[0011] Furthermore, assuming the original filter window A has a size of S×S, then the front of the filter window C... Go forward The elements in the triangular region formed by the columns are taken as the non-median element in the top left corner, and the filter window C is then... Actions and After The elements in the triangular region formed by the columns are considered as the non-middle element in the upper right corner. This indicates rounding up to the nearest integer.
[0012] Furthermore, when the original filter window A is 7×7, the non-median element in the upper left corner of the filter window C includes C0. 11 C 12 C 21 C 13 C 14 C 22 C 23 C 31 C 32 C 41 The non-median element in the bottom right corner includes C. 47 C 56 C 57 C 65 C 66 C 74 C 75 C 76 C 67 , where C ab This represents the element in the a-th row and b-th column of the filter window C, where a = 1, 2, 3, ..., 7 and b = 1, 2, 3, ..., 7;
[0013] The non-median elements of the filter window D include D 15 D 16 D 17 D 24 D 25 D 26 D 33 D 34 D 42 D 46 D 54 D 55 D 62D 63 D 64 D 71 D 72 D 73 , where D pq This represents the element in the p-th row and q-th column of the filter window D, where p = 1, 2, 3, ..., 7 and q = 1, 2, 3, ..., 7;
[0014] The non-median elements of the filter window E include E 27 E 35 E 36 E 43 E 45 E 52 E 53 E 61 , of which E cd This represents the element in the c-th row and d-th column of the filter window E, where c = 2, 3, ..., 6 and d = 1, 2, 3, 5, 6, 7.
[0015] Furthermore, when the original filter window A is 5×5, the non-median element in the upper left corner of the filter window C includes C0. 11 C 12 C 21 C 13 C 22 C 31 The non-median element in the bottom right corner includes C. 35 C 44 C 45 C 53 C 54 C 55 , where C ab This represents the element in the a-th row and b-th column of the filter window C, where a = 1, 2, 3, 4, 5 and b = 1, 2, 3, 4, 5.
[0016] The non-median elements of the filter window D include D 14 D 15 D 23 D 24 D 32 D 34 D 42 D 43 D 51 D 52 , where D pq This represents the element in the p-th row and q-th column of the filter window D, where p = 1, 2, 3, 4, 5 and q = 1, 2, 3, 4, 5.
[0017] The non-median elements of the filter window E include E 25 E 41 , of which E cdThis represents the element in the c-th row and d-th column of the filter window E, where c = 2, 4 and d = 1, 5.
[0018] A wide-window fast filtering system for spatial surveillance images, assuming the size of the original filtering window A is 7×7, the system is implemented based on FPGA and includes two or more 7-element sorting modules, 5-element sorting modules, and 3-element sorting modules;
[0019] Each 7-element sorting module is used to receive 7 or 6 input elements respectively, and each 7-element sorting module sorts the input elements in descending order in parallel and outputs the sorted results in parallel.
[0020] Each 5-element sorting module is used to receive 5 or 4 input elements respectively, and each 5-element sorting module sorts the input elements in descending order in parallel and outputs the sorted results in parallel.
[0021] Each 3-element sorting module is used to receive 3 input elements, and each 3-element sorting module sorts the input elements in descending order in parallel and outputs the sorted results in parallel.
[0022] Furthermore, a 7-element sorting module is first used to sort 7 or 6 elements, then a 5-element sorting module is used to sort 5 or 4 elements, and finally a 3-element sorting module is used to sort 3 elements. A register for splitting the data transmission path of the sorting data is inserted between the element sorting modules that are placed at the beginning and the element sorting modules that are placed at the end.
[0023] Furthermore, the 7-element sorting module sorts 7 elements as follows:
[0024] Step 1: Compare the two elements at positions 1 and 2, positions 4 and 5, and positions 6 and 7 in pairs, and swap their positions according to the comparison results so that the larger element is to the left of the smaller element.
[0025] Step 2: Based on the sorting result obtained in Step 1, compare the three elements at positions 1, 2, and 3, the two elements at positions 4 and 6, and the two elements at positions 5 and 7 in pairs, and swap their positions according to the comparison results, so that the larger element is to the left of the smaller element.
[0026] Step 3: Based on the sorting result obtained in Step 2, compare the two elements at positions 1 and 4, the two elements at positions 3 and 7, and the two elements at positions 5 and 6 in pairs, and swap their positions according to the comparison results, so that the larger element is to the left of the smaller element.
[0027] Step 4: Based on the sorting result obtained in Step 3, compare the two elements at positions 2 and 3, and the three elements at positions 4, 5 and 6 in pairs, and swap their positions according to the comparison results, so that the larger element is to the left of the smaller element.
[0028] Step 5: Based on the sorting result obtained in Step 4, compare the two elements at positions 2 and 4, and the two elements at positions 3 and 6 in pairs, and swap their positions according to the comparison results, so that the larger element is to the left of the smaller element.
[0029] Step 6: Based on the sorting result obtained in Step 5, compare the two elements at positions 3 and 4 pairwise, and swap their positions according to the comparison results, so that the larger element is to the left of the smaller element.
[0030] Step 7: Based on the sorting result obtained in Step 6, compare the three elements at positions 3, 4 and 5 in pairs, and swap their positions according to the comparison results, so that the larger element is to the left of the smaller element, resulting in 7 elements sorted from left to right in descending order.
[0031] Furthermore, the 5-element sorting module sorts 5 elements as follows:
[0032] Step 1: Compare the two elements at positions 1 and 2, and the two elements at positions 4 and 5 in pairs, and swap their positions according to the comparison results, so that the larger element is to the left of the smaller element.
[0033] Step 2: Based on the sorting result obtained in Step 1, compare the three elements at positions 1, 2, and 3 in pairs, and swap their positions according to the comparison results, so that the larger element is to the left of the smaller element.
[0034] Step 3: Based on the sorting result obtained in Step 2, compare the two elements at positions 1 and 5, and the three elements at positions 2, 3, and 4 in pairs, and swap their positions according to the comparison results, so that the larger element is to the left of the smaller element.
[0035] Step 4: Based on the sorting result obtained in Step 3, compare the two elements at positions 1 and 2, and the three elements at positions 3, 4 and 5 in pairs, and swap their positions according to the comparison results, so that the larger element is to the left of the smaller element.
[0036] Step 5: Based on the sorting result obtained in Step 4, compare the three elements at positions 2, 3, and 4 in pairs, and swap their positions according to the comparison results, so that the larger element is to the left of the smaller element, resulting in 5 elements sorted from left to right in descending order.
[0037] Beneficial effects:
[0038] 1. This invention provides a fast wide-window filtering method for spatial surveillance images. The original filtering window is sorted by row, column, and diagonal. During the sorting process, elements that are definitely not the median are continuously removed, thereby achieving fast output of the wide-window median filtering result and greatly reducing the computational load caused by wide-window median filtering.
[0039] 2. This invention provides a fast wide-window filtering method for spatial surveillance images, and gives a method for determining non-median elements in a 5×5 window and a 7×7 window, thereby improving the accuracy of wide-window median filtering results.
[0040] 3. This invention provides a wide-window fast filtering system for spatial surveillance images. It delves into the inherent parallelism of sorting operations and utilizes the characteristics of fully parallel pipelined processing, easy hardware resource expansion and reuse of programmable logic circuits such as FPGAs. Multiple sorting modules are reused for parallel processing, supporting median filtering of arbitrary window sizes. Moreover, the hardware architecture is flexible and easy to expand. Under the premise of ensuring circuit stability and reliability, for a 5×5 window size, a delay of 3×5+2=17 clock cycles is required; for a 7×7 window size, a delay of 7×3+5+2=28 clock cycles is required.
[0041] 4. This invention provides a wide-window fast filtering system for spatial surveillance images. A register for dividing the sorting data transmission path is inserted between the element sorting modules before and after processing, which shortens the longest timing path, increases the maximum clock frequency that the system can achieve, effectively improves processing efficiency, and reduces computational latency. Attached Figure Description
[0042] Figure 1 A flowchart of a wide-window fast filtering method for spatial surveillance images;
[0043] Figure 2 A diagram illustrating the calculation process of fast median filtering for a 5×5 window size;
[0044] Figure 3 A diagram illustrating the calculation process of fast median filtering for a 7×7 window size;
[0045] Figure 4 A diagram illustrating the process of sorting 3 elements;
[0046] Figure 5A diagram illustrating the sorting process of 5 elements;
[0047] Figure 6 A diagram illustrating the process of sorting 7 elements;
[0048] Figure 7 A parallel processing architecture diagram for fast median filtering with a 5×5 window size;
[0049] Figure 8 The parallel processing architecture diagram for fast median filtering with a 7×7 window size. Detailed Implementation
[0050] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.
[0051] Because the computational complexity of median filtering increases significantly with the window size, current known fast filtering methods are only applicable to 3×3 windows, and there are no fast median filtering methods suitable for 5×5, 7×7, or other wide windows. To overcome the problem of high computational complexity caused by wide-window median filtering, this invention proposes a method and system suitable for wide-window median filtering. It fully utilizes the fully parallel pipelined processing and easily expandable hardware resources of programmable logic circuits such as FPGAs to achieve rapid output of wide-window median filtering results.
[0052] like Figure 1 As shown, a wide-window fast filtering method for spatial surveillance images includes the following steps:
[0053] S1: Sort the elements in each row of the original filter window A from left to right in descending order to obtain the row-sorted filter window B;
[0054] S2: Sort the elements in each column of the filter window B from top to bottom in descending order to obtain the sorted filter window C;
[0055] S3: Remove the non-median elements in the upper left and lower right corners of the filter window C, and sort the remaining diagonal elements from top to bottom in descending order to obtain the filter window D;
[0056] Furthermore, assuming the original filter window A has a size of S×S, then the front of the filter window C... Go forward The elements in the triangular region formed by the columns are taken as the non-median element in the top left corner, and the filter window C is then... Actions and After The elements in the triangular region formed by the columns are considered as the non-middle element in the upper right corner. Indicates rounding up;
[0057] S4: Remove the non-median elements in the filter window D, and sort the remaining diagonal elements from top to bottom in descending order to obtain the filter window E;
[0058] S5: Remove the non-median elements from the filter window E to obtain the filter window F. Use the median in the filter window F as the median of the original filter window A to complete the median filtering.
[0059] like Figure 2 The diagram shows a fast filtering method when the original filtering window A is 5×5. Figure 2 In the filter window C, the non-median elements in the upper left corner include C0. 11 C 12 C 21 C 13 C 22 C 31 The non-median element in the bottom right corner includes C. 35 C 44 C 45 C 53 C 54 C 55 , where C ab This represents the element in the a-th row and b-th column of the filter window C, where a = 1, 2, 3, 4, 5 and b = 1, 2, 3, 4, 5.
[0060] The non-median elements of the filter window D include D 14 D 15 D 23 D 24 D 32 D 34 D 42 D 43 D 51 D 52 , where D pq This represents the element in the p-th row and q-th column of the filter window D, where p = 1, 2, 3, 4, 5 and q = 1, 2, 3, 4, 5.
[0061] The non-median elements of the filter window E include E 25 E 41 , of which E cd This represents the element in the c-th row and d-th column of the filter window E, where c = 2, 4 and d = 1, 5.
[0062] In other words, for example Figure 2The 5x5 filter window shown in the diagram is processed as follows: First, the five elements in each row are sorted. After row sorting, the values of the five elements in each row are in descending order. Next, the five elements in each column are sorted. After column sorting, the values of the five elements in each column are in descending order. Then, the elements on the three diagonal lines are sorted. The elements marked with the gray diagonal lines in the diagram are those that are determined not to be part of the median and do not need to participate in the subsequent sorting. Finally, the remaining elements are sorted. The last three diagonal elements are selected for sorting, and the resulting median is the median of the final 5x5 filter window. To fully utilize the fully parallel pipelined processing and easily expandable hardware resources of FPGA and other programmable logic circuits, the following approach is adopted... Figure 7 The parallel pipelined processing architecture shown requires a delay of 3×5+2=17 clock cycles for a 5×5 window size.
[0063] It should be noted that a 5x5 window requires three five-element sorts and one three-element sort. The five-element sort takes five clock cycles. See [link / reference]. Figure 5 As shown, sorting 3 elements takes 2 clock cycles. Figure 4 As shown, the delay of 5×5 is 3×5+2=17.
[0064] like Figure 3 The figure shows a schematic diagram of a fast filtering method when the size of the original filtering window A is 7×7. Figure 3 In the filter window C, the non-median elements in the upper left corner include C0. 11 C 12 C 21 C 13 C 14 C 22 C 23 C 31 C 32 C 41 The non-median element in the bottom right corner includes C. 47 C 56 C 57 C 65 C 66 C 74 C 75 C 76 C 67 , where C ab Let C represent the element in row a, column b of the filter window C, where a = 1, 2, 3, ..., 7 and b = 1, 2, 3, ..., 7; that is, C 11 It is the maximum value among all elements, C 77 It is the minimum value among all elements; neither of them is the median, so they can be eliminated. (Compared to C) 12 C 21The smaller one has 36 elements, which is more than C. 76 C 67 There are 36 large elements, and these are not the median, so they can be eliminated. Similarly, C... 13 C 14 C 22 C 23 C 31 C 32 C 41 Larger than the median, and C 47 C 56 C 57 C 65 C 66 C 74 C 75 Elements smaller than the median are not the median and can be eliminated, leaving 29 elements.
[0065] The non-median elements of the filter window D include D 15 D 16 D 17 D 24 D 25 D 26 D 33 D 34 D 42 D 46 D 54 D 55 D 62 D 63 D 64 D 71 D 72 D 73 There are 11 remaining elements, of which D pq This represents the element in the p-th row and q-th column of the filter window D, where p = 1, 2, 3, ..., 7 and q = 1, 2, 3, ..., 7;
[0066] The non-median elements of the filter window E include E 27 E 35 E 36 E 43 E 45 E 52 E 53 E 61 There are 3 remaining elements, of which E cd This represents the element in the c-th row and d-th column of the filter window E, where c = 2, 3, ..., 6 and d = 1, 2, 3, 5, 6, 7.
[0067] In other words, for example Figure 3The 7×7 filter window shown in the diagram is processed as follows: First, the seven elements in each row are sorted. After row sorting, the values of the seven elements in each row are in descending order. Next, the seven elements in each column are sorted. After column sorting, the values of the seven elements in each column are in descending order. Then, the elements on the five diagonal lines are sorted. The elements marked with diagonal gray lines in the diagram are elements that are determined not to be part of the median and do not need to participate in the subsequent sorting. Next, the remaining elements are sorted. The elements on the remaining three diagonal lines are sorted. The elements marked with diagonal gray lines in the diagram are elements that are determined not to be part of the median and do not need to participate in the subsequent sorting. Finally, the last three diagonal elements are sorted, and the resulting median is the median of the final 7×7 filter window. To fully utilize the fully parallel pipelined processing and easily expandable hardware resources of FPGA and other programmable logic circuits, the following approach is adopted: Figure 8 The parallel pipelined processing architecture shown requires a delay of 7*3+5+2=28 clock cycles for a 7×7 window size.
[0068] A 7x7 window requires three sorts of 7 elements, one sort of 5 elements, and one sort of 3 elements. The 7-element sort takes 7 clock cycles. Figure 6 As shown, sorting 5 elements takes 5 clock cycles. Figure 5 As shown, sorting 3 elements takes 2 clock cycles. Figure 4 As shown, the delay of 7×7 is 7×3+5+2=28.
[0069] Furthermore, based on the above method, the present invention provides a wide-window fast filtering system for spatial surveillance images. The system is implemented based on FPGA and includes two or more 7-element sorting modules, 5-element sorting modules, and 3-element sorting modules.
[0070] Each 7-element sorting module is used to receive 7 or 6 input elements respectively, and each 7-element sorting module sorts the input elements in descending order in parallel and outputs the sorted results in parallel.
[0071] Each 5-element sorting module is used to receive 5 or 4 input elements respectively, and each 5-element sorting module sorts the input elements in descending order in parallel and outputs the sorted results in parallel.
[0072] Each 3-element sorting module is used to receive 3 input elements, and each 3-element sorting module sorts the input elements in descending order in parallel and outputs the sorted results in parallel.
[0073] It should be noted that the 7-element sorting module is first used to sort 7 or 6 elements, then the 5-element sorting module is used to sort 5 or 4 elements, and finally the 3-element sorting module is used to sort 3 elements. A register is inserted between the element sorting modules that are placed at the beginning and the element sorting modules that are placed at the end to separate the sorting data transmission path.
[0074] like Figure 4 As shown, the 3-element sorting module sorts 3 elements as follows:
[0075] Step 1: Compare the two elements at positions 1 and 2 pairwise, and swap their positions according to the comparison results, so that the larger element is to the left of the smaller element;
[0076] Step 2: Based on the sorting result obtained in Step 1, compare the three elements at positions 1, 2, and 3 in pairs, and swap their positions according to the comparison results, so that the larger element is to the left of the smaller element, resulting in 5 elements sorted from left to right in descending order.
[0077] like Figure 5 As shown, the 5-element sorting module sorts 5 elements as follows:
[0078] Step 1: Compare the two elements at positions 1 and 2, and the two elements at positions 4 and 5 in pairs, and swap their positions according to the comparison results, so that the larger element is to the left of the smaller element.
[0079] Step 2: Based on the sorting result obtained in Step 1, compare the three elements at positions 1, 2, and 3 in pairs, and swap their positions according to the comparison results, so that the larger element is to the left of the smaller element.
[0080] Step 3: Based on the sorting result obtained in Step 2, compare the two elements at positions 1 and 5, and the three elements at positions 2, 3, and 4 in pairs, and swap their positions according to the comparison results, so that the larger element is to the left of the smaller element.
[0081] Step 4: Based on the sorting result obtained in Step 3, compare the two elements at positions 1 and 2, and the three elements at positions 3, 4 and 5 in pairs, and swap their positions according to the comparison results, so that the larger element is to the left of the smaller element.
[0082] Step 5: Based on the sorting result obtained in Step 4, compare the three elements at positions 2, 3, and 4 in pairs, and swap their positions according to the comparison results, so that the larger element is to the left of the smaller element, resulting in 5 elements sorted from left to right in descending order.
[0083] In other words, the 5-element sorting module sorts the 5 input elements in descending order, obtaining the final sorted result by comparing two elements sequentially, and inserting a register after each comparison. Figure 5 As shown by the gray horizontal solid line, it can be seen that after a 5-clock delay, the sorting result of the 5 elements is obtained.
[0084] like Figure 6 As shown, the 7-element sorting module sorts 7 elements as follows:
[0085] Step 1: Compare the two elements at positions 1 and 2, positions 4 and 5, and positions 6 and 7 in pairs, and swap their positions according to the comparison results so that the larger element is to the left of the smaller element.
[0086] Step 2: Based on the sorting result obtained in Step 1, compare the three elements at positions 1, 2, and 3, the two elements at positions 4 and 6, and the two elements at positions 5 and 7 in pairs, and swap their positions according to the comparison results, so that the larger element is to the left of the smaller element.
[0087] Step 3: Based on the sorting result obtained in Step 2, compare the two elements at positions 1 and 4, the two elements at positions 3 and 7, and the two elements at positions 5 and 6 in pairs, and swap their positions according to the comparison results, so that the larger element is to the left of the smaller element.
[0088] Step 4: Based on the sorting result obtained in Step 3, compare the two elements at positions 2 and 3, and the three elements at positions 4, 5 and 6 in pairs, and swap their positions according to the comparison results, so that the larger element is to the left of the smaller element.
[0089] Step 5: Based on the sorting result obtained in Step 4, compare the two elements at positions 2 and 4, and the two elements at positions 3 and 6 in pairs, and swap their positions according to the comparison results, so that the larger element is to the left of the smaller element.
[0090] Step 6: Based on the sorting result obtained in Step 5, compare the two elements at positions 3 and 4 pairwise, and swap their positions according to the comparison results, so that the larger element is to the left of the smaller element.
[0091] Step 7: Based on the sorting result obtained in Step 6, compare the three elements at positions 3, 4 and 5 in pairs, and swap their positions according to the comparison results, so that the larger element is to the left of the smaller element, resulting in 7 elements sorted from left to right in descending order.
[0092] In other words, the 7-element sorting module sorts the 7 input elements in descending order, obtaining the final sorted result by comparing two elements sequentially, and inserting a register after each comparison. Figure 6 As shown by the gray horizontal solid line, it can be seen that after a 7-clock delay, the sorted result of 7 elements is obtained.
[0093] In summary, this invention delves into the inherent parallelism of sorting operations and proposes a wide-window fast median filtering method. Leveraging the fully parallel pipelined processing capabilities of programmable logic circuits such as FPGAs, and their ease of hardware resource expansion and reuse, a parallel processing architecture for wide-window fast median filtering is designed. This design fully utilizes the characteristics of programmable logic circuits such as FPGAs, reusing multiple sorting modules for parallel processing. Registers are inserted between the pre- and post-processing sorting modules to shorten the longest timing path, increase the maximum achievable clock frequency of the system, effectively improve processing efficiency, and reduce computational latency. Furthermore, the hardware architecture of this invention supports median filtering with arbitrary window sizes and is flexible and easily expandable. While ensuring circuit stability and reliability, for a 5×5 window size, only a delay of 3×5+2=17 clock cycles is required; for a 7×7 window size, only a delay of 7×3+5+2=28 clock cycles is required.
[0094] Of course, the present invention may have other various embodiments. Without departing from the spirit and essence of the present invention, those skilled in the art can make various corresponding changes and modifications according to the present invention, but these corresponding changes and modifications should all fall within the protection scope of the appended claims.
Claims
1. A method of spatially monitoring image wide window fast filtering, characterized by, The method comprises the following steps: Sort the elements in each row of the original filter window A from left to right in descending order to obtain a row-sorted filter window B; Sort the elements in each column of the filter window B from top to bottom in descending order to obtain a column-sorted filter window C; Remove the non-middle elements at the top-left corner and the bottom-right corner of the filter window C, and sort the elements on the remaining diagonal line from top to bottom in descending order to obtain a filter window D; Remove the non-middle elements in the filter window D, and sort the elements on the remaining diagonal line from top to bottom in descending order to obtain a filter window E; Remove the non-middle elements of the filter window E to obtain a filter window F, and take the middle value in the filter window F as the middle value of the original filter window A to complete the median filtering.
2. A method for fast filtering of a spatially monitored image wide window as claimed in claim 1, characterized in that, Assuming the size of the original filter window A is SxS, the elements in the triangular region formed by the top row and the left column of the filter window C are taken as the top-left non-median elements, while the elements in the triangular region formed by the bottom row and the right column of the filter window C are taken as the top-right non-median elements, where denotes the ceiling function.
3. A spatially supervised image wide window fast filtering method according to claim 1 or 2, characterized in that, When the original filter window A size is 7x7, the non-central elements in the top left corner of the filter window C include C 11 , C 12 , C 21 , C 13 , C 14 , C 22 , C 23 , C 31 , C 32 , C 41 , and the non-central elements in the bottom right corner include C 47 , C 56 , C 57 , C 65 , C 66 , C 74 , C 75 , C 76 , C 67 , wherein C ab represents the element in the a-th row and the b-th column of the filter window C, a=1, 2, 3, …, 7, b=1, 2, 3, …, 7. The non-median elements of the filter window D include D 15 D 16 D 17 D 24 D 25 D 26 D 33 D 34 D 42 D 46 D 54 D 55 D 62 D 63 D 64 D 71 D 72 D 73 , where D pq This represents the element in the p-th row and q-th column of the filter window D, where p = 1, 2, 3, ..., 7 and q = 1, 2, 3, ..., 7; The non-median elements of the filter window E include E 27 , E 35 , E 36 , E 43 , E 45 , E 52 , E 53 , E 61 , wherein E cd represents the element in the cth row and the dth column of the filter window E, c = 2, 3, …, 6, d = 1, 2, 3, 5, 6, 7.
4. A method for fast filtering of wide windows of spatially monitored images according to claim 1 or 2, characterized in that, When the original filter window A size is 5x5, the non-central element in the top-left corner of the filter window C includes C 11 , C 12 , C 21 , C 13 , C 22 , C 31 , the non-central element in the bottom-right corner includes C 35 , C 44 , C 45 , C 53 , C 54 , C 55 , wherein C ab represents the element in the a-th row and the b-th column of the filter window C, a = 1, 2, 3, 4, 5, b = 1, 2, 3, 4, 5. The non-median elements of the filter window D include D 14 , D 15 , D 23 , D 24 , D 32 , D 34 , D 42 , D 43 , D 51 , D 52 , wherein D pq represents the element in the pth row and the qth column of the filter window D, p = 1, 2, 3, 4, 5, q = 1, 2, 3, 4, 5. The non-median elements of the filter window E include E 25 , E 41 wherein E cd denotes the element in the c-th row and d-th column of the filter window E, c = 2,4, d = 1,5.
5. A spatial surveillance image wide window fast filtering system implementing the spatial surveillance image wide window fast filtering method of claim 1, characterized in that, Assuming that the size of the original filter window A is 7*7, the system is implemented based on FPGA and comprises two or more 7-element sorting modules, 5-element sorting modules and 3-element sorting modules; Each 7-element sorting module is used for receiving 7 or 6 input elements, and each 7-element sorting module is used for sorting the input elements in descending order in parallel and outputting the sorted results in parallel; Each 5-element sorting module is used for receiving 5 or 4 input elements, and each 5-element sorting module is used for sorting the input elements in descending order in parallel and outputting the sorted results in parallel; Each 3-element sorting module is used for receiving 3 input elements, and each 3-element sorting module is used for sorting the input elements in descending order in parallel and outputting the sorted results in parallel.
6. A spatially supervised image wide window fast filtering system as claimed in claim 5, characterized by, Firstly, the 7-element sorting module is used for sorting 7 or 6 elements, then the 5-element sorting module is used for sorting 5 or 4 elements, and finally the 3-element sorting module is used for sorting 3 elements, wherein a register for dividing the sorting data transmission path is inserted between the element sorting module in front and the element sorting module behind.
7. A spatially supervised image wide window fast filtering system as claimed in claim 5 or 6, characterized in that, The method for sorting 7 elements by the 7-element sorting module is as follows: Step 1, compare the two elements at positions 1 and 2, the two elements at positions 4 and 5 and the two elements at positions 6 and 7 respectively, and exchange the positions according to the comparison results, so that the larger element is located to the left of the smaller element; Step 2, on the basis of the sorting result obtained in step 1, compare the three elements at positions 1, 2 and 3, the two elements at positions 4 and 6 and the two elements at positions 5 and 7 respectively, and exchange the positions according to the comparison results, so that the larger element is located to the left of the smaller element; Step 3, on the basis of the sorting result obtained in step 2, compare the two elements at positions 1 and 4, the two elements at positions 3 and 7 and the two elements at positions 5 and 6 respectively, and exchange the positions according to the comparison results, so that the larger element is located to the left of the smaller element; Step 4, on the basis of the sorting result obtained in step 3, two elements in positions 2 and 3, three elements in positions 4, 5 and 6 are compared respectively, and position exchange is performed according to the comparison result, so that the larger element is located to the left of the smaller element; Step 5, on the basis of the sorting result obtained in step 4, two elements in positions 2 and 4, two elements in positions 3 and 6 are compared respectively, and position exchange is performed according to the comparison result, so that the larger element is located to the left of the smaller element; Step 6, on the basis of the sorting result obtained in step 5, two elements in positions 3 and 4 are compared, and position exchange is performed according to the comparison result, so that the larger element is located to the left of the smaller element; Step 7, on the basis of the sorting result obtained in step 6, three elements in positions 3, 4 and 5 are compared, and position exchange is performed according to the comparison result, so that the larger element is located to the left of the smaller element, and 7 elements are sorted from left to right in descending order.
8. A spatially supervised image wide window fast filtering system as claimed in claim 5 or 6, characterized in that, The method for sorting 5 elements by the 5-element sorting module is as follows: Step 1, two elements in positions 1 and 2, two elements in positions 4 and 5 are compared respectively, and position exchange is performed according to the comparison result, so that the larger element is located to the left of the smaller element; Step 2, on the basis of the sorting result obtained in step 1, three elements in positions 1, 2 and 3 are compared respectively, and position exchange is performed according to the comparison result, so that the larger element is located to the left of the smaller element; Step 3, on the basis of the sorting result obtained in step 2, two elements in positions 1 and 5, three elements in positions 2, 3 and 4 are compared respectively, and position exchange is performed according to the comparison result, so that the larger element is located to the left of the smaller element; Step 4, on the basis of the sorting result obtained in step 3, two elements in positions 1 and 2, three elements in positions 3, 4 and 5 are compared respectively, and position exchange is performed according to the comparison result, so that the larger element is located to the left of the smaller element; Step 5, on the basis of the sorting result obtained in step 4, three elements in positions 2, 3 and 4 are compared respectively, and position exchange is performed according to the comparison result, so that the larger element is located to the left of the smaller element, and 5 elements are sorted from left to right in descending order.
Citation Information
Patent Citations
Connection information normalization system based on adjacent matrix, graph feature extraction system and graph classification system and method
CN108520275A
Sorting system and sorting method suitable for image median filtering
CN110956598A