Image median filtering method, system, device and medium based on FPGA

By establishing an image processing model on the FPGA platform and using the median filtering algorithm, the problems of traditional median filtering loss details and blindness of neural network parameters are solved, and efficient image noise suppression and detail retention are achieved.

CN118918013BActive Publication Date: 2024-12-10SICHUAN SDRISING INFORMATION TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411411573.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-11
Publication Date
2024-12-10
Estimated Expiration
2044-10-11

AI Technical Summary

Technical Problem

The traditional median filtering method will cause the image to lose some details, and the network parameter determination method of neural networks is lacking, resulting in unsatisfactory image filtering effect.

Method used

Using the median filtering method of image based on FPGA, by establishing an image processing model and presetting model parameters, judging and replacing noise points in the image, using the median filtering algorithm to process noise points, retain image details and edge information, and pass Adaptively obtaining model parameters improves processing efficiency.

Benefits of technology

Effectively suppress image noise, preserve image details and edge information, improve the accuracy and efficiency of filtering processing, solve the problem of blindness of parameters in traditional methods, and achieve better denoising effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118918013B_ABST
    Figure CN118918013B_ABST
Patent Text Reader

Abstract

The invention discloses an image median filtering method, system, device and medium based on FPGA, and relates to the technical field of image filtering. The method comprises: establishing an image processing model corresponding to the number of neurons according to the pixel points of an image to be processed; inputting the image to be processed into an image processing model based on model parameters for processing, and obtaining a plurality of noise points in the image to be processed; acquiring the pixel values ​​of eight pixel points adjacent to each noise point, sorting the pixel values ​​of the noise point and each adjacent pixel point, and obtaining a sorting result; replacing the original pixel value of each noise point in the image to be processed with the corresponding target pixel value, and determining the image to be processed after all noise points are pixel-replaced as a filtered processed image; the problem that the use of a traditional median filtering method causes the entire image to lose some details, and the current method for determining the network parameters of a neural network is insufficient, resulting in an unsatisfactory effect when filtering an image is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image filtering technology, and more specifically, to an image median filtering method, system, device and medium based on FPGA. Background Art

[0002] In the process of generating, transmitting and recording image signals, various types of noise are inevitably generated due to the inherent defects of the imaging system, transmission medium, working environment and recording equipment, which reduces the quality of the image and further affects the effect or accuracy of subsequent processing (such as edge detection, image segmentation, feature extraction, pattern recognition, etc.). Therefore, filtering the noisy image is a necessary preprocessing process.

[0003] The median filtering algorithm is a nonlinear smoothing technology. Its basic principle is to replace the value of a point in a digital image or digital sequence with the median of the values ​​of all points in a neighborhood of the point. It sets the grayscale value of each pixel to the median of the grayscale values ​​of all pixels in a neighborhood window of the point, so that the surrounding pixel values ​​are close to the true value, thereby eliminating isolated noise points. It is a nonlinear signal processing technology that can effectively suppress noise, but some details will be lost when denoising the entire image. At present, neural networks have been introduced to filter images, and the network parameters of the introduced neural networks are mostly set based on experience, resulting in unsatisfactory results when filtering images.

[0004] In view of this, this application is hereby made. Summary of the invention

[0005] The purpose of the present invention is to provide an image median filtering method, system, device and medium based on FPGA to solve the problem that the traditional median filtering method will cause the entire image to lose some details, and the current method for determining the network parameters of the neural network is insufficient, resulting in unsatisfactory filtering effects on the image.

[0006] The above technical objectives of the present invention are achieved through the following technical solutions:

[0007] In a first aspect, the present application provides an image median filtering method based on FPGA, comprising the following specific steps:

[0008] Acquire an image to be processed, establish an image processing model corresponding to the number of neurons according to the pixels of the image to be processed, and obtain model parameters of the image processing model by presetting;

[0009] The image to be processed is input into an image processing model based on model parameters for processing, and a plurality of noise points are obtained from each pixel point of the image to be processed;

