A pipeline implementation method for image recursive median filtering

By dividing the calculation process of recursive median filtering in two steps: finding the reserved data of the initial filter window block and finding the median value of the current filtering sequence, the problem that the recursive median filtering algorithm cannot split the pipeline and improves the filtering speed.

CN115409744BActive Publication Date: 2025-08-12SOUTHWEAT UNIV OF SCI & TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211242746.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-11
Publication Date
2025-08-12
Estimated Expiration
2042-10-11

AI Technical Summary

Technical Problem

The recursive median filtering algorithm is slower due to the inability to split the pipeline.

Method used

The calculation process of recursive median filtering of the image is divided into two steps: obtaining the retained data of the initial filter window block and obtaining the median value of the current filtering sequence, corresponding to steps S1 and S3 respectively. Step S1 is performed before the filter window slides, and step S3 is performed after the slides to realize pipeline segmentation.

Benefits of technology

Through pipeline segmentation, the calculation speed of recursive median filtering of image is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115409744B_ABST
    Figure CN115409744B_ABST
Patent Text Reader

Abstract

The present invention discloses a pipeline implementation method for recursive median filtering of an image, comprising the following steps: S1, expanding and comparing part of image data in an initial filtering window block, and finding retained data based on the comparison result and the median of the initial filtering window block; S2, sliding the initial filtering window block forward by one column, filling it with new image data as a current filtering window block, and constructing a current filtering sequence based on the new image data and the retained data of step S1; S3, calculating the median of the current filtering window block according to all image data in the current filtering sequence; S4, taking the current filtering window block as the initial filtering window block and jumping to step S1 until all image data are traversed; S5, taking all medians calculated in step S3 as data after recursive median filtering of the image; the present invention solves the problem of slow filtering speed caused by the inability to split the pipeline when calculating the median of an image using a recursive median filtering algorithm.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to a pipeline implementation method for image recursive median filtering. Background Art

[0002] Image median filtering refills the window with data each time the window slides forward, calculating a median value. Multiple slides, resulting in multiple median values, allow all original data to be filtered. Recursive median filtering is a modification of the standard median filter. Before the window slides to the next position, the calculated median value replaces the center of the window. When using the recursive median filter algorithm to calculate the image median, the median value calculation must be completed before each window slide. This prevents the recursive median filter from being pipelined, ultimately resulting in slower filtering speeds. Summary of the Invention

[0003] In view of the above-mentioned deficiencies in the prior art, the present invention provides a pipeline implementation method for recursive median filtering of an image, which solves the problem of slow filtering speed caused by the inability to split the pipeline when calculating the median of an image using a recursive median filtering algorithm.

[0004] In order to achieve the above-mentioned object of the invention, the technical solution adopted by the present invention is: a pipeline implementation method of image recursive median filtering, comprising the following steps:

[0005] S1, expanding and comparing part of the image data in the initial filter window block, and finding the retained data based on the comparison result and the median value of the initial filter window block;

[0006] S2. Slide the initial filter window block forward one column, fill it with new image data as the current filter window block, and construct the current filter sequence based on the new image data and the retained data in step S1;

[0007] S3. Calculate the median of the current filter window block based on all image data in the current filter sequence;

[0008] S4, taking the current filter window block as the initial filter window block and jumping to step S1 until the image data is traversed;

[0009] S5. All medians calculated in step S3 are used as data after recursive median filtering of the image.

[0010] Furthermore, the step S1 includes the following sub-steps:

[0011] S11, expanding part of the data in the initial filter window block, and comparing the size of each image data with other image data to obtain a comparison result;

[0012] S12. Construct a result sequence of all image data according to the comparison result of the same image data, and find the retained data based on the order of the result values in the result sequence and the median value of the initial filtering window block.

[0013] Furthermore, the step S11 includes the following sub-steps:

[0014] S111, expand all image data in the initial filter window block except the first column of image data and the window center data into a one-dimensional sequence {x0, x1, ..., x m ,…,x M-1}, x0~x M-1 is M image data, where N is the length and width of the filter window block, N is an odd number, M=N(N-1)-1;

[0015] S112, take any image data x in the one-dimensional sequence m , where 0≤m≤x-1;

[0016] S113, judging image data x m Is it greater than the image data x? i , if so, then the image data x m The comparison result is 1, if not, the image data x m The comparison result is 0, where m+1≤i≤M-1;

