Image processing method and image processing device
By calculating the sum of pixel values between filtered cores in image processing and updating the pixel values, the problems of waste and low efficiency of computing resources in the prior art are solved, and more efficient image processing is achieved.
Patent Information
- Application Number
- CN202411822007.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-11
- Publication Date
- 2025-04-18
AI Technical Summary
Existing image processing methods are seriously wasted computing resources when removing noise, and their computing efficiency and image processing efficiency are low.
By obtaining the pixel values of each pixel point of the image to be processed, the sum of pixel values of the two regions is calculated based on the newly added area of the second filter core relative to the first filter core during the processing, and the pixel values are updated to improve image quality and calculation efficiency.
The calculation amount of the sum of pixel values of the newly added area is greatly reduced, the calculation efficiency and image processing efficiency are improved, and the calculation logic is universal.
Smart Images

Figure CN119850455A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of image processing technology, and in particular, relates to an image processing method and an image processing device. Background Art
[0002] There is often noise in the image, and the image needs to be filtered to remove the noise in the image. In the related art, the pixel values in the filter kernel are accumulated one by one, and the accumulated sum is divided by the size of the filter kernel. Based on the calculated value, the image with noise is filtered. However, the above image processing method greatly wastes computing resources, has low computing efficiency, and low image processing efficiency. Summary of the invention
[0003] The present application aims to solve at least one of the technical problems existing in the related art. To this end, the present application proposes an image processing method and an image processing device to improve image quality, improve computing efficiency, and have universal computing logic.
[0004] In a first aspect, the present application provides an image processing method, the method comprising:
[0005] Obtain the pixel position and pixel value corresponding to each pixel point in the image to be processed;
[0006] Moving a first filter kernel corresponding to a first pixel point in the image to be processed based on a first moving direction and a target step size to obtain a second filter kernel corresponding to a second pixel point in the image to be processed;
[0007] Based on the pixel value of the pixel point at the first position in the image to be processed and the pixel value of the pixel point at the second position, the sum of the pixel values corresponding to the area newly added by the second filter kernel relative to the first filter kernel is calculated; the first position is the pixel point within the first target step length along the second moving direction outside the newly added area, and the second position is the pixel point within the last target step length along the second moving direction within the newly added area; the second moving direction is perpendicular to the first moving direction;
[0008] Update the pixel value of the second pixel point based on the sum of pixel values corresponding to the newly added area, the sum of pixel values corresponding to the first filter kernel, and the sum of pixel values corresponding to the area reduced by the second filter kernel relative to the first filter kernel.
[0009] According to the image processing method of the present application, by obtaining the pixel value of each pixel point of the image to be processed, in the process of processing each pixel point, based on the area newly added by the second filter kernel to be processed relative to the first filter kernel, the pixel value of the two calculated sums of the pixel values corresponding to the newly added areas is determined, the sum of the pixel values corresponding to the newly added areas can be calculated by the two pixel values, and based on the sum of the pixel values corresponding to the newly added areas, the pixel value of the second pixel point is updated, thereby improving the image quality, greatly reducing the amount of calculation of the sum of the pixel values corresponding to the newly added areas, improving the calculation efficiency, and the calculation logic is universal.
[0010] According to the image processing method of the present application, the step of calculating the sum of pixel values corresponding to the area newly added by the second filter kernel relative to the first filter kernel based on the pixel value of the pixel point at the first position in the image to be processed and the pixel value of the pixel point at the second position includes:
[0011] Performing a difference operation on the pixel value of the pixel point at the first position and the pixel value of the pixel point at the second position to obtain a first difference;
[0012] An addition operation is performed on the first difference and the sum of the pixel values corresponding to the first area to obtain the sum of the pixel values corresponding to the newly added area of the second filter kernel relative to the first filter kernel; the first area is the area corresponding to the target step length moved forward by the newly added area along the second moving direction.
[0013] According to the image processing method of the present application, updating the pixel value of the second pixel point based on the sum of pixel values corresponding to the newly added area, the sum of pixel values corresponding to the first filter kernel, and the sum of pixel values corresponding to the area reduced by the second filter kernel relative to the first filter kernel includes:
[0014] Performing a difference operation on the sum of pixel values corresponding to the area reduced by the second filter kernel relative to the first filter kernel and the sum of pixel values corresponding to the newly added area to obtain a second difference;
[0015] performing an addition operation on the second difference and the sum of pixel values corresponding to the first filter kernel to obtain the sum of pixel values corresponding to the second filter kernel;
[0016] Based on the sum of pixel values corresponding to the second filter kernel, the pixel value of the second pixel point is updated.
[0017] According to the image processing method of the present application, updating the pixel value of the second pixel point based on the sum of pixel values corresponding to the second filter kernel includes:
[0018] Obtaining the size of the second filter kernel;
[0019] Performing a division operation on the sum of pixel values corresponding to the second filter kernel and the size of the second filter kernel to obtain the target pixel value;
[0020] The target pixel value is assigned to the second pixel point to update the pixel value of the second pixel point.
[0021] According to the image processing method of the present application, after updating the pixel value of the second pixel point based on the sum of pixel values corresponding to the newly added area, the sum of pixel values corresponding to the first filter kernel, and the sum of pixel values corresponding to the area reduced by the second filter kernel relative to the first filter kernel, the method further includes:
[0022] Updating the second pixel point to a new first pixel point, and obtaining a new second pixel point based on the first moving direction and the target step size;
[0023] When the new second pixel point is the last pixel point of the second pixel point in the to-be-processed image along the first moving direction, fill the pixel values in the third filter kernel corresponding to the new second pixel point, and calculate the sum of the pixel values corresponding to the filled third filter kernel based on the pixel values in the filled third filter kernel;
[0024] Based on the sum of pixel values corresponding to the filled third filter kernel, the pixel value of the new second pixel point is updated.
[0025] According to the image processing method of the present application, after updating the pixel value of the second pixel point based on the sum of pixel values corresponding to the newly added area, the sum of pixel values corresponding to the first filter kernel, and the sum of pixel values corresponding to the area reduced by the second filter kernel relative to the first filter kernel, the method further includes:
[0026] When the second pixel point is the last pixel point of the second pixel point along the first moving direction in the image to be processed;
[0027] Moving the second filter kernel corresponding to the second pixel point in the image to be processed based on the second moving direction and the target step size to obtain a new second pixel point and a fourth filter kernel corresponding to the new second pixel point;
[0028] Based on the fourth filter kernel corresponding to the new second pixel point, the pixel value of the new second pixel point is updated.
[0029] In a second aspect, the present application provides an image processing device, the device comprising:
[0030] The first processing module is used to obtain the pixel position and pixel value corresponding to each pixel point in the image to be processed;
[0031] A second processing module, used for moving the first filter kernel corresponding to the first pixel point in the image to be processed based on the first moving direction and the target step length, to obtain a second filter kernel corresponding to the second pixel point in the image to be processed;
[0032] A third processing module is used to calculate the sum of pixel values corresponding to the area newly added by the second filter kernel relative to the first filter kernel based on the pixel value of the pixel point at the first position in the image to be processed and the pixel value of the pixel point at the second position; the first position is the pixel point within the first target step length along the second moving direction outside the newly added area, and the second position is the pixel point within the last target step length along the second moving direction within the newly added area; the second moving direction is perpendicular to the first moving direction;
[0033] The fourth processing module is used to update the pixel value of the second pixel point based on the sum of pixel values corresponding to the newly added area, the sum of pixel values corresponding to the first filter kernel, and the sum of pixel values corresponding to the area reduced by the second filter kernel relative to the first filter kernel.
[0034] According to the image processing device of the present application, by acquiring the pixel value of each pixel point of the image to be processed, in the process of processing each pixel point, based on the area newly added by the second filter kernel to be processed relative to the first filter kernel, the pixel value of the two calculated sums of the pixel values corresponding to the newly added areas is determined, the sum of the pixel values corresponding to the newly added areas can be calculated by the two pixel values, and based on the sum of the pixel values corresponding to the newly added areas, the pixel value of the second pixel point is updated, thereby improving the image quality, greatly reducing the amount of calculation of the sum of the pixel values corresponding to the newly added areas, improving the calculation efficiency, and the calculation logic is universal.
[0035] 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 the image processing method as described in the first aspect above when executing the computer program.
[0036] In a fourth aspect, the present application provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the image processing method as described in the first aspect above.
[0037] In a fifth aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the image processing method as described in the first aspect above.
[0038] The above one or more technical solutions in the embodiments of the present application have at least one of the following technical effects:
[0039] By acquiring the pixel value of each pixel point of the image to be processed, in the process of processing each pixel point, based on the area newly added by the second filter kernel to be processed relative to the first filter kernel, the pixel value of the two calculated sums of the pixel values corresponding to the newly added areas is determined, the sum of the pixel values corresponding to the newly added areas can be calculated through the two pixel values, and based on the sum of the pixel values corresponding to the newly added areas, the pixel value of the second pixel point is updated, thereby improving the image quality, greatly reducing the amount of calculation of the sum of the pixel values corresponding to the newly added areas, improving the calculation efficiency, and the calculation logic is universal.
[0040] Furthermore, by calculating the second difference between the sum of pixel values of the newly added area and the sum of pixel values of the reduced area, the transformation of the sum of pixel values of the newly added area relative to the sum of pixel values of the reduced area is effectively determined, and the second difference and the sum of pixel values corresponding to the first filter kernel are added to obtain the sum of pixel values corresponding to the second filter kernel. The sum of pixel values corresponding to the second filter kernel is calculated by incremental updating, effectively reducing the amount of calculation of the sum of pixel values corresponding to the second filter kernel.
[0041] Furthermore, by performing a division operation on the sum of the pixel values corresponding to the second filter kernel and the size of the second filter kernel, the mean of the second filter kernel, that is, the target pixel value, is obtained, and the target pixel value is assigned to the second pixel point, the pixel value of the second pixel point is updated, and the second pixel point is subjected to mean filtering to effectively remove the noise of the second pixel point and improve the image quality.
[0042] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0044] Figure 1 This is one of the flowcharts of the image processing method provided in the embodiment of the present application;
[0045] Figure 2 This is the second flowchart of the image processing method provided in the embodiment of the present application;
[0046] Figure 3 is a structural schematic diagram of an image processing device provided in an embodiment of the present application;
[0047] Figure 4 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0048] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0049] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0050] The image processing method, image processing device, electronic device and readable storage medium provided by the embodiments of the present application are described in detail below with reference to the accompanying drawings through specific embodiments and their application scenarios.
[0051] The image processing method may be applied to a terminal, and may be specifically executed by hardware or software in the terminal.
[0052] The terminal includes but is not limited to portable communication devices such as mobile phones or tablet computers. It should also be understood that in some embodiments, the terminal may not be a portable communication device, but a desktop computer.
[0053] In the following various embodiments, a terminal including a display and a touch-sensitive surface is described. However, it should be understood that the terminal may include one or more other physical user interface devices such as a physical keyboard, a mouse and a joystick.
[0054] The image processing method provided in the embodiment of the present application may be executed by an electronic device or a functional module or functional entity in the electronic device that can implement the image processing method. The electronic devices mentioned in the embodiment of the present application include but are not limited to mobile phones, tablet computers, computers, cameras, and wearable devices. The image processing method provided in the embodiment of the present application is described below using the electronic device as an example of the execution subject.
[0055] like Figure 1 As shown, the image processing method includes: step 110, step 120, step 130 and step 140.
[0056] Step 110, obtaining the pixel position and pixel value corresponding to each pixel point in the image to be processed;
[0057] In this step, the image to be processed is an image that needs to remove noise or enhance features.
[0058] In the actual execution process, the image to be processed can be acquired through devices such as image sensors or mobile terminals.
[0059] Of course, the image to be processed may also be acquired through any other feasible method, which is not limited in this application.
[0060] The pixel position is the coordinate of each pixel in the image to be processed.
[0061] In actual implementation, the pixel position may be represented by an abscissa (ie, a horizontal direction) and a ordinate (ie, a direction perpendicular to the horizontal direction).
[0062] For example, in an image with a length of 240 and a width of 160, the pixel position of the upper left pixel is usually (0, 0), and the pixel position coordinates of the lower right pixel are usually (239, 159).
[0063] The pixel value is a numerical value that represents information such as brightness and color at the pixel position corresponding to each pixel point.
[0064] In the actual execution process, after the image to be processed is obtained, the pixel position and pixel value corresponding to each pixel point in the image to be processed can be obtained through image processing software or an image processing library.
[0065] Of course, in the actual execution process, the pixel position and pixel value corresponding to each pixel point in the image to be processed may also be obtained by any other feasible method.
[0066] In some embodiments, after obtaining the pixel position and pixel value corresponding to each pixel point in the image to be processed, the pixel position and pixel value corresponding to each pixel point can be stored in a register, such as a double data rate synchronous dynamic random access memory (DDR), so as to subsequently process the image to be processed based on the stored pixel value.
[0067] Step 120, moving the first filter kernel corresponding to the first pixel point in the image to be processed based on the first moving direction and the target step length to obtain the second filter kernel corresponding to the second pixel point in the image to be processed;
[0068] In this step, the first pixel point is any pixel point in the image to be processed.
[0069] The first filter kernel is a filter kernel that processes the pixel value of the first pixel point.
[0070] The first filter kernel is determined based on the pixel position of the first pixel and the target filter kernel size.
[0071] The specific value of the target filter kernel size can be based on user customization or actual conditions. For example, the target filter kernel size is 5×5 or 8×4, which is not limited in this application.
[0072] It should be noted that the pixel value of the first pixel has been processed based on the first filter kernel.
[0073] The first moving direction is a preset moving direction.
[0074] The first moving direction may be a horizontal direction or a direction perpendicular to the horizontal direction.
[0075] The specific direction of the first moving direction can be determined based on actual implementation conditions and is not limited in this application.
[0076] The target step size is the preset moving pixel step size.
[0077] The specific value of the target step size can be user-defined or determined based on actual conditions. For example, the target step size can be 1 pixel position or 2 pixel positions, which is not limited in this application.
[0078] The second pixel point is a pixel point that needs to be processed.
[0079] The second filter kernel is a filter kernel for processing the pixel value of the second pixel point.
[0080] The second filter kernel is determined based on the pixel position of the second pixel point and the target filter kernel size.
[0081] It should be noted that, in the actual execution process, the image to be identified includes multiple pixels, and the pixel values of the pixel positions corresponding to the pixels to be processed among the pixels may be processed sequentially based on the first moving direction.
[0082] For example, when all pixels in the image to be identified need to be processed, the image can be moved based on the first moving direction with a target step length of 1 pixel position to sequentially process the pixel values of each pixel.
[0083] For another example, when part of each pixel in the image to be identified needs to be processed, the part of the pixels can be processed sequentially by moving based on the first moving direction with a target step length of 2 pixel positions or 3 pixel positions.
[0084] like Figure 2As shown, in the actual execution process, taking the pixel position of the first pixel point as (3, 6), the first filter kernel size as 8×4, the first moving direction as the horizontal direction, and the target step size as 1 pixel position as an example, the first filter kernel is the pixel values of each pixel point corresponding to the pixel position (2, 3) to the pixel position (5, 10), and the first filter kernel is obtained.
[0085] The first filter kernel is moved horizontally by one pixel position to obtain the pixel position of the second pixel point as (4, 6), and the second filter kernel, i.e., the pixel values of each pixel point corresponding to the pixel position (3, 3) to the pixel position (6, 10), is obtained.
[0086] Step 130: Based on the pixel value of the pixel point at the first position and the pixel value of the pixel point at the second position in the image to be processed, calculate the sum of the pixel values corresponding to the area newly added by the second filter kernel relative to the first filter kernel;
[0087] In this step, the first position is a pixel point outside the newly added area within the front target step length along the second moving direction.
[0088] It should be noted that the pixel value of the pixel point at the first position has participated in the calculation process of the correlation filter kernel during the image processing.
[0089] The newly added area is the area where the sum of pixel values is not calculated.
[0090] The second position is a pixel point within the last target step length along the second moving direction in the newly added area.
[0091] It should be noted that the pixel value of the pixel point at the second position has not yet participated in the calculation process of the relevant filter kernel during the image processing.
[0092] The second moving direction is perpendicular to the first moving direction.
[0093] When the first moving direction is a horizontal direction, the second moving direction is a direction perpendicular to the horizontal direction.
[0094] When the first moving direction is a direction perpendicular to the horizontal direction, the second moving direction is a horizontal direction.
[0095] The following description is made by taking an example where the first direction is a horizontal direction and the second direction is a direction perpendicular to the horizontal direction.
[0096] Continue to refer Figure 2 , taking the pixel position of the first pixel as (3, 6), the pixel position of the second pixel as (4, 6), and the target step size as 1 as an example, the newly added area is the area corresponding to the pixel positions (6, 3) to (6, 10).
[0097] The pixel position of the pixel point at the first pixel position outside the area corresponding to the newly added area (6, 3) to (6, 10) is (6, 2), that is, the first position is (6, 2).
[0098] The pixel position of the last pixel position in the vertical direction in the area corresponding to the newly added area (6, 3) to (6, 10) is (6, 10), that is, the second position is (6, 10).
[0099] In the actual implementation process, after determining the second pixel point and the second filter kernel, the second filter kernel can be compared with the first filter kernel to obtain a newly added area, thereby determining the adjacent pixel value of the first moving direction that has been processed outside the second filter kernel based on the location of the newly added area and the second moving direction (i.e., Figure 2 The pixel value of the second row shown in FIG. 1 ) and the pixel value of the first moving direction having the shortest storage time relative to the pixel values of the other first moving directions in the second filter kernel (ie, as shown in FIG. 1 ). Figure 2 The first position and the second position are determined from the second and tenth rows, and the sum of the pixel values corresponding to the newly added area is calculated through the pixel value of the first position and the pixel value of the second position.
[0100] Step 140: Update the pixel value of the second pixel based on the sum of pixel values corresponding to the newly added area, the sum of pixel values corresponding to the first filter kernel, and the sum of pixel values corresponding to the area reduced by the second filter kernel relative to the first filter kernel.
[0101] In this step, the reduced area is the area in the first filter kernel where the sum of pixel values has been calculated.
[0102] The sum of the pixel values corresponding to the reduced area has been calculated and stored in the previous process of moving the filter kernel.
[0103] The sum of the pixel values corresponding to the first filter kernel is the sum of the pixel values in the first filter kernel.
[0104] The sum of pixel values corresponding to the first filter kernel has been calculated and stored in the previous process of moving the filter kernel.
[0105] During the actual execution process, after obtaining the sum of pixel values corresponding to the newly added area, the sum of pixel values corresponding to the area reduced by the second filter kernel relative to the first filter kernel, and the sum of pixel values corresponding to the first filter kernel, corresponding operations can be performed based on the correlation between the sum of pixel values corresponding to the newly added area, the sum of pixel values corresponding to the area reduced by the second filter kernel relative to the first filter kernel, and the sum of pixel values corresponding to the first filter kernel to process the second filter kernel, and assign the processing result of the second filter kernel to the second pixel point to update the pixel value of the second pixel point.
[0106] When processing the entire image to be processed, it is only necessary to completely calculate once the sum of each pixel point in the filter kernel corresponding to the starting pixel point in the image to be processed. The calculation after the starting pixel point only needs to continue to update based on the previous intermediate results involved, which has high calculation efficiency.
[0107] The inventors found in the research and development process that in the related art, the pixel values in the filter kernel are accumulated one by one, the accumulated sum is divided by the size of the filter kernel, and the image with noise is filtered based on the calculated value. However, the above image processing method greatly wastes computing resources and has low computing efficiency.
[0108] The inventors also found that in the process of incrementally processing each pixel point in an image, the related technology needs to add each pixel point of the newly added row or column to obtain the pixel sum of the newly added row or column, which has low calculation efficiency.
[0109] In addition, the inventors also found that the image processing method based on the related technology is encoded in a field programmable gate array to perform image processing, and the size of the filter kernel involved cannot be changed, and the usability is poor.
[0110] The present application obtains detailed data of the image to be processed by acquiring the pixel position and pixel value corresponding to each pixel point of the image to be processed; and in the process of image processing, based on the first moving direction and the target step size, moves the first filter kernel corresponding to the first pixel point, accurately determines the next pixel point to be processed, that is, obtains the second pixel point, and clarifies the processing order of each pixel point; by comparing the first filter kernel and the second filter kernel, determines the pixel points included in the newly added area, and through the newly added area, determines the position of the two calculated pixel value sums corresponding to the newly added area, and the sum of the pixel values corresponding to the newly added area can be calculated by the two pixel values, which greatly reduces the amount of calculation of the sum of the pixel values corresponding to the newly added area and improves the calculation efficiency. Based on the sum of the pixel values corresponding to the newly added area, the sum of the pixel values corresponding to the first filter kernel and the sum of the pixel values corresponding to the reduced area, the pixel value of the second pixel point is updated to improve the image quality. In addition, the calculation logic can be applied to the calculation of the sum of pixel values of different filter kernel sizes, and has universality, thereby improving the image processing efficiency.
[0111] According to the image processing method provided by the embodiment of the present application, by obtaining the pixel value of each pixel point of the image to be processed, in the process of processing each pixel point, based on the area newly added by the second filter kernel to be processed relative to the first filter kernel, the pixel value of the two calculated sums of the pixel values corresponding to the newly added areas is determined, the sum of the pixel values corresponding to the newly added areas can be calculated by the two pixel values, and based on the sum of the pixel values corresponding to the newly added areas, the pixel value of the second pixel point is updated, thereby improving the image quality, greatly reducing the amount of calculation of the sum of the pixel values corresponding to the newly added areas, improving the calculation efficiency, and the calculation logic is universal.
[0112] In some embodiments, step 130 may further include:
[0113] Performing a difference operation on a pixel value of a pixel point at a first position and a pixel value of a pixel point at a second position to obtain a first difference;
[0114] An addition operation is performed on the first difference and the sum of the pixel values corresponding to the first area to obtain the sum of the pixel values corresponding to the area newly added by the second filter kernel relative to the first filter kernel.
[0115] In this step, the first difference value is used to represent the difference between the pixel value of the pixel point at the second position and the pixel value of the pixel point at the first position.
[0116] The first area is an area corresponding to a target step length moved forward by the newly added area along the second moving direction.
[0117] Continue to refer Figure 2 , taking the newly added area as the area corresponding to pixel positions (6, 3) to (6, 10) and the target step size as 1 pixel position as an example, the newly added area is moved forward one pixel position in a direction perpendicular to the horizontal direction, and the determined area is the area corresponding to pixel positions (6, 2) to (6, 9).
[0118] The pixel value of the pixel point at the first position is 9, and the pixel value of the pixel point at the second position is 17. The difference operation is performed on 9 and 17 to obtain a first difference value of -8, which indicates that the pixel value of the newly added area is increased by 8 compared to the pixel value of the first area. The first difference value is added to the total pixel value corresponding to the first area, 100, to obtain the total pixel value corresponding to the newly added area, 108.
[0119] It should be noted that, in the process of sequentially processing the pixel points at each pixel position in the image to be processed, the sum of the pixel values corresponding to the first area has been calculated, and the calculation result can be stored in the corresponding register for use in subsequent calculation processes.
[0120] In the actual implementation process, based on the above image processing process, corresponding logic codes can be written in the field programmable gate array to perform image processing, and the sum of pixel values of the corresponding area calculated during the image processing process can be stored in the block random access memory.
[0121] like Figure 2 As shown, the pixel word sum of the processed area, namely the local column sum, can be stored in a block random access memory (Block Random Access Memory, BRAM).
[0122] It should be noted that the local column sums stored in the BRAM, 60, 68, 76, 84, 92 and 100 are respectively the local column sums of pixel positions (0, 3) to (0, 10), the local column sums of (1, 3) to (1, 10), the local column sums of (2, 3) to (2, 10), the local column sums of (3, 3) to (3, 10), the local column sums of (4, 3) to (4, 10), the local column sums of (5, 3) to (5, 10), the local column sums of (6, 2) to (6, 9), the local column sums of (7, 2) to (7, 9), and the local column sums of (8, 2) to (8, 9).
[0123] According to the image processing method provided in the embodiment of the application itself, by performing a difference operation on the pixel value of the pixel point at the first position and the pixel value of the pixel point at the second position, the change of the sum of the pixel values of the newly added area relative to the sum of the pixel values of the first area is effectively determined, and the change is added to the sum of the pixel values corresponding to the first area that has been obtained. The sum of the pixel values corresponding to the newly added area can be obtained. Only two operations are required, and there is no need to add the pixel values of the newly added area. The amount of calculation of the sum of the pixel values corresponding to the newly added area is effectively reduced, the calculation efficiency is improved, and the calculation resources are saved.
[0124] In some embodiments, step 140 may further include:
[0125] Performing a difference operation on the sum of pixel values corresponding to the area reduced by the second filter kernel relative to the first filter kernel and the sum of pixel values corresponding to the newly added area to obtain a second difference;
[0126] Performing an addition operation on the second difference and the sum of the pixel values corresponding to the first filter kernel to obtain the sum of the pixel values corresponding to the second filter kernel;
[0127] Based on the sum of the pixel values corresponding to the second filter kernel, the pixel value of the second pixel is updated.
[0128] In this embodiment, the second difference value is used to characterize the difference between the sum of pixel values corresponding to the reduced area and the sum of pixel values corresponding to the newly added area.
[0129] The sum of the pixel values corresponding to the second filter kernel is the sum of the pixel values in the second filter kernel.
[0130] Continue to refer Figure 2 Taking the sum of pixel values corresponding to the newly added area as 108 and the sum of pixel values corresponding to the reduced area as 76 as an example, a difference operation is performed on 76 and 108 to obtain a second difference value of -32, which indicates that the sum of pixel values of the newly added area is increased by 32 compared with the sum of pixel values of the reduced area. The second difference value is added to the sum of pixel values 356 corresponding to the first filter kernel to obtain the sum of pixel values 388 corresponding to the second filter kernel.
[0131] It should be noted that, in the process of sequentially processing the pixel points at each pixel position in the image to be processed, the sum of the pixel values corresponding to the first filter kernel has been calculated, and the sum of the pixel values corresponding to the first filter kernel can be stored in a register.
[0132] like Figure 2 As shown, in the process of calculating based on the sum of pixel values corresponding to the newly added area and the sum of pixel values corresponding to the reduced area, the sum of pixel values corresponding to the newly added area, the sum of pixel values of each area between the newly added area and the reduced area, and the sum of pixel values corresponding to the reduced area can be saved in the REG register, the sum of pixel values corresponding to the newly added area is shifted and cached, the sum of pixel values corresponding to the newly added area is moved into the REG register, and the sum of pixel values corresponding to the reduced area is deleted from the REG register.
[0133] In the process of calculating the sum of pixel values corresponding to the second filter kernel, the sum of pixel values corresponding to the reduced area is subtracted from the sum of pixel values corresponding to the first filter kernel, and the sum of pixel values corresponding to the newly added area is added.
[0134] During the actual execution process, after obtaining the sum of pixel values corresponding to the second filter kernel, the pixel value of the second pixel point can be processed based on the sum of pixel values corresponding to the second filter kernel, such as updating the pixel value of the second pixel point based on the sum of pixel values corresponding to the second filter kernel and data such as the corresponding weight of the second pixel point.
[0135] According to the image processing method provided by the embodiment of the present application, by calculating the second difference between the sum of pixel values of the newly added area and the sum of pixel values of the reduced area, the transformation of the sum of pixel values of the newly added area relative to the sum of pixel values of the reduced area is effectively determined, and the second difference and the sum of pixel values corresponding to the first filter kernel are added to obtain the sum of pixel values corresponding to the second filter kernel. The sum of pixel values corresponding to the second filter kernel is calculated by incremental updating, effectively reducing the amount of calculation of the sum of pixel values corresponding to the second filter kernel.
[0136] In some embodiments, updating the pixel value of the second pixel point based on the sum of the pixel values corresponding to the second filter kernel may also include:
[0137] Get the size of the second filter kernel;
[0138] Performing a division operation on the sum of pixel values corresponding to the second filter kernel and the size of the second filter kernel to obtain a target pixel value;
[0139] The target pixel value is assigned to the second pixel point to update the pixel value of the second pixel point.
[0140] In this embodiment, the size of the second filter kernel is the number of pixels included in the second filter kernel.
[0141] The target pixel value is a new pixel value that the user replaces the original pixel value of the second pixel point.
[0142] For example, the second filter kernel includes 9 pixel points, and the size of the second filter kernel is 9. For another example, the second filter kernel includes 32 pixel points, and the size of the second filter kernel is 32.
[0143] Continue to refer Figure 2 Taking the size of the second filter kernel as 32 as an example, the sum of the pixel values corresponding to the second filter kernel 388 and the size of the second filter kernel 32 are divided to obtain 12, which is the target pixel value.
[0144] It should be noted that when the sum of the pixel values corresponding to the filter kernel is not divisible by the size of the filter kernel, the target pixel value can be obtained by discarding the low bits.
[0145] In the actual execution process, after obtaining the target pixel value, the pixel value 11 of the second pixel point is replaced by 12, and the second pixel point is subjected to mean filtering.
[0146] According to the image processing method provided in the embodiment of the present application, by performing a division operation on the sum of pixel values corresponding to the second filter kernel and the size of the second filter kernel, the mean of the second filter kernel, that is, the target pixel value, is obtained, and the target pixel value is assigned to the second pixel point, the pixel value of the second pixel point is updated, and the second pixel point is mean filtered to effectively remove the noise of the second pixel point and improve the image quality.
[0147] In some embodiments, after step 140, the method may further include:
[0148] Updating the second pixel point to a new first pixel point, and obtaining a new second pixel point based on the first moving direction and the target step size;
[0149] When the new second pixel point is the last pixel point of the second pixel point in the to-be-processed image along the first moving direction, fill the pixel values in the third filter kernel corresponding to the new second pixel point, and calculate the sum of the pixel values corresponding to the filled third filter kernel based on the pixel values in the filled third filter kernel;
[0150] Based on the sum of the pixel values corresponding to the filled third filter kernel, the pixel value of the new second pixel point is updated.
[0151] In this embodiment, the new second pixel point is a pixel point on the boundary of the image to be processed.
[0152] The third filter kernel is a filter kernel for processing the pixel value of the new second pixel point.
[0153] The third filter kernel is determined based on the pixel position of the new second pixel point and the target filter kernel size.
[0154] Continue to refer Figure 2 In the actual execution process, after updating the pixel value of the second pixel point, that is, the pixel value of the pixel position (4, 6), the second pixel value can be used as the first pixel point, and the second pixel point is moved to a new pixel position, such as the pixel position (5, 6) based on the first moving direction and the target step size. At this time, the new second pixel point is the pixel point at the pixel position (4, 6), and the new second pixel point is processed, and so on.
[0155] When the new second pixel point is the pixel position (8, 6), the pixel point at this pixel position cannot completely fill the third filter kernel of size 4×6. At this time, the position where the third filter kernel lacks pixel values can be filled, such as filling based on the pixel value of the pixel position (8, 6), or giving a target value for expansion.
[0156] The target value is a preset pixel value.
[0157] The specific value of the target value can be based on user customization or determined based on actual conditions, and this application does not limit it.
[0158] Of course, in the actual implementation process, the third filter kernel corresponding to the last pixel point of the second pixel point along the first moving direction in the image to be processed may be filled in any other feasible manner.
[0159] It should be noted that the filter kernel corresponding to each pixel point located at the edge of the image to be identified can be filled in the above manner.
[0160] After obtaining the pixel value in the filled third filter kernel, the pixel value of the new second pixel point can be updated through step 130 and step 140, which will not be described here to avoid repetition.
[0161] According to the image recognition method provided by the embodiment of the present application, the first pixel point and the second pixel point are updated in real time after the pixel value of the second pixel point is updated, and the pixel positions that have not been processed in the image to be recognized are processed in sequence. When the new second pixel point is the last pixel point of the second pixel point along the first moving direction in the image to be processed, the third filter kernel of the new second pixel point is filled, and the new second pixel point is processed based on the pixel value in the filled third filter kernel, so as to effectively process the pixel points located at the edge of the image to be recognized and improve the image processing quality.
[0162] In some embodiments, after step 140, the method may further include:
[0163] When the second pixel point is the last pixel point of the second pixel point along the first moving direction in the image to be processed;
[0164] Moving the second filter kernel corresponding to the second pixel point in the image to be processed based on the second moving direction and the target step length to obtain a new second pixel point and a fourth filter kernel corresponding to the new second pixel point;
[0165] Based on the fourth filter kernel corresponding to the new second pixel point, the pixel value of the new second pixel point is updated.
[0166] In this embodiment, the new second pixel point is a pixel point which differs from the second pixel point by a target step length in the second moving direction and whose coordinate position in the first moving direction is 0.
[0167] The fourth filter kernel is a filter kernel for processing the pixel value of the new second pixel point.
[0168] During the actual execution process, after processing all the pixels in a certain area of the image to be processed, the second pixel can be moved along the second moving direction to obtain a new second pixel to be processed, based on the new second pixel and the fourth filter kernel corresponding to the new second pixel.
[0169] It should be noted that, when the new second pixel point is located at the edge of the image to be identified, the pixel value in the fourth filter kernel can be filled, and the pixel value of the new second pixel point is based on the filled fourth filter kernel.
[0170] Similarly, the pixel value of the new second pixel point can be processed by steps 130 and 140, which will not be described here to avoid repetition.
[0171] According to the image processing method provided in the embodiment of the present application, by determining that the second pixel point is the last pixel point of the second pixel point in the image to be processed along the first moving direction, on the basis of the first moving direction, the second filter kernel corresponding to the second pixel point is further moved based on the second moving direction, and the second filter kernel is updated to the new area to process the new second pixel point in the new area. The pixel points to be processed are updated through two moving directions, and the updating method is simple and easy to operate.
[0172] The image processing method provided in the embodiment of the present application can be executed by an image processing device. In the embodiment of the present application, an image processing device executing the image processing method is taken as an example to illustrate the image processing device provided in the embodiment of the present application.
[0173] The embodiment of the present application also provides an image processing device.
[0174] like Figure 3 As shown, the image processing device includes: a first processing module 310 , a second processing module 320 , a third processing module 330 and a fourth processing module 340 .
[0175] The first processing module 310 is used to obtain the pixel position and pixel value corresponding to each pixel point in the image to be processed;
[0176] The second processing module 320 is used to move the first filter kernel corresponding to the first pixel point in the image to be processed based on the first moving direction and the target step size to obtain the second filter kernel corresponding to the second pixel point in the image to be processed;
[0177] The third processing module 330 is used to calculate the sum of pixel values corresponding to the area newly added by the second filter kernel relative to the first filter kernel based on the pixel value of the pixel point at the first position in the image to be processed and the pixel value of the pixel point at the second position; the first position is the pixel point within the first target step length along the second moving direction outside the newly added area, and the second position is the pixel point within the last target step length along the second moving direction within the newly added area; the second moving direction is perpendicular to the first moving direction;
[0178] The fourth processing module 340 is used to update the pixel value of the second pixel point based on the sum of pixel values corresponding to the newly added area, the sum of pixel values corresponding to the first filter kernel, and the sum of pixel values corresponding to the area reduced by the second filter kernel relative to the first filter kernel.
[0179] According to the image processing device provided by the embodiment of the present application, by obtaining the pixel value of each pixel point of the image to be processed, in the process of processing each pixel point, based on the area newly added by the second filter kernel to be processed relative to the first filter kernel, the pixel value of the two calculated sums of the pixel values corresponding to the newly added areas is determined, the sum of the pixel values corresponding to the newly added areas can be calculated by the two pixel values, and based on the sum of the pixel values corresponding to the newly added areas, the pixel value of the second pixel point is updated, thereby improving the image quality, greatly reducing the amount of calculation of the sum of the pixel values corresponding to the newly added areas, improving the calculation efficiency, and the calculation logic is universal.
[0180] In some embodiments, the third processing module 330 may also be used to:
[0181] Performing a difference operation on a pixel value of a pixel point at a first position and a pixel value of a pixel point at a second position to obtain a first difference;
[0182] An addition operation is performed on the first difference and the sum of the pixel values corresponding to the first area to calculate the sum of the pixel values corresponding to the area newly added by the second filter kernel relative to the first filter kernel; the first area is the area corresponding to a target step length moved forward along the second moving direction by the newly added area.
[0183] In some embodiments, the fourth processing module 340 may also be used to:
[0184] Performing a difference operation on the sum of pixel values corresponding to the area reduced by the second filter kernel relative to the first filter kernel and the sum of pixel values corresponding to the newly added area to obtain a second difference;
[0185] Performing an addition operation on the second difference and the sum of the pixel values corresponding to the first filter kernel to obtain the sum of the pixel values corresponding to the second filter kernel;
[0186] Based on the sum of the pixel values corresponding to the second filter kernel, the pixel value of the second pixel is updated.
[0187] In some embodiments, the fourth processing module 340 may also be used to:
[0188] Get the size of the second filter kernel;
[0189] Performing a division operation on the sum of pixel values corresponding to the second filter kernel and the size of the second filter kernel to obtain a target pixel value;
[0190] The target pixel value is assigned to the second pixel point to update the pixel value of the second pixel point.
[0191] In some embodiments, the apparatus may further include a fifth processing module, configured to:
[0192] Updating the second pixel point to a new first pixel point, and obtaining a new second pixel point based on the first moving direction and the target step size;
[0193] When the new second pixel point is the last pixel point of the second pixel point in the to-be-processed image along the first moving direction, fill the pixel values in the third filter kernel corresponding to the new second pixel point, and calculate the sum of the pixel values corresponding to the filled third filter kernel based on the pixel values in the filled third filter kernel;
[0194] Based on the sum of the pixel values corresponding to the filled third filter kernel, the pixel value of the new second pixel point is updated.
[0195] In some embodiments, the apparatus may further include a sixth processing module, configured to:
[0196] When the second pixel point is the last pixel point of the second pixel point along the first moving direction in the image to be processed;
[0197] Moving the second filter kernel corresponding to the second pixel point in the image to be processed based on the second moving direction and the target step length to obtain a new second pixel point and a fourth filter kernel corresponding to the new second pixel point;
[0198] Based on the fourth filter kernel corresponding to the new second pixel point, the pixel value of the new second pixel point is updated.
[0199] The image processing device in the embodiment of the present application can be an electronic device, or a component in the electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or other devices other than a terminal. Exemplarily, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (augmented reality, AR) / virtual reality (virtual reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0200] The image processing device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an IOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0201] The image processing device provided in the embodiment of the present application can achieve Figure 1 to Figure 2 To avoid repetition, the various processes implemented by the method embodiment are not described here.
[0202] In some embodiments, Figure 4 As shown, an embodiment of the present application also provides an electronic device 400, including a processor 401, a memory 402, and a computer program stored in the memory 402 and executable on the processor 401. When the program is executed by the processor 401, each process of the above-mentioned image processing method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0203] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.
[0204] An embodiment of the present application also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the above-mentioned image processing method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0205] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.
[0206] An embodiment of the present application also provides a computer program product, including a computer program, which implements the above-mentioned image processing method when executed by a processor.
[0207] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.
[0208] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned image processing method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0209] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0210] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0211] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the relevant technology, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0212] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
[0213] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials, or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0214] Although the embodiments of the present application have been shown and described, those skilled in the art will appreciate that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present application, and that the scope of the present application is defined by the claims and their equivalents.
Claims
1. An image processing method, characterized in that: include: Obtain the pixel position and pixel value corresponding to each pixel point in the image to be processed; Moving a first filter kernel corresponding to a first pixel point in the image to be processed based on a first moving direction and a target step size to obtain a second filter kernel corresponding to a second pixel point in the image to be processed; Based on the pixel value of the pixel point at the first position in the image to be processed and the pixel value of the pixel point at the second position, the sum of the pixel values corresponding to the area newly added by the second filter kernel relative to the first filter kernel is calculated; the first position is the pixel point within the first target step length along the second moving direction outside the newly added area, and the second position is the pixel point within the last target step length along the second moving direction within the newly added area; The second moving direction is perpendicular to the first moving direction; Update the pixel value of the second pixel point based on the sum of pixel values corresponding to the newly added area, the sum of pixel values corresponding to the first filter kernel, and the sum of pixel values corresponding to the area reduced by the second filter kernel relative to the first filter kernel.
2. The image processing method according to claim 1, characterized in that: The calculating, based on the pixel value of the pixel point at the first position in the image to be processed and the pixel value of the pixel point at the second position, the sum of the pixel values corresponding to the area newly added by the second filter kernel relative to the first filter kernel comprises: Performing a difference operation on the pixel value of the pixel point at the first position and the pixel value of the pixel point at the second position to obtain a first difference; An addition operation is performed on the first difference and the sum of the pixel values corresponding to the first area to obtain the sum of the pixel values corresponding to the newly added area of the second filter kernel relative to the first filter kernel; the first area is the area corresponding to the target step length moved forward by the newly added area along the second moving direction.
3. The image processing method according to claim 1, characterized in that: The updating the pixel value of the second pixel point based on the sum of pixel values corresponding to the newly added area, the sum of pixel values corresponding to the first filter kernel, and the sum of pixel values corresponding to the area reduced by the second filter kernel relative to the first filter kernel, comprises: Performing a difference operation on the sum of pixel values corresponding to the area reduced by the second filter kernel relative to the first filter kernel and the sum of pixel values corresponding to the newly added area to obtain a second difference; performing an addition operation on the second difference and the sum of pixel values corresponding to the first filter kernel to obtain the sum of pixel values corresponding to the second filter kernel; Based on the sum of pixel values corresponding to the second filter kernel, the pixel value of the second pixel is updated.
4. The image processing method according to claim 3, characterized in that: The updating the pixel value of the second pixel point based on the sum of the pixel values corresponding to the second filter kernel includes: Obtaining the size of the second filter kernel; Performing a division operation on the sum of pixel values corresponding to the second filter kernel and the size of the second filter kernel to obtain the target pixel value; The target pixel value is assigned to the second pixel point to update the pixel value of the second pixel point.
5. The image processing method according to any one of claims 1 to 4, characterized in that: After updating the pixel value of the second pixel point based on the sum of pixel values corresponding to the newly added area, the sum of pixel values corresponding to the first filter kernel, and the sum of pixel values corresponding to the area reduced by the second filter kernel relative to the first filter kernel, the method further includes: Updating the second pixel point to a new first pixel point, and obtaining a new second pixel point based on the first moving direction and the target step size; When the new second pixel point is the last pixel point of the second pixel point in the to-be-processed image along the first moving direction, fill the pixel values in the third filter kernel corresponding to the new second pixel point, and calculate the sum of the pixel values corresponding to the filled third filter kernel based on the pixel values in the filled third filter kernel; Based on the sum of pixel values corresponding to the filled third filter kernel, the pixel value of the new second pixel point is updated.
6. The image processing method according to any one of claims 1 to 4, characterized in that: After updating the pixel value of the second pixel point based on the sum of pixel values corresponding to the newly added area, the sum of pixel values corresponding to the first filter kernel, and the sum of pixel values corresponding to the area reduced by the second filter kernel relative to the first filter kernel, the method further includes: When the second pixel point is the last pixel point of the second pixel point along the first moving direction in the image to be processed; Moving the second filter kernel corresponding to the second pixel point in the image to be processed based on the second moving direction and the target step size to obtain a new second pixel point and a fourth filter kernel corresponding to the new second pixel point; Based on the fourth filter kernel corresponding to the new second pixel point, the pixel value of the new second pixel point is updated.
7. An image processing device, characterized in that: include: The first processing module is used to obtain the pixel position and pixel value corresponding to each pixel point in the image to be processed; A second processing module, used for moving the first filter kernel corresponding to the first pixel point in the image to be processed based on the first moving direction and the target step length, to obtain a second filter kernel corresponding to the second pixel point in the image to be processed; A third processing module is used to calculate the sum of pixel values corresponding to the area newly added by the second filter kernel relative to the first filter kernel based on the pixel value of the pixel point at the first position in the image to be processed and the pixel value of the pixel point at the second position; the first position is the pixel point within the first target step length along the second moving direction outside the newly added area, and the second position is the pixel point within the last target step length along the second moving direction within the newly added area; The second moving direction is perpendicular to the first moving direction; The fourth processing module is used to update the pixel value of the second pixel point based on the sum of pixel values corresponding to the newly added area, the sum of pixel values corresponding to the first filter kernel, and the sum of pixel values corresponding to the area reduced by the second filter kernel relative to the first filter kernel.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the image processing method according to any one of claims 1 to 6 is implemented.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the image processing method according to any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the image processing method according to any one of claims 1 to 6 is implemented.