[0010] For each noise point, the pixel values ​​of eight pixels adjacent to the noise point are obtained, the pixel values ​​of the noise point and each of the adjacent pixels are sorted, and a sorting result is obtained;

[0011] For each noise point, the middle value in the corresponding sorting result is determined as the target pixel value;

[0012] The original pixel values ​​of each noise point in the image to be processed are replaced with the corresponding target pixel values, and the image to be processed after all noise points have been pixel-replaced is determined as the filtered processed image.

[0013] The beneficial effect of the present invention is as follows: in this scheme, after obtaining the model parameters of the image processing model by a preset method, the image to be processed is processed based on the image processing model of the model parameters to obtain the noise points that need to be filtered from the various pixel points of the image to be processed, and then the various noise points that need to be filtered are filtered by using a median filtering method; when filtering is performed by using a median filtering method, for each noise point that needs to be filtered, the corresponding noise point is taken as the center, and then eight pixel points adjacent to it are taken to form a 3*3 array, and the pixel value of the pixel point and the pixel values ​​of the eight pixel points adjacent to it are sorted; the middle value in the sorting result is determined as the replacement value of the noise point, that is, the target pixel value, and the original pixel value of the corresponding noise point is replaced by the target pixel value. When all the noise points in the image to be processed have completed the replacement of the target pixel value, the filtering process of the image to be processed is completed, and the image in which all the noise points have been replaced is determined as the filtered processed image to be output.

[0014] In this scheme, compared with the traditional median filtering processing method, the method adopted in this scheme does not perform median filtering on all the pixel points in the image to be processed, but first uses the model to determine which pixels need to be filtered, that is, finds out the noise points with noise from the image to be processed, and then filters these noise points by means of median filtering. This not only effectively suppresses image noise, but also can well preserve the image detail information and image edge information; at the same time, the model parameters of the model obtained by the preset method can effectively improve the processing ability and effect of the model compared with the traditional method of obtaining parameters based on experience, so that it can more accurately determine which are noise points, so that it can be more efficient when performing filtering processing.

[0015] Based on the above technical solution, the present invention can also be improved as follows.

[0016] Furthermore, the pixel values ​​of the noise point and the adjacent pixels are sorted as follows:

[0017] For the noise point and the 3*3 array composed of the eight adjacent pixels, the maximum value, the middle value and the minimum value of each of the three rows are obtained respectively;

[0018] Compare the maximum value in the three rows, the middle value in the three rows and the minimum value in the three rows respectively, and obtain the comparison result of the maximum value in the three rows, the comparison result of the middle value in the three rows and the comparison result of the minimum value in the three rows respectively;

[0019] The minimum value in the comparison results of the three rows of maximum values, the middle value in the comparison results of the three rows of middle values, and the maximum value in the comparison results of the three rows of minimum values ​​are sorted to obtain a sorting result.

[0020] The beneficial effect of adopting the above further scheme is: by comparing and analyzing the pixel values ​​of each row, compared with the traditional method of analyzing 9 values ​​together, this method occupies less memory and is more efficient, which can effectively improve the efficiency of sorting.

[0021] Furthermore, the above image processing model is specifically:

[0022] ;in:

[0023] ; ;

[0024] , ;

[0025] In the formula, represents the number of iterations, and Respectively represent the first i , j ) neurons’ feedback input and connection input, Indicates the image to be processed ( i , j ) pixel values, Represents an internal activity item, represents the dynamic threshold, Indicates the first i , j ) pixels are processed by the image processing model and then output as pulses. Express request The weighting coefficient of represents the exponential decay time constant, represents the connection strength constant between neurons, Represents the inherent potential in the dynamic threshold.

[0026] The beneficial effect of adopting the above further scheme is: by inputting each pixel point in the image to be processed into the model for processing, the value corresponding to each pixel point is finally output, that is, 0 or 1, and finally the result of each noise point is obtained according to the value output by each pixel point.

[0027] Furthermore, the above model parameters include exponential decay time constant, connection strength constant and intrinsic potential, and the model parameters of the image processing model are obtained by presetting, specifically:

[0028] According to the preset range of the model parameter, the preset range is divided into a plurality of reference values ​​with a unit step length, and the initial matching degree of each reference value is calculated, and the maximum value among the initial matching degrees is determined as the optimal matching degree;

[0029] Randomly dividing the multiple initial matching degrees into a preset number of first combinations, and the number of initial matching degrees in each first combination is the same;

[0030] For each first combination, based on the optimal matching degree, each initial matching degree in the first combination is optimized and updated by a preset first number to obtain a second combination including a plurality of second matching degrees;

[0031] Regrouping the second matching degrees in each second combination to obtain a preset number of third combinations, and performing optimization update of the first number based on the optimal matching degree again until the number of regroupings reaches a preset second number;

[0032] The matching degrees after the last grouping and optimization update are determined as the third matching degree, the third matching degree with the largest value is determined as the target matching degree, and the reference value corresponding to the target matching degree is determined as the model parameter.

[0033] The beneficial effect of adopting the above further scheme is: to achieve adaptive acquisition of model parameters of the image processing model, the problem of blindness in selecting parameters of the image processing model is solved, and better denoising effect is achieved compared with manually selecting model parameters for image denoising.

[0034] Furthermore, the above initial matching degree is specifically:

[0035] ,in: ;

[0036] In the formula, represents the initial matching degree, represents the calculation parameters, Indicates that the image to be processed is only the image after median filtering. Indicates that the image to be processed is only the image after PCNN denoising. M and NIndicates the width and height of the image to be processed, P Representation Matrix of P norm matrix, P= 2.

[0037] Furthermore, for each first combination, each optimization update is specifically as follows:

[0038] For each initial matching degree, a new matching degree is calculated using the optimal matching degree, the initial matching degree with the largest value in the first combination, and the initial matching degree with the smallest value in the first combination;

[0039] If the new matching degree is not less than the corresponding initial matching degree, the new matching degree is determined as the second matching degree; if the new matching degree is not greater than the corresponding initial matching degree, the optimal matching degree is determined as the second matching degree.

[0040] Furthermore, the above new matching degree is specifically:

[0041] ,in: ;

[0042] In the formula, Indicates the new matching degree, Indicates the initial matching degree or the second matching degree, Indicates the maximum matching degree in the first combination or the second combination. Represents a random number between 0 and 1. Indicates the maximum value allowed to change.

[0043] In a second aspect, the present application provides an FPGA-based image median filtering system, which is applied to any FPGA-based image median filtering method in the first aspect, including:

[0044] The first module is used to obtain an image to be processed, establish an image processing model corresponding to the number of neurons according to the pixels of the image to be processed, and obtain model parameters of the image processing model by presetting;

[0045] The second module is used to input the image to be processed into the image processing model based on the model parameters for processing, and obtain multiple noise points from each pixel point of the image to be processed;

[0046] The third module is used to obtain the pixel values ​​of eight pixels adjacent to each noise point, sort the pixel values ​​of the noise point and each adjacent pixel point, and obtain the sorting result;

[0047] The fourth module is used to determine, for each noise point, the middle value in the corresponding sorting result as the target pixel value;

[0048] The fifth module is used to replace the original pixel value of each noise point in the image to be processed with the corresponding target pixel value, and determine the image to be processed after the pixel replacement of all noise points as the filtered processed image.

[0049] In a third aspect, the present application provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any one of the methods in the first aspect when executing the computer program.

[0050] In a fourth aspect, the present application provides a non-transitory computer-readable storage medium, which stores computer instructions, and the computer instructions enable a computer to execute any one of the methods in the first aspect.

[0051] Compared with the prior art, the present invention has at least the following beneficial effects:

[0052] In the present application, after obtaining the model parameters of the image processing model by a preset method, the image to be processed is processed by the image processing model based on the model parameters to obtain the noise points that need to be filtered from each pixel point of the image to be processed, and then the median filtering method is used to filter the noise points that need to be filtered; when the median filtering method is used for filtering, for each noise point that needs to be filtered, the corresponding noise point is taken as the center and the eight adjacent pixels are taken to form a 3*3 array, and the pixel value of the pixel point and the pixel values ​​of the eight adjacent pixels are sorted; the middle value in the sorting result is determined as the replacement value of the noise point, that is, the target pixel value, and the original pixel value of the corresponding noise point is replaced by the target pixel value. When all the noise points in the image to be processed have completed the replacement of the target pixel value, the filtering process of the image to be processed is completed, and the image in which all the noise points have been replaced is determined as the filtered processed image to be output.

[0053] In the present application, compared with the traditional median filtering processing method, the method adopted in this scheme does not perform median filtering on all the pixel points in the image to be processed, but first uses the model to determine which image points need to be filtered, that is, finds out the noise points with noise from the image to be processed, and then filters these noise points by means of median filtering. This not only effectively suppresses image noise, but also can well preserve the image detail information and image edge information; at the same time, the model parameters of the model obtained by the preset method can effectively improve the processing ability and effect of the model compared with the traditional method of obtaining parameters based on experience, so that it can more accurately determine which are noise points, so that it can be more efficient when performing filtering processing.

[0054] In the present application, by comparing and analyzing the pixel values ​​of each row, compared with the traditional method of analyzing 9 values ​​together, this occupies less memory and is more efficient, which can effectively improve the efficiency of sorting; by inputting each pixel point in the image to be processed into the model for processing, and finally outputting the value corresponding to each pixel point, that is, 0 or 1, finally achieving the result of each noise point according to the value output by each pixel point; through the above-mentioned model parameter acquisition method, the model parameters of the image processing model are adaptively acquired, which solves the problem of blindness in the selection of parameters of the image processing model, and has better denoising effect than manually selecting model parameters for image denoising.

[0055] In the present application, through the secondary image filtering method, on the premise of completing the image adaptive denoising, the advantage of the traditional M-median denoising method in completely preserving the statistical characteristics of the image is retained. It can not only effectively suppress the noise by isolating the noise points, but also completely preserve the image detail information and contour information, and can be well used for later image analysis and processing. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] The drawings described herein are used to provide a further understanding of the embodiments of the present invention, constitute a part of this application, and do not constitute a limitation of the embodiments of the present invention. In the drawings:

[0057] Figure 1 A method flow chart of a filtering method in an embodiment of the present invention;

[0058] Figure 2 A schematic diagram of a sorting result in an embodiment of the present invention;

[0059] Figure 3 Schematic diagram of a median filtering processing method in an embodiment of the present invention;

[0060] Figure 4 It is a connection block diagram of image filtering based on FPGA in an embodiment of the present invention;

[0061] Figure 5 A connection diagram of a filter system in an embodiment of the present invention;

[0062] Figure 6 Schematic diagram of the connection of electronic equipment in an embodiment of the present invention. DETAILED DESCRIPTION

[0063] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.

[0064] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0065] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.

[0066] In the description of the embodiments of the present invention, "plurality" means at least 2.

[0067] Embodiment 1: In order to solve the problem that the traditional median filtering method causes the entire image to lose some details, and the current method for determining the network parameters of the neural network is insufficient, resulting in unsatisfactory results when filtering the image, this embodiment provides an image median filtering method based on FPGA, such as Figure 1 As shown, the following specific steps are included:

[0068] S1, obtaining an image to be processed, establishing an image processing model with a corresponding number of neurons according to the pixels of the image to be processed, and obtaining model parameters of the image processing model by presetting.

[0069] Among them, the image processing model can be a pulse coupled neural network (PCNN) model. PCNN is an artificial neural network in which neurons correspond to pixels one by one. It can well retain image detail information by obtaining an image ignition matrix.

[0070] Optionally, the above model parameters include an exponential decay time constant, a connection strength constant and an intrinsic potential, and the model parameters of the image processing model are obtained by presetting, specifically:

[0071] S11, according to the preset range of the model parameter, the preset range is divided into a plurality of reference values ​​in unit step length, and the initial matching degree of each reference value is calculated, and the maximum value among the initial matching degrees is determined as the optimal matching degree.