[0017] S114, judging image data x m Is it greater than the image data x? j , if so, then the image data x m The comparison result is 0. If not, the image data x m The comparison result is 1, where 0≤j≤m-1;

[0018] S115: Through steps S113 and S114, the image data x m Compare with other image data in the one-dimensional sequence to obtain image data x m All comparison results.

[0019] Furthermore, the step S12 includes the following sub-steps:

[0020] S121, the same image data x m All comparison results are added together to obtain a result sequence of length M: {CMP0, CMP1, ..., CMP m ,…,CMP M-1}, CMP0~CMP M-1 There are 0 to M-1 result values, each of which is the same image data x m All comparison results are added together;

[0021] S122, exclude the result sequence in and The result value in the range is found The result value of the range, where N is the filter window block length and width, and N is an odd number;

[0022] S123, according to The result value of the range is sorted in the result sequence, and the one-dimensional sequence {x0,x1,…,x m ,…,x M-1 The image data in} is used as the reserved data, a total of N;

[0023] S124 , saving the N retained data obtained in step S123 and the median of the initial filtering window block, a total of N+1 data, as the retained data of the initial filtering window block.

[0024] Furthermore, step S3 includes the following sub-steps:

[0025] S31, expanding the image data in the current filtering sequence, and comparing the size of each image data with other image data to obtain a comparison result;

[0026] S32. Find the median of the current filtering sequence according to the comparison result;

[0027] S33. The median value of the current filtering sequence is the median value of the current filtering window block.

[0028] Furthermore, the step S31 includes the following sub-steps:

[0029] S311, expand all image data in the current filtering sequence into a one-dimensional sequence {y0, y1, ..., y k ,…,y K-1},y0~y K-1 is K image data, where N is the length and width of the filter window block, N is an odd number, K=2N+1;

[0030] S312, take any image data y in the one-dimensional sequence k , where 0≤k≤K-1;

[0031] S313, determine the image data k k Is it greater than the image data y i , if so, then the image data y k The comparison result is 1, if not, the image data y k The comparison result is 0, where k+1≤i≤K-1;

[0032] S314, determine the image data yk Is it greater than the image data y j , if so, then the image data y k The comparison result is 0. If not, the image data y k The comparison result is 1, where 0≤j≤k-1;

[0033] S315, through steps S313 and S314, the image data y k Compare with other image data in the one-dimensional sequence to obtain image data y k All comparison results.

[0034] Furthermore, the step S32 includes the following sub-steps:

[0035] S321, the same image data y k Add up all the comparison results to get a result sequence of length K: {CMP′0,CMP′1,…,CMP′ k ,…,CMP′ K-1}, CMP′0~CMP′ K-1 There are 0 to K-1 result values, each of which is the same image data y k All comparison results are added together;

[0036] S322, find the result value equal to N in the result sequence, and use the sorting number of the result value in the result sequence to find the one-dimensional sequence {y0, y1, ..., y k ,…,y K-1} is used as the median of the current filtering sequence, where N is the length and width of the filtering window block and N is an odd number.

[0037] In summary, the beneficial effects of the present invention are:

[0038] The present invention divides the calculation process of obtaining the median of the current filter window block into two steps: obtaining the retained data of the initial filter window block and obtaining the median of the current filter sequence, which correspond to steps S1 and S3 respectively. Compared with directly calculating the median of the entire window, the present invention calculates the median of the entire window by excluding image data that is not the median data in step S1 and calculating the median of the current filter sequence in step S3. In addition, step S1 occurs before the filter window slides, and step S3 occurs after the filter window slides. Therefore, steps S1 and S3 are equivalent to dividing the pipeline of the median calculation process, which solves the problem that the recursive median filtering algorithm cannot divide the pipeline. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 It is a flow chart of a pipeline implementation method of image recursive median filtering;

[0040] Figure 2 This is the hardware architecture diagram for the specific implementation of recursive median filtering using a 3×3 window;

[0041] Figure 3 This is the hardware architecture diagram for the specific implementation of recursive median filtering using a 5×5 window;

[0042] Figure 4 This is a comparison result diagram taking the sequence {X[0],X[1],X[2],X[3],X[4]}={3,4,6,1,3} as an example. DETAILED DESCRIPTION

