Image median filtering method and device, electronic equipment, chip and storage medium
By constructing a 7×5 filtering window in the image median filtering method and sorting it multiple times, the problems of poor median filtering effect and high resource consumption in the prior art are solved, and better image noise reduction effect and resource optimization are achieved.
Patent Information
- Application Number
- CN202410186297.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-19
- Publication Date
- 2025-07-25
AI Technical Summary
The existing median filtering method has limited effect in image noise reduction processing and has high computing and storage resource consumption.
The pixel data is read from the four single-port static random access memory SRAMs in the line buffer, and a filter window with a size of 7×5 is constructed, and the pixel data in the filter window is sorted multiple times, and the median filtering calculation is performed.
The filtering window is expanded, the filtering effect is improved, the calculation and storage resource consumption is reduced, and the noise reduction capability of median filtering is enhanced.
Smart Images

Figure CN120374400A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to median filtering processing technology, and in particular, to an image median filtering method, apparatus, electronic device, chip, and storage medium. Background Art
[0002] With the development of image processing technology, the median filtering method is increasingly widely used in image noise reduction processing scenarios. The median filtering method is a non-linear signal processing technology based on sorting statistical theory that can effectively suppress noise. It sets the gray value of each pixel in the image to the median of all pixel gray values within a certain neighborhood window of the pixel, so as to eliminate isolated noise points. Summary of the Invention
[0003] The present disclosure provides an image median filtering method, apparatus, electronic device, chip, and storage medium.
[0004] According to a first aspect of an embodiment of the present disclosure, there is provided an image median filtering method, including:
[0005] Reading pixel data from 4 single-port static random access memories (SRAMs) of a row buffer respectively; wherein each single-port SRAM is used to store 1 row of pixel data, and the pixel data buffered by the row buffer is the pixel data output by an image sensor scanning a raw image in a raster scan manner;
[0006] Constructing a filtering window with a size of 7×5 according to the pixel data read from the 4 single-port SRAMs and the currently input pixel data; the currently input pixel data is the pixel data currently output by the image sensor;
[0007] Performing median filtering calculation on the pixel data within the filtering window through multiple sorts to obtain the median filtering output pixel value of the filtering window.
[0008] According to a second aspect of an embodiment of the present disclosure, there is provided an image median filtering apparatus, including:
[0009] A reading module, configured to read pixel data from 4 single-port static random access memories (SRAMs) of a row buffer respectively; wherein each single-port SRAM is used to store 1 row of pixel data, and the pixel data buffered by the row buffer is the pixel data output by an image sensor scanning a raw image in a raster scan manner;
[0010] A processing module, configured to construct a filtering window with a size of 7×5 according to the pixel data read from the 4 single-port SRAMs and the currently input pixel data; the currently input pixel data is the pixel data currently output by the image sensor;
[0011] The processing module is further configured to perform median filtering calculation on the pixel data within the filtering window to obtain the median filtering output pixel value of the filtering window after sorting the pixel data within the filtering window multiple times.
[0012] In some embodiments of the present disclosure, the image median filtering device further includes a writing module. The writing module is configured to splice and store the continuously written two-shot pixel data for the writing operation of each single-port SRAM.
[0013] In some embodiments of the present disclosure, the reading module is further configured to read pixel data from 4 single-port SRAMs respectively during the interval between two-shot writing operations.
[0014] In some embodiments of the present disclosure, the processing module is further configured to splice the 4 continuously two-shot pixel data read from 4 single-port SRAMs during the time period of the current read operation with the currently input continuously two-shot pixel data to form a pixel matrix with a size of 2×5; sort the two columns of pixel data in the pixel matrix respectively to obtain the sorted pixel matrix of 2×5; continue to splice the pixel data read during the time period of the next read operation with the pixel data input next time, and sort each column of pixel data in the spliced pixel matrix respectively, and so on, to construct a filtering window with a size of 7×5.
[0015] In some embodiments of the present disclosure, the processing module is further configured to sort the pixel data within the filtering window in sequence in the horizontal direction, in the first diagonal direction, in the second diagonal direction, and in the third diagonal direction, and continuously eliminate the pixel data that is not the median during the sorting process to obtain the median filtering output pixel value of the filtering window.
[0016] In some embodiments of the present disclosure, the processing module is further configured to define the positions of the filtering window as p11, p12, p13, p14, p15, p16, p17, p21, p22, p23, p24, p25, p26, p27, p31, p32, p33, p34, p35, p36, p37, p41, p42, p43, p44, p45, p46, p47, p51, p52, p53, p54, p55, p56, p57.
[0017] In some embodiments of the present disclosure, the processing module is further configured to sort the pixel data within the filtering window horizontally, sorting 7 pixel data in each row respectively, and removing the pixel data at positions p11, p12, p13, p14, p21, p22, p23, p31, p37, p45, p46, p47, p54, p55, p56, p57 respectively; sorting the remaining 19 pixel data in the first diagonal direction, sorting 2, 5, 5, 5, 2 pixel data respectively, and removing the pixel data at positions p15, p16, p24, p32, p36, p44, p52, p53 respectively; sorting the remaining 11 pixel data in the second diagonal direction, sorting 3, 5, 3 pixel data respectively, and removing the pixel data at positions p25, p26, p27, p33, p35, p41, p42, p43 respectively; determining the median filtering output pixel value of the filtering window from the remaining 3 pixel data.
[0018] In some embodiments of the present disclosure, the processing module is further configured to sort the remaining 19 pixel data in the first diagonal direction, sorting the pixel data at positions p32, p41 respectively, sorting the pixel data at positions p15, p24, p33, p42, p51 respectively, sorting the pixel data at positions p16, p25, p34, p43, p52 respectively, sorting the pixel data at positions p17, p26, p35, p44, p53 respectively, and sorting the pixel data at positions p27, p36 respectively.
[0019] In some embodiments of the present disclosure, the processing module is further configured to sort the remaining 11 pixel data in the second diagonal direction, sorting the pixel data at positions p33, p25, p17 respectively, sorting the pixel data at positions p41, p42, p34, p26, p27 respectively, and sorting the pixel data at positions p51, p43, p35 respectively.
[0020] According to a third aspect of the embodiments of the present disclosure, an electronic device is provided, including: one or more processors; wherein, the electronic device is configured to execute the image median filtering method described in the first aspect above.
[0021] According to a fourth aspect of the embodiments of the present disclosure, a chip is provided, including: one or more processors; an image sensor configured to scan a raw image in a raster scan manner; a row buffer configured to buffer the pixel data output by the image sensor, wherein the row buffer includes 4 single-port static random access memories (SRAMs), and each single-port SRAM is configured to store 1 row of pixel data; wherein, the chip is configured to execute the image median filtering method described in the first aspect above.
[0022] According to a fifth aspect of the embodiments of the present disclosure, a storage medium is provided. The storage medium stores instructions that, when run on an electronic device, cause the electronic device to execute the image median filtering method described in the first aspect above.
[0023] The technical solutions provided by the embodiments of the present disclosure may include the following beneficial effects: Pixel data is respectively read from four single-port static random access memories (SRAMs) of a line buffer; according to the pixel data read from the four single-port SRAMs and the currently input pixel data, a filtering window with a size of 7×5 is constructed, which can expand the filtering window and improve the filtering effect; the pixel data within the filtering window is sorted multiple times, and median filtering calculation is performed to obtain the median filtering output pixel value of the filtering window, which can enhance the filtering and noise reduction effect of the median filtering process and reduce the consumption of computing and storage resources.
[0024] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] The accompanying drawings herein are incorporated into the specification and form a part of the specification, showing embodiments consistent with the present invention and, together with the specification, are used to explain the principles of the present invention.
[0026] Figure 1 is a flowchart of an image median filtering method provided according to an embodiment of the present disclosure.
[0027] Figure 2 is a flowchart of an image median filtering method provided according to an embodiment of the present disclosure.
[0028] Figure 3 is a schematic diagram of a filtering window construction method provided according to an embodiment of the present disclosure.
[0029] Figure 4 is a flowchart of an image median filtering method provided according to an embodiment of the present disclosure.
[0030] Figure 5 is a schematic diagram of a filtering window sorting method provided according to an embodiment of the present disclosure.
[0031] Figure 6 is a schematic diagram of a filtering window sorting method provided according to an embodiment of the present disclosure.
[0032] Figure 7 is a schematic diagram of a filtering window sorting method provided according to an embodiment of the present disclosure.
[0033] Figure 8 is a schematic diagram of a filtering window sorting method provided according to an embodiment of the present disclosure.
[0034] Figure 9 is a block diagram of an image median filtering device provided according to an embodiment of the present disclosure.
[0035] Figure 10 is a block diagram of an electronic device provided according to an embodiment of the present disclosure.
[0036] Figure 11 is a block diagram of a chip provided according to an embodiment of the present disclosure. Detailed implementation manners
[0037] Here, exemplary embodiments will be described in detail, and examples thereof are shown in the drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementation manners described in the following exemplary embodiments do not represent all implementation manners consistent with the present invention. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present invention as detailed in the appended claims.
[0038] Figure 1 is a flowchart of an image median filtering method provided according to an embodiment of the present disclosure. As Figure 1 shown, the image median filtering method includes but is not limited to the following steps:
[0039] In step S101, pixel data is respectively read from 4 blocks of single-port static random access memories (SRAMs) of a row buffer.
[0040] It should be noted that the row buffer is used to read and write pixel data of an image to facilitate the construction of a filtering window for median filtering calculation. Exemplarily, 4 blocks of single-port static random access memories of the row buffer respectively cache one row of pixel data; pixel data is respectively read from 4 blocks of single-port static random access memories (SRAMs) of the row buffer.
[0041] In step S102, a filtering window with a size of 7×5 is constructed according to the pixel data read from 4 blocks of single-port SRAMs and the currently input pixel data.
[0042] It should be noted that the filtering window with a size of 7×5 refers to a filtering window with a width of 7 and a height of 5.
[0043] Optionally, in some embodiments, for each time period of a read operation, splicing processing is performed according to the read pixel data and the currently input pixel data to obtain an intermediate pixel matrix; splicing processing is performed on multiple intermediate pixel matrices to construct a filtering window with a size of 7×5.
[0044] In step S103, the pixel data within the filtering window is sorted multiple times, and median filtering calculation is performed to obtain the median filtering output pixel value of the filtering window.
[0045] It should be noted that the pixel data within the filtering window is sorted multiple times to facilitate eliminating the pixel data that is not the median, and obtain the median filtering output pixel value of the filtering window. Exemplarily, the pixel data within the filtering window is sorted to obtain a first sorting result; according to the first sorting result, the pixel data that is not the median is eliminated to obtain intermediate pixel data; the intermediate pixel data is continuously sorted to obtain a second sorting result, and the pixel data that is not the median is eliminated, and so on, until the number of pixels in the intermediate pixel data is 3, and the median of the 3 intermediate pixel data is determined as the median filtering output pixel value of the filtering window.
[0046] In an embodiment of the present disclosure, pixel data is respectively read from 4 single-port static random access memories (SRAMs) of the line buffer; according to the pixel data read from the 4 single-port SRAMs and the currently input pixel data, a filtering window with a size of 7×5 is constructed, which can expand the filtering window and improve the filtering effect; the pixel data within the filtering window is sorted multiple times, and median filtering calculation is performed to obtain the median filtering output pixel value of the filtering window, which can enhance the filtering and noise reduction effect of the median filtering process and reduce the consumption of computing and storage resources.
[0047] Figure 2 is a flowchart of an image median filtering method provided according to an embodiment of the present disclosure. As Figure 2 shown, the image median filtering method includes but is not limited to the following steps:
[0048] In step S201, for the write operation of each single-port SRAM, the continuously written two beats of pixel data are spliced and stored.
[0049] It should be noted that the image median filtering method provided in the embodiments of the present disclosure is mainly applied in the field of ISP (Image Signal Process) chips. The ISP chip includes but is not limited to an image sensor, a line buffer, and a processor. Exemplarily, the image sensor scans the original image in a raster scan manner to obtain pixel data; the line buffer caches the pixel data output by the image sensor; pixel data is read from the line buffer to obtain a filtering window; the median filter performs median filtering on the filtering window to obtain a median filtering output pixel value, so as to filter and reduce noise of the image.
[0050] It should be noted that the clock cycle is the most basic and smallest time unit in a computer. A clock cycle is defined as one beat. Therefore, two consecutive beats of pixel data written can refer to the pixel data written within two consecutive clock cycles.
[0051] In step S202, pixel data is read from 4 blocks of single-port static random access memory (SRAM) in the row buffer respectively.
[0052] Optionally, in some embodiments, during the interval between two beats of write operations, pixel data is read from 4 blocks of single-port SRAM respectively.
[0053] In step S203, according to the pixel data read from 4 blocks of single-port SRAM and the currently input pixel data, a filtering window with a size of 7×5 is constructed.
[0054] Optionally, in some embodiments, 4 consecutive two-beat pixel data read from 4 blocks of single-port SRAM during the time period of the current read operation are concatenated with the currently input consecutive two-beat pixel data to form a pixel matrix with a size of 2×5 (width × height); the two columns of pixel data in the pixel matrix are sorted respectively to obtain a sorted 2×5 pixel matrix; then the pixel data read during the time period of the next read operation is concatenated with the next input pixel data, and each column of pixel data in the concatenated pixel matrix is sorted respectively, and so on, to construct a filtering window with a size of 7×5.
[0055] Exemplarily, 4 consecutive two-beat pixel data read from 4 blocks of single-port SRAM during the time period of the current read operation are concatenated with the currently input consecutive two-beat pixel data to form a pixel matrix with a size of 2×5; the two columns of pixel data in the pixel matrix are sorted respectively to obtain a sorted 2×5 pixel matrix. Sorting the pixel matrix of the first two columns in the filtering window in advance in this way can reduce the number of sorting operations for median filtering the filtering window in the subsequent process; then the pixel data read during the time period of the next read operation is concatenated with the next input pixel data, and each column of pixel data in the concatenated pixel matrix is sorted respectively, and so on, to obtain three sorted 2×5 pixel matrices and one sorted 1×5 pixel matrix; the three sorted 2×5 pixel matrices and one sorted 1×5 pixel matrix are concatenated to construct a filtering window with a size of 7×5.
[0056] In step S204, the pixel data in the filtering window is sorted multiple times, and median filtering calculation is performed to obtain the median filtering output pixel value of the filtering window.
[0057] In an embodiment of the present disclosure, step S204 can be implemented in any one of the embodiments of the present disclosure. The embodiments of the present disclosure do not limit this and will not be elaborated further.
[0058] In some embodiments of the present disclosure, for the write operation of each single-port SRAM, the consecutive two-shot pixel data to be written is concatenated and stored; pixel data is respectively read from the 4 single-port static random access memories (SRAMs) of the line buffer, so that the read pixel data can be concatenated with the currently input pixel data to facilitate sorting the concatenated pixel matrix in advance; according to the pixel data read from the 4 single-port SRAMs and the currently input pixel data, a pixel matrix with a size of 2×5 is formed; the two columns of pixel data in the pixel matrix are respectively sorted to obtain a sorted 2×5 pixel matrix. Sorting the pixel matrix of the first two columns in the filter window in advance in this way can reduce the number of sorting operations for median filtering the filter window in the subsequent process; continue to concatenate the pixel data read in the time period of the next read operation with the pixel data input next time, and respectively sort each column of pixel data in the concatenated pixel matrix, and so on, to construct a filter window with a size of 7×5, which can reduce the sorting operation for median filtering calculation and further reduce the consumption of computing and storage resources.
[0059] Figure 3 is a schematic diagram of a filter window construction method provided according to an embodiment of the present disclosure. As Figure 3 shown, for the write operation of each single-port SRAM, the consecutive two-shot pixel data to be written is concatenated and stored. During the interval between the two-shot write operations, pixel data is respectively read from the 4 single-port SRAMs to obtain a 2×4 pixel matrix. The 2×4 pixel matrix read from the 4 single-port SRAMs in the time period of the current read operation is concatenated with the currently input consecutive two-shot pixel data to form a pixel matrix with a size of 2×5; the two columns of pixel data in the pixel matrix are respectively sorted to obtain a sorted 2×5 pixel matrix; continue to concatenate the pixel data read in the time period of the next read operation with the pixel data input next time, and respectively sort each column of pixel data in the concatenated pixel matrix, and so on, to construct a filter window with a size of 7×5.
[0060] Figure 4 is a flowchart of an image median filtering method provided according to an embodiment of the present disclosure. As Figure 4 shown, the image median filtering method includes but is not limited to the following steps:
[0061] In step S401, pixel data is respectively read from the 4 single-port static random access memories (SRAMs) of the line buffer.
[0062] In an embodiment of the present disclosure, step S401 can be implemented in any one of the embodiments of the present disclosure. The embodiments of the present disclosure do not limit this and will not be elaborated further.
[0063] In step S402, a filtering window with a size of 7×5 is constructed according to the pixel data read from 4 single-port SRAMs and the currently input pixel data.
[0064] In an embodiment of the present disclosure, step S402 can be implemented in any one of the embodiments of the present disclosure. The embodiments of the present disclosure do not limit this and will not be elaborated further.
[0065] In step S403, the pixel data within the filtering window is sorted in sequence in the horizontal direction, in the first diagonal direction, in the second diagonal direction, and in the third diagonal direction. During the sorting process, the pixel data that is not the median is continuously eliminated to obtain the median filtering output pixel value of the filtering window.
[0066] It should be noted that Figure 5 , Figure 6 , Figure 7 and Figure 8 are schematic diagrams of the filtering window sorting method provided according to the embodiments of the present disclosure. Figure 5 , Figure 6 , Figure 7 and Figure 8 The arrows in indicate the sorting size order. This sorting size order can be ascending order (in the direction of the arrow, the pixel data (such as pixel values) is sorted from small to large), or it can be descending order (in the direction of the arrow, the pixel data (such as pixel values) is sorted from large to small). During the multiple sorting processes of pre-sorting and median filtering processing when constructing the filtering window, this sorting size order should be kept consistent.
[0067] Figure 5 is a schematic diagram of the filtering window sorting method provided according to the embodiments of the present disclosure. As shown in Figure 5 , the positions of the filtering window are defined as p11, p12, p13, p14, p15, p16, p17, p21, p22, p23, p24, p25, p26, p27, p31, p32, p33, p34, p35, p36, p37, p41, p42, p43, p44, p45, p46, p47, p51, p52, p53, p54, p55, p56, p57. Exemplarily, the pixel data within the filtering window is sorted in the horizontal direction, and each row of pixel data is sorted respectively.
[0068] Optionally, in some embodiments, the pixel data within the filtering window is sorted horizontally, and for each row of 7 pixel data, the pixel data at positions p11, p12, p13, p14, p21, p22, p23, p31, p37, p45, p46, p47, p54, p55, p56, and p57 are excluded; the remaining 19 pixel data are sorted in the first diagonal direction, and for 2, 5, 5, 5, and 2 pixel data respectively, the pixel data at positions p15, p16, p24, p32, p36, p44, p52, and p53 are excluded; the remaining 11 pixel data are sorted in the second diagonal direction, and for 3, 5, and 3 pixel data respectively, the pixel data at positions p25, p26, p27, p33, p35, p41, p42, and p43 are excluded; the median filtering output pixel value of the filtering window is determined from the remaining 3 pixel data.
[0069] Figure 6 is a schematic diagram of the filtering window sorting method provided according to an embodiment of the present disclosure. Optionally, in some embodiments, the specific implementation of sorting the remaining 19 pixel data in the first diagonal direction for 2, 5, 5, 5, and 2 pixel data respectively can be: the remaining 19 pixel data are sorted in the first diagonal direction, the pixel data at positions p32 and p41 are sorted, the pixel data at positions p15, p24, p33, p42, and p51 are sorted, the pixel data at positions p16, p25, p34, p43, and p52 are sorted, the pixel data at positions p17, p26, p35, p44, and p53 are sorted, and the pixel data at positions p27 and p36 are sorted.
[0070] Figure 7 is a schematic diagram of the filtering window sorting method provided according to an embodiment of the present disclosure. Optionally, in some embodiments, the specific implementation of sorting the remaining 11 pixel data in the second diagonal direction for 3, 5, and 3 pixel data respectively can be: the remaining 11 pixel data are sorted in the second diagonal direction, the pixel data at positions p33, p25, and p17 are sorted, the pixel data at positions p41, p42, p34, p26, and p27 are sorted, and the pixel data at positions p51, p43, and p35 are sorted.
[0071] Figure 8 is a schematic diagram of the filtering window sorting method provided according to an embodiment of the present disclosure. As Figure 8As shown, the median filter output pixel value of the filter window is determined from the remaining 3 pixel data. Optionally, in some embodiments, the pixel data at positions p51, p34, and p17 are sorted, and the median of the pixel data at positions p51, p34, and p17 is determined as the median filter output pixel value.
[0072] In the embodiments of the present disclosure, the pixel data within the filter window are sequentially sorted in the horizontal direction, sorted in the first diagonal direction, sorted in the second diagonal direction, and sorted in the third diagonal direction. During the sorting process, the pixel data that are not the median are continuously excluded to obtain the median filter output pixel value of the filter window. In this way, median filtering calculation can be performed using a filter window with a size of 7×5, further improving the filter noise reduction effect.
[0073] Figure 9 is a block diagram of an image median filter device provided according to an embodiment of the present disclosure. As Figure 9 shown, the image median filter device includes a reading module 901 and a processing module 902.
[0074] Among them, the reading module 901 is used to respectively read pixel data from 4 single-port static random access memories (SRAMs) of the line buffer; among them, each single-port SRAM is used to store 1 row of pixel data, and the pixel data buffered by the line buffer are the pixel data output by the image sensor scanning the original image in a raster scan manner;
[0075] The processing module 902 is used to construct a filter window with a size of 7×5 according to the pixel data read from the 4 single-port SRAMs and the currently input pixel data; the currently input pixel data are the pixel data currently output by the image sensor;
[0076] The processing module 902 is further used to perform median filtering calculation on the pixel data within the filter window through multiple sorts to obtain the median filter output pixel value of the filter window.
[0077] As an example, the image median filter device further includes a writing module 903. The writing module 903 is used for the writing operation of each single-port SRAM to splice and store the continuously written two-shot pixel data.
[0078] As an example, the reading module 901 is further used to respectively read pixel data from the 4 single-port SRAMs during the interval between two-shot writing operations.
[0079] As an example, the processing module 902 is further configured to splice the four consecutive two-beat pixel data read from the four single-port SRAMs during the time period of the current read operation with the current input consecutive two-beat pixel data to form a pixel matrix with a size of 2×5; sort the two columns of pixel data in the pixel matrix respectively to obtain a sorted pixel matrix of 2×5; continue to splice the pixel data read during the time period of the next read operation with the pixel data input next time, and sort each column of pixel data in the spliced pixel matrix respectively, and so on, to construct a filtering window with a size of 7×5.
[0080] As an example, the processing module 902 is further configured to sort the pixel data in the filtering window in the horizontal direction, in the first diagonal direction, in the second diagonal direction, and in the third diagonal direction in sequence, and continuously eliminate the pixel data that is not the median value during the sorting process to obtain the median filtering output pixel value of the filtering window.
[0081] As an example, the processing module 902 is further configured to define the positions of the filtering window as p11, p12, p13, p14, p15, p16, p17, p21, p22, p23, p24, p25, p26, p27, p31, p32, p33, p34, p35, p36, p37, p41, p42, p43, p44, p45, p46, p47, p51, p52, p53, p54, p55, p56, p57.
[0082] As an example, the processing module 902 is further configured to sort the pixel data in the filtering window in the horizontal direction, and sort the 7 pixel data in each row respectively, and eliminate the pixel data at positions p11, p12, p13, p14, p21, p22, p23, p31, p37, p45, p46, p47, p54, p55, p56, p57 respectively; sort the remaining 19 pixel data in the first diagonal direction, and sort 2, 5, 5, 5, 2 pixel data respectively, and eliminate the pixel data at positions p15, p16, p24, p32, p36, p44, p52, p53 respectively; sort the remaining 11 pixel data in the second diagonal direction, and sort 3, 5, 3 pixel data respectively, and eliminate the pixel data at positions p25, p26, p27, p33, p35, p41, p42, p43 respectively; determine the median filtering output pixel value of the filtering window from the remaining 3 pixel data.
[0083] As an example, the processing module 902 is further configured to sort the remaining 19 pixel data in the first diagonal direction, sort the pixel data at positions p32 and p41 respectively, sort the pixel data at positions p15, p24, p33, p42, and p51 respectively, sort the pixel data at positions p16, p25, p34, p43, and p52 respectively, sort the pixel data at positions p17, p26, p35, p44, and p53 respectively, and sort the pixel data at positions p27 and p36 respectively.
[0084] As an example, the processing module 902 is further configured to sort the remaining 11 pixel data in the second diagonal direction, sort the pixel data at positions p33, p25, and p17 respectively, sort the pixel data at positions p41, p42, p34, p26, and p27 respectively, and sort the pixel data at positions p51, p43, and p35 respectively.
[0085] Regarding the device in the above embodiments, the specific manner in which each module performs operations has been described in detail in the embodiments related to the method, and will not be elaborated here.
[0086] According to an embodiment of the present disclosure, the present disclosure also provides a chip, an electronic device, and a readable storage medium.
[0087] Figure 10 is a block diagram of an electronic device provided according to an embodiment of the present disclosure. For example, the electronic device may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc. Refer to Figure 10 , the electronic device 1000 may include one or more of the following components: one or more processors 1001, a memory 1002, a power component 1003, and a sensor component 1004.
[0088] One or more processors 1001 generally control the overall operation of the electronic device 1000, such as operations associated with display, telephone calls, data communication, camera operations, and recording operations. One or more processors 1001 may execute instructions to complete all or part of the steps of the above method. In addition, one or more processors 1001 may include one or more modules to facilitate the interaction between one or more processors 1001 and other components. For example, one or more processors 1001 may include a sensor module to facilitate the interaction between the sensor component 1004 and one or more processors 1001.
[0089] The memory 1002 is configured to store various types of data to support the operation of the electronic device 1000. Examples of such data include instructions for any application or method operating on the electronic device 1000, contact data, phone book data, messages, pictures, videos, and the like. The memory 1002 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, a magnetic disk, or an optical disk.
[0090] The power component 1003 provides power to various components of the electronic device 1000. The power component 1003 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 1000.
[0091] The sensor component 1004 includes one or more sensors for providing a status assessment of various aspects of the vehicle. For example, the sensor component 1004 can detect the on / off state of the electronic device 1000, the relative positioning of components, such as the display and keypad of the vehicle, the sensor component 1004 can also detect a change in the position of the vehicle or a component of the vehicle, the presence or absence of user contact with the vehicle, the vehicle orientation or acceleration / deceleration, and the temperature change of the vehicle. The sensor component 1004 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor component 1004 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor component 1004 may further include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0092] In an exemplary embodiment, the electronic device 1000 can be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components for performing the above method.
[0093] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions, such as the memory 1002 including instructions, is also provided, and the above instructions can be executed by one or more processors 1001 of the electronic device 1000 to complete the above method. For example, the non-transitory computer-readable storage medium can be ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.
[0094] Figure 11 is a block diagram of a chip provided according to an embodiment of the present disclosure. As Figure 11 shown, the chip 1100 includes an image sensor 1101, a line buffer 1102, and one or more processors 1001. Figure 11 Taking one processor 1001 as an example. The chip 1100 can be used to execute any of the above methods. The processor 1001 can be used to execute the image median filtering method provided by the present disclosure. The image sensor 1101 is used to scan the original image in a raster scan manner. The line buffer 1102 is used to cache the pixel data output by the image sensor 1101. Among them, the line buffer 1102 includes 4 blocks of single-port static random access memory SRAM, and each block of single-port SRAM is used to store 1 row of pixel data.
[0095] In some embodiments, the chip 1100 further includes one or more interface circuits. Optionally, terms such as interface circuit, interface, and transceiver pin can be replaced with each other. In some embodiments, the chip 1100 further includes one or more memories for storing data. Optionally, all or part of the memories can be outside the chip 1100. Optionally, the interface circuit is connected to the memory, and the interface circuit can be used to receive data from the memory or other devices, and the interface circuit can be used to send data to the memory or other devices. For example, the interface circuit can read the data stored in the memory and send the data to one or more processors 1001.
[0096] In each embodiment such as virtual devices, physical devices, and chips, the various modules and / or devices described can be combined or separated arbitrarily according to the situation. Optionally, some or all steps can also be executed by multiple modules and / or devices in cooperation, which is not limited here.
[0097] Those skilled in the art will readily think of other embodiments of the present disclosure after considering the specification and practicing the disclosure herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure, which follow the general principles of the present disclosure and include known common knowledge or conventional technical means in the technical field not disclosed in the present disclosure. The specification and embodiments are only regarded as exemplary, and the true scope and spirit of the present disclosure are pointed out by the following claims.
[0098] It should be understood that the present disclosure is not limited to the exact structures already described and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the present disclosure is only limited by the appended claims.
Claims
1. An image median filtering method, characterized in that, Including: Reading pixel data from 4 blocks of single-port static random access memory (SRAM) in a row buffer respectively; wherein, each block of the single-port SRAM is used to store 1 row of pixel data, and the pixel data cached in the row buffer is the pixel data output by an image sensor scanning an original image in a raster scan manner. Constructing a filtering window with a size of 7×5 according to the pixel data read from the 4 blocks of single-port SRAM and the currently input pixel data; the currently input pixel data is the pixel data currently output by the image sensor. Performing median filtering calculation on the pixel data within the filtering window through multiple sorts to obtain the median filtering output pixel value of the filtering window.
2. The method according to claim 1, characterized in that, The method further includes: For the write operation of each block of the single-port SRAM, splicing and storing the continuously written two beats of pixel data.
3. The method according to claim 2, wherein The step of respectively reading pixel data from 4 blocks of single-port static random access memory (SRAM) in the row buffer includes: During the interval between two beats of write operations, respectively reading pixel data from the 4 blocks of single-port SRAM.
4. The method according to claim 2 or 3, characterized in that, The step of constructing a filtering window with a size of 7×5 according to the pixel data read from the 4 blocks of single-port SRAM and the currently input pixel data includes: Splicing the 4 continuously written two beats of pixel data read from the 4 blocks of single-port SRAM during the time period of the current read operation with the continuously written two beats of currently input pixel data to form a pixel matrix with a size of 2×5. Sorting the two columns of pixel data in the pixel matrix respectively to obtain the sorted pixel matrix with a size of 2×5. Continuing to splice the pixel data read during the time period of the next read operation with the next input pixel data, and respectively sorting each column of pixel data in the spliced pixel matrix, and so on, to construct the filtering window with a size of 7×5.
5. The method according to claim 1, wherein The step of performing median filtering calculation on the pixel data within the filtering window through multiple sorts to obtain the median filtering output pixel value of the filtering window includes: Sequentially sorting the pixel data within the filtering window in the horizontal direction, in the first diagonal direction, in the second diagonal direction, and in the third diagonal direction, and continuously removing the pixel data that is not the median during the sorting process to obtain the median filtering output pixel value of the filtering window.
6. The method according to claim 5, wherein Defining the positions of the filtering window as p11, p12, p13, p14, p15, p16, p17, p21, p22, p23, p24, p25, p26, p27, p31, p32, p33, p34, p35, p36, p37, p41, p42, p43, p44, p45, p46, p47, p51, p52, p53, p54, p55, p56, p57. Among them, the step of successively sorting the pixel data within the filtering window in the horizontal direction, in the first diagonal direction, in the second diagonal direction, and in the third diagonal direction, and continuously removing the pixel data that is not the median during the sorting process to obtain the median filtering output pixel value of the filtering window includes: Sorting the pixel data within the filtering window in the horizontal direction, and respectively sorting 7 pixel data in each row, and removing the pixel data at positions p11, p12, p13, p14, p21, p22, p23, p31, p37, p45, p46, p47, p54, p55, p56, and p57; Sorting the remaining 19 pixel data in the first diagonal direction, and respectively sorting 2, 5, 5, 5, and 2 pixel data, and removing the pixel data at positions p15, p16, p24, p32, p36, p44, p52, and p53; Sorting the remaining 11 pixel data in the second diagonal direction, and respectively sorting 3, 5, and 3 pixel data, and removing the pixel data at positions p25, p26, p27, p33, p35, p41, p42, and p43; Determining the median filtering output pixel value of the filtering window from the remaining 3 pixel data.
7. The method according to claim 6, wherein The step of sorting the remaining 19 pixel data in the first diagonal direction, and respectively sorting 2, 5, 5, 5, and 2 pixel data includes: Sorting the remaining 19 pixel data in the first diagonal direction, sorting the pixel data at positions p32 and p41, sorting the pixel data at positions p15, p24, p33, p42, and p51, sorting the pixel data at positions p16, p25, p34, p43, and p52, sorting the pixel data at positions p17, p26, p35, p44, and p53, and sorting the pixel data at positions p27 and p36.
8. The method according to claim 6, characterized in that, The step of sorting the remaining 11 pixel data in the second diagonal direction, and respectively sorting 3, 5, and 3 pixel data includes: Sorting the remaining 11 pixel data in the second diagonal direction, sorting the pixel data at positions p33, p25, and p17, sorting the pixel data at positions p41, p42, p34, p26, and p27, and sorting the pixel data at positions p51, p43, and p35.
9. An image median filtering device, characterized in that, including: A reading module, configured to respectively read pixel data from 4 blocks of single-port static random access memories (SRAMs) in a line buffer; wherein each block of the single-port SRAM is used to store 1 row of pixel data, and the pixel data cached in the line buffer is the pixel data output by an image sensor scanning an original image in a raster scan manner; A processing module, configured to construct a filtering window with a size of 7×5 according to the pixel data read from the 4 blocks of single-port SRAMs and the currently input pixel data; the currently input pixel data is the pixel data currently output by the image sensor; The processing module is further configured to perform median filtering calculation on the pixel data within the filtering window through multiple sorts to obtain the median filtering output pixel value of the filtering window.
10. An electronic device, characterized in that, Comprising: One or more processors; Wherein, the electronic device is configured to execute the image median filtering method according to any one of claims 1-8.
11. A chip, characterized in that, Comprising: One or more processors; An image sensor, configured to scan an original image in a raster scan manner; A line buffer, configured to cache the pixel data output by the image sensor, wherein the line buffer includes 4 blocks of single-port static random access memories (SRAMs), and each block of the single-port SRAM is used to store 1 row of pixel data; Wherein, the chip is configured to execute the image median filtering method according to any one of claims 1-8.
12. A storage medium, wherein the storage medium stores instructions, characterized in that, When the instruction runs on the electronic device, the electronic device is caused to execute the image median filtering method according to any one of claims 1-8.