A watermark color changing method, device, equipment and storage medium

By dynamically adjusting the watermark color using the butterfly algorithm, the problem of watermark color being confused by background color is solved, enabling real-time updates and information tracking of watermark color, improving user reminder effect and calculation accuracy.

CN116012468BActive Publication Date: 2025-12-05AGRICULTURAL BANK OF CHINA
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211097781.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-08
Publication Date
2025-12-05
Estimated Expiration
2042-09-08

AI Technical Summary

Technical Problem

In existing technologies, watermark colors are easily confused with page colors, making it difficult for users to see clearly, reducing the deterrent effect of the warning, and making it impossible to trace the source of information leakage.

Method used

The butterfly algorithm is used to dynamically adjust the watermark color, updating the watermark color in real time according to changes in the background color. By establishing a color space coordinate system, the global and local search mechanisms of the butterfly algorithm are used, combined with Euclidean distance and similarity to select the optimal solution, and vertical weighted optimization is performed to ensure that the watermark color matches the background color.

Benefits of technology

It achieves synchronized changes in watermark color and background color, avoiding confusion, improving the deterrent effect on users, and enabling the tracking of the source of information leakage, thereby improving calculation precision and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116012468B_ABST
    Figure CN116012468B_ABST
Patent Text Reader

Abstract

The application discloses a watermark color changing method, device and equipment and a storage medium. The method comprises the following steps: obtaining an initial background color and an initial watermark color of an image; obtaining an updated background color when it is determined that the initial background color is changed; and dynamically adjusting the initial watermark color by using a butterfly algorithm according to the updated background color to obtain an adjusted watermark color. By obtaining the initial background color and the initial watermark color of the image, and then obtaining the updated background color after it is determined that the initial background color is changed, it can be ensured that the watermark color is changed when the background color is changed, the watermark is prevented from being confused by the background color, the effect of reminding and deterring the user is improved, the tracking of the leaked information is realized, the initial watermark color is adjusted by using the butterfly algorithm, the calculation precision is improved, and the best adjusted watermark color can be accurately obtained.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of image processing, and in particular to a watermark color changing method and device, equipment and a storage medium. BACKGROUND

[0002] With the development of information technology and smart phones, mobile terminal equipment brings great convenience to our daily work, but also brings the risk of leakage of private information in work.

[0003] In order to improve the deterrent effect of work information that should be kept secret, and to trace the source of information and handle it in time when information is leaked, many internal office APPs add fixed watermarks to sensitive pages, and the fixed watermarks have the ID and nickname of the employee or user, so as to remind the employee not to leak office information at will.

[0004] However, in the prior art, when the user changes the page background color as needed, the watermark is mixed with the page color, so that the user cannot see clearly, especially the reminding and deterrent effect on the user is reduced, and once important information is leaked, it cannot be traced. SUMMARY

[0005] The present application provides a watermark color changing method, device, equipment and storage medium, so as to realize dynamic change of the watermark color with the background color of the image.

[0006] According to an aspect of the present application, a watermark color changing method is provided, comprising:

[0007] obtaining an initial background color and an initial watermark color of an image;

[0008] obtaining an updated background color when it is determined that the initial background color has changed;

[0009] dynamically adjusting the initial watermark color according to the updated background color by using a butterfly algorithm to obtain an adjusted watermark color.

[0010] Preferably, the initial background color and the initial watermark color of the image are obtained, comprising: establishing a color space coordinate system for the image, wherein the color space coordinate system contains three color channels of red, green and blue; determining the color values contained in the background and the watermark of the image, and matching the color values with the color channels of the color space coordinate system to obtain the initial background color and the initial watermark color.

[0011] Preferably, the initial watermark color is dynamically adjusted according to the updated background color by using the butterfly algorithm to obtain an adjusted watermark color, comprising: solving the initial watermark color by using the butterfly algorithm to obtain a target watermark color; screening the target watermark color according to the updated background color to obtain an optimal solution and a suboptimal solution, and taking the optimal solution as a final watermark color; optimizing the final watermark color according to the suboptimal solution to obtain a watermark color optimization result, and dynamically adjusting the initial watermark color by using the watermark color optimization result to obtain the adjusted watermark color.