[0043] The specific embodiments of the present invention are described below to facilitate understanding of the present invention by those skilled in the art. However, it should be clear that the present invention is not limited to the scope of the specific embodiments. For those skilled in the art, as long as various changes are within the spirit and scope of the present invention as defined and determined by the appended claims, these changes are obvious, and all inventions and creations utilizing the concepts of the present invention are protected.

[0044] like Figure 1 As shown, a pipeline implementation method for recursive median filtering of an image includes the following steps:

[0045] S1, expanding and comparing part of the image data in the initial filter window block, and finding the retained data based on the comparison result and the median value of the initial filter window block;

[0046] The present invention sets the size of the filter window block to N*N, where N is an odd number. When sliding, the image data in the previous filter window block will enter the next filter window block, but the minimum and maximum values of the two blocks are The image data will not be the median of the next window, so it can be filtered out. Steps S111 to S115 and steps S121 to S124 describe in detail how to remove the minimum and maximum values. image data.

[0047] The step S1 includes the following sub-steps:

[0048] S11, expanding part of the data in the initial filter window block, and comparing the size of each image data with other image data to obtain a comparison result;

[0049] The step S11 includes the following sub-steps:

[0050] S111, expand all image data in the initial filter window block except the first column of image data and the window center data into a one-dimensional sequence {x0, x1, ..., x m ,…,x M-1}, x0~x M-1is M image data, where N is the length and width of the filter window block, N is an odd number, M=N(N-1)-1;

[0051] S112, take any image data x in the one-dimensional sequence m , where 0≤m≤M-1;

[0052] S113, judging image data x m Is it greater than the image data x? i , if so, then the image data x m The comparison result is 1, if not, the image data x m The comparison result is 0, where m+1≤i≤M-1;

[0053] S114, judging image data x m Is it greater than the image data x? j , if so, then the image data x m The comparison result is 0. If not, the image data x m The comparison result is 1, where 0≤j≤m-1;

[0054] S115: Through steps S113 and S114, the image data x m Compare with other image data in the one-dimensional sequence to obtain image data x m All comparison results.

[0055] S12. Construct a result sequence of all image data according to the comparison result of the same image data, and find the retained data based on the order of the result values in the result sequence and the median value of the initial filtering window block.

[0056] The step S12 includes the following sub-steps:

[0057] S121, the same image data x m All comparison results are added together to obtain a result sequence of length M: {CMP0, CMP1, ..., CMP m ,…,CMP M-1}, CMP0~CMP M-1 There are 0 to M-1 result values, each of which is the same image data x m All comparison results are added together;

[0058] S122, exclude the result sequence in and The result value in the range is found The result value of the range, where N is the filter window block length and width, and N is an odd number;

[0059] S123, according to The result value of the range is sorted in the result sequence, and the one-dimensional sequence {x0,x1,…,x m ,…,x M-1 The image data in} is used as the reserved data, a total of N;

[0060] S124 , saving the N retained data obtained in step S123 and the median of the initial filtering window block, a total of N+1 data, as the retained data of the initial filtering window block.

[0061] S2. Slide the initial filter window block forward one column, fill it with new image data as the current filter window block, and construct the current filter sequence based on the new image data and the retained data in step S1;

[0062] S3. Calculate the median of the current filter window block based on all image data in the current filter sequence;

[0063] The step S3 includes the following sub-steps:

[0064] S31, expanding the image data in the current filtering sequence, and comparing the size of each image data with other image data to obtain a comparison result;

[0065] The step S31 includes the following sub-steps:

[0066] S311, expand all image data in the current filtering sequence into a one-dimensional sequence {y0, y1, ..., y k ,…,y K-1},y0~y K-1 is K image data, where N is the length and width of the filter window block, N is an odd number, K=2N+1;

[0067] S312, take any image data y in the one-dimensional sequence k , where 0≤k≤K-1;

[0068] S313, determine the image data y k Is it greater than the image data y i , if so, then the image data y k The comparison result is 1, if not, the image data y k The comparison result is 0, where k+1≤i≤K-1;

[0069] S314, determine the image data y k Is it greater than the image data y j , if so, then the image data y k The comparison result is 0. If not, the image data y k The comparison result is 1, where 0≤j≤k-1;

[0070] S315, through steps S313 and S314, the image data y k Compare with other image data in the one-dimensional sequence to obtain image data y k All comparison results.

[0071] S32. Find the median of the current filtering sequence according to the comparison result;

[0072] The step S32 includes the following sub-steps:

[0073] S321, the same image data y k Add up all the comparison results to get a result sequence of length K: {CMP′0,CMP′1,…,CMP′ k ,…,CMP′ K-1}, CMP′0~CMP′ K-1 There are 0 to K-1 result values, each of which is the same image data y k All comparison results are added together;

[0074] S322, find the result value equal to N in the result sequence, and use the sorting number of the result value in the result sequence to find the one-dimensional sequence {y0, y1, ..., y k ,…,y K-1} is used as the median of the current filtering sequence, where N is the length and width of the filtering window block and N is an odd number.

[0075] S33. The median value of the current filtering sequence is the median value of the current filtering window block.

[0076] S4, taking the current filter window block as the initial filter window block and jumping to step S1 until the image data is traversed;

[0077] S5. All medians calculated in step S3 are used as data after recursive median filtering of the image.

[0078] The beneficial effects of the present invention are as follows: the present invention divides the calculation process of obtaining the median of the current filter window block into two steps: obtaining the retained data of the initial filter window block and obtaining the median of the current filter sequence, which correspond to steps S1 and S3 respectively. Compared with directly calculating the median of the entire window, the present invention calculates the median of the entire window by excluding image data of non-median data in step S1 and calculating the median of the current filter sequence in step S3. Moreover, step S1 occurs before the filter window slides, and step S3 occurs after the filter window slides. Therefore, steps S1 and S3 are equivalent to dividing the pipeline of the median calculation process, which solves the problem that the recursive median filter algorithm cannot divide the pipeline.

[0079] Argumentation process: There are two sequences A and B, A={A low ,A med ,A up}, B={p1,p2,...,p 2k-1}. Define the operation and means that any element in X is less than or equal to all elements in Y. The meaning is opposite. In set A, A low , A up Each contains n elements, A med Contains 2m (m ≥ k) elements and Among them, A low is a subsequence of smaller elements in sequence A, A med is a subsequence consisting of the middle elements in sequence A, A up is a subsequence of the larger elements in sequence A. In this embodiment, smaller, middle, and larger are hierarchical layers of element size in the sequence. In this case, we have:

[0080] med{A,B}=med{A med ,B}

[0081] Among them, med{} is the operation to obtain the median of the sequence.

[0082] Proof: First, assume that p med =med{A med ,B}. Therefore, {A med ,B} can be divided into {Q low ,p med ,Q up},Right now:

[0083] {A med ,B}={Q low ,p med ,Q up}

[0084] Among them A low ,Q up Each has m+k-1 elements. Therefore {Q low ,p med} has a total of m+k elements. Since m≥k, therefore, m+k≥2k>2k-1. There are only 2k-1 elements in B, so the sequence {Q low ,p med} cannot be entirely in B, and there must be an element that satisfies the following conditions:

[0085]

[0086] Therefore, px Greater than or equal to A low All elements in p x There are two cases. If p x ∈Q low , then:

[0087]

[0088] if Then we have:

[0089]

[0090] Therefore, in either case there is The same logic applies because

[0091]

[0092] Therefore, p med Greater than or equal to A low n elements and Q low There are m+k-1 elements in it, that is:

[0093]

[0094] Similarly:

[0095]

[0096] According to the above conditions, we can get:

[0097] p med =med{A,B}=med{A med ,B}.

[0098] From the above proof results, it can be seen that the median of the two sequences can be calculated by combining the median of the previous sequence A with the sequence B. Therefore, the present invention uses this point to calculate the new median by adding the median of the previous filter window block to the new image data sequence.

[0099] This embodiment provides a specific hardware implementation.

[0100] Figure 2 This is the specific implementation architecture for recursive median filtering using a 3×3 window. Figure 3This is the specific implementation architecture for recursive median filtering using a 5×5 window. The data retention unit filters out retained data and pre-stores it in a first register. This first register then transfers the retained data to the median calculation unit, which then fills the unit with new image data to calculate the median, which is then stored in a second register. The data retention unit executes step S1 above, and the median calculation unit executes step S3 above.

[0101] In the 3×3 window, execute steps S111 to S115 and steps S121 to S124 to remove the smallest and largest image data to obtain the retained data. The retained data continues to stay in the 3×3 window. Through steps S2 and S3, the median is calculated. Through step S1, the median calculated in step S3 will participate in the next median calculation process.

