Image processing method and apparatus, electronic device, and storage medium
By adding spot pattern special effects to the image, the problem of limited types of special effects in the prior art is solved, and the diversified visual effects of the image are enhanced.
Patent Information
- Application Number
- PCT/CN2024/137957
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-01-10
- Filing Date
- 2024-12-09
- Publication Date
- 2025-07-17
AI Technical Summary
In the prior art, the types of image special effects addition functions are limited, and it is difficult to meet the diverse needs of users.
The spot addition area is determined in the target image, and a spot pattern including the first type of spot pattern and the second type of spot pattern is added. The first type of spot pattern is a preset pattern, and the second type of spot pattern is a dispersed flash point. The brightness value of the two is greater than or equal to the set threshold value. The second type of spot pattern is located on the upper layer of the first type of spot pattern.
It realizes the user's diverse special effects addition needs, and the spot pattern significantly enhances the visual effect of the image.
Smart Images

Figure CN2024137957_17072025_PF_FP_ABST
Abstract
Description
Image processing method, device, electronic device and storage medium
[0001] This application claims priority to the Chinese invention patent application entitled “Image processing method, device, electronic device and storage medium” and application number 202410039504.8 filed on January 10, 2024. The entire contents of that application are incorporated herein by reference. Technical Field
[0002] The present disclosure relates to the field of image processing technology, and in particular to an image processing method, device, electronic device, and storage medium. Background Art
[0003] With the rapid development of digital imaging technology, people are placing higher demands on the visual quality of images. Adding special effects to images has become an important technical tool to enhance their visual appeal and artistic quality. Special effects can enrich the visual quality of images, making them more attractive and valuable.
[0004] However, although there are some software or applications on the market that provide the function of adding special effects, the types of special effects they provide are limited and it is difficult to meet the diverse needs of users. Summary of the Invention
[0005] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides an image processing method, apparatus, electronic device and storage medium.
[0006] In a first aspect, the present disclosure provides an image processing method, comprising: acquiring a target image; determining a light spot adding area in the target image; adding a light spot pattern in the light spot adding area of the target image to obtain a processed image; the light spot pattern comprises a first type of light spot pattern and a second type of light spot pattern; the shape of the first type of light spot pattern is a preset graphic, the second type of light spot pattern is a scattered flashing point, the brightness value of the pixel points in the first type of light spot pattern and the second type of light spot pattern is greater than or equal to a first set brightness threshold; the second type of light spot pattern is located on an upper layer of the first type of light spot pattern.
[0007] In the second aspect, the present disclosure also provides an image processing device, including: an acquisition module for acquiring a target image; a determination module for determining a light spot adding area in the target image; a processing module for adding a light spot pattern in the light spot adding area of the target image to obtain a processed image; the light spot pattern includes a first type of light spot pattern and a second type of light spot pattern; the shape of the first type of light spot pattern is a preset graphic, and the second type of light spot pattern is a scattered flash point, and the brightness value of the pixel points in the first type of light spot pattern and the second type of light spot pattern is greater than or equal to a first set brightness threshold; the second type of light spot pattern is located on the upper layer of the first type of light spot pattern.
[0008] In a third aspect, the present disclosure also provides an electronic device, comprising: one or more processors; a storage device for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement the image processing method as described above.
[0009] In a fourth aspect, the present disclosure further provides a computer-readable storage medium having a computer program stored thereon, which implements the image processing method described above when executed by a processor.
[0010] The technical solution provided by the embodiments of the present disclosure has the following advantages over the prior art:
[0011] The technical solution provided by the embodiment of the present disclosure determines a light spot adding area in a target image; adds a light spot pattern in the light spot adding area of the target image to obtain a processed image; the light spot pattern includes a first type of light spot pattern and a second type of light spot pattern; the shape of the first type of light spot pattern is a preset graphic, and the second type of light spot pattern is a scattered flashing point. The brightness value of the pixel points in the first type of light spot pattern and the second type of light spot pattern is greater than or equal to a first set brightness threshold; the second type of light spot pattern is located on the upper layer of the first type of light spot pattern. In essence, it provides a method for automatically adding light spot pattern special effects to the target image, which can meet the user's diverse special effects adding needs. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0013] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0014] FIG1 is a flow chart of an image processing method provided by an embodiment of the present disclosure;
[0015] 2 to 6 are schematic diagrams of the image processing method provided by the embodiments of the present disclosure;
[0016] FIG7 is a schematic structural diagram of an image processing device according to an embodiment of the present disclosure; and
[0017] FIG8 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0018] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features therein can be combined with each other in the absence of conflict.
[0019] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.
[0020] Figure 1 is a flowchart of an image processing method provided by an embodiment of the present disclosure. This embodiment is applicable to situations where image processing is performed in a client. The method can be executed by an image processing device, which can be implemented in software and / or hardware. The device can be configured in an electronic device, such as a terminal, specifically including but not limited to a smart phone, a PDA, a tablet computer, a wearable device with a display screen, a desktop computer, a laptop computer, an all-in-one computer, a smart home device, etc. Alternatively, this embodiment is applicable to situations where image processing is performed in a server. The method can be executed by an image processing device, which can be implemented in software and / or hardware. The device can be configured in an electronic device, such as a server.
[0021] As shown in FIG1 , the method may specifically include: S110 , acquiring a target image.
[0022] The target image may be, for example, an image to which a light spot pattern effect is to be added. The target image may be specified by the user. Specifically, it may be an image captured by the user or an image downloaded from the Internet.
[0023] Optionally, the target image may be, for example, a static image, a dynamic image, or an image frame in a video.
[0024] In addition, the target image can be an image that has been edited before, or an image that has not been edited. Here, the "edited image" can be, for example, an image that has been added with other special effects.
[0025] It should be noted that the technical solution provided in this application can be used to add a spot pattern to the target image. The spot patterns that can be added include a first type of spot pattern and a second type of spot pattern; the first type of spot pattern has a preset shape, and the second type of spot pattern consists of scattered flashing points. The brightness values of the pixels in the first and second types of spot patterns are greater than or equal to a first set brightness threshold.
[0026] The first set brightness threshold is a pre-specified brightness threshold. The brightness value of the pixels in the first and second light spot patterns is greater than or equal to the first set brightness threshold, which means that the first and second light spot patterns are more obvious and easier to see.
[0027] The preset shape may be, for example, a triangle, square, rhombus, or heart. If the preset shape is a rhombus, the first type of spot pattern refers to a rhombus-shaped spot, and the brightness value of the pixels constituting the spot is greater than or equal to the first set brightness threshold.
[0028] The scattered flash points may be, for example, discrete bright spots. The brightness value of the pixel points forming the bright spot is greater than or equal to the first set brightness threshold. This application does not limit the density of the scattered flash points per unit area.
[0029] The present application does not limit the color of the light spot pattern (including the first type of light spot pattern and the second type of light spot pattern). In practice, the color of the light spot pattern can be set by the user.
[0030] S120: Determine a light spot adding area in the target image.
[0031] The light spot adding area may be, for example, an area for adding a light spot. Optionally, the light spot adding area may be pre-specified, or determined according to a light spot adding area determination rule.
[0032] In practice, different spot patterns can be assigned to different spot addition areas. Specifically, this step includes determining a first type of spot addition area and a second type of spot addition area in the target image, where the first type of spot addition area is used to add the first type of spot pattern, and the second type of spot addition area is used to add the second type of spot pattern. Because the first type of spot addition area and the second type of spot addition area are different, determining the first type of spot addition area and the second type of spot addition area in the target image essentially selects appropriate locations for adding the first type of spot pattern and the second type of spot pattern, respectively, making the first type of spot pattern and the second type of spot pattern more prominent and easier to see.
[0033] In one embodiment, determining the first type of light spot adding area in the target image may include: determining the first type of light spot adding area in the target image based on the brightness value of the pixel point in the target image, the brightness value of the pixel point in the first type of light spot adding area being greater than a second set brightness threshold.
[0034] Furthermore, "determining the first type of light spot addition area in the target image based on the brightness values of the pixels in the target image" may include: determining the first type of light spot addition area in the target image based on the brightness values of the pixels in the target image and a second preset brightness threshold. The second preset brightness threshold is used to determine whether the area occupied by a pixel in the target image is included in the first type of light spot addition area.
[0035] Optionally, “determining the first type of light spot adding area in the target image based on the brightness value of the pixel points in the target image” may include: determining the first type of light spot adding area in the target image based on the brightness value of the pixel points in the target image and the bilateral threshold.
[0036] Bilateral thresholding involves defining a high threshold and a low threshold. If a pixel's brightness is greater than the high threshold, the pixel's location is determined to belong to the first type of light spot addition area. If the pixel's brightness is lower than the low threshold, the pixel's location is determined not to belong to the first type of light spot addition area. If a pixel's brightness is between the low and high thresholds, the distance between the pixel and pixels already identified as belonging to the first type of light spot addition area determines whether the pixel's location belongs to the first type of light spot addition area.
[0037] In another embodiment, determining the second type of light spot adding area in the target image includes: performing smoothing filtering on the target image to obtain a third image; and determining the second type of light spot adding area in the target image based on the third image and the target image.
[0038] Perform smoothing filtering on the target image. For example, box filtering can be performed on the target image.
[0039] Exemplarily, determining the second type of light spot added area in the target image based on the third image and the target image may include: subtracting the target image from the third image to obtain the second type of light spot added area.
[0040] By smoothing the target image, the edges in the third image are smoothed, reducing the sharpness of edge details. Because the target image retains the sharpness of edge details, the specific location of the edges can be accurately identified by comparing the target image with the third image. The area enclosed by these edges is marked as the second type of spot addition area, preparing for the subsequent addition of the second type of spot pattern.
[0041] S130. Add a light spot pattern to the light spot adding area of the target image to obtain a processed image; the light spot pattern includes a first type of light spot pattern and a second type of light spot pattern; the shape of the first type of light spot pattern is a preset graphic, and the second type of light spot pattern is a scattered flashing point. The brightness value of the pixel points in the first type of light spot pattern and the second type of light spot pattern is greater than or equal to the first set brightness threshold; the second type of light spot pattern is located on the upper layer of the first type of light spot pattern.
[0042] Among them, the second type of light spot pattern is located on the upper layer of the first type of light spot pattern, which means that if the target image, the first type of light spot pattern and the second type of light spot pattern are regarded as a layer respectively, the arrangement order of the images from the bottom layer to the top layer is the target image, the first type of light spot pattern and the second type of light spot pattern.
[0043] There are multiple methods for implementing this step, which are not limited in this application. For example, the light spot addition area includes a first-type light spot addition area and a second-type light spot addition area; the implementation method of this step includes: adding a first-type light spot pattern to the first-type light spot addition area of the target image to obtain a first image; and adding a second-type light spot pattern to the second-type light spot addition area of the first image to obtain a processed image.
[0044] Furthermore, in one embodiment, optionally, adding a first type of light spot pattern in the first type of light spot adding area of the target image to obtain the first image includes: performing edge detection on the image in the first type of light spot adding area of the target image to obtain an edge contour image; performing connected domain detection on the edge contour image to obtain a connected domain; and adding the first type of light spot pattern in the connected domain to obtain the first image.
[0045] A connected domain is generally composed of a group of connected pixels that have the same color, grayscale value, or other characteristics. This application does not limit the specific characteristics of the pixels in the connected domain that are the same.
[0046] In practice, the first type of light spot pattern may be added to each connected domain; or the first type of light spot pattern may be added only to some connected domains.
[0047] In practice, optionally, it may be configured to add the first type of spot pattern to all connected domains whose sizes are larger than a set size threshold.
[0048] In practice, the first type of spot pattern can be added at any position in the connected domain, and this application does not impose any restrictions on this. In practice, optionally, "adding the first type of spot pattern to the connected domain to obtain the first image" includes: determining the center point position of the connected domain; based on the center point position of the connected domain, determining the target area, where the center point of the target area coincides with the center point of the connected domain; and adding the first type of spot pattern to the target area to obtain the first image.
[0049] The center point of the connected domain may be, for example, the geometric center of the connected domain.
[0050] The target area may be, for example, an area used to fill the first type of light spot pattern.
[0051] Exemplarily, if the target image is as shown in FIG2 , the spot addition area determination rule corresponding to the first type of spot pattern is used to obtain the first type of spot addition area, as shown in FIG3 . Edge detection is performed on the image in the first type of spot addition area of the target image to obtain an edge contour image; connected domain detection is performed on the edge contour image, as shown in FIG3 , to obtain two connected domains, namely connected domain a and connected domain b. The center point position of connected domain a is determined, as shown in FIG4 , and target area a is determined in connected domain a. Target area a is a rectangle, and the center point of target area a coincides with the center point of connected domain a. The center point position of connected domain b is determined, as shown in FIG4 , and target area b is determined in connected domain b. Target area b is a rectangle, and the center point of target area b coincides with the center point of connected domain b. Referring to FIG5 , the pre-set or selected first type of spot pattern is added to target areas a and b. The processed image is obtained. Exemplarily, in FIG5 , the first type of spot pattern is in the shape of a four-pointed star and emits white light.
[0052] It should be noted that in FIG5 , target area a and target area b are indicated by dotted lines, and the rectangular wireframes indicating target area a and target area b are not visible. That is, in practice, target area a and target area b are not displayed, and only the first type of light spot pattern is displayed.
[0053] In another embodiment, if the light spot pattern includes a second type of light spot pattern; the specific implementation method of this step may include: dynamically sampling the preset gradient noise image that changes in time sequence to obtain a sampling result; based on the sampling result, adding the second type of light spot pattern to the second type of light spot addition area of the first image to obtain an intermediate processed image; and blurring the second type of light spot addition area in the intermediate processed image to obtain a processed image.
[0054] The preset gradient noise image that changes with time can be, for example, a noise image with a gradient generated on time series data, wherein the intensity or pattern of the noise changes with time and is adjusted in the gradient direction. Such an image can be used to simulate the dynamic changes of natural phenomena or random processes, and to generate time series data with specific characteristics. Exemplarily, the preset gradient noise image that changes with time can be a Perlin noise image, a Simplex noise image, etc. Setting the preset gradient noise image that changes with time can be a Perlin noise image, a Simplex noise image, etc., can make the added second type of spot pattern simulate a sense of flow.
[0055] Dynamic sampling of a time-varying preset gradient noise image essentially involves extracting partial data or information from the preset gradient noise image through random sampling, uniform sampling, or periodic sampling based on a specific rule. This data or information represents the distribution and intensity of the noise. Each sampling result is a noise image composed of the partial data or information extracted at that time. In other words, the sampling result includes multiple noise images.
[0056] The intermediate processed image includes multiple light points, and different light points may have different positions and / or brightness in the intermediate processed image.
[0057] In practice, optionally, "dynamically sampling the temporally varying preset gradient noise image to obtain sampling results" includes: periodically sampling the temporally varying preset gradient noise image at different sampling frequencies to obtain multiple first results; different first results correspond to different sampling frequencies; each first result includes a noise image sampled at a different sampling time; and the noise images obtained at different sampling frequencies are fused to obtain multiple sampling results. "Based on the sampling results, adding a second type of speckle pattern to the second type of speckle addition region of the first image to obtain an intermediate processed image" includes: adding a second type of speckle pattern to the second type of speckle addition region of the first image based on each sampling result to obtain an intermediate processed image.
[0058] For example, the sampling frequency is set to t1, and the preset gradient noise image that changes in time sequence is periodically sampled to obtain noise images S1, S2, S3, .... The sampling frequency is set to t2, and the preset gradient noise image that changes in time sequence is periodically sampled to obtain noise images M1, M2, M3, .... S1 and M1 are synthesized to obtain sampling result F1; S2 and M2 are synthesized to obtain sampling result F2; S3 and M3 are synthesized to obtain sampling result F3; .... Based on the sampling result F1, a second type of light spot pattern is added to the second type of light spot addition area of the first image to obtain an intermediate processed image B1. Based on the sampling result F2, a second type of light spot pattern is added to the second type of light spot addition area of the first image to obtain an intermediate processed image B2. Based on the sampling result F3, a second type of light spot pattern is added to the second type of light spot addition area of the first image to obtain an intermediate processed image B3. ...
[0059] By using the above method, when multiple intermediate processed images or the final image obtained based on multiple intermediate processed images are played continuously, the light spots can produce a flickering particle effect, that is, the light spots are transformed into flashing points, making them look more vivid and realistic.
[0060] Based on the sampling results, a second type of light spot pattern is added in the second type of light spot adding area of the first image to obtain an intermediate processed image, which may specifically include: processing the pixel points in the sampling results into light spots, adding the light spots in the second type of light spot adding area of the first image, and obtaining an intermediate processed image.
[0061] “Blurring the second type of light spot added area in the intermediate processed image to obtain a processed image” may, for example, be performing Gaussian blurring on the second type of light spot added area in the intermediate processed image so that the flashing points in the second type of light spot pattern present a luminous visual effect.
[0062] It should be noted that, in practice, the second type of spot added area in the intermediate processed image may be subjected to multiple layers of blurring processing.
[0063] For example, still using Figure 2 as the target image, assuming that the areas to be added with the second type of light spots include the nose tip, eyelids, and cheeks of the face, the effect of adding the second type of light spot pattern is shown in Figure 6. For example, in Figure 6, the color of the flash points in the second type of light spot pattern is white.
[0064] On the basis of the above technical solutions, if the target image includes a target object; based on the sampling results, a second type of light spot pattern is added to the second type of light spot adding area of the first image to obtain an intermediate processed image, including: based on the position information of the target object in the target image, obtaining a target mask; based on the target mask, a second type of light spot pattern is added to the second type of light spot adding area of the first image to obtain an intermediate processed image.
[0065] The target object may be, for example, an object that requires special attention. This application does not limit what the target object specifically refers to. In some scenarios, the target object may be the main body of the target image, or a part of the main body. For example, the target object may be, for example, a person, an animal, a building, etc.; or, the target object may be the face of a person or an animal, etc.; or, the target object may be the nose, eyelid, eye corner, and chin of a person or an animal, etc.; or, the target object may be the outline of the main body of the target image.
[0066] The target mask may be used, for example, to indicate the location of the target object in the target image.
[0067] In one embodiment, based on the target mask, adding the second type of light spot pattern in the second type of light spot adding area of the first image to obtain an intermediate processed image may include: based on the target mask, adding the second type of light spot pattern in the area indicated by the target mask in the second type of light spot adding area of the first image to obtain an intermediate processed image.
[0068] The area indicated by the target mask is the area where the target object is located.
[0069] For example, if the target object is a person's nose, the person's nose in the target image can be identified to obtain a target mask, where the target mask indicates the area where the person's nose is located. A second type of spot pattern is added to the area where the person's nose is located.
[0070] Alternatively, based on the target mask, a second type of light spot pattern is added in the second type of light spot adding area of the first image to obtain an intermediate processed image, including: based on the target mask, a second type of light spot pattern is added in the second type of light spot adding area of the first image to obtain a second image; and the brightness value of the flash point in the area indicated by the target mask in the second image is adjusted to a third brightness value.
[0071] The third brightness value is a pre-specified brightness value, and this application does not limit its specific value. For example, the third brightness value is 0.
[0072] For example, if the target object is the outline of a person, the subject in the target image can be identified to obtain a first mask; the first mask is then dilated and blurred to obtain a second mask. The second mask is subtracted from the first mask to obtain a target mask, with the area indicated by the target mask representing the edge of the person. The second type of spot pattern is added to the second type of spot addition area to obtain a second image. The brightness value of the flash points in the area indicated by the target mask in the second image (i.e., the flash points at the edge of the person) is adjusted to 0. This means that the second type of spot pattern is visually invisible at the edge of the person.
[0073] The above technical solution determines the spot adding area in the target image; adds a spot pattern in the spot adding area of the target image to obtain a processed image; the spot pattern includes a first type of spot pattern and a second type of spot pattern; the shape of the first type of spot pattern is a preset graphic, and the second type of spot pattern is a scattered flashing point. The brightness value of the pixel points in the first type of spot pattern and the second type of spot pattern is greater than or equal to the first set brightness threshold; the second type of spot pattern is located on the upper layer of the first type of spot pattern. In essence, it provides a method for automatically adding spot pattern special effects to the target image, which can meet the user's diverse special effects adding needs.
[0074] It is understandable that before using the technical solutions disclosed in the various embodiments of this disclosure, the type, scope of use, usage scenarios, etc. of the personal information involved in this disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0075] For example, in response to a user's active request, a prompt message is sent to the user to clearly inform the user that the operation requested will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the electronic device, application, server, storage medium, or other software or hardware that performs the operations of the disclosed technical solution based on the prompt message.
[0076] As an optional but non-limiting implementation, in response to receiving a user's active request, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. Furthermore, the pop-up window may also contain a selection control for the user to select "agree" or "disagree" to provide personal information to the electronic device.
[0077] It is understandable that the above notification and user authorization process are merely illustrative and do not limit the implementation of the present disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0078] It should be noted that for the aforementioned method embodiments, for simplicity of description, they are all expressed as a series of action combinations. However, those skilled in the art should be aware that the present invention is not limited by the order of the actions described, because according to the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0079] FIG7 is a schematic diagram of the structure of an image processing device in an embodiment of the present disclosure. The image processing device provided by the embodiment of the present disclosure can be configured in a client, or can be configured in a server. Referring to FIG7 , the image processing device specifically includes: an acquisition module 310 for acquiring a target image; a determination module 320 for determining a light spot adding area in the target image; a processing module 330 for adding a light spot pattern in the light spot adding area of the target image to obtain a processed image; the light spot pattern includes a first type of light spot pattern and a second type of light spot pattern; the shape of the first type of light spot pattern is a preset graphic, and the second type of light spot pattern is a scattered flash point, and the brightness value of the pixel points in the first type of light spot pattern and the second type of light spot pattern is greater than or equal to a first set brightness threshold; the second type of light spot pattern is located on the upper layer of the first type of light spot pattern.
[0080] Furthermore, the light spot adding area includes a first type of light spot adding area and a second type of light spot adding area; the processing module 330 is used to: add a first type of light spot pattern in the first type of light spot adding area of the target image to obtain a first image; add a second type of light spot pattern in the second type of light spot adding area of the first image to obtain a processed image.
[0081] Furthermore, the processing module 330 is used to: perform edge detection on the image in the first type of light spot adding area of the target image to obtain an edge contour image; perform connected domain detection on the edge contour image to obtain a connected domain; and add the first type of light spot pattern in the connected domain to obtain a first image.
[0082] Furthermore, the processing module 330 is used to: determine the center point position of the connected domain; determine the target area based on the center point position of the connected domain, and the center point of the target area coincides with the center point of the connected domain; add a first type of spot pattern in the target area to obtain a first image.
[0083] Furthermore, the determination module 320 is used to: determine a first type of light spot adding area in the target image based on the brightness values of the pixels in the target image, wherein the brightness values of the pixels in the first type of light spot adding area are greater than a second set brightness threshold.
[0084] Furthermore, the processing module 330 is used to: dynamically sample the preset gradient noise image that changes in time sequence to obtain a sampling result; based on the sampling result, add the second type of light spot pattern to the second type of light spot adding area of the first image to obtain an intermediate processed image; and blur the second type of light spot adding area in the intermediate processed image to obtain a processed image.
[0085] Furthermore, the determination module 320 is configured to: perform smoothing filtering on the target image to obtain a third image; and determine a second type of spot addition area in the target image based on the third image and the target image.
[0086] Furthermore, the processing module 330 is configured to: obtain a target mask based on position information of the target object in the target image; and add the second type of spot pattern to the second type of spot adding area of the first image based on the target mask to obtain an intermediate processed image.
[0087] Furthermore, the processing module 330 is configured to: based on the target mask, add the second type of light spot pattern to the area indicated by the target mask in the second type of light spot addition area of the first image to obtain an intermediate processed image.
[0088] Furthermore, the processing module 330 is used to: based on the target mask, add the second type of light spot pattern in the second type of light spot adding area of the first image to obtain a second image; and adjust the brightness value of the flash point in the area indicated by the target mask in the second image to a third brightness value.
[0089] The image processing device provided in the embodiment of the present disclosure can execute the steps executed by the client or server in the image processing method provided in the embodiment of the method of the present disclosure, and has the execution steps and beneficial effects, which will not be repeated here.
[0090] FIG8 is a schematic diagram of the structure of an electronic device in an embodiment of the present disclosure. Specific reference will be made to FIG8 below, which shows a schematic diagram of the structure of an electronic device 1000 suitable for implementing an embodiment of the present disclosure. The electronic device 1000 in the embodiment of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), wearable electronic devices, and the like, as well as fixed terminals such as digital TVs, desktop computers, smart home devices, and the like. The electronic device shown in FIG8 is merely an example and should not impose any limitations on the functions and scope of use of the embodiments of the present disclosure.
[0091] As shown in FIG8 , the electronic device 1000 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 1001, which can perform various appropriate actions and processes to implement the image processing method of the embodiment described in the present disclosure according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1008 into a random access memory (RAM) 1003. Various programs and information required for the operation of the electronic device 1000 are also stored in the RAM 1003. The processing device 1001, the ROM 1002, and the RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.
[0092] Typically, the following devices may be connected to the I / O interface 1005: an input device 1006 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 1007 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 1008 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 may allow the electronic device 1000 to communicate with other devices wirelessly or by wire to exchange information. Although FIG8 shows the electronic device 1000 with various devices, it should be understood that it is not required to implement or have all of the devices shown. More or fewer devices may alternatively be implemented or have.
[0093] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart, thereby implementing the image processing method described above. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 1009, or installed from the storage device 1008, or installed from the ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment of the present disclosure are performed.
[0094] It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, device, or component. In the present disclosure, a computer-readable signal medium may include an information signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated information signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof.
[0095] In some embodiments, the client and server can communicate using any known or future developed network protocol, such as HTTP (HyperText Transfer Protocol), and can be interconnected with any form or medium of digital information communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any known or future developed network.
[0096] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0097] The above-mentioned computer-readable medium carries one or more programs. When the above-mentioned one or more programs are executed by the electronic device, the electronic device is enabled to: acquire a target image; determine a light spot adding area in the target image; add a light spot pattern in the light spot adding area of the target image to obtain a processed image; the light spot pattern includes a first type of light spot pattern and a second type of light spot pattern; the shape of the first type of light spot pattern is a preset graphic, and the second type of light spot pattern is a scattered flashing point, and the brightness value of the pixel points in the first type of light spot pattern and the second type of light spot pattern is greater than or equal to a first set brightness threshold; the second type of light spot pattern is located on the upper layer of the first type of light spot pattern.
[0098] Optionally, when the above one or more programs are executed by the electronic device, the electronic device may also execute other steps described in the above embodiments.
[0099] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages, or a combination thereof, including, but not limited to, object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on the remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0100] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0101] The units involved in the embodiments described in this disclosure may be implemented in software or hardware, wherein the name of a unit does not necessarily limit the unit itself.
[0102] The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, and without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.
[0103] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0104] According to one or more embodiments of the present disclosure, the present disclosure provides an electronic device, comprising: one or more processors; a memory for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement any image processing method provided by the present disclosure.
[0105] According to one or more embodiments of the present disclosure, the present disclosure provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any image processing method provided by the present disclosure.
[0106] An embodiment of the present disclosure further provides a computer program product, which includes a computer program or instructions, and when the computer program or instructions are executed by a processor, the image processing method described above is implemented.
[0107] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.
[0108] The foregoing description is intended only to provide specific embodiments of the present disclosure, intended to enable those skilled in the art to understand and implement the present disclosure. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure is not intended to be limited to the embodiments described herein, but rather to be construed in the broadest manner consistent with the principles and novel features disclosed herein.
Claims
1. An image processing method, comprising: Get the target image; Determining a light spot adding area in the target image; A light spot pattern is added to the light spot adding area of the target image to obtain a processed image; the light spot pattern includes a first type of light spot pattern and a second type of light spot pattern; the shape of the first type of light spot pattern is a preset graphic, and the second type of light spot pattern is a scattered flashing point, and the brightness value of the pixel points in the first type of light spot pattern and the second type of light spot pattern is greater than or equal to a first set brightness threshold; the second type of light spot pattern is located on the upper layer of the first type of light spot pattern.
2. The method according to claim 1, wherein the light spot adding area comprises a first type of light spot adding area and a second type of light spot adding area; Adding a spot pattern in the spot adding area of the target image to obtain a processed image includes: Adding a first type of light spot pattern in the first type of light spot adding area of the target image to obtain a first image; A second type of light spot pattern is added to the second type of light spot adding area of the first image to obtain a processed image.
3. The method according to claim 2, wherein adding the first type of light spot pattern in the first type of light spot adding area of the target image to obtain the first image comprises: Performing edge detection on the image in the first type of light spot added area of the target image to obtain an edge contour image; Performing connected domain detection on the edge contour image to obtain a connected domain; A first type of spot pattern is added to the connected domain to obtain a first image.
4. The method according to claim 3, wherein adding a first type of spot pattern to the connected domain to obtain a first image comprises: Determine the center point position of the connected domain; Based on the position of the center point of the connected domain, determining a target area, wherein the center point of the target area coincides with the center point of the connected domain; A first type of spot pattern is added to the target area to obtain a first image.
5. The method according to claim 2, wherein determining the first type of spot adding area in the target image comprises: Based on the brightness values of the pixels in the target image, a first type of light spot adding area is determined in the target image, and the brightness values of the pixels in the first type of light spot adding area are greater than a second set brightness threshold.
6. The method according to claim 2, wherein the adding the second type of spot pattern in the second type of spot adding area of the first image to obtain a processed image comprises: Dynamically sampling the preset gradient noise image that changes in time sequence to obtain a sampling result; Based on the sampling result, adding the second type of light spot pattern to the second type of light spot adding area of the first image to obtain an intermediate processed image; The second type of spot added area in the intermediate processed image is blurred to obtain a processed image.
7. The method according to claim 2, wherein determining the second type of spot adding area in the target image comprises: Performing smoothing filtering on the target image to obtain a third image; Based on the third image and the target image, a second type of light spot adding area is determined in the target image.
8. The method according to claim 6, wherein if the target image includes a target object; adding the second type of spot pattern to the second type of spot adding area of the first image based on the sampling result to obtain an intermediate processed image comprises: Obtaining a target mask based on position information of the target object in the target image; Based on the target mask, the second type of light spot pattern is added to the second type of light spot adding area of the first image to obtain an intermediate processed image.
9. The method according to claim 8, wherein the step of adding the second type of spot pattern to the second type of spot adding region of the first image based on the target mask to obtain an intermediate processed image comprises: Based on the target mask, the second type of light spot pattern is added in the area indicated by the target mask in the second type of light spot adding area of the first image to obtain an intermediate processed image.
10. The method according to claim 8, wherein the step of adding the second type of spot pattern to the second type of spot adding region of the first image based on the target mask to obtain an intermediate processed image comprises: Based on the target mask, adding the second type of light spot pattern in the second type of light spot adding area of the first image to obtain a second image; The brightness value of the flash point in the area indicated by the target mask in the second image is adjusted to a third brightness value.
11. An image processing device, comprising: An acquisition module, used for acquiring a target image; A determination module, used for determining a light spot adding area in the target image; A processing module is used to add a spot pattern in the spot adding area of the target image to obtain a processed image; the spot pattern includes a first type of spot pattern and a second type of spot pattern; the shape of the first type of spot pattern is a preset figure, the second type of spot pattern is a scattered flash point, and the brightness value of the pixel points in the first type of spot pattern and the second type of spot pattern is greater than or equal to a first set brightness threshold; the second type of spot pattern is located on the upper layer of the first type of spot pattern.
12. An electronic device, comprising: one or more processors; A storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 10.
13. A computer-readable storage medium having a computer program stored thereon, wherein when the program is executed by a processor, the method according to any one of claims 1 to 10 is implemented.
14. A computer program product tangibly stored in a computer storage medium and comprising computer executable instructions which, when executed by a device, cause the device to perform the method according to any one of claims 1-10.
Citation Information
Patent Citations
Image processing method and apparatus
CN106504220A
Image light spot adding method and device
CN112561777A
Image processing method and device, electronic equipment and storage medium
CN114240742A
Light spot adding method and device, equipment and storage medium
CN114758054A
Image processing method and device, electronic equipment and storage medium
CN117274041A