[0072] Optionally, the above initial matching degree is specifically:

[0073] ,in: ;

[0074] In the formula, represents the initial matching degree, represents the calculation parameters, Indicates that the image to be processed is only the image after median filtering. Indicates that the image to be processed is only the image after PCNN denoising. M and N Indicates the width and height of the image to be processed, P Representation Matrix of P norm matrix, P= 2.

[0075] S12: randomly divide the multiple initial matching degrees into a preset number of first combinations, and the number of initial matching degrees in each first combination is the same.

[0076] S13, for each first combination, based on the optimal matching degree, each initial matching degree in the first combination is optimized and updated by a preset first number of times to obtain a second combination including a plurality of second matching degrees.

[0077] Optionally, for each first combination, each optimization update is specifically as follows:

[0078] S131, for each initial matching degree, a new matching degree is calculated using the optimal matching degree, the initial matching degree with the largest value in the first combination, and the initial matching degree with the smallest value in the first combination.

[0079] Optionally, the above new matching degree is specifically:

[0080] ,in: ;

[0081] In the formula, Indicates the new matching degree, Indicates the initial matching degree or the second matching degree, Indicates the maximum matching degree in the first combination or the second combination. Represents a random number between 0 and 1. Indicates the maximum value allowed to change.

[0082] S132: If the new matching degree is not less than the corresponding initial matching degree, the new matching degree is determined as the second matching degree; if the new matching degree is not greater than the corresponding initial matching degree, the optimal matching degree is determined as the second matching degree.

[0083] S14, regrouping the second matching degrees in each second combination to obtain a preset number of third combinations, and again optimizing and updating the first number based on the optimal matching degree until the number of regroupings reaches a preset second number.

[0084] S15, determining each matching degree after the last grouping and optimization update as the third matching degree, determining the third matching degree with the largest value as the target matching degree, and determining the reference value corresponding to the target matching degree as the model parameter.

[0085] Among them, the adaptive acquisition of model parameters of the image processing model is realized, which solves the problem of blindness in selecting parameters of the image processing model. Compared with manually selecting model parameters for image denoising, it has a better denoising effect.

[0086] S2, inputting the image to be processed into an image processing model based on the model parameters for processing, and obtaining a plurality of noise points from each pixel point of the image to be processed.

[0087] Among them, compared with the traditional median filtering processing method, the method adopted in this scheme does not perform median filtering on all the pixels in the image to be processed, but first uses the model to determine which pixels need to be filtered, that is, to find out the noise points with noise from the image to be processed, and then filter these noise points by median filtering. This not only effectively suppresses image noise, but also can well preserve image detail information and image edge information.

[0088] Optionally, the above image processing model is specifically:

[0089] ;in:

[0090] ; ;

[0091] , ;

[0092] In the formula, represents the number of iterations, and Respectively represent the first i , j ) neurons’ feedback input and connection input, Indicates the image to be processed ( i , j ) pixel values, Represents an internal activity item, represents the dynamic threshold, Indicates the first i , j ) pixels are processed by the image processing model and then output as pulses. Express request The weighting coefficient of represents the exponential decay time constant, represents the connection strength constant between neurons, Represents the inherent potential in the dynamic threshold.

[0093] Among them, when the image processing model performs image processing, the value of any pixel in the image to be processed has a certain connection with the values ​​of the pixels around it; for example, because a certain pixel is polluted by noise, the correlation between adjacent pixels is destroyed, causing the neuron activation corresponding to the pixel polluted by noise to be different from the activation corresponding to the pixels in its neighborhood; the activated state can be recorded as 1 and the unactivated state as 0 (that is, the output of each pixel processed by the model is 1 or 0); therefore, according to the difference in activation status of a certain neuron and other neurons in its neighborhood, it is judged whether it is a noise point; the judgment basis is: if the value of a certain pixel is larger, the probability that the neuron corresponding to the pixel is activated is higher, and vice versa.

