Image processing method, device, apparatus and storage medium

By calculating the gradient matrix of the current frame and the background image, and using the pixel change amplitude to generate an image that matches the background content, the problem of light and color differences in blackboard videos in remote meetings or teaching is solved, and the harmonious integration of images is achieved.

CN116664464BActive Publication Date: 2026-01-06GUANGZHOU AVA ELECTRONICS TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310622666.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-29
Publication Date
2026-01-06
Estimated Expiration
2043-05-29

AI Technical Summary

Technical Problem

In remote meetings or teaching, when recording videos of whiteboard writing, the presenter may block the content, making it impossible to view the complete content. Furthermore, existing technologies may result in discordant images due to differences in lighting and color after merging.

Method used

By acquiring the target area image of the current frame and the background image, calculating the gradient matrix, and using the pixel change amplitude to replace the direct pixel value, an image that matches the background content and has a consistent color distribution is generated. Edge pixels are then fused to resolve differences in light color.

Benefits of technology

It achieves the goal of preserving the original content in the fused image while matching the color distribution with the current frame image, solving the problem of light color differences and improving the harmony of image fusion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116664464B_ABST
    Figure CN116664464B_ABST
Patent Text Reader

Abstract

This invention discloses an image processing method, apparatus, device, and storage medium. The method includes the following steps: acquiring an image of a target region in the current frame and an image of a target region in the background image; calculating the gradient matrix of the target region image in the current frame; calculating pixel changes using the first single-sided pixels of the target region image in the background image based on the changes in the gradient matrix, obtaining a first gradient pixel matrix; comparing the first gradient pixel matrix with the pixels of the target region image in the background image at a second single-sided position to obtain a comparison result; and generating a first image based on the first gradient pixel matrix when the comparison result is within a preset threshold range, using the first image as the fused output image. This invention solves the problem of light and color differences between the background image and the current frame image, preserving the original image content while ensuring that the brightness distribution of the processed image is similar to the target region position of the current frame image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the technical field of artificial intelligence visual recognition, and more specifically, to an image processing method, apparatus, device, and storage medium. Background Technology

[0002] Blackboard notes, written on whiteboards or blackboards for meetings, speeches, and teaching, are an important medium for information transmission. Participants, audiences, or students can better understand the information the speaker wants to convey by viewing the blackboard notes. Therefore, in remote meetings or teaching, videos of the blackboard notes are often recorded so that participants can see the speaker's notes. However, when recording blackboard notes, the speaker often obscures the content while explaining, preventing participants from seeing the entire blackboard.

[0003] In existing technologies, to address the issue of obscured whiteboard content in videos, a common approach is to synthesize multiple video frames to obtain an unobstructed background image containing the complete whiteboard content. Then, the presenter's target area is outlined within the current frame containing the presenter, and this target area is merged with the background image to obtain a target video frame that includes both the presenter and the whiteboard content. However, due to differences in lighting and color between the background image and the current frame image, issues such as… Figure 1 As shown, the merged speaker area looks very abrupt and discordant. Summary of the Invention

[0004] To overcome at least one deficiency in the prior art, the present invention provides an image processing method, a video switching method, an apparatus, a device, and a storage medium. To solve the above-mentioned technical problems, the technical solution adopted by the present invention is as follows.

[0005] In a first aspect, the present invention provides an image processing method, comprising:

[0006] The target region of the current frame and the target region of the background image are obtained, where the target region of the current frame and the target region of the background image are both obtained based on the position information of the target object.

[0007] Calculate the gradient matrix of the target region image in the current frame;

[0008] Based on the changes in the gradient matrix, the first gradient pixel matrix is ​​obtained by calculating the pixel changes using the first single-sided pixels of the target area image in the background.

[0009] By comparing the pixels of the first gradient pixel matrix with the pixels of the target area of ​​the background image at the second single-sided position, the comparison result is obtained.

[0010] When the comparison result is within a preset threshold range, a first image is generated based on the first gradient pixel matrix, and the first image is used as the fused output image.

[0011] In one implementation, it further includes:

[0012] When the comparison result is not within the preset threshold range, the second gradient pixel matrix is ​​obtained by calculating the pixel change using the second single-sided pixel of the target area image of the background image based on the change of the gradient matrix.

[0013] Merge the first gradient pixel matrix and the second gradient pixel matrix to obtain the merged pixel matrix;

[0014] A second image is generated based on the merged pixel matrix, and the second image is used as the fused output image.

[0015] In one embodiment, the gradient matrix includes: an x-gradient matrix in the x-direction and a y-gradient matrix in the y-direction;

[0016] The first single side includes: a first vertical single side and a first horizontal single side;

[0017] The process of calculating the pixel change of the first gradient pixel matrix by using the first single-sided pixel of the target region of the background image based on the change of the gradient matrix includes:

[0018] Based on the changes in the x-gradient matrix, the pixel changes are calculated using the first vertical single-sided pixels of the target area image in the background image, resulting in the first gradient x-pixel matrix.

[0019] Based on the changes in the y-gradient matrix, the pixel changes are calculated using the first horizontal single-sided pixels of the target area image in the background to obtain the first gradient y-pixel matrix.

[0020] In one embodiment, the second single side includes: a second vertical single side and a second horizontal single side;

[0021] The process of comparing the first gradient pixel matrix with the pixels of the target region of the background image at the second unilateral position to obtain the comparison result includes:

[0022] By comparing the first gradient x pixel matrix with the pixels of the target area of ​​the background image at the second vertical single-sided position, the x comparison result is obtained.

[0023] By comparing the first gradient y-pixel matrix with the pixels of the target area of ​​the background image at the second horizontal single-sided position, the y-matching result is obtained.

[0024] In one implementation, the process of calculating pixel changes on the second single-sided pixels of the target region of the background image based on the change of the gradient matrix when the comparison result is not within a preset threshold range, to obtain the second gradient pixel matrix, includes:

[0025] When the x-matching result is not within the preset threshold range, the second gradient x-pixel matrix is ​​obtained by calculating the pixel change using the second vertical single-sided pixel of the target area image of the background image based on the change of the x-gradient matrix.

[0026] When the y-matching result is not within the preset threshold range, the second gradient y-pixel matrix is ​​obtained by calculating the pixel change using the second horizontal single-sided pixel of the target area image in the background image based on the change of the y-gradient matrix.

[0027] In one implementation, the process of generating an image based on a gradient pixel matrix includes:

[0028] The x-pixel matrix and y-pixel matrix are fused, and the values ​​are normalized, with the range restricted to [0, 255], to obtain the fused image.

[0029] In one embodiment, the first vertical single side is the leftmost column or the rightmost column;

[0030] The first horizontal line is either the top row or the bottom row;

[0031] The second vertical single side is a column at the end opposite to the first vertical single side;

[0032] The second horizontal line is a row at the end opposite to the first horizontal line.

[0033] In a second aspect, the present invention provides an image processing apparatus, comprising:

[0034] The acquisition module is used to acquire images of the target area in the current frame and the target area in the background image. The target area in the current frame and the target area in the background image are both obtained based on the position information of the target object.

[0035] The calculation module is used to calculate the gradient matrix of the target region image in the current frame. Based on the change of the gradient matrix, the first single-sided pixel of the target region image in the background image is used to calculate the pixel change to obtain the first gradient pixel matrix.

[0036] The comparison module is used to compare the pixels of the first gradient pixel matrix with the pixels of the target area of ​​the background image at the second single-sided position to obtain the comparison result;

[0037] The output module is used to generate a first image based on the first gradient pixel matrix when the comparison result is within a preset threshold range, and to use the first image as the fused output image.

[0038] Thirdly, the present invention provides a computer device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method of any of the above embodiments.

[0039] Fourthly, the present invention provides a computer-readable storage medium having a computer program stored thereon, characterized in that the program, when executed by a processor, implements the method of any of the above embodiments.