[0012] Preferably, the initial watermark color is dynamically adjusted according to the updated background color by using the butterfly algorithm to obtain an adjusted watermark color, comprising: solving the initial watermark color by using the butterfly algorithm to obtain a target watermark color; screening the target watermark color according to the updated background color to obtain an optimal solution and a suboptimal solution, and taking the optimal solution as a final watermark color; optimizing the final watermark color according to the suboptimal solution to obtain a watermark color optimization result, and dynamically adjusting the initial watermark color by using the watermark color optimization result to obtain the adjusted watermark color.

[0013] Preferably, the initial watermark color is dynamically adjusted according to the updated background color by using the butterfly algorithm to obtain an adjusted watermark color, comprising: solving the initial watermark color by using the butterfly algorithm to obtain a target watermark color; screening the target watermark color according to the updated background color to obtain an optimal solution and a suboptimal solution, and taking the optimal solution as a final watermark color; optimizing the final watermark color according to the suboptimal solution to obtain a watermark color optimization result, and dynamically adjusting the initial watermark color by using the watermark color optimization result to obtain the adjusted watermark color.

[0014] Preferably, the initial watermark color is dynamically adjusted according to the updated background color by using the butterfly algorithm to obtain an adjusted watermark color, comprising: solving the initial watermark color by using the butterfly algorithm to obtain a target watermark color; screening the target watermark color according to the updated background color to obtain an optimal solution and a suboptimal solution, and taking the optimal solution as a final watermark color; optimizing the final watermark color according to the suboptimal solution to obtain a watermark color optimization result, and dynamically adjusting the initial watermark color by using the watermark color optimization result to obtain the adjusted watermark color.

[0015] Preferably, the initial watermark color is dynamically adjusted according to the updated background color by using the butterfly algorithm to obtain an adjusted watermark color, comprising: solving the initial watermark color by using the butterfly algorithm to obtain a target watermark color; screening the target watermark color according to the updated background color to obtain an optimal solution and a suboptimal solution, and taking the optimal solution as a final watermark color; optimizing the final watermark color according to the suboptimal solution to obtain a watermark color optimization result, and dynamically adjusting the initial watermark color by using the watermark color optimization result to obtain the adjusted watermark color.

[0016] According to another aspect of the present application, there is provided a watermark color changing device, comprising:

[0017] An initial watermark color obtaining module is configured to obtain an initial background color and an initial watermark color of an image.

[0018] An updated background color obtaining module is configured to obtain an updated background color when it is determined that the initial background color has changed.

[0019] A watermark color adjusting module is configured to dynamically adjust the initial watermark color according to the updated background color by using a butterfly algorithm to obtain an adjusted watermark color.

[0020] According to another aspect of the present application, an electronic device is provided, which comprises:

[0021] at least one processor; and

[0022] a memory connected to the at least one processor in communication; wherein,

[0023] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute a watermark color changing method according to any one of the embodiments of the present application.

[0024] According to another aspect of the present application, a computer readable storage medium is provided, which stores computer instructions for enabling a processor to implement a watermark color changing method according to any one of the embodiments of the present application when executed by the processor.

[0025] The technical solution of the embodiments of the present application can obtain the initial background color and the initial watermark color of an image, and then obtain an updated background color after determining that the initial background color has changed, so that the watermark color can be changed when the background color changes, the watermark is prevented from being confused with the background color, the effect of reminding and deterring the user is improved, the tracking of the leaked information is realized, the initial watermark color is adjusted by using the butterfly algorithm, the calculation accuracy is improved, and the best adjusted watermark color can be accurately obtained.

[0026] It should be understood that the content described in this part is not intended to identify key or important features of the embodiments of the present application, nor is it used to limit the scope of the present application. Other features of the present application will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS

[0027] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0028] Figure 1is a flow chart of a watermark color changing method according to the first embodiment of the present application;

[0029] Figure 2 is a flow chart of another watermark color changing method according to the first embodiment of the present application;

[0030] Figure 3 is a schematic diagram of the relationship between switching probability and iteration number according to the first embodiment of the present application;