[0094] Specifically, if a neuron is marked as 1 and most (preset to 80%) neurons in its neighborhood are marked as 0, it is believed that the value of the pixel point in the image corresponding to it will decrease due to noise pollution; similarly, if a neuron is marked as 0 and most of the neurons in its neighborhood are marked as 1, it is believed that the value of the pixel point in the image corresponding to it will increase due to noise pollution. In other cases, it is believed that the corresponding pixel point is not polluted by noise and the value remains unchanged.

[0095] S3, for each noise point, obtain pixel values ​​of eight pixel points adjacent to the noise point, sort the pixel values ​​of the noise point and each adjacent pixel point, and obtain a sorting result.

[0096] Specifically, the median filtering method is as follows: Figure 3 As shown, in Figure 3 The left and right figures are before and after median processing respectively. The processing principle is: Figure 3 The 3*3 pixels in the middle area are processed by median. The pixel value of the central pixel on the left side of the figure is 2. When processing, the pixel values ​​of the 3*3 pixels are arranged from large to small or from small to large, such as Figure 3 In the lower part, the fifth value is the middle value, then the center pixel of the 3*3 pixels is replaced by the middle value obtained by sorting, see Figure 3 , that is, replace 2 with 16.

[0097] For each noise point obtained, eight pixel points adjacent to the corresponding noise point are taken as the center to form a 3*3 array, and the pixel value of the pixel point and the pixel values ​​of the eight pixel points adjacent to the corresponding noise point are sorted.

[0098] Optionally, the above-mentioned sorting of the pixel values ​​of the noise point and each adjacent pixel point is specifically as follows:

[0099] S31, for the noise point and the 3*3 array formed by the eight pixel points adjacent to it, obtain the maximum value, the middle value and the minimum value of each of the three rows respectively.

[0100] S32, comparing the maximum value in the three rows, the middle value in the three rows and the minimum value in the three rows respectively, to obtain the comparison results of the maximum value in the three rows, the comparison results of the middle value in the three rows and the comparison results of the minimum value in the three rows respectively.

[0101] S33, sorting the minimum value in the comparison results of the three rows of maximum values, the middle value in the comparison results of the three rows of middle values, and the maximum value in the comparison results of the three rows of minimum values ​​to obtain a sorting result.

[0102] Specifically, the above ranking results can be found in Figure 2 , the specific steps are:

[0103] Step 1: Find the maximum, median and minimum values ​​in the same row among the three rows respectively;

[0104] like Figure 2 Among them, Max1 is the maximum value of the first row, Med1 is the middle value of the first row, and Min1 is the minimum value of the first row. Similarly, there are Max2, Med2, Min2, Max3, Med3, Min3.

[0105] Step 2: Compare the maximum value, middle value, and minimum value in the three rows respectively;

[0106] Compare the three values ​​of Max1, Max2, and Max3 to get the minimum value Min_of_Max of these three values;

[0107] Compare the three values ​​of Med1, Med2, and Med3 to get the middle value of these three values, Med_of_Med;

[0108] Compare the three values ​​Min1, Min2, and Min3 to get the maximum value Max_of_Min of these three values.

[0109] Step 3: Compare the three values ​​obtained in the previous step to get the middle value of the 3x3 matrix;

[0110] Compare Min_Max, Med_Med, and Max_Min obtained in the second step to obtain the middle value of these three values, which is the middle value of this 3x3 matrix.

[0111] Among them, by comparing and analyzing the pixel values ​​of each row, compared with the traditional method of analyzing 9 values ​​together, this method takes up less memory and is more efficient, which can effectively improve the efficiency of sorting.

[0112] S4, for each noise point, determining the middle value in the corresponding sorting result as the target pixel value.

[0113] S5, replacing the original pixel value of each noise point in the image to be processed with the corresponding target pixel value, and determining the image to be processed after all noise points are pixel-replaced as the filtered processed image.

[0114] Among them, the original pixel value of the corresponding noise point is replaced by the target pixel value. When all the noise points in the image to be processed have completed the replacement of the target pixel value, the filtering processing of the image to be processed is completed, and the image in which all the noise points have been replaced is determined as the filtered processed image to be output.

