Voucher watermark processing method and system, electronic equipment and storage medium
By identifying and adjusting the area of the banking document image and dynamically embedding the watermark image, the problems of information confusion and counterfeiting risks associated with fixed watermark images are solved. This achieves improved watermark anti-counterfeiting capabilities and counterfeit document recognition rates without affecting the readability of the document.
Patent Information
- Application Number
- CN202511033611.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-25
- Publication Date
- 2025-10-28
AI Technical Summary
The fixed watermark images in existing technologies can easily confuse voucher information, reduce readability, and pose a risk of counterfeiting, thus reducing the effectiveness of watermark anti-counterfeiting.
By identifying the background, foreground, and gaze areas of a banking document image, the watermark intensity value is estimated. Based on the watermark intensity value and magnification factor, the pixel values of the background and foreground areas are adjusted, and the watermark image is dynamically embedded into the document to maintain its readability. Furthermore, counterfeit documents are identified through structural similarity comparison.
Without compromising the readability of the voucher, the anti-counterfeiting capabilities of the watermark have been improved, enhancing the identification rate of counterfeit vouchers.
Smart Images

Figure CN120852136A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and specifically to a method, system, electronic device, and storage medium for processing credential watermarks. Background Technology
[0002] In the process of banking transactions, transaction vouchers record detailed information about each transaction and are of great importance in all aspects. Transaction vouchers are susceptible to forgery and alteration; therefore, adding watermarks can be used to prevent counterfeiting.
[0003] Currently, fixed watermark images are typically added to business vouchers. However, on the one hand, fixed watermark images can easily cause customers to confuse the watermark information with the business voucher information when reading information in areas with complex textures, reducing the readability of the business voucher. On the other hand, fixed watermark images are also susceptible to counterfeiting, which reduces the effectiveness of watermark anti-counterfeiting. Summary of the Invention
[0004] In view of this, embodiments of the present invention provide a method, system, electronic device, and storage medium for processing voucher watermarks, in order to solve the problems of reduced readability of business vouchers and reduced effectiveness of watermark anti-counterfeiting that exist in the method of adding fixed watermark images to business vouchers.
[0005] To achieve the above objectives, the embodiments of the present invention provide the following technical solutions:
[0006] The first aspect of this invention discloses a method for processing watermarks on vouchers, the method comprising:
[0007] Acquire a watermark image and a first business voucher image to which a watermark is to be added, wherein the watermark image and the first business voucher image have the same size;
[0008] Identify a first background region, a first foreground region, and a second foreground region in the first business voucher image, wherein the second foreground region includes a business seal region and a gaze region;
[0009] Estimate the first watermark intensity value of each pixel in the watermarked image;
[0010] The pixel values of each pixel in the second foreground region are maintained, and the pixel values of each pixel in the first background region and the first foreground region are adjusted based on the first watermark intensity value and the preset watermark intensity amplification factor, so as to embed the watermark image into the first business voucher image.
[0011] Preferably, adjusting the pixel values of each pixel in the first background region and the first foreground region based on the first watermark intensity value and a preset watermark intensity amplification factor includes:
[0012] Subtract the corresponding first watermark intensity value from the pixel value of each pixel in the first background area;
[0013] The product of the first watermark strength value and the preset watermark strength amplification factor is calculated to obtain the second watermark strength value.
[0014] For each pixel in the first foreground region, the pixel value of the pixel in the first foreground region is adjusted to the maximum of the following two: 0, the difference between the pixel value of the pixel in the first foreground region and the corresponding second watermark intensity value.
[0015] Preferably, identifying the first background region, the first foreground region, and the second foreground region in the first business voucher image includes:
[0016] The first business voucher image is converted into a grayscale image, and a first background region and a first foreground region are divided based on the grayscale image;
[0017] Optical character recognition and color recognition are performed on the first business voucher image to obtain the gaze area and business seal area that constitute the second foreground area.
[0018] Preferably, optical character recognition and color recognition are performed on the first business voucher image to obtain the gaze area and business seal area constituting the second foreground area, including:
[0019] Optical character recognition is performed on the first business voucher image to filter out the numeric region;
[0020] The local center of the local area is selected by aggregating the adjacent numbers in the digital area, and the gaze area is derived based on the visual gaze center point.
[0021] Color recognition is performed on the first business voucher image to extract the pixel positions where the color is in the red hue;
[0022] Connect the outermost pixels with the red hue to obtain the business seal area.
[0023] Preferably, after embedding the watermark image into the first business voucher image, the method further includes:
[0024] The first business voucher image, which embeds the watermark image, is binarized to remove the watermark information, resulting in a second business voucher image that does not contain the watermark image. The second business voucher image is a binary image.
[0025] Based on the first watermark intensity value and the watermark intensity amplification factor, the pixel values of each pixel in the second business voucher image are adjusted to embed the watermark image into the second business voucher image, thereby obtaining a first reconstructed image with the watermark image embedded.
[0026] Calculate the structural similarity between the first business voucher image with the watermarked image embedded and the first reconstructed image;
[0027] Based on the structural similarity between the first business voucher image with the watermarked image embedded and the first reconstructed image, a probability distribution of structural similarity is generated;
[0028] Based on the probability distribution of the structural similarity, it is determined whether the business credential image to be verified, which embeds the watermark image, is a counterfeit credential.
[0029] A second aspect of this invention discloses a voucher watermarking system, the system comprising:
[0030] The acquisition unit is used to acquire a watermark image and a first business voucher image to which a watermark is to be added, wherein the watermark image and the first business voucher image have the same size.
[0031] The recognition unit is used to recognize a first background region, a first foreground region, and a second foreground region in the first business voucher image, wherein the second foreground region includes a business seal region and a gaze region.
[0032] An estimation unit is used to estimate the first watermark intensity value of each pixel in the watermark image;
[0033] An embedding unit is used to maintain the pixel values of each pixel in the second foreground region and adjust the pixel values of each pixel in the first background region and the first foreground region based on the first watermark intensity value and a preset watermark intensity amplification factor, so as to embed the watermark image into the first business voucher image.
[0034] Preferably, the embedding unit includes:
[0035] The first adjustment module is used to subtract the corresponding first watermark intensity value from the pixel value of each pixel in the first background area.
[0036] The calculation module is used to calculate the product between the first watermark strength value and the preset watermark strength amplification factor to obtain the second watermark strength value;
[0037] The second adjustment module is used to adjust the pixel value of each pixel in the first foreground region to the maximum value of the following two: 0, the difference between the pixel value of the pixel in the first foreground region and the corresponding second watermark intensity value.
[0038] Preferably, the identification unit includes:
[0039] The conversion module is used to convert the first business voucher image into a grayscale image, and to divide the grayscale image into a first background region and a first foreground region.
[0040] The recognition module is used to perform optical character recognition and color recognition on the first business voucher image respectively to obtain the gaze area and business seal area that constitute the second foreground area.
[0041] A third aspect of this invention discloses an electronic device, comprising: a processor and a memory, the processor and the memory being connected via a communication bus; wherein, the processor is used to call and execute a program stored in the memory; the memory is used to store the program, the program being used to implement the credential watermarking processing method disclosed in the first aspect of this invention.
[0042] The fourth aspect of the present invention discloses a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the credential watermarking method disclosed in the first aspect of the present invention.
[0043] Based on the above-described embodiments of the present invention, a method, system, electronic device, and storage medium for processing voucher watermarks are provided. The first business voucher image to which the watermark needs to be added is divided into a first background region, a first foreground region, and a second foreground region. The first watermark intensity value of each pixel in the watermark image is estimated. The second foreground region includes a business seal region and a gaze region. During watermark embedding, the pixel values of each pixel in the second foreground region remain unchanged. The pixel values of each pixel in the first background region and the first foreground region are adjusted according to the estimated first watermark intensity value and a watermark intensity amplification factor, thereby embedding the watermark image into the first business voucher image. Without affecting the readability of the business voucher, adjusting the pixels in the background and foreground regions according to the first watermark intensity value and the watermark intensity amplification factor improves the watermark's anti-counterfeiting capability. Attached Figure Description
[0044] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0045] Figure 1 A flowchart of a voucher watermarking method provided in an embodiment of the present invention;
[0046] Figure 2 A flowchart for embedding a voucher watermark is provided in an embodiment of the present invention;
[0047] Figure 3 A flowchart illustrating the comparison process of business voucher images provided in this embodiment of the invention;
[0048] Figure 4 This is a structural block diagram of a voucher watermarking system provided in an embodiment of the present invention. Detailed Implementation
[0049] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0050] In this application, the terms "comprising," "including," or any other variations thereof are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0051] In the process of banking transactions, transaction vouchers record detailed information about each transaction and are of great importance in recording financial status, monitoring fund flows, protecting rights, and collecting evidence. Transaction vouchers have legal effect and are subject to forgery and alteration. At the same time, transaction vouchers are also one of the ways banks promote themselves externally. Adding a watermark with corporate characteristics to the vouchers can both enhance the bank's image and serve as a security measure against counterfeiting.
[0052] In current practices, fixed watermark images are usually added to business vouchers. However, on the one hand, fixed watermark images can easily cause customers to confuse watermark information with business voucher information when reading information in complex areas of the voucher, reducing the readability of the business voucher. On the other hand, fixed watermark images are also susceptible to counterfeiting, which also reduces the effectiveness of watermark anti-counterfeiting.
[0053] Research has found that after a successful banking transaction, the transaction details, amount, customer information, and other business elements are often recorded in the form of a voucher. This voucher has legal effect and plays an important role in subsequent consumer rights protection and in banks retaining transaction evidence. Existing vouchers often rely on official seals for anti-counterfeiting, but this method is limited and susceptible to forgery and alteration. Some vouchers additionally use fixed watermarks for corporate promotion and anti-counterfeiting purposes; however, for media like banking vouchers that contain key textual elements such as amounts and customer information, fixed watermark images can create areas with high textural complexity, confusing the watermark information with the information on the voucher itself and significantly reducing readability.
[0054] To address the aforementioned issues, this solution proposes a method, system, electronic device, and storage medium for processing watermarked vouchers. The first business voucher image to be watermarked is divided into a first background region, a first foreground region, and a second foreground region. The first watermark intensity value of each pixel in the watermark image is estimated. The second foreground region includes the business seal area and the gaze area. During watermark embedding, the pixel values of each pixel in the second foreground region remain unchanged. The pixel values of each pixel in the first background region and the first foreground region are adjusted according to the estimated first watermark intensity value and a watermark intensity amplification factor, thereby embedding the watermark image into the first business voucher image. Without affecting the readability of the business voucher, adjusting the pixels in the background and foreground regions according to the first watermark intensity value and the watermark intensity amplification factor improves the watermark's anti-counterfeiting capability.
[0055] Overall, this solution addresses the characteristic that visual systems are insensitive to subtle pixel brightness differences in images by dynamically embedding watermarks into banking documents. This ensures that the embedded watermark information does not affect the readability of the main content of the banking document. Simultaneously, for the original banking document with embedded watermarks, the watermark is removed using image binary segmentation. Then, the watermark is reapplied to the watermark-free document and compared with the original watermarked document. By comparing the similarity between the two, it is determined whether the original watermarked document is counterfeit, thus increasing the detection rate of counterfeit and altered documents. The following detailed descriptions of various embodiments further illustrate this solution.
[0056] See Figure 1The flowchart illustrates a method for processing voucher watermarks according to an embodiment of the present invention. The method includes:
[0057] Step S101: Obtain the watermark image and the first business voucher image to which the watermark is to be added.
[0058] In the specific implementation step S101, a watermark image and a first business document image (such as a bank business document image) to which the watermark is to be added are obtained, and the watermark image and the first business document image have the same size.
[0059] It is understandable that the watermark image with the same size as the first business voucher image is obtained by copying and filling the original watermark image. Specifically, by copying and filling the original watermark image, a watermark image of the same size as the first business voucher image can be obtained.
[0060] Step S102: Identify the first background region, the first foreground region, and the second foreground region in the first business voucher image.
[0061] It should be noted that business vouchers mainly consist of text characters (transaction amount), table borders, and business seals. From an image feature perspective, these parts of business voucher images are characterized by sharp edges and high texture complexity. In addition, business vouchers often have large areas of background color, and apart from a few areas such as the seal, the remaining areas consist only of white, black, and gray.
[0062] From a semantic perspective, business voucher images contain a large amount of high-level semantic information, especially numerical areas such as amount and transaction time. The visual system pays significantly more attention to these areas than other areas.
[0063] Based on the image and semantic features of the business voucher, this solution requires distinguishing the background area from the text and border areas of the business voucher image and estimating the strength of the embedded watermark for each. For areas of high visual system attention, such as amount and transaction time, and for key business areas such as seals, it is necessary to exclude the influence of the watermark on these areas.
[0064] In the specific implementation step S102, the first business voucher image is converted into a grayscale image, and the first background region and the first foreground region are divided based on the grayscale image.
[0065] Specifically, by extracting the luminance component, the first business voucher image is converted into a grayscale image, and then the grayscale image is segmented based on visual system features to divide the first background region and the first foreground region.
[0066] Optical character recognition and color recognition are performed on the first business voucher image to obtain the gaze area (high-sensitivity gaze area) and the business seal area that constitute the second foreground area. The second foreground area includes the business seal area and the gaze area.
[0067] It should be noted that the first foreground area and the second foreground area constitute the overall foreground area of the first business voucher image. The second foreground area includes the gaze area (high-sensitivity gaze area) and the business seal area. The first foreground area is any other foreground area besides the second foreground area.
[0068] In some specific embodiments, the specific implementation of obtaining the gaze area and the business seal area is as follows: optical character recognition is performed on the first business voucher image to filter out the digital area; neighboring numbers in the digital area are aggregated to select the center of the local area as the visual gaze center point, and the gaze area is derived based on the visual gaze center point;
[0069] Color recognition is performed on the first business voucher image to extract the pixel positions where the color is in the red hue; the outermost edge of the pixel positions where the color is in the red hue is connected to obtain the business seal area.
[0070] The following sections detail how to distinguish between the background area, foreground area, gaze area, and stamp area:
[0071] From the perspective of human eye structure, the retina is mainly composed of "rod cells with poor light resolution" and "cone cells with strong light sensitivity and photoreceptivity". Cone cells are mainly concentrated in the fovea region of the retina, which is the visual fixation area.
[0072] Intuitively, areas of intense visual fixation are more perceptible to distortion. Conversely, image portions further from the fixation area, due to the lower sensitivity of rod cells, are more tolerant of distortion. The human eye is most sensitive to distortion within a 10-degree radius of the line of sight. Within this 10-degree cone-shaped region, the visual system exhibits high sensitivity. Therefore, when distinguishing between background and foreground areas perceived by the visual system, the presence of text, borders, or other information within a few pixels of the fixation point can be used as features for image segmentation.
[0073] When performing region differentiation, first estimate the pixel width of the high-sensitivity region (such as the business seal region and the gaze region) when the vision system gazes at the business voucher image. The angle between a certain position of the vision system gazing at the business voucher image and the perpendicular line from the vision system to the image plane (usually approximated as the vision system and the center point of the image) can be expressed as formula (1).
[0074] (1);
[0075] In formula (1), D represents the vertical distance between the visual system and the image plane, and d represents the distance between the center point of the image and the current gaze point.
[0076] From the content of formula (1), the absolute distance (denoted as d) of the position at 10 degrees from the center of gaze on the business voucher image (hereinafter referred to as the image) can be derived. r ) can be estimated using formula (2).
[0077] (2);
[0078] Based on formula (2), the maximum pixel distance (denoted as d) from the fixation center point on the image at a position 10 degrees from the gaze point is... p ) can be derived from formula (3).
[0079] (3);
[0080] In formula (3), D T p represents the vertical length of the image. T This indicates the resolution of the image in the vertical direction. (d) p Different values can be selected depending on the scenario (e.g., A4 voucher, A5 voucher), printing resolution, etc. For example, in this solution, d p It can be fixed to a length of 32 pixels.
[0081] When dividing the background and foreground regions of a business voucher image, the foreground region is determined by image features within a circular region where the current pixel is less than 32 pixels away from the background. Specifically, if a pixel brightness value (i.e., pixel value, also known as pixel luminance) within this circular region is not equal to the background brightness, the visual system can perceive text and borders within this circular region, which is then designated as the foreground region S. FT Conversely, the circular area is the background area S. BG .
[0082] The most significant difference between bank transaction document images and natural images lies in the fact that, in addition to elements such as brightness and contrast, transaction document images also contain higher-level semantic information such as customer information and transaction contract names, as well as areas with red-colored seals. Particular attention is paid to numerical values such as amounts and transaction dates, and the visual system focuses on these areas far more than on background and foreground areas. To address this characteristic of transaction document scenarios, the numerical areas and the business seal areas are processed separately:
[0083] 1. By using Optical Character Recognition (OCR) to filter the numerical regions such as amount and transaction date in the business voucher image, and aggregating adjacent numbers to select the center of the local region as the visual gaze center point, the gaze region (high-sensitivity gaze region, denoted as S) is derived according to the above formula (3). NUM ).
[0084] 2. Extract the RGB components of the pixel positions in the business voucher image, extracting the pixels with red hues. Then, connect the outermost edges of these red-hue pixels; the area enclosed by the connection is the business seal area (denoted as S). SEAL ).
[0085] For the gaze region S identified above NUM and business seal area S SEAL These two areas contain information of high interest or important business information. During the watermarking process, the watermark intensity of these two areas is set to 0, and these two areas remain in the state before the watermark is added (this will be explained in the subsequent step S104).
[0086] The above is an explanation of how to distinguish between the background area, foreground area, gaze area, and stamp area.
[0087] Step S103: Estimate the first watermark intensity value of each pixel in the watermark image.
[0088] It should be noted that the original watermark image can be represented as a fixed-size binary image, where a pixel value of 0 (the lowest pixel brightness value) represents the watermark foreground, and a pixel value of 255 (the highest pixel brightness value) represents the watermark background. By copying and filling the original watermark image, a watermark image Q(z) of the same size as the first business voucher image can be obtained, where z represents the pixel position, and each pixel position corresponds to one pixel.
[0089] In the specific implementation step S103, the first watermark intensity value Q of each pixel in the watermark image Q(z) is estimated using formula (4). J (z), the first watermark intensity value is the watermark intensity of the background area.
[0090] (4);
[0091] In formula (4), J BG This represents the background watermark intensity value.
[0092] When embedding the watermark, the first watermark strength value Q is... J The process of embedding the background image B(z) into (z) is shown in formula (5).
[0093] BJ (z) = B(z) - Q J (z)(5;
[0094] In formula (5), B J (z) is the value of the first watermark intensity Q embedded into the background image B(z). J The result obtained by (z) is equivalent to embedding a watermark image into the background image B(z). Specifically, B(z) can represent the pixel value of the pixel at pixel position z in the background image. The other parameters are similar and will not be explained one by one.
[0095] In banking document processing scenarios, B(z) is typically a large pixel value (e.g., a white background with a brightness of 255 pixels and a background watermark intensity value of J). BG (For a small value), that is, the background image B(z) is equivalent to a pure white background image, which ensures that B(z) is greater than J. BG .
[0096] It should be noted that J BG The experiment involved inviting participants of various ages (e.g., 15 participants from each age group) and selecting four background image brightness values of 255, 235, 215, and 195 pixels. The intensity of the embedded watermark was varied, and the watermark intensity at which it was just visually recognizable was recorded. Linear fitting was then performed to obtain the watermark intensity that could be used to calculate J. BG Formula (6).
[0097] (6);
[0098] In formula (6), k represents pixel depth. Taking 8-bit pixel depth as an example, when the background is pure white, the watermark intensity is 1 pixel brightness, that is, the brightness of the watermark area is 254 and the brightness of the non-watermark area is 255. It can be seen that the visual system is highly sensitive to the background area and the watermark intensity that can be embedded is also low.
[0099] Step S104: Maintain the pixel values of each pixel in the second foreground region, and adjust the pixel values of each pixel in the first background region and the first foreground region based on the first watermark intensity value and the preset watermark intensity amplification factor, so as to embed the watermark image into the first business voucher image.
[0100] It should be noted that, as can be seen from the content of step S102 above, the second foreground area includes two parts: the business stamp area and the attention area. These two parts contain high-attention information or important business information. During the process of adding watermarks, the watermark intensity of these two parts is set to 0, that is, these two parts maintain the state before adding watermarks.
[0101] In the specific implementation step S104, the pixel values of each pixel in the second foreground region are maintained (maintaining the state before adding the watermark), based on the first watermark intensity value and the watermark intensity amplification factor (denoted as k). BG Adjust the pixel values of each pixel in the first background area and the first foreground area to embed the watermark image into the first business voucher image. The first business voucher image with the added watermark image does not affect the readability of the content in the second foreground area.
[0102] In some specific embodiments, the specific implementation of adjusting the pixel values of each pixel in the first background area and the first foreground area is as follows: subtract the corresponding first watermark intensity value from the pixel value of each pixel in the first background area.
[0103] Specifically, the watermark image is the same size as the first business voucher image. For each pixel in the first background region, the pixel value of the pixel at that pixel position in the first background region is subtracted from the "first watermark intensity value of the pixel at the same pixel position in the watermark image", thereby realizing the watermark embedding in the first background region.
[0104] It should be noted that the first watermark intensity value corresponding to "a certain pixel in the first background region" specifically refers to the first watermark intensity value of the pixel at the same pixel position in the watermark image.
[0105] It should be noted that the foreground watermark embedding method used in this scheme is as follows: based on the already embedded background watermark, a watermark intensity amplification factor (k) is added to the foreground watermark. BG The process involves synthesizing watermark images with different watermark intensity amplification factors. When the pixel value of the original image minus the watermark intensity value of the watermark image is less than 0, the watermark intensity value of the watermark image is fixed at 0 to prevent negative pixels. The intensity of the watermark intensity amplification factor is estimated experimentally. For common business voucher images with white background (255 pixel brightness) and black text (0 pixel brightness), the watermark intensity amplification factor (k...) is... BG ) can be set to 20 (example only).
[0106] Based on the aforementioned foreground area watermark embedding method, the first watermark intensity value and the preset watermark intensity amplification factor (k) are calculated. BG The product of the two values is used to obtain the second watermark strength value;
[0107] For each pixel in the first foreground region, the pixel value of the pixel in the first foreground region is adjusted to the maximum of the following two values: 0, the difference between the pixel value of the pixel in the first foreground region and the corresponding second watermark intensity value.
[0108] In other words, for each pixel in the first foreground region, the pixel value of the pixel in the first foreground region is adjusted to max(0, pixel value - second watermark intensity value), thereby realizing the watermark embedding in the first foreground region.
[0109] In general, the watermark image can be embedded in the first business voucher image in the manner shown in formula (7).
[0110] (7);
[0111] In formula (7), S BG As the first background area, S NUM S is the area of focus. SEAL This is the area for business seals, therefore Characterizes the pixel position in the second foreground region. Characterizes the pixel position in the first foreground region.
[0112] k BG Q is the watermark intensity amplification factor. J (z) represents the first watermark strength value. I(z) represents the first business document image before the watermark image is embedded. J (z) is the first business voucher image after the watermark image has been embedded.
[0113] z represents the pixel position, and I(z) specifically represents the pixel value of the pixel at pixel position z in the first business document image before embedding the watermark image, Q J (z) specifically represents the first watermark intensity value of the pixel at position z, I J (z) Similarly, it will not be elaborated here.
[0114] In this embodiment of the invention, the first business document image to be watermarked is divided into a first background region, a first foreground region, and a second foreground region. The first watermark intensity value of each pixel in the watermark image is estimated. The second foreground region includes a business seal region and a gaze region. During watermark embedding, the pixel values of each pixel in the second foreground region remain unchanged. The pixel values of each pixel in the first background region and the first foreground region are adjusted according to the estimated first watermark intensity value and a watermark intensity amplification factor, thereby embedding the watermark image into the first business document image. Without affecting the readability of the business document, adjusting the pixels in the background and foreground regions according to the first watermark intensity value and the watermark intensity amplification factor improves the watermark's anti-counterfeiting capability.
[0115] To better understand the overall process of watermark embedding, the following will explain... Figure 2 The flowchart shown illustrates the watermark embedding process from an overall perspective. Figure 2 This includes steps S201 to S207.
[0116] The overall process of watermark embedding mainly consists of two parts: the first part consists of steps S201 to S204, and the second part consists of steps S205 to S207.
[0117] Step S201: Extract the luminance component from the bank voucher image to obtain a grayscale image. Then, segment the grayscale image based on visual system features to obtain the background and foreground regions.
[0118] It should be noted that the bank voucher image in this example is the first business voucher image before the watermark is embedded in the above-mentioned solution, the background area is the first background area, and the foreground area is the first foreground area.
[0119] Step S202: Estimate the watermark intensity in the background area.
[0120] It should be noted that the watermark intensity in the background area is the first watermark intensity value.
[0121] Step S203: Determine the watermark intensity amplification factor.
[0122] Step S204: Embed watermarks in the background and foreground areas.
[0123] Step S205: OCR identifies and filters the digit region, and aggregates the neighboring digits to select the center of the local region as the visual gaze center point, thus deriving the gaze region.
[0124] Step S206: Color recognition, identifying the business seal area.
[0125] Step S207: Set the watermark intensity of the gaze area and the business seal area to 0.
[0126] It should be noted that "setting the watermark intensity of the gaze area and the business seal area to 0" means keeping the pixel values of each pixel in the gaze area and the business seal area unchanged.
[0127] By integrating the results obtained from steps S204 and S207, a bank voucher watermark image can be obtained, which is the first business voucher image with the watermark image embedded.
[0128] It should be noted that the execution principle of steps S201 to S207 above can be found in the above embodiments of the present invention. Figure 1 The contents of that document will not be repeated here.
[0129] In practical applications, after receiving a business voucher image with an embedded watermark, the received "business voucher image with embedded watermark" may be a forged or altered voucher, or it may be a genuine and valid voucher. This requires comparing the received "business voucher image" to verify whether the "business voucher image" is genuine and valid.
[0130] This solution also proposes a corresponding comparison method for business credential images with embedded watermarks, as detailed in [link to relevant documentation]. Figure 3 The flowchart shown is a comparison process for business document images. Figure 3 Includes the following steps:
[0131] Step S301: Binarize the first business voucher image with the embedded watermark image to remove the watermark information, and obtain a second business voucher image without the watermark image.
[0132] It should be noted that, through the above embodiments of the present invention Figure 1 The "first business voucher image with embedded watermark" obtained by the processing method is a confirmed, genuine, and valid business voucher image with embedded watermark.
[0133] In the specific implementation step S301, the first business voucher image with the embedded watermark image is binarized to remove the watermark information, resulting in a second business voucher image without the watermark image. The second business voucher image without the watermark image can be equivalent to "the original first business voucher image I(z) without the embedded watermark". The second business voucher image is a binary image.
[0134] Specifically, for the first business voucher image I that incorporates a watermark image using this scheme... J (z), since most of its area consists of text and borders, it can be represented by I in the following way. J Estimation is performed on the original image of (z) (the first business document image I(z) without embedded watermark):
[0135] First, regarding I J (z) Perform OCR and color recognition to filter out the corresponding gaze area and business seal area. Then, use a binary method to distinguish the foreground and background areas. Pixel brightness greater than 127 is considered a background area and is uniformly fixed at a background brightness (e.g., 255 pixel brightness); pixel brightness less than 127 is considered a foreground area and is uniformly fixed at a text brightness (e.g., 0 pixel brightness). The binary image I can be obtained through the aforementioned method. B (z), the binary image I B (z) is the second business voucher image that does not contain a watermark image.
[0136] It's important to note that although business vouchers mostly consist of text and borders, there's still a transition color between the text borders and the background. This means the text area isn't a simple binary image; for example, there's a transition area with a pixel brightness of 200 between black regular script characters and the background. Therefore, image binarization can be used to remove watermark information, thus roughly estimating the I... J The original image of (z).
[0137] Step S302: Based on the first watermark intensity value and the watermark intensity amplification factor, adjust the pixel values of each pixel in the second business voucher image to embed the watermark image into the second business voucher image, thereby obtaining a first reconstructed image with the watermark image embedded.
[0138] In the specific implementation step S302, the second business voucher image I is adjusted based on the first watermark strength value and the watermark strength amplification factor. B The pixel values of each pixel in (z) are used to embed the watermark image into the second business voucher image, thus obtaining the first reconstructed image I with the watermark image embedded. BJ (z). The first reconstructed image is equivalent to the second business voucher image with the watermark image embedded.
[0139] Specifically, the above-described embodiments of the present invention can be adopted. Figure 1 The processing method in step S104 is to adjust the second business voucher image I. B The pixel values of each pixel in (z) are used to obtain the first reconstructed image I with the watermark embedded. BJ (z).
[0140] Step S303: Calculate the structural similarity between the first business voucher image with the embedded watermark image and the first reconstructed image.
[0141] It should be noted that, considering the second business voucher image I B Image (z) is not completely identical to "the first business voucher image I(z) without watermark embedding". Therefore, the watermarked voucher images obtained after embedding watermarked images in the two images are not completely identical. Thus, this scheme uses structural similarity (SSIM) to estimate "the first business voucher image I(z) with watermark embedded". J (z)” and “the first reconstructed image I with embedded watermark image” BJ The similarity between (z)”, where the SSIM value can be calculated by formula (8).
[0142] (8);
[0143] In formula (8), k JFor "the first business voucher image I with embedded watermark image" J The pixel average value of (z), k BJ For "the first reconstructed image I with embedded watermark image" BJ The pixel average value of (z), h J For I J The variance of (z), h BJ For I BJ (z) variance, h JBJ For I J (z) and I BJ The covariance between (z).
[0144] In the specific implementation step S303, the structural similarity between the first business voucher image with embedded watermark image and the first reconstructed image is calculated using the above formula (8).
[0145] In practical applications, multiple samples employing the above-described embodiments of the present invention are collected in advance. Figure 1 The processing method generates a "first business voucher image with embedded watermark image" (which has been confirmed to be real and valid). Then, the structural similarity between each "first business voucher image with embedded watermark image" and its corresponding "first reconstructed image" is calculated using the above formula (8). Multiple structural similarities can be calculated.
[0146] Step S304: Generate a probability distribution of structural similarity based on the structural similarity between the first business voucher image with embedded watermark image and the first reconstructed image.
[0147] In the specific implementation step S304, based on the structural similarity (SSIM) between each confirmed genuine and valid "first business voucher image embedded with watermark image" and its corresponding "first reconstructed image", a probability distribution of structural similarity (denoted as p) is generated. SSIM ).
[0148] Specifically, this solution involves statistically analyzing each confirmed authentic and valid "first business voucher image I embedded with a watermark image". J (z)” and “First reconstructed image I” BJ The probability distribution p of SSIM between (z)” SSIM Thus, the comparison feature function is obtained.
[0149] Step S305: Based on the probability distribution of structural similarity, determine whether the business voucher image to be verified, which has an embedded watermark image, is a counterfeit voucher.
[0150] In the specific implementation step S305, for the business credential image to be verified that embeds a watermark image, the probability distribution p of the structural similarity generated above is used. SSIMIt determines whether the business voucher image to be verified, which has an embedded watermark image, is a forged voucher (or an altered voucher).
[0151] Specifically, for a business credential image to be verified that has an embedded watermark image, the image is binarized to remove the watermark information, resulting in a third business credential image that does not contain a watermark image.
[0152] Based on the first watermark intensity value and the watermark intensity amplification factor, the pixel values of each pixel in the third business voucher image are adjusted to embed the watermark image into the third business voucher image, resulting in a second reconstructed image with the watermark image embedded.
[0153] It should be noted that the method for embedding the watermark image into the third business voucher image can be found in the above-described embodiments of the present invention. Figure 1 The processing method of step S104 will not be described in detail here.
[0154] Using the formula (8) above, the structural similarity between the "business voucher image to be verified" and the "second reconstructed image" is calculated (denoted as SSIM). c ).
[0155] SSIM (Structural Similarity Study) between the "Image of Business Credentials to be Verified" and the "Second Reconstructed Image" c With probability distribution p SSIM Compare and calculate when the probability distribution p SSIM SSIM in the range is less than or equal to SSIM c The probability of time Specifically, it can be calculated using formula (9) when SSIM is less than or equal to SSIM. c The probability of time .
[0156] (9);
[0157] It should be noted that, =Confidence level; calculated Then, the confidence level of the business credential image to be verified can be determined.
[0158] When the confidence level of the business voucher image to be verified is less than a specified threshold, it can be determined that the business voucher image to be verified is a forged or altered voucher; otherwise, it can be determined that the business voucher image to be verified is genuine and valid.
[0159] The above embodiments of the present invention Figure 3 This is an explanation of the comparison method for business voucher images.
[0160] Corresponding to the watermark processing method for vouchers provided in the above embodiments of the present invention, see also... Figure 4 The present invention also provides a structural block diagram of a voucher watermarking system, which includes: an acquisition unit 100, an identification unit 200, an estimation unit 300, and an embedding unit 400.
[0161] The acquisition unit 100 is used to acquire a watermark image and a first business voucher image to which a watermark is to be added, wherein the watermark image and the first business voucher image have the same size.
[0162] The recognition unit 200 is used to recognize a first background region, a first foreground region, and a second foreground region in a first business document image. The second foreground region includes a business seal region and a gaze region.
[0163] The estimation unit 300 is used to estimate the first watermark intensity value of each pixel in the watermark image.
[0164] The embedding unit 400 is used to maintain the pixel values of each pixel in the second foreground region and adjust the pixel values of each pixel in the first background region and the first foreground region based on the first watermark intensity value and the preset watermark intensity amplification factor, so as to embed the watermark image into the first business voucher image.
[0165] In this embodiment of the invention, the first business document image to be watermarked is divided into a first background region, a first foreground region, and a second foreground region. The first watermark intensity value of each pixel in the watermark image is estimated. The second foreground region includes a business seal region and a gaze region. During watermark embedding, the pixel values of each pixel in the second foreground region remain unchanged. The pixel values of each pixel in the first background region and the first foreground region are adjusted according to the estimated first watermark intensity value and a watermark intensity amplification factor, thereby embedding the watermark image into the first business document image. Without affecting the readability of the business document, adjusting the pixels in the background and foreground regions according to the first watermark intensity value and the watermark intensity amplification factor improves the watermark's anti-counterfeiting capability.
[0166] Preferred, combined Figure 4 The embedded unit 400, as shown, includes a first adjustment module, a calculation module, and a second adjustment module. The execution principle of each module is as follows:
[0167] The first adjustment module is used to subtract the corresponding first watermark intensity value from the pixel value of each pixel in the first background area.
[0168] The calculation module is used to calculate the product between the first watermark intensity value and the preset watermark intensity amplification factor to obtain the second watermark intensity value.
[0169] The second adjustment module is used to adjust the pixel value of each pixel in the first foreground region to the maximum of the following two values: 0, the difference between the pixel value of the pixel in the first foreground region and the corresponding second watermark intensity value.
[0170] Preferred, combined Figure 4 The content shown indicates that the recognition unit 200 includes a conversion module and a recognition module, and the execution principle of each module is as follows:
[0171] The conversion module is used to convert the first business voucher image into a grayscale image, and to divide the first background region and the first foreground region based on the grayscale image.
[0172] The recognition module is used to perform optical character recognition and color recognition on the first business voucher image to obtain the gaze area and business seal area that constitute the second foreground area.
[0173] In the specific implementation, the recognition module is used to: perform optical character recognition on the first business voucher image and filter out the digital area; aggregate the adjacent numbers in the digital area to select the center of the local area as the visual gaze center point, and deduce the gaze area based on the visual gaze center point; perform color recognition on the first business voucher image and extract the pixel positions where the color is in the red hue; connect the outermost of the pixel positions where the color is in the red hue to obtain the business seal area.
[0174] Preferred, combined Figure 4 The document watermarking system, as shown, also includes:
[0175] The watermark removal unit is used to perform binarization processing on the first business voucher image with the embedded watermark image to remove the watermark information when a voucher verification instruction is received, so as to obtain a second business voucher image without the watermark image. The second business voucher image is a binary image.
[0176] The reconstruction unit is used to adjust the pixel values of each pixel in the second business document image based on the first watermark intensity value and the watermark intensity amplification factor in order to embed the watermark image into the second business document image, thereby obtaining a first reconstructed image with the watermark image embedded.
[0177] The calculation unit is used to calculate the structural similarity between the first business voucher image with the watermarked image embedded and the first reconstructed image.
[0178] The generation unit is used to generate a probability distribution of structural similarity based on the structural similarity between the first business voucher image with the embedded watermark image and the first reconstructed image.
[0179] The determination unit is used to determine whether a business voucher image with an embedded watermark image is a counterfeit voucher based on the probability distribution of structural similarity.
[0180] Preferably, the present invention also provides an electronic device, including: a processor and a memory, the processor and the memory being connected via a communication bus; wherein, the processor is used to call and execute a program stored in the memory; the memory is used to store the program, the program being used to implement the credential watermarking processing method provided in the above method embodiments.
[0181] Preferably, the present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the credential watermarking method provided in the above-described method embodiments.
[0182] In summary, this invention provides a method, system, electronic device, and storage medium for processing watermarked vouchers. The method divides a first business voucher image to be watermarked into a first background region, a first foreground region, and a second foreground region. It also estimates the first watermark intensity value for each pixel in the watermark image. The second foreground region includes a business seal area and a gaze area. During watermark embedding, the pixel values of each pixel in the second foreground region remain unchanged. The pixel values of each pixel in the first background region and the first foreground region are adjusted according to the estimated first watermark intensity value and a watermark intensity amplification factor, thereby embedding the watermark image into the first business voucher image. Without affecting the readability of the business voucher, adjusting the pixels in the background and foreground regions according to the first watermark intensity value and the watermark intensity amplification factor improves the anti-counterfeiting capability of the watermark.
[0183] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, for system or system embodiments, since they are basically similar to method embodiments, the description is relatively simple, and relevant parts can be referred to the descriptions in the method embodiments. The systems and system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0184] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0185] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. 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 scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for processing watermarks on vouchers, characterized in that, The method comprises: Acquire a watermark image and a first business voucher image to which a watermark is to be added, wherein the watermark image and the first business voucher image have the same size; Identify a first background region, a first foreground region, and a second foreground region in the first business voucher image, wherein the second foreground region includes a business seal region and a gaze region; Estimate the first watermark intensity value of each pixel in the watermarked image; The pixel values of each pixel in the second foreground region are maintained, and the pixel values of each pixel in the first background region and the first foreground region are adjusted based on the first watermark intensity value and the preset watermark intensity amplification factor, so as to embed the watermark image into the first business voucher image.
2. The method according to claim 1, characterized in that, Adjusting the pixel values of each pixel in the first background region and the first foreground region based on the first watermark intensity value and a preset watermark intensity amplification factor includes: Subtract the corresponding first watermark intensity value from the pixel value of each pixel in the first background area; The product of the first watermark strength value and the preset watermark strength amplification factor is calculated to obtain the second watermark strength value. For each pixel in the first foreground region, the pixel value of the pixel in the first foreground region is adjusted to the maximum of the following two: 0, the difference between the pixel value of the pixel in the first foreground region and the corresponding second watermark intensity value.
3. The method according to claim 1, characterized in that, Identifying a first background region, a first foreground region, and a second foreground region in the first business voucher image includes: The first business voucher image is converted into a grayscale image, and a first background region and a first foreground region are divided based on the grayscale image; Optical character recognition and color recognition are performed on the first business voucher image to obtain the gaze area and business seal area that constitute the second foreground area.
4. The method according to claim 3, characterized in that, Optical character recognition and color recognition are performed on the first business voucher image respectively to obtain the gaze area and business seal area constituting the second foreground area, including: Optical character recognition is performed on the first business voucher image to filter out the numeric region; The local center of the local area is selected by aggregating the adjacent numbers in the digital area, and the gaze area is derived based on the visual gaze center point. Color recognition is performed on the first business voucher image to extract the pixel positions where the color is in the red hue; Connect the outermost pixels with the red hue to obtain the business seal area.
5. The method according to any one of claims 1-4, characterized in that, After embedding the watermark image into the first business voucher image, the method further includes: The first business voucher image, which embeds the watermark image, is binarized to remove the watermark information, resulting in a second business voucher image that does not contain the watermark image. The second business voucher image is a binary image. Based on the first watermark intensity value and the watermark intensity amplification factor, the pixel values of each pixel in the second business voucher image are adjusted to embed the watermark image into the second business voucher image, thereby obtaining a first reconstructed image with the watermark image embedded. Calculate the structural similarity between the first business voucher image with the watermarked image embedded and the first reconstructed image; Based on the structural similarity between the first business voucher image with the watermarked image embedded and the first reconstructed image, a probability distribution of structural similarity is generated; Based on the probability distribution of the structural similarity, it is determined whether the business credential image to be verified, which embeds the watermark image, is a counterfeit credential.
6. A voucher watermarking system, characterized in that, The system includes: The acquisition unit is used to acquire a watermark image and a first business voucher image to which a watermark is to be added, wherein the watermark image and the first business voucher image have the same size. The recognition unit is used to recognize a first background region, a first foreground region, and a second foreground region in the first business voucher image, wherein the second foreground region includes a business seal region and a gaze region. An estimation unit is used to estimate the first watermark intensity value of each pixel in the watermark image; An embedding unit is used to maintain the pixel values of each pixel in the second foreground region and adjust the pixel values of each pixel in the first background region and the first foreground region based on the first watermark intensity value and a preset watermark intensity amplification factor, so as to embed the watermark image into the first business voucher image.
7. The system according to claim 6, characterized in that, The embedding unit includes: The first adjustment module is used to subtract the corresponding first watermark intensity value from the pixel value of each pixel in the first background area. The calculation module is used to calculate the product between the first watermark strength value and the preset watermark strength amplification factor to obtain the second watermark strength value; The second adjustment module is used to adjust the pixel value of each pixel in the first foreground region to the maximum value of the following two: 0, the difference between the pixel value of the pixel in the first foreground region and the corresponding second watermark intensity value.
8. The system according to claim 6, characterized in that, The identification unit includes: The conversion module is used to convert the first business voucher image into a grayscale image, and to divide the grayscale image into a first background region and a first foreground region. The recognition module is used to perform optical character recognition and color recognition on the first business voucher image respectively to obtain the gaze area and business seal area that constitute the second foreground area.
9. An electronic device, characterized in that, include: A processor and a memory are connected via a communication bus; wherein the processor is used to call and execute a program stored in the memory; The memory is used to store a program for implementing the credential watermarking processing method as described in any one of claims 1-5.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the credential watermarking method as described in any one of claims 1-5.