[0031] Figure 4 is a schematic diagram of the relationship between flight speed and iteration number during global search according to the first embodiment of the present application;

[0032] Figure 5 is a schematic diagram of the relationship between flight speed and iteration number during local search according to the first embodiment of the present application;

[0033] Figure 6 is a flow chart of another watermark color changing method according to the second embodiment of the present application;

[0034] Figure 7 is a structural schematic diagram of a watermark color changing device according to the third embodiment of the present application;

[0035] Figure 8 is a structural schematic diagram of an electronic device implementing a watermark color changing method according to the present application. DETAILED DESCRIPTION

[0036] In order to make the persons skilled in the art better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all the other embodiments obtained by the persons skilled in the art without creative labor should belong to the protection scope of the present application.

[0037] It should be noted that the terms "first", "second", and the like in the description and claims of the application and the above drawings are used to distinguish between similar objects and are not necessarily used to describe a particular sequential or chronological order. It should be understood that the use of such terms as "first", "second", and the like, if used herein, are used to distinguish one object from another, rather than to describe a particular sequential or chronological order. It should be understood that the use of such terms as "first", "second", and the like, if used herein, are used to distinguish one object from another, rather than to describe a particular sequential or chronological order. In addition, the terms "comprise" and "have" and any variations thereof, are intended to cover non-exclusive inclusion, for example, a process, method, system, product or apparatus that includes a list of steps or units as processes, methods, systems, products or apparatuses are not necessarily limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to such processes, methods, products or apparatuses.

[0038] Embodiment one

[0039] Figure 1 A flowchart of a watermark color changing method is provided for the first embodiment of the application. The embodiment can be applied to the case of changing the watermark color when the background color of the image changes. The method can be performed by a watermark color changing device, which can be realized in the form of hardware and / or software, and can be configured in a computer. As shown in Figure 1 The method comprises:

[0040] S110, obtaining the initial background color and the initial watermark color of the image.

[0041] The image refers to the image viewed by the user through the terminal interface. The user refers to the personnel viewing the image. The terminal includes but is not limited to mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers) and PMPs (portable multimedia players). The background color refers to the ground color of the image. The initial background color refers to the ground color of the image of the page first viewed by the user. When the user switches the mode or the background color, the background color will also change. The watermark refers to the logo, information or website address added to the image. The purpose of adding the watermark is to protect the copyright. When the information is leaked, the watermark can also be added to track the information.

[0042] Preferably, a color space coordinate system is established for the image, wherein the color space coordinate system contains three color channels of red, green and blue; the color values contained in the background and the watermark of the image are determined, and the color values are matched with the color channels of the color space coordinate system to obtain the initial background color and the initial watermark color.

[0043] Specifically, the controller establishing a color space coordinate system for the image refers to a three-dimensional space formed by the value range of the Red Green Blue (RGB) model in the coordinate system. The RGB model refers to three color channels of red, green, and blue, which are superimposed to form color. The definition domain of each channel is generally [0, 255], and the value is usually an integer, such as (255, 210, 115).

[0044] Further, after the controller establishes the color space coordinate system, it determines the color values contained in the background and watermark of the image, and matches the color values with each color channel in the color space coordinate system. The obtained coordinate values of each channel are the determined initial background color and initial watermark color. For example, the initial background color can be divided into red, green, and blue color values. The red color value in the initial background color corresponds to a value of 100 in the color channel value domain, the green color value corresponds to a value of 150, and the blue color value corresponds to a value of 250. Therefore, the initial background color is (100, 150, 250). The red color value in the initial watermark color corresponds to a value of 123 in the color channel value domain, the green color value corresponds to a value of 120, and the blue color value corresponds to a value of 241. Therefore, the initial watermark color is (123, 120, 241).

[0045] S120, when the initial background color is determined to change, obtaining an updated background color.