[0040] This invention primarily utilizes the method of replacing direct pixel values ​​with pixel variation amplitude based on the obvious gradient changes of the blackboard content and the absence of excessive natural color interference. The pixels at the fusion edge are used to fit an image that conforms to both the background content and the color distribution based on the pixel variation amplitude, thereby solving the problem of light and color differences between the background image and the current frame image. This allows the current frame image to blend into the background image, making it more consistent with the color distribution while retaining the original image content. The brightness distribution of the processed image is similar to the target area position of the current frame image. Attached Figure Description

[0041] Figure 1 This is a schematic diagram illustrating a defect in the existing technology.

[0042] Figure 2 This is a flowchart illustrating Embodiment 1 of the present invention.

[0043] Figure 3 This is a schematic diagram of the overall structure of Embodiment 2 of the present invention. Detailed Implementation

[0044] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.

[0045] It should be noted that the terms "first, second, ..." used in the embodiments of the present invention are merely used to distinguish similar objects and do not represent a specific ordering of objects. It is understood that "first, second, ..." can be interchanged in a specific order or sequence where permissible. It should be understood that the objects distinguished by "first, second, ..." can be interchanged where appropriate so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein.

[0046] Example 1

[0047] Please see Figure 2 , Figure 2 This is a flowchart illustrating an image processing method according to Embodiment 1 of the present invention. The method includes steps S110, S120, S130, S140, and S150. It should be noted that steps S110, S120, S130, S140, and S150 are merely reference numerals used to clearly explain the embodiment and the accompanying drawings. Figure 2 The correspondence does not imply a limitation on the order of the method steps in this embodiment.

[0048] Step S110: Obtain the image of the target area in the current frame and the image of the target area in the background frame, wherein the target area in the current frame and the target area in the background frame are obtained based on the position information of the target object.

[0049] Step S120: Calculate the gradient matrix of the target region image in the current frame;

[0050] Step S130: Based on the change of the gradient matrix, the first gradient pixel matrix is ​​obtained by calculating the pixel change using the first single-sided pixel of the target area of ​​the background image.

[0051] Step S140: Compare the pixels of the first gradient pixel matrix with the pixels of the target area of ​​the background image at the second single-sided position to obtain the comparison result;

[0052] Step S150: When the comparison result is within a preset threshold range, a first image is generated based on the first gradient pixel matrix, and the first image is used as the output image.

[0053] It is understood that this method can be used in various scenarios where blackboard writing can be displayed, including but not limited to blackboards, whiteboards, multimedia display boards, smart blackboards, etc. However, for ease of explanation, this implementation method will be described using a classroom teaching scenario as an example, where the blackboard is the display board and the content on the blackboard is the teacher's handwritten content.

[0054] This method is used to process the target region before fusing the background image containing the complete blackboard content with the target region of the current image frame containing the speaker.

[0055] Typically, cameras used to film blackboard writing are relatively stationary and rarely move horizontally or vertically. Therefore, the position of the blackboard is the same in both the background image and the current frame captured by the camera. From this, we can infer that the virtual position of any obstruction (the target object) in the current frame captured by the camera should also be the same as its position in the current frame. Therefore, we can extract the target object's position information (Bbox_i) from the current frame. Using this Bbox_i, we can then obtain the image subI_i of the target area in the current frame corresponding to the target object's position information (Bbox_i) and the image subB_i of the target area in the corresponding background image.

[0056] Then, calculate the magnitude of the change in the target region image subI_i in the x and y directions in the current frame, obtain two directional change matrices G_x and G_y, and accumulate the directional change matrices along the corresponding directions to obtain the gradient matrices SigmaG_x and SigmaG_y of the two directional changes.

[0057] It should be noted that in step S120, the gradient matrices SigmaG_x and SigmaG_y accumulated from changes in both directions can be obtained as described above. Alternatively, depending on the actual needs, only SigmaG_x or SigmaG_y can be obtained. This method does not impose specific limitations, as long as the subsequent steps correspond. If there are gradient matrices SigmaG_x and SigmaG_y accumulated from changes in both directions, then the gradient matrix includes: the x-gradient matrix in the x-direction and the y-gradient matrix in the y-direction. If only SigmaG_x or SigmaG_y is obtained, then the gradient matrix includes only: the x-gradient matrix in the x-direction or the y-gradient matrix in the y-direction.