[0102] Similarly, for the 5×5 window, the largest 7 data and the smallest 7 data in the 4 columns to the right of the common data are excluded, and the remaining data is obtained and sent to the cache register.

[0103] Figure 4 Taking the sequence {X[0], X[1], X[2], X[3], X[4]} = {3, 4, 6, 1, 3} as an example, the results obtained through the comparison process of steps S111 to S115 or S311 to S315 are shown. It can be seen that all comparison results for the same data are added together to obtain a result value. The larger the result value, the larger the original data.

Claims

1. A pipeline implementation method for image recursive median filtering, characterized in that: The following steps are involved: S1, expanding and comparing part of the image data in the initial filter window block, and finding the retained data based on the comparison result and the median value of the initial filter window block; The step S1 includes the following sub-steps: S11, expanding part of the data in the initial filter window block, and comparing the size of each image data with other image data to obtain a comparison result; The step S11 includes the following sub-steps: S111, expand all image data except the first column of image data and window center data in the initial filtering window block into a one-dimensional sequence , for image data, where is the filter window block length and width, is an odd number, ; S112, take any image data in the one-dimensional sequence ,in, ; S113, judging image data Is it larger than the image data? , if so, then the image data The comparison result is 1, if not, the image data The comparison result is 0, where ; S114: Determine image data Is it larger than the image data? , if so, then the image data The comparison result is 0. If not, the image data The comparison result is 1, where ; S115: Through steps S113 and S114, the image data Compare with other image data in the one-dimensional sequence to obtain image data All comparison results of S12. Constructing a result sequence of all image data based on the comparison results of the same image data, and finding the retained data based on the order of the result values in the result sequence and the median value of the initial filter window block; said step S12 includes the following sub-steps: S121, the same image data Add up all the comparison results to get the length of The resulting sequence is: , 0~ result values, each result value is the same image data All comparison results are added together; S122, exclude the result sequence in and The result value in the range is found The resulting value of the range, where is the filter window block length and width, is an odd number; S123, according to The result value of the range is sorted in the result sequence, and the one-dimensional sequence with the same permutation number is found The image data in is used as the reserved data. indivual; S124, the result obtained in step S123 The retained data and the median of the initial filter window block are The data are saved as the retained data of the initial filter window block; S2. Slide the initial filter window block forward one column, fill it with new image data as the current filter window block, and construct the current filter sequence based on the new image data and the retained data in step S1; S3. Calculate the median of the current filter window block based on all image data in the current filter sequence; S4, taking the current filter window block as the initial filter window block and jumping to step S1 until the image data is traversed; S5. All medians calculated in step S3 are used as data after recursive median filtering of the image.

2. The pipeline implementation method of image recursive median filtering according to claim 1, characterized in that: The step S3 includes the following sub-steps: S31, expanding the image data in the current filtering sequence, and comparing the size of each image data with other image data to obtain a comparison result; S32. Find the median of the current filtering sequence according to the comparison result; S33. The median value of the current filtering sequence is the median value of the current filtering window block.

3. The pipeline implementation method of image recursive median filtering according to claim 2, characterized in that: The step S31 includes the following sub-steps: S311, expand all image data in the current filtering sequence into a one-dimensional sequence , for image data, where is the filter window block length and width, is an odd number, ; S312, take any image data in the one-dimensional sequence ,in, ; S313, judging image data Is it larger than the image data? , if so, then the image data The comparison result is 1, if not, the image data The comparison result is 0, where ; S314, judging image data Is it larger than the image data? , if so, then the image data The comparison result is 0. If not, the image data The comparison result is 1, where ; S315: The image data is converted through steps S313 and S314. Compare with other image data in the one-dimensional sequence to obtain image data All comparison results.

4. The pipeline implementation method of image recursive median filtering according to claim 2, characterized in that: The step S32 includes the following sub-steps: S321, the same image data Add up all the comparison results to get the length of The resulting sequence is: , 0~ result values, each result value is the same image data All comparison results are added together; S322, find the result sequence that is equal to The result value, with the sorting number of the result value in the result sequence, find the one-dimensional sequence with the same sorting number The image data in is taken as the median of the current filtering sequence, where is the filter window block length and width, An odd number.

Citation Information

Patent Citations

  • Image median filtering method based on incomplete rapid sorting algorithm

    CN103793886A

  • Image processing apparatus and x-ray diagnosis apparatus

    US20170316579A1