[0046] Specifically, when a user browses an image through a terminal, the user can switch the background color through a default mode or by selecting a background color. The default mode refers to the user switching modes by selecting a default mode. The user can customize the background color by selecting a mode. Mode switching refers to the user adjusting the theme color displayed by the terminal. For example, the user can switch the daytime mode to the night mode by setting. The main tone of the image in the daytime mode is light, while the main tone of the image in the night mode is dark. The initial background color refers to the background color of the image on the first page viewed by the user. When the user switches pages or modes, the initial background color will also change. For example, the initial background color of the initial page is light (100, 50, 85) in the daytime mode, and the initial watermark color is dark (200, 211, 210). After the user switches to the night mode, the background color becomes dark (220, 210, 200) and the initial watermark color is close, which may result in the watermark being unclear. When the user performs a screenshot or photographing operation at this time, the privacy information of the image cannot be protected. Therefore, the controller obtains an updated background color when the initial background color of the image changes.

[0047] S130, dynamically adjusting the initial watermark color according to the updated background color by using the butterfly algorithm to obtain an adjusted watermark color.

[0048] The butterfly algorithm refers to an algorithm for searching a solution space by simulating the behavior of a butterfly sensing odor, mainly including a global search stage of approaching a companion and a local search stage of random movement. When the controller obtains the updated background color, the initial watermark color can be dynamically adjusted according to the updated color. The dynamic adjustment refers to that the controller can timely adjust the watermark color and obtain the adjusted watermark color each time the background color changes.

[0049] Figure 2 A flowchart of a watermark color changing method is provided for the first embodiment of the application, and step S130 mainly includes the following steps S131 to S133:

[0050] S131, solving and obtaining a target watermark color by using the butterfly algorithm according to the initial watermark color.

[0051] Preferably, the current iteration number of the butterfly algorithm is determined, and a random number and a dynamic switching probability value are determined according to the current iteration number. It is determined whether the random number is less than the dynamic switching probability value. If yes, the algorithm corresponding to the global search is selected to obtain the flight speed, otherwise the algorithm corresponding to the local search is selected to obtain the flight speed. The initial watermark color is globally or locally searched by using the butterfly algorithm according to the flight speed, and a search result is obtained. The search result is taken as the target watermark color.

[0052] Specifically, the controller first determines the current iteration number of the butterfly algorithm, and then determines a random number and a dynamic switching probability value according to the current iteration number. This is because the global search and the local search in the butterfly optimization algorithm are randomly switched. For each iteration process, a switching probability is determined according to the iteration number, and the switching probability is used to determine whether the global search or the local search is performed each time. A random number q is randomly generated each time to compare with the switching probability p to determine whether the global search or the local search is performed at this time. The value of the switching probability is related to the current iteration number, that is, the following formula (1) is used:

[0053]

[0054] Wherein, p represents the switching probability, t represents the current iteration number, t max represents the maximum iteration number, and ε represents the adjustment coefficient, which is 0.3 here, and e represents Euler's constant. Further, the controller generates a random number q in each iteration process, 0<q<1. When q<p, the butterfly performs global search, otherwise the butterfly performs local search. Figure 3It is a schematic diagram showing the relationship between the switching probability p and the number of iterations t. Figure 3 The black dots in it represent When the probability of the butterfly performing global search decreases, and the probability of local search increases; When the probability of the butterfly performing global search increases, and the probability of local search decreases. The global search process and the local search process of the butterfly are carried out under dynamically changing probabilities, reducing the "premature convergence" phenomenon and the oscillation problem in the later stage of iteration.

[0055] Specifically, the controller will judge whether the generated random number is less than the calculated dynamic switching probability value. When q < p, the controller will select the algorithm corresponding to global search to obtain the flight speed. When q ≥ p, the controller selects the algorithm corresponding to local search to obtain the flight speed, that is, the flight speed is calculated using the following formula (2):

[0056]

[0057] where, v represents the flight speed, t represents the current number of iterations, tmax represents the maximum number of iterations, m, n, a, b, θ, ω, α and β represent adjustment coefficients, and the adjustment coefficients can be set according to the user's calculation requirements. When q < p, the butterfly performs global search, and when q ≥ p, the butterfly performs local search. Further, after the controller calculates the flight speed, it will perform global search or local search on the initial watermark color using the butterfly algorithm according to the flight speed to obtain the search result, that is, the search result is obtained using the following formula (3):

[0058]