[0058] After obtaining the gradient matrix, the pixel change is calculated using the first single-sided pixel of the target region image in the current frame based on the change of the gradient matrix, and the first gradient pixel matrix is ​​obtained.

[0059] At this point, corresponding processing is required based on the gradient matrix obtained in step S120. If only SigmaG_x is obtained, then the first single side of the target area image of the background image contains only one vertical single side. Preferably, the leftmost column or the rightmost column is taken. Taking the leftmost column as an example, its reference pixels are broadcast and added to the gradient matrix SigmaG_x to obtain the first gradient pixel matrix F_x. If only SigmaG_y is obtained, then the first single side of the target area image of the background image contains only one horizontal single side. Preferably, the topmost row or the bottommost row is taken. Taking the topmost row as an example, its reference pixels are broadcast and added to the gradient matrix SigmaG_y to obtain the first gradient pixel matrix F_y. Of course, if both gradient matrices SigmaG_x and SigmaG_y are available, the first single side of the target area image in the background image includes: the first vertical single side and the first horizontal single side. Taking the leftmost column of the first vertical single side and the top row of the first horizontal single side as examples, we will broadcast and add the reference pixels of each to the gradient matrices SigmaG_x and SigmaG_y to obtain the first gradient pixel matrices F_x and F_y.

[0060] It should be noted that when taking the rightmost column and the bottommost row, a broadcast subtraction operation is required with the gradient matrix SigmaG_x and the gradient matrix SigmaG_y, respectively. If the selected column is not the outermost single edge, a broadcast addition or subtraction operation is required depending on the specific circumstances.

[0061] This method is suitable for background and current frame images that are essentially blackboard content, with significant gradient changes but minimal natural color interference. Furthermore, this method addresses color differences caused by lighting conditions. Therefore, the first gradient pixel matrix can be viewed as adding the current frame image's matrix to the target area of ​​the background image. Then, it needs to be compared with the original image before the addition to obtain the comparison results. Based on the comparison results, it can be determined whether there is a significant color difference between the two images due to lighting conditions.

[0062] Step S140 involves the comparison process. The same position is taken in the first gradient pixel matrix and the target region image, i.e., the position of the second single side. Preferably, the second single side is taken from the side opposite to the first single side. That is, if the first single side is the leftmost column, then the second single side is taken from the rightmost column; if the first single side is the top row, then the second single side is taken from the bottom row. If only the first gradient pixel matrix F_x is obtained, then the reference pixel v_right in the rightmost column of the corresponding background image region subB_i is taken, and the average difference between v_right and the rightmost column vector of the pixel matrix F_x is calculated as diff_xmean. If only the first gradient pixel matrix F_y is obtained, then the reference pixel v_bottom in the bottom row of the corresponding background image region subB_i is taken, and the average difference between v_bottom and the bottom row vector of the pixel matrix F_y is calculated as diff_ymean. Of course, if F_x and F_y are obtained at the same time, then take the rightmost column reference pixel v_right and the bottommost row reference pixel v_bottom of the corresponding background image position region image subB_i, calculate the average difference between v_right and the rightmost column vector of the pixel matrix F_x, and calculate the average difference between v_bottom and the bottommost row vector of the pixel matrix F_y ....

[0063] If the comparison results are within the preset threshold range, it means that the color difference is within a reasonable range and no further optimization is needed. At this time, the first image can be generated based on the first gradient pixel matrix, and the first image can be used as the output image.

[0064] It should be noted that if there are two objects for the average difference, diff_xmean and diff_ymean, then the color difference is considered to be within a reasonable range only if both are within the preset threshold range; otherwise, the first image cannot be generated without optimization.

[0065] In one implementation, the process of generating an image using a gradient pixel matrix includes:

[0066] The x-pixel matrix and y-pixel matrix are fused, and the values ​​are normalized, limiting the value range to [0, 255], to obtain the fused image. Preferably, the process of fusing the x-pixel matrix and y-pixel matrix is ​​as follows:

[0067]

[0068] In one embodiment, the image processing method further includes steps S160, S170, and S180.

[0069] Step S160: When the comparison result is not within the preset threshold range, the second gradient pixel matrix is ​​obtained by calculating the pixel change using the second single-sided pixel of the target area image of the background image based on the change of the gradient matrix.

[0070] Step S170: Merge the first gradient pixel matrix and the second gradient pixel matrix to obtain the merged pixel matrix;

[0071] Step S180: Generate a second image based on the merged pixel matrix, and use the second image as the fused output image.

[0072] This implementation addresses situations where color differences are outside a reasonable range and require further optimization. Step S160 is essentially the same as step S130, except that this time, pixel change calculations are performed using the second single-sided pixel to obtain the second gradient pixel matrix. At this point, the first and second gradient pixel matrices are obtained. These two gradient pixel matrices are then adjusted to obtain a pixel matrix with the same color as the current frame image. In step S170, adjustments are made by merging to obtain a merged pixel matrix. In step S160, the second gradient pixel matrices F_x' and F_y' are obtained. In step S170, they are averaged with the first gradient pixel matrices F_x' and F_y' to obtain the merged pixel matrices F_x'' and F_y''. The process of generating an image from the gradient pixel matrix in step S180 is the same as before. A second image is generated based on the merged pixel matrix, and this second image is used as the fused output image.

[0073] It should be noted that there is a possibility that one of F_x and F_y is within the threshold range, while the other is not. In this case, only the one that is not within the threshold range needs to be adjusted.

[0074] This method primarily utilizes the principle that the gradient changes of the blackboard content are obvious and there is little interference from natural colors. It uses the pixel change amplitude to replace the direct pixel value and uses the pixels at the fusion edge to fit an image that conforms to both the background content and the color distribution. This solves the problem of light and color difference between the background image and the current frame image, allowing the current frame image to blend into the background image, making it more consistent with the color distribution while retaining the original image content. The brightness distribution of the processed image is close to the target area of ​​the current frame image.

[0075] In one embodiment, the gradient matrix includes: an x-gradient matrix in the x-direction and a y-gradient matrix in the y-direction;

[0076] The first single side includes: a first vertical single side and a first horizontal single side;

[0077] The process of step S130 includes steps S131 and S132.

[0078] Step S131: Based on the change of the x gradient matrix, the pixel change is calculated using the first vertical single-sided pixel of the target area image of the background image to obtain the first gradient x pixel matrix.

[0079] Step S132: Based on the change of the y gradient matrix, the pixel change is calculated using the first horizontal single-sided pixel of the target area image of the background image to obtain the first gradient y pixel matrix.

[0080] This implementation method is the case mentioned earlier where gradient matrices SigmaG_x and SigmaG_y, which are accumulated by changes in two directions, are used to obtain the first gradient pixel matrices F_x and F_y.

[0081] In one embodiment, the second single side includes: a second vertical single side and a second horizontal single side;

[0082] The process of step S140 includes steps S141 and S142.

[0083] Step S141: Compare the first gradient x pixel matrix at the second vertical single-sided position with the pixels of the target region image in the current frame to obtain the x comparison result;

[0084] Step S142: Compare the first gradient y pixel matrix at the second horizontal single-sided position with the pixels of the target region image in the current frame to obtain the y comparison result.

[0085] This implementation method is the case mentioned earlier where F_x and F_y are obtained simultaneously, and the average difference values ​​diff_xmean and diff_ymean are obtained.

[0086] In one implementation, step S160 includes:

[0087] Step S161: When the x comparison result is not within the preset threshold range, the second gradient x pixel matrix is ​​obtained by calculating the pixel change using the second vertical single-sided pixel of the target area image of the background image based on the change of the x gradient matrix.

[0088] Step S162: When the y comparison result is not within the preset threshold range, the second gradient y pixel matrix is ​​obtained by calculating the pixel change using the second horizontal single-sided pixel of the target area image of the background image based on the change of the y gradient matrix.