[0115] Specifically, the hardware schematic diagram of the FPGA-based image filtering proposed in this embodiment is shown in FIG. Figure 4 ,like Figure 4 As shown, by inputting the original image into the data receiving module, the original image is the image to be processed, and the data receiving module transmits it to the RAM for caching. The cached image data is then processed by the median filter module. Figure 4 The median filter module in the embodiment includes various processing steps in this embodiment. Finally, after all the noise points in the image to be processed have completed the replacement of the target pixel values, the filtering processing of the image to be processed is completed, so as to output the processed image. Among them, the salt and pepper noise or interference pulse in the image can be effectively removed by the filtering method in this embodiment. The use of FPGA can realize the streaming processing of image data with low data delay. The algorithm based on FPGA can be adapted to a variety of different image input and output interfaces and has a wide range of applications.

[0116] Embodiment 2: This embodiment provides an FPGA-based image median filtering system, which is applied to any FPGA-based image median filtering method in Embodiment 1, such as Figure 5 As shown, including:

[0117] The first module is used to obtain the image to be processed, establish an image processing model with a corresponding number of neurons according to the pixels of the image to be processed, and obtain the model parameters of the image processing model by presetting.

[0118] The second module is used to input the image to be processed into an image processing model based on model parameters for processing, and obtain multiple noise points from each pixel point of the image to be processed.

[0119] The third module is used to obtain the pixel values ​​of eight pixel points adjacent to the noise point for each noise point, sort the pixel values ​​of the noise point and each adjacent pixel point, and obtain the sorting result.

[0120] The fourth module is used to determine, for each noise point, the middle value in the corresponding sorting result as the target pixel value.

[0121] The fifth module is used to replace the original pixel value of each noise point in the image to be processed with the corresponding target pixel value, and determine the image to be processed after the pixel replacement of all noise points as the filtered processed image.

[0122] Embodiment 3: This embodiment of the present application provides an electronic device, such as Figure 6 As shown, it includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, any method in Embodiment 1 is implemented.

[0123] Embodiment 4: The embodiment of the present application provides a non-transitory computer-readable storage medium, which stores computer instructions, and the computer instructions enable a computer to execute any method in Embodiment 1.

[0124] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. The image median filtering method based on FPGA is characterized by: The specific steps include: Obtain an image to be processed, establish an image processing model corresponding to the number of neurons according to the pixel points of the image to be processed, and obtain model parameters of the image processing model by presetting; the image processing model is specifically: in: YOU ij [n]=F ij [n]{1+βL ij [n]};F ij [n]=I ij ; L ij [n]=∑ B W ij Y k [n−1],E ij [n]=e α IT ij [n−1]+VY ij [n]: In the formula, n represents the number of iterations, F ij and L ij Respectively represent the feedback input and connection input of the (i, j)th neuron, I ij represents the pixel value of the (i, j)th pixel in the image to be processed, U ij represents the internal activity item, E ij Indicates the dynamic threshold, Y ij represents the pulse output of the (i, j)th pixel after being processed by the image processing model, W ij Indicates the search for L ij The weighting coefficient of , α represents the exponential decay time constant, β represents the connection strength constant between neurons, and V represents the inherent potential in the dynamic threshold; the model parameters include the exponential decay time constant, the connection strength constant and the inherent potential, and the model parameters of the image processing model obtained by the preset method are specifically: According to the preset range of the model parameter, the preset range is divided into a plurality of reference values ​​in unit step length, and the initial matching degree of each reference value is calculated, and the largest value among the initial matching degrees is determined as the optimal matching degree; Randomly dividing the multiple initial matching degrees into a preset number of first combinations, and the number of initial matching degrees in each of the first combinations is the same; For each first combination, based on the optimal matching degree, each initial matching degree in the first combination is optimized and updated by a preset first number to obtain a second combination including a plurality of second matching degrees; Regrouping the second matching degrees in each second combination to obtain a preset number of third combinations, and performing optimization update of the first number based on the optimal matching degree again until the number of regroupings reaches a preset second number; Determine the matching degrees after the last grouping and optimization update as the third matching degree, determine the third matching degree with the largest value as the target matching degree, and determine the target and the corresponding reference value as the model parameter; Inputting the image to be processed into the image processing model based on the model parameters for processing, and obtaining a plurality of noise points from each pixel point of the image to be processed; For each noise point, the pixel values ​​of eight pixels adjacent to the noise point are obtained, the pixel values ​​of the noise point and each of the adjacent pixels are sorted, and a sorting result is obtained; For each of the noise points, determining the middle value in the corresponding sorting result as the target pixel value; The original pixel value of each noise point in the image to be processed is replaced with the corresponding target pixel value, and the image to be processed after all noise points are pixel-replaced is determined as a filtered processed image.

2. The FPGA-based image median filtering method according to claim 1, characterized in that: The pixel values ​​of the noise point and adjacent pixel points are sorted as follows: For the noise point and the 3*3 array composed of the eight pixel points adjacent to it, the maximum value, the middle value and the minimum value of each of the three rows are obtained respectively; Compare the maximum value in the three rows, the middle value in the three rows and the minimum value in the three rows respectively, and obtain the comparison result of the maximum value in the three rows, the comparison result of the middle value in the three rows and the comparison result of the minimum value in the three rows respectively; The minimum value in the comparison results of the three rows of maximum values, the middle value in the comparison results of the three rows of middle values, and the maximum value in the comparison results of the three rows of minimum values ​​are sorted to obtain the sorting result.

3. The FPGA-based image median filtering method according to claim 1, characterized in that: The initial matching degree is specifically: in: Where f represents the initial matching degree, θ represents the calculation parameter, I represents the image after the image to be processed is only subjected to median filtering, O represents the image after the image to be processed is only subjected to PCNN denoising, M and N represent the width and height of the image to be processed, and P represents the P-norm matrix of the matrix ‖IO‖, where P = 2.

4. The FPGA-based image median filtering method according to claim 1, characterized in that: For each of the first combinations, each optimization update is specifically as follows: For each initial matching degree, a new matching degree is calculated using the optimal matching degree, the initial matching degree with the largest value in the first combination, and the initial matching degree with the smallest value in the first combination; If the new matching degree is not less than the corresponding initial matching degree, determining the new matching degree as the second matching degree; If the new matching degree is not greater than the corresponding initial matching degree, the optimal matching degree is determined as the second matching degree.

5. The FPGA-based image median filtering method according to claim 4, characterized in that: The new matching degree is specifically: A' w = A w r(A b -A w ), in which: r(A b -A w ) ≤ D; In the formula, A' w Represents the new matching degree, A w Indicates the initial matching degree or the second matching degree, A b It represents the maximum matching degree of the first combination or the second combination, r represents a random number between 0 and 1, and D represents the maximum value allowed to change.

6. An FPGA-based image median filtering system, applied to the FPGA-based image median filtering method according to any one of claims 1 to 5, characterized in that: include: The first module is used to obtain an image to be processed, establish an image processing model corresponding to the number of neurons according to the pixel points of the image to be processed, and obtain model parameters of the image processing model by presetting; The second module is used to input the image to be processed into the image processing model based on the model parameters for processing, and obtain multiple noise points from each pixel point of the image to be processed; The third module is used to obtain, for each noise point, pixel values ​​of eight pixels adjacent to the noise point, sort the pixel values ​​of the noise point and each adjacent pixel point, and obtain a sorting result; A fourth module is used to determine, for each of the noise points, a middle value in the corresponding sorting result as a target pixel value; The fifth module is used to replace the original pixel value of each noise point in the image to be processed with the corresponding target pixel value, and determine the image to be processed after the pixel replacement of all noise points as the filtered processed image.

7. An electronic device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the method according to any one of claims 1 to 5 is implemented when the processor executes the computer program.

8. A non-transitory computer-readable storage medium, characterized in that: The non-transitory computer-readable storage medium stores computer instructions, which enable a computer to execute the method of any one of claims 1-5.