[0059] where, x t+1 i represents the search result, v q<p represents the flight speed in the global search stage, v q≥p represents the flight speed in the local search stage, x t i represents the search result of the i-th butterfly in the t-th iteration, r represents a random number between 0 and 1, g t * represents the optimal search result in the solution space during the t-th iteration process, x t j and x t k represent the search results of the j-th and k-th butterflies randomly selected in the t-th iteration, f i represents the smell emitted by the i-th butterfly, and the smell is calculated using the following formula (4):

[0060] f = cI α (4)

[0061] Where f represents odor; c represents sensory factor, and the domain of c is [0,1]; I represents stimulus intensity; and α represents power exponent, and the domain of α is [0,1].

[0062] Specifically, Figure 4 This is a schematic diagram illustrating the relationship between flight speed and the number of iterations during global search. Figure 5 This is a schematic diagram illustrating the relationship between flight speed and iteration number during local search. Figure 4 and Figure 5 It can be seen that in the early stages of iteration, the global search speed reaches its peak, while the local search speed is relatively low. At this point, the global search probability is higher than the local search probability, allowing the butterfly algorithm to perform a large initial step size for the global search. As the iteration progresses to the midpoint, the global search speed and probability gradually decrease, while the local search speed and probability gradually increase, reaching their peak at the midpoint. This stage allows the global search step size to gradually decrease, preventing premature convergence and the "premature convergence" phenomenon. Simultaneously, the increased local search step size and probability give the iteration a stronger ability to escape local optima. In the later stages of iteration, the global search speed continues to decrease while the probability gradually increases, while the local search speed and probability gradually decrease, achieving a more refined search while avoiding the problem of oscillating around the optimal solution without convergence.

[0063] S132. Based on the updated background color, the optimal and suboptimal solutions for the target watermark color are selected, and the optimal solution is taken as the final watermark color.

[0064] Preferably, the correlation parameters between each target watermark color and the updated background color are calculated, and the correlation parameters are used as the fitness of each target watermark color. The correlation parameters include Euclidean distance, similarity, or Pearson correlation coefficient. The fitness values ​​are sorted in descending order to generate a fitness sequence. The target watermark color corresponding to the first fitness value in the fitness sequence is taken as the optimal solution, and the target watermark color corresponding to the second fitness value in the fitness sequence is taken as the suboptimal solution.

[0065] Specifically, the controller calculates the relevant parameters between each target watermark color and the updated background color, namely Euclidean distance, similarity, or Pearson correlation coefficient. In this embodiment, the Euclidean distance is used as an example for explanation. After calculating the relevant parameters, the controller uses them as the fitness of each target watermark color, that is, the fitness is calculated using the following formula (5):

[0066]

[0067] Where d(x, y) represents fitness, x k Indicates the target watermark color, y kThis represents the updated background color. A higher fitness value indicates a better target watermark color. Therefore, after calculating the fitness of each target watermark color, the controller sorts the fitness values ​​in descending order to generate a fitness sequence. The target watermark color corresponding to the first fitness value in the fitness sequence is taken as the optimal solution, and the target watermark color corresponding to the second fitness value in the fitness sequence is taken as the suboptimal solution.

[0068] S133. Optimize the final watermark color based on the suboptimal solution to obtain the watermark color optimization result, and use the watermark color optimization result to dynamically adjust the initial watermark color to obtain the adjusted watermark color.

[0069] Specifically, the controller optimizes the final watermark color based on the suboptimal solution to compensate for the shortcomings of the butterfly algorithm, which has a long step size and may overshoot the optimal solution, and further solves the problem of easily getting trapped in local optima. The optimized watermark color is then used to dynamically adjust the initial watermark color, so that the user can see different watermark colors that dynamically change for different background colors on the image displayed on the terminal.

[0070] The technical solution of this invention obtains the initial background color and initial watermark color of the image, and then obtains the updated background color after determining that the initial background color has changed. This ensures that the watermark color changes when the background color changes, avoiding confusion with the background color and improving the deterrent effect on users while also tracking leaked information. The butterfly algorithm is used to adjust the initial watermark color, which improves the accuracy of the calculation and can accurately obtain the optimal watermark color.

[0071] Example 2