[0089] Example 2

[0090] Corresponding to the image processing method in Embodiment 1, such as Figure 3As shown, the present invention also provides an image processing device 3, including: an acquisition module 310, a calculation module 320, a comparison module 330 and an output module 340.

[0091] The acquisition module 310 is used to acquire the image of the target area of ​​the current frame and the image of the target area of ​​the background screen, wherein the target area of ​​the current frame and the target area of ​​the background screen are both obtained based on the position information of the target object;

[0092] The calculation module 320 is used to calculate the gradient matrix of the target region image in the current frame. Based on the change of the gradient matrix, the first single-sided pixel of the target region image in the background image is used to calculate the pixel change to obtain the first gradient pixel matrix.

[0093] The comparison module 330 is used to compare the pixels of the first gradient pixel matrix with the target area of ​​the background image at the second single-sided position to obtain the comparison result.

[0094] The output module 340 is used to generate a first image based on the first gradient pixel matrix when the comparison result is within a preset threshold range, and to use the first image as the fused output image.

[0095] In one implementation, the calculation module is further configured to, when the comparison result is not within a preset threshold range, calculate the pixel change using the second single-sided pixel of the target area of ​​the background image based on the change of the gradient matrix, obtain a second gradient pixel matrix, and merge the first gradient pixel matrix and the second gradient pixel matrix to obtain a merged pixel matrix.

[0096] The output module is also used to generate a second image based on the merged pixel matrix, and use the second image as the fused output image.

[0097] This device primarily utilizes the method of replacing direct pixel values ​​with pixel variation amplitude based on the obvious gradient changes of the blackboard content and the absence of excessive natural color interference. The pixels at the fusion edge are used to fit an image that conforms to both the background content and the color distribution based on the pixel variation amplitude. This solves the problem of light and color differences between the background image and the current frame image, allowing the current frame image to blend into the background image, making it more consistent with the color distribution while retaining the original image content. The brightness distribution of the processed image is close to the target area position of the current frame image.

[0098] Example 3

[0099] This invention also provides a storage medium storing computer instructions that, when executed by a processor, implement the image processing method of any of the above embodiments.

[0100] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, random access memory (RAM), read-only memory (ROM), magnetic disks, or optical disks.

[0101] Alternatively, if the integrated units of this invention are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this invention, or the parts that contribute to related technologies, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, terminal, or network device, etc.) to execute all or part of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, RAM, ROM, magnetic disks, or optical disks.

[0102] Corresponding to the computer storage medium described above, one embodiment also provides a computer device, which includes a memory, an encoder, and a computer program stored in the memory and executable on the encoder, wherein the encoder executes the program to implement any of the image processing methods described in the above embodiments.

[0103] The aforementioned computer equipment primarily utilizes a method that, based on the obvious gradient changes in the blackboard content and the absence of excessive natural color interference, uses pixel variation amplitude to replace direct pixel values. By using the pixels at the fusion edge to fit an image that conforms to both the background content and the color distribution, the problem of light and color differences between the background image and the current frame image is solved. This allows the current frame image to blend into the background image, making it more closely match the color distribution while retaining the original image content. The brightness distribution of the processed image is similar to the target area position of the current frame image.

[0104] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0105] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the present invention, and are not intended to limit the implementation of the present invention. Those skilled in the art can make other variations or modifications based on the above description. It is neither necessary nor possible to exhaustively describe all embodiments here. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the claims of the present invention.

Claims

1. An image processing method, characterized by, The method comprises the following steps: obtaining an image of a target region of a current frame and an image of a target region of a background picture, wherein the target region of the current frame and the target region of the background picture are obtained according to position information of a target object; calculating a gradient matrix of the image of the target region of the current frame; according to the change of the gradient matrix, performing pixel change calculation on first single-side pixels of the image of the target region of the background picture to obtain a first gradient pixel matrix; comparing the first gradient pixel matrix with pixels of the image of the target region of the background picture at a second single-side position to obtain a comparison result; when the comparison result is within a preset threshold range, generating a first image according to the first gradient pixel matrix, and taking the first image as a fused output image.