[0072] Figure 6 This is a flowchart of a watermark color changing method provided in Embodiment 2 of the present invention. Based on Embodiment 1, this embodiment optimizes the final watermark color according to a suboptimal solution to obtain an optimized watermark color result, and uses the optimized watermark color result to dynamically adjust the initial watermark color to obtain the adjusted watermark color. For example... Figure 6 As shown, the method includes:

[0073] S210. Obtain the expected value of the initial watermark color, and perform vertical weighted calculation on the expected value and the final watermark color according to the suboptimal solution to obtain the calculation result.

[0074] Specifically, the controller obtains the expected value of the initial watermark color, and performs a vertical weighted calculation on the expected value and the final watermark color based on the optimal solution to obtain the calculation result, that is, the calculation result is obtained by using the following formula (6):

[0075]

[0076] Among them, g t new Let g represent the calculation result after the t-th iteration optimization. t * Let g represent the optimal solution in the t-th iteration. t sec Let x represent the suboptimal solution in the t-th iteration. t i It is the i-th butterfly randomly selected in the t-th iteration, where t represents the iteration number, μ represents the expected value, and X follows a Gaussian distribution, i.e., X ~ N(μ, σ). 2 P(X) represents the probability density function value of X. When X ≤ μ, the optimal solution and the suboptimal solution are calculated vertically with weights, and when X > μ, the optimal solution and a randomly selected solution are calculated vertically with weights.

[0077] S220. Use the calculation result as the watermark color optimization result.

[0078] Specifically, the controller will use the calculation result of formula (6) as the watermark color optimization result. Through optimization, new mutant individuals can be obtained, the information exchange mechanism between butterfly individuals and the optimal individuals can be improved, the diversity of the population can be enhanced, and the iterative optimization ability can be improved. The effective information contained in the solution vector can be fully utilized, and the potential optimal solution can be searched. The blindness of the search can be reduced, and the shortcomings of the single optimization direction and simple form can be overcome. The shortcomings of the long step size may be overtaken and the disadvantage of being prone to getting trapped in local optima can be further solved.

[0079] S230. Obtain the color values ​​corresponding to red, green and blue in the watermark color optimization results.

[0080] For example, when the watermark color optimization result obtained by the controller is (200, 211, 125), the controller can obtain the color values ​​corresponding to red, green and blue in the watermark color optimization result, that is, the value corresponding to red is 200, the value corresponding to green is 211 and the value corresponding to blue is 125.

[0081] S240. Dynamically adjust the initial watermark color based on the color value to obtain the adjusted watermark color.

[0082] Specifically, the controller dynamically adjusts the initial watermark color based on the color values ​​of each color channel obtained. That is, it adjusts the color value of the initial watermark color to the color values ​​corresponding to red, green and blue in the watermark color optimization result. After the color values ​​are adjusted, the watermark color will change accordingly.

[0083] The technical solution of this invention obtains the initial background color and initial watermark color of an image, and then obtains the updated background color after determining that the initial background color has changed. This ensures that the watermark color changes accordingly when the background color changes, avoiding confusion with the background color and improving the deterrent effect on users while also enabling the tracking of leaked information. The initial watermark color is adjusted using the butterfly algorithm, which improves the accuracy of the calculation. A vertical mutation method based on Gaussian distribution is proposed to better balance the global search process and the local search process, improving the search capability and precision. It can more effectively guide the information exchange between butterfly individuals and search for potential optimal solutions, further reducing the probability that the final solution is a local optimum, so as to accurately obtain the best adjusted watermark color.

[0084] Example 3

[0085] Figure 7 This is a schematic diagram of a watermark color changing device provided in Embodiment 3 of the present invention. Figure 7 As shown, the device includes: an initial watermark color acquisition module 310, used to acquire the initial background color and initial watermark color of the image; an updated background color acquisition module 320, used to acquire the updated background color when it is determined that the initial background color has changed; and a watermark color adjustment module 330, used to dynamically adjust the initial watermark color according to the updated background color using a butterfly algorithm to obtain the adjusted watermark color.

[0086] Preferably, the initial watermark color acquisition module 310 is specifically used for: establishing a color space coordinate system for the image, wherein the color space coordinate system contains three color channels: red, green, and blue; determining the color values ​​contained in the background and watermark of the image; and matching the color values ​​with the color channels of the color space coordinate system to obtain the initial background color and the initial watermark color.

[0087] Preferably, the watermark color adjustment module 330 specifically includes: a target watermark color acquisition unit, used to obtain the target watermark color by solving the initial watermark color using the butterfly algorithm; a watermark color filtering unit, used to filter the optimal and suboptimal solutions for the target watermark color based on the updated background color, and use the optimal solution as the final watermark color; and a watermark color adjustment unit, used to optimize the final watermark color based on the suboptimal solution to obtain the watermark color optimization result, and use the watermark color optimization result to dynamically adjust the initial watermark color to obtain the adjusted watermark color.

[0088] Preferably, the target watermark color acquisition unit is specifically used for: determining the current iteration number of the butterfly algorithm; determining a random number and a dynamic switching probability value based on the current iteration number; determining whether the random number is less than the dynamic switching probability value; if so, selecting the algorithm corresponding to the global search to obtain the flight speed; otherwise, selecting the algorithm corresponding to the local search to obtain the flight speed; performing a global or local search on the initial watermark color using the butterfly algorithm based on the flight speed to obtain the search result; and using the search result as the target watermark color.

[0089] Preferably, the watermark color filtering unit is specifically used for: calculating the correlation parameters between each target watermark color and the updated background color, and using the correlation parameters as the fitness of each target watermark color, wherein the correlation parameters include Euclidean distance, similarity or Pearson correlation coefficient; sorting the fitness in descending order to generate a fitness sequence; taking the target watermark color corresponding to the first fitness in the fitness sequence as the optimal solution, and taking the target watermark color corresponding to the second fitness in the fitness sequence as the suboptimal solution.

[0090] Preferably, the watermark color adjustment unit specifically includes: a watermark color optimization result acquisition subunit, which is used to acquire the expected value of the initial watermark color, perform vertical weighted calculation on the expected value and the final watermark color according to the suboptimal solution to obtain the calculation result, and use the calculation result as the watermark color optimization result.

[0091] Preferably, the watermark color adjustment unit further includes: a watermark color adjustment subunit, used to obtain the color values ​​corresponding to red, green and blue in the watermark color optimization result; and to dynamically adjust the initial watermark color according to the color values ​​to obtain the adjusted watermark color.

[0092] The technical solution of this invention obtains the initial background color and initial watermark color of the image, and then obtains the updated background color after determining that the initial background color has changed. This ensures that the watermark color changes when the background color changes, avoiding confusion with the background color and improving the deterrent effect on users while also tracking leaked information. The butterfly algorithm is used to adjust the initial watermark color, which improves the accuracy of the calculation and can accurately obtain the optimal watermark color.

[0093] The watermark color changing device provided in this embodiment of the invention can execute a watermark color changing method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of executing the method.

[0094] Example 4

[0095] Figure 8A schematic diagram of an electronic device 10 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0096] like Figure 8 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0097] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0098] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as a watermark color changing method.

[0099] In some embodiments, a watermark color changing method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the watermark color changing method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform a watermark color changing method by any other suitable means (e.g., by means of firmware).

[0100] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0101] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0102] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0103] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0104] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0105] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0106] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

[0107] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A method of changing the color of a watermark, characterized by, The method comprises the following steps: acquiring an initial background color and an initial watermark color of an image; acquiring an updated background color when it is determined that the initial background color changes; solving the initial watermark color by using a butterfly algorithm to acquire a target watermark color; screening optimal solutions and suboptimal solutions of the target watermark color according to the updated background color, and taking the optimal solution as a final watermark color; optimizing the final watermark color according to the suboptimal solution to acquire a watermark color optimization result, and dynamically adjusting the initial watermark color by using the watermark color optimization result to acquire an adjusted watermark color; wherein the solving the initial watermark color by using the butterfly algorithm to acquire the target watermark color comprises: determining a current iteration number of the butterfly algorithm, determining a random number and a dynamic switching probability value according to the current iteration number; judging whether the random number is less than the dynamic switching probability value, if yes, selecting a global search corresponding algorithm to acquire a flight speed, otherwise, selecting a local search corresponding algorithm to acquire the flight speed; performing global search or local search on the initial watermark color by using the butterfly algorithm according to the flight speed to acquire a search result; taking the search result as the target watermark color; wherein the flight speed calculation formula is: ; Wherein, v represents the flight speed, t represents the current iteration number, tmax represents the maximum iteration number, m, n, a, b, indicates the adjustment coefficient, p indicates the switching probability, q indicates the random number, q < p, the butterfly performs global search, q ≥ p, the butterfly performs local search.