2. The image processing method of claim 1, wherein, The method further comprises the following steps: when the comparison result is not within the preset threshold range, performing pixel change calculation on second single-side pixels of the image of the target region of the background picture according to the change of the gradient matrix to obtain a second gradient pixel matrix; merging the first gradient pixel matrix and the second gradient pixel matrix to obtain a merged pixel matrix; generating a second image according to the merged pixel matrix, and taking the second image as the fused output image.

3. The image processing method of claim 2, wherein, The gradient matrix comprises an x gradient matrix in an x direction and a y gradient matrix in a y direction; the first single side comprises a first vertical single side and a first horizontal single side; the process of performing pixel change calculation on the first single-side pixels of the image of the target region of the background picture according to the change of the gradient matrix to obtain the first gradient pixel matrix comprises the following steps: performing pixel change calculation on first vertical single-side pixels of the image of the target region of the background picture according to the change of the x gradient matrix to obtain a first gradient x pixel matrix; performing pixel change calculation on first horizontal single-side pixels of the image of the target region of the background picture according to the change of the y gradient matrix to obtain a first gradient y pixel matrix.

4. The image processing method of claim 3, wherein, the second single side comprises a second vertical single side and a second horizontal single side; the process of comparing the first gradient pixel matrix with pixels of the image of the target region of the background picture at the second single-side position to obtain the comparison result comprises the following steps: comparing the first gradient x pixel matrix with pixels of the image of the target region of the background picture at a second vertical single-side position to obtain an x comparison result; comparing the first gradient y pixel matrix with pixels of the image of the target region of the background picture at a second horizontal single-side position to obtain a y comparison result.

5. The image processing method of claim 4, wherein, the process of performing pixel change calculation on the second single-side pixels of the image of the target region of the background picture according to the change of the gradient matrix to obtain the second gradient pixel matrix when the comparison result is not within the preset threshold range comprises the following steps: when the x comparison result is not within the preset threshold range, performing pixel change calculation on second vertical single-side pixels of the image of the target region of the background picture according to the change of the x gradient matrix to obtain a second gradient x pixel matrix; when the y comparison result is not within the preset threshold range, performing pixel change calculation on second horizontal single-side pixels of the image of the target region of the background picture according to the change of the y gradient matrix to obtain a second gradient y pixel matrix.

6. The image processing method of claim 5, wherein, the process of generating an image according to a gradient pixel matrix comprises the following steps: The x-pixel matrix and the y-pixel matrix are fused, and the numerical values are normalized to limit the value range to [0, 255], so as to obtain a fused result image.

7. The image processing method of any of claims 4-6, wherein, The first vertical single side is the leftmost column or the rightmost column; The first horizontal single side is the topmost row or the bottommost row; The second vertical single side is a column at one end opposite to the first vertical single side; The second horizontal single side is a row at one end opposite to the first horizontal single side.

8. An image processing apparatus characterized by comprising: Comprise: An acquisition module, configured to acquire an image of a target region of a current frame and an image of a target region of a background picture, wherein the target region of the current frame and the target region of the background picture are both obtained according to position information of a target object; A calculation module, configured to calculate a gradient matrix of the image of the target region of the current frame, and perform pixel change calculation on a first single side pixel of the image of the target region of the background picture according to a change of the gradient matrix to obtain a first gradient pixel matrix; A comparison module, configured to compare the first gradient pixel matrix with pixels of the image of the target region of the background picture at a second single side position to obtain a comparison result; An output module, configured to generate a first image according to the first gradient pixel matrix when the comparison result is within a preset threshold range, and take the first image as a fused output image.

9. A computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the program to implement the method in any one of claims 1-7.

10. A computer-readable storage medium having stored thereon a computer program, characterized in that, The program is executed by the processor to implement the method in any one of claims 1-7.

Citation Information

Patent Citations

  • Image processing method and device, computer equipment and storage medium

    CN113192101A

  • Image data processing method and device and storage medium

    CN114897740A