2. The method of claim 1, wherein, the acquiring the initial background color and the initial watermark color of the image comprises: establishing a color space coordinate system for the image, wherein the color space coordinate system contains three color channels of red, green and blue; determining color values contained in the background and the watermark of the image, and matching the color values with the color channels of the color space coordinate system to acquire the initial background color and the initial watermark color.

3. The method of claim 1, wherein, the screening the optimal solutions and the suboptimal solutions of the target watermark color according to the updated background color comprises: calculating correlation parameters of each target watermark color and the updated background color, and taking the correlation parameters as fitness of each target watermark color, wherein the correlation parameters include Euclidean distance, similarity or Pearson correlation coefficient; sorting the fitness in descending order to generate a fitness sequence; taking a target watermark color corresponding to a first fitness in the fitness sequence as the optimal solution, and taking a target watermark color corresponding to a second fitness in the fitness sequence as the suboptimal solution.

4. The method of claim 3, wherein, the optimizing the final watermark color according to the suboptimal solution to acquire the watermark color optimization result comprises: acquiring an expected value of the initial watermark color, and performing vertical weighted calculation on the expected value and the final watermark color according to the suboptimal solution to obtain a calculation result; taking the calculation result as the watermark color optimization result.

5. The method of claim 4, wherein, the dynamically adjusting the initial watermark color by using the watermark color optimization result to acquire the adjusted watermark color comprises: acquiring color values corresponding to red, green and blue in the watermark color optimization result; dynamically adjusting the initial watermark color according to the color values to acquire the adjusted watermark color.

6. A watermark color changing apparatus, characterized by, The method comprises the following steps: An initial watermark color acquisition module is configured to acquire an initial background color and an initial watermark color of an image. An updated background color acquisition module is configured to acquire an updated background color when it is determined that the initial background color has changed. A watermark color adjustment module is configured to dynamically adjust the initial watermark color according to the updated background color by using a butterfly algorithm to obtain an adjusted watermark color. The watermark color adjustment module specifically includes a target watermark color acquisition unit configured to acquire a target watermark color by solving the butterfly algorithm according to the initial watermark color. A watermark color screening unit is configured to screen the target watermark color for optimal and suboptimal solutions according to the updated background color, and take the optimal solution as a final watermark color. A watermark color adjustment unit is configured to optimize the final watermark color according to the suboptimal solution to obtain a watermark color optimization result, and dynamically adjust the initial watermark color by using the watermark color optimization result to obtain an adjusted watermark color. The target watermark color acquisition unit is specifically configured to determine a current iteration number of the butterfly algorithm, determine a random number and a dynamic switching probability value according to the current iteration number, determine whether the random number is less than the dynamic switching probability value, select a global search corresponding algorithm to obtain a flight speed if yes, otherwise, select a local search corresponding algorithm to obtain the flight speed, perform global search or local search on the initial watermark color by using the butterfly algorithm according to the flight speed to obtain a search result, and take the search result as the target watermark color. The electronic device includes: at least one processor; and a memory connected with the at least one processor in communication; wherein the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the method of any one of claims 1-5. ; Wherein, v represents the flight speed, t represents the current iteration number, tmax represents the maximum iteration number, m, n, a, b, indicates the adjustment coefficient, p indicates the switching probability, q indicates the random number, q < p, the butterfly performs global search, q ≥ p, the butterfly performs local search.

7. An electronic device, comprising: The computer storage medium stores computer instructions for causing the processor to implement the method of any one of claims 1-5 when executed. ​ ​ ​ 8. A computer storage medium, characterized in that ​

Citation Information

Patent Citations

  • Watermark processing method and device

    CN114820267A