A method for automatically generating an electronic seal module that can add a forgery-proof watermark
By automatically generating electronic seal templates, the problem of low efficiency in traditional manual production of electronic seal templates has been solved. This method enables the efficient generation and addition of anti-counterfeiting watermarks to electronic seal templates, thereby improving the efficiency of enterprise seal usage and anti-counterfeiting capabilities.
Patent Information
- Application Number
- CN202210435777.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-24
- Publication Date
- 2026-01-13
- Estimated Expiration
- 2042-04-24
AI Technical Summary
The traditional manual production of electronic seal molds is labor-intensive, resulting in low efficiency for enterprises in using seals and difficulty in effectively adding anti-counterfeiting watermarks.
An automatic method for generating electronic seal templates that can be used to add anti-counterfeiting watermarks is adopted. The process involves extracting seal and signature images, detecting five-pointed stars, aligning images, detecting elliptical borders, and detecting engraving lines to generate electronic seal template files.
It improves the efficiency of electronic seal generation, provides a convenient basis for adding anti-counterfeiting watermarks, reduces manual production steps, and enhances the anti-counterfeiting capabilities of electronic seals.
Smart Images

Figure CN115188011B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of electronic anti-counterfeiting seal technology, and in particular to a method for automatically generating electronic seal templates that can be used to add anti-counterfeiting watermarks. Background Technology
[0002] With the development of society and economy, enterprises are constantly expanding in scale, and the number of official seals is increasing, and the frequency of use is also increasing. At the same time, some official seals need to be equipped with anti-counterfeiting watermarks, which further increases the workload of traditional manual production of electronic seal molds and seriously restricts the efficiency of enterprises in using seals.
[0003] To improve the efficiency of stamp production and facilitate the generation of stamps and the addition of anti-counterfeiting watermarks, this invention provides a method for automatically generating electronic stamps that can be used to add anti-counterfeiting watermarks, effectively solving the aforementioned problems. Summary of the Invention
[0004] To achieve the objectives of this invention, the following technical solution is adopted:
[0005] A method for automatically generating electronic seal templates that can be used to add anti-counterfeiting watermarks includes the following steps: Step 1. Extracting the seal and signature; Step 2. Detecting a five-pointed star; Step 3. Generating a properly aligned seal pattern; Step 4. Detecting the parameters of the aligned seal image; Step 5. Detecting engraved lines; Step 6. Generating the seal template.
[0006] The method for automatically generating electronic seal templates that can be used to add anti-counterfeiting watermarks, wherein step 1 includes:
[0007] Extract the stamp image with a pure white foreground and a pure black background from the white background stamp scan image; extract the signature image with a pure white foreground and a pure black background from the white background signature scan image;
[0008] The scanned images of the white-background seal and signature are converted into HSV images, and the H, S, and V channel parameters are extracted to determine the colors of the seal and signature, respectively, and denoted as color. 印章 color 签名 .
[0009] The method for automatically generating electronic seal templates suitable for adding anti-counterfeiting watermarks includes step 2: finding the largest white area near the center of the seal image.
[0010] (1) First, generate a rectangular area based on the top, right, bottom and left positions of the white area. Then calculate the size of the white area inside the rectangle. When the white area inside the rectangle is the largest, calculate the width-to-length ratio of the rectangle. If the width-to-length ratio is within the predetermined range, the white area inside the rectangle is identified as a pentagram.
[0011] (2) Fill the black holes in the white area, and then use the rectangular frame from step (1) to cut out the rectangular area with the five-pointed star pattern.
[0012] The method for automatically generating electronic seal templates that can be used to add anti-counterfeiting watermarks, wherein step 3 includes:
[0013] The rectangular area image with a pentagram pattern obtained in step 2 is called the comparison image. A standard regular pentagram pattern of the same size is generated using this area, resulting in a rectangular area image with a pure white foreground and a pure black background, which is called the standard image.
[0014] Compare the standard image with the comparison image, add the standard image and the comparison image to obtain image A. Then count the number of white points S1 within the white area of the standard pentagram and the number of white points S2 outside the white area of the standard pentagram in image A, so that the value of S1-S2 is maximized. At this time, the rotation angle of the regular pentagram pattern in the standard image is set as angle.
[0015] Then, based on angle, the center coordinates of the ellipse border of the seal image are used to determine the seal image. Rotate the image around the center by angles of angl, angle+72°, angl+144°, angle+216°, and angle+288° respectively, generating five images. Select one image from these five that begins with (ellipse_x). Optimal ellipse_y Optimal The image is symmetrical about the center. This image is the image of the seal after the angle is corrected, and is called the corrected seal image.
[0016] The method for automatically generating electronic seal templates that can be used to add anti-counterfeiting watermarks includes step 4 as follows:
[0017] 4.1 Locate the pentagram in the stamp image after the angle is corrected, and then calculate the square area inside the pentagram. Its coordinates in the stamp image are (x, y, width, height).
[0018] 4.2 Border Shape Detection:
[0019] (1) The shape description parameters of the elliptical seal border are detected in the upright seal image.
[0020] The parameters describing the border shape are as follows:
[0021] (ellipse_x1,ellipse_y1,ellipse_a1,ellipse_b1)
[0022] Where ellipse_x1 is the x-coordinate of the center of the ellipse, ellipse_y1 is the y-coordinate of the center of the ellipse, ellipse_a1 is the major axis of the ellipse, and ellipse_b1 is the minor axis of the ellipse.
[0023] (2) Extract the elliptical border of the upright seal image, stretch it into a strip state, calculate the proportion of white foreground to black background in each row of the strip image, start from the top row of the image and go down to record the row number where the white foreground proportion is greater than 50% for the first time as row1, start from the bottom row of the image and go up to record the row number where the foreground proportion is greater than 50% for the first time as row2.
[0024] The border width is: thickness ellipse =|row2-row1|;
[0025] Therefore, two ellipses are constructed:
[0026] (ellipse_x1,ellipse_y1,ellipse_a1-thickness ellipse / 2,ellipse_b1-thickness ellipse / 2)
[0027] (ellipse_x1,ellipse_y1,ellipse_a1+thickness ellipse / 2,ellipse_b1+thickness ellipse / 2)
[0028] An elliptical ring region is constructed on the upright seal image using these two ellipses. The number of white pixels in the upright seal image within the border of this elliptical ring region is counted. The values of ellipse_x1, ellipse_y1, ellipse_a1, and ellipse_b1 are continuously changed until the maximum number is found. The ellipse shape description parameters at this point are the optimal ellipse shape description parameters, and are recorded as follows:
[0029] (ellipse_x Opt ellipse_y Opt ellipse_a Opt ,ellipse_b Opt )
[0030] Fill the elliptical stamp border: Extend the thickness both inwards and outwards based on the optimal ellipse shape description parameters. ellipse 1 pixel, resulting in two ellipses:
[0031] (ellipse_xOpt ellipse_y Opt ellipse_a Opt +thickness,ellipse_b Opt +thickness)
[0032] (ellipse_x Opt ellipse_y Opt ellipse_a Opt -thickness,ellipse_b Opt -thickness)
[0033] Construct an elliptical ring region from these two ellipses, and process the stamp image within the elliptical ring region as follows: if there are black holes inside the white foreground, fill the holes with white.
[0034] The method for automatically generating electronic seal templates that can be used to add anti-counterfeiting watermarks, wherein step 5 includes:
[0035] The image within the elliptical ring region constructed according to the optimal elliptical shape description parameters is stretched into a strip image, and the proportion of white foreground in each row of the strip image is calculated.
[0036] From top to bottom, record the row number where the foreground percentage is greater than 50% for the first time as row5; from bottom to top, record the row number where the foreground percentage is greater than 50% for the first time as row6.
[0037] Fill all rows in the strip image with row numbers less than row6 and greater than row5 with white. Then calculate the difference between the top and bottom row numbers of each black connected region. If it equals |row6-row5|, calculate the column numbers of the leftmost and rightmost points in each black connected region, and record them as col5 and col6 respectively. The total number of columns in the strip image is denoted as col. Based on the algorithm principle of stretching an elliptical ring into a strip, the angle of the scribe line position relative to the center of the ellipse can be calculated:
[0038] Starting angle: angle start = (col5 / col) * 360
[0039] Ending angle: angle end = (col6 / col)*360
[0040] This set of markings is identified as (angle) start ,angle end Repeat the above operation in all black areas to obtain the angle range of all engraved lines in the seal.
[0041] The method for automatically generating electronic seal templates that can be used to add anti-counterfeiting watermarks includes step 6 as follows:
[0042] Package the following packaging information into a compressed file to create the chapter template file.
[0043] The packaging information includes:
[0044] Seal Image
[0045] Signature Image
[0046] Color, including stamp color 印章 Signature color 签名
[0047] Ellipse border shape parameters
[0048] (ellipse_x Optimal ellipse_y Optimal ellipse_a Optimal ,ellipse_b Optimal ), thickness ellipse
[0049] Scale angle range
[0050] The square region (x, y, width, height) inside the pentagram. Attached Figure Description
[0051] Figure 1 This is a scanned image of the official seal;
[0052] Figure 2 For signature image;
[0053] Figure 3 The extracted image of the seal;
[0054] Figure 4 The extracted signature image;
[0055] Figure 5 The image of the stamp after filling in the five-pointed star;
[0056] Figure 6 The image is a cropped five-pointed star.
[0057] Figure 7 A standard regular pentagram image;
[0058] Figure 8 To fill in the five-pointed star and the straightened stamp image;
[0059] Figure 9 The image is a square inscribed in a pentagram;
[0060] Figure 10 The image of the stamp after filling the black holes inside the outer border;
[0061] Figure 11 The extracted image of the outer border strip of the seal;
[0062] Figure 12 This is the processed image of the outer border strip of the seal. Detailed Implementation
[0063] The following is in conjunction with the appendix Figure 1-12 The specific embodiments of the present invention will be described in detail below.
[0064] like Figure 1 As shown, methods for automatically generating electronic seal templates that can be used to add anti-counterfeiting watermarks include:
[0065] Step 1. Extract the seal and signature
[0066] Using the Otsu's method (Otsu's method), in situations such as Figure 1 Extracting the stamp image with a pure white foreground and a pure black background from the scanned image of the white-background stamp shown, as follows: Figure 3 As shown;
[0067] In such Figure 2 The signature image with a pure white foreground and a pure black background is extracted from the white background signature scan image shown. Figure 4 As shown;
[0068] The scanned images of the white-background seal and signature are converted into HSV images, and the H, S, and V channel parameters are extracted. Since official seals are generally pure red, pure blue, and pure purple, the colors of the seal and signature can be determined based on the color ranges of pure red, pure blue, and pure purple in the H, S, and V channels, respectively, and denoted as color. 印章 color 签名 .
[0069] Figure 1 The scanned image of the seal mentioned in the document was obtained by scanning a piece of white paper stamped with the official seal; Figure 2 The signature scan image was obtained by scanning a blank piece of paper with a signature.
[0070] Step 2. Pentagram Detection
[0071] 2.1 Locate the area with the largest white area near the center of the stamp image.
[0072] (1) Since a five-pointed star is generally located near the center of the seal, this invention finds the largest white area near the center of the seal image. First, a rectangular area can be generated based on the top, right, bottom and left positions of the white area. Then, the size of the white area within the rectangular area is calculated. When the white area within the rectangular area is the largest, the width-to-length ratio of the rectangular area is calculated. If the width-to-length ratio is within a predetermined range, the white area within the rectangular area can be identified as a five-pointed star. The horizontal coordinate of the upper left corner of the rectangular area is x1 and the vertical coordinate is y1.
[0073] Assuming the length of the line connecting any vertex of a standard regular pentagram to any other vertex (excluding adjacent vertices) is *l*, the maximum width of the circumscribed rectangle of the standard regular pentagram is *l*, with a length of *l*sin72° and a width-to-length ratio of 1 / sin72°. The minimum width of the circumscribed rectangle is *l*sin72°, with a maximum length of *l*, and a width-to-length ratio of *sin72°*. Therefore, theoretically, the width-to-length ratio range of the rectangular region containing the pentagram is between [sin72°, 1 / sin72°]. Considering that the pentagram in actual seal images is not standard and has some distortion, the width-to-length ratio range of the rectangular region is optimized and adjusted to [sin72°-0.15, 1 / sin72°+0.15]. We then determine whether the width-to-length ratio of the smallest circumscribed rectangle of the largest white area falls within this range. If it does, the white area can be preliminarily considered as a pentagram.
[0074] (2) Fill the black holes in the white area, such as Figure 5 As shown, then use the rectangular frame from step (1) to cut out the stamp image, and cut out the rectangular area with the five-pointed star pattern, as shown. Figure 6 As shown;
[0075] The aforementioned black holes are caused by ink leakage in the five-pointed star area printed on the paper when the stamp is applied, due to uneven ink adhesion on the stamp or uneven pressure.
[0076] Step 3. Generate an image of the properly aligned stamp.
[0077] Using the rectangular area with the five-pointed star pattern obtained in step 2 (such as...) Figure 6 The image shown (referred to as the comparison image) generates a standard regular pentagram pattern of the same size. The generation method is as follows: Take the smaller of the width and length of the rectangular area as the length of the line connecting any one of the five vertices of the pentagram to its opposite vertex. Based on the properties of a regular pentagram, a regular pentagram can be generated. Then, create a pure black image with the same size as the rectangular area. Align the center of the pentagram with the center of this image, and fill the pentagram with pure white. This will give you a rectangular image with a pure white foreground and a pure black background. Figure 7 The image shown is called the standard image;
[0078] The standard image is compared with the comparison image by continuously rotating, translating, and scaling the pentagram in the standard image. The resulting standard image is then added to the comparison image, yielding image A. The operation rules are: black + black = black, white + black = white, white + white = white, black + white = white. Then, the number of white points S1 within the white area of the standard pentagram and the number of white points S2 outside the white area of the standard pentagram are counted in image A, maximizing the value of S1 - S2. At this point, the rotation angle of the regular pentagram pattern in the standard image is set to angle, and the position of the center of the pentagram in the standard image is recorded, with the horizontal coordinate as x2 and the vertical coordinate as y2.
[0079] Theoretically, if the pentagrams in the standard image and the comparison image completely overlap, then S1-S2 is the largest. However, due to the existence of errors, complete overlap is extremely rare. Therefore, this invention sets a corresponding threshold range. If the value of S1-S2 is within this threshold range, then the image cropped in step 2 is considered to contain a pentagram.
[0080] If there is a five-pointed star, then according to the rotation angle, it will be as follows: Figure 5 The stamp image shown is rotated around the coordinates (x1+x2, y1+y2) by angle, angle+72°, angle+144°, angle+216°, and angle+288° respectively. If the stamp part rotates out of the image, the image is automatically expanded with a pure black background. After the rotation, the stamp part is cropped out, and the coordinates of the original rotation center are updated according to the values of image expansion and cropping, set to (x3, y3). This generates five images. In each of these five images, one point of the five-pointed star is vertically upward. Utilizing the property that a properly aligned seal typically has symmetrically distributed text and one vertically upward-pointing star, we can select one image from these five, centered at (x3, y3), where the text is symmetrically distributed horizontally. This image represents the properly aligned seal image. The selection method is as follows: Flip the image horizontally and vertically around its center coordinates. Add the flipped image to the original image according to the following formulas: black + white = white, black + black = black, white + white = white. This generates five result images. Then, select the image with the smallest white area. The original image corresponding to this image represents the symmetrical portion of the text. Figure 8 As shown. The subsequent steps are all based on the stamp image after the angle has been corrected, and are collectively referred to as the corrected stamp image.
[0081] Step 4. Parameter detection of the aligned seal image
[0082] 4.1 Following the pentagram detection procedure described above, locate the pentagram in the stamp image after the angle is corrected. First, calculate the inner circle of the pentagram based on the principle that the distance from the center to each side of the pentagram is equal. Then, calculate the inscribed square of the inner circle, such as... Figure 9 As shown. The coordinates (x, y, width, height) of the inscribed square in the seal image, where x and y are the coordinates of the top-left corner of the inscribed square, width is the width of the inscribed square, and height is the height of the inscribed square.
[0083] 4.2 Border Shape Detection:
[0084] (1) The shape description parameters of the elliptical seal border are detected in the upright seal image.
[0085] The parameters describing the border shape are as follows:
[0086] (ellipse_x1,ellipse_y1,ellipse_a1,ellipse_b1)
[0087] Where ellipse_x1 is the x-coordinate of the center of the ellipse, ellipse_y1 is the y-coordinate of the center of the ellipse, ellipse_a1 is the major axis of the ellipse, and ellipse_b1 is the minor axis of the ellipse.
[0088] (2) Extract the elliptical border of the aligned seal image and stretch it into a strip shape, such as... Figure 11 As shown. Calculate the proportion of white foreground to black background in each row of the striped image. Starting from the top row of the image, iterate downwards, recording the row number where the first white foreground proportion is greater than 50% as row1. Starting from the bottom row of the image, iterate upwards, recording the row number where the first foreground proportion is greater than 50% as row2.
[0089] The border width is: thickness ellipse =|row2-row1|, the present invention can accurately determine the upper and lower boundaries of the elliptical border through the above method.
[0090] Therefore, two ellipses can be constructed:
[0091] (ellipse_x1,ellipse_y1,ellipse_a1-thickness ellipse / 2,ellipse_b1-thickness ellipse / 2)
[0092] (ellipse_x1,ellipse_y1,ellipse_a1+thickness ellipse / 2,ellipse_b1+thickness ellipse / 2)
[0093] These two ellipses can be used to construct an elliptical ring region on the upright stamp image. The number of white pixels in the upright stamp image within the border of this elliptical ring region is counted, and the values of ellipse_x1, ellipse_y1, ellipse_a1, and ellipse_b1 are continuously changed until the maximum number is found. The ellipse shape description parameters at this point are the optimal ellipse shape description parameters, and are recorded as follows:
[0094] (ellipse_x Opt ellipse_y Opt ellipse_a Opt ,ellipse_b Opt )
[0095] Fill the elliptical stamp border: Extend the thickness both inwards and outwards based on the optimal ellipse shape description parameters. ellipse [Number] pixels. This results in two ellipses:
[0096] (ellipse_x Opt ellipse_y Opt ellipse_a Opt +thickness,ellipse_b Opt +thickness)
[0097] (ellipse_x Opt ellipse_y Opt ellipse_a Opt -thickness,ellipse_b Opt -thickness)
[0098] These two ellipses can be used to construct an elliptical annular region. The stamp image within this region is then processed as follows: If a black hole exists inside the white foreground, the hole is filled with white. After filling, the result is as follows: Figure 10 As shown.
[0099] Step 5. Scribing inspection.
[0100] The image within the elliptical ring region constructed according to the optimal elliptical shape description parameters is stretched into a strip image (e.g., Figure 11(As shown), calculate the proportion of white foreground in each row of the strip image. From top to bottom, record the row number where the first foreground proportion is greater than 50% as row5, and from bottom to top, record the row number where the first foreground proportion is greater than 50% as row6. Fill all rows in the strip image with white (e.g., row number less than row6 and greater than row5). Figure 12 As shown (for ease of demonstration, a black outline is added around the white background), the row number difference between the top and bottom of each black connected region is calculated. If it equals |row6-row5|, the column numbers of the leftmost and rightmost points in each black connected region are calculated and recorded as col5 and col6 respectively. The total number of columns in the strip image is denoted as col. Based on the algorithm principle of stretching an elliptical ring into a strip, the angle of the scribe line position relative to the center of the ellipse can be calculated:
[0101] Starting angle: angle start = (col5 / col) * 360
[0102] Ending angle: angle end = (col6 / col)*360
[0103] This set of markings is identified as (angle) start ,angle end By repeatedly performing the above operation in all black areas, the angle range of all engraved lines in the seal can be obtained.
[0104] Step 6. Seal Template Generation. Package the following information into a compressed zip file to create the seal template file. This template file can be used to add anti-counterfeiting watermark information and generate an electronic seal.
[0105] The packaging information includes:
[0106] 1. Seal image ( Figure 10 )
[0107] 2. Signature image ( Figure 4 )
[0108] 3. Color, including the color of the stamp. 印章 Signature color 签名
[0109] 4. Elliptical border shape parameters
[0110] (ellipse_x Optimal ellipse_y Optimal ellipse_a Optimal ,ellipse_b Optimal ), thickness ellipse
[0111] 5. Range of engraving angles
[0112] 6. The square area (x, y, width, height) inside the five-pointed star allows for easy addition of anti-counterfeiting watermarks within this area of the stamp.
[0113] The method of this invention can automatically generate electronic seal templates that can be used to add anti-counterfeiting watermarks, eliminating the need to manually produce a large number of seal templates, greatly improving efficiency. It also provides key basic information for adding anti-counterfeiting watermarks to electronic seals, making it easier to add anti-counterfeiting watermarks to seals.
Claims
1. A method for automatically generating an electronic seal form to which an anti- counterfeit watermark can be added, characterized by The method comprises the following steps: Step 1. Extracting seal and signature; Step 2. Pentagram detection; Step 3. Generating a righted seal pattern; Step 4. Righted seal image parameter detection; Step 5. Ruling line detection; Step 6. Seal die generation; Step 1 comprises: Extracting a seal image with white foreground and black background from a white background seal scanning image; and extracting a signature image with white foreground and black background from a white background signature scanning image; Step 2 comprises: Finding a white maximum area region near the center of the seal image; Step 3 comprises: Then, according to angle, the seal image is rotated by angle, angle+72°, angle+144°, angle+216°, angle+288° respectively with the center of the ellipse coordinates (ellipse_x Optimal ,ellipse_y Optimal ) of the seal image frame, and five images are generated. Among the five images, a left-right symmetrical image with the center of (ellipse_x Optimal ,ellipse_y Optimal ) is selected, which is the angle-corrected seal image, referred to as the corrected seal image. Taking the rectangular region image with a pentagram pattern obtained in step 2 as a comparison image, generating a standard right pentagram pattern with the same size, and obtaining a rectangular region image with white foreground and black background, which is called a standard image; Comparing the standard image with the comparison image, performing addition operation on the standard image and the comparison image to obtain an image A, then counting the number S1 of white points in the standard pentagram white region and the number S2 of white points outside the standard pentagram white region, so that the value of S1-S2 is maximum, and the rotation angle of the right pentagram pattern in the standard image is angle; Step 4 comprises: Step 4.1 finding the pentagram in the righted seal image, and calculating a square region in the pentagram, the coordinates of which in the seal image are (x, y, width, height); Step 4.2 frame shape detection: (1) detecting an elliptical seal frame shape description parameter in the righted seal image, The frame shape description parameter is as follows: (ellipse_x1, ellipse_y1, ellipse_a1, ellipse_b1) The border width is then: thickness ellipse = |row2 - row1|; ellipse_x1 is the horizontal coordinate of the center of the ellipse, ellipse_y1 is the vertical coordinate of the center of the ellipse, ellipse_a1 is the major axis of the ellipse, and ellipse_b1 is the minor axis of the ellipse; (ellipse_x1,ellipse_y1,ellipse_a1-thickness ellipse / 2,ellipse_b1-thickness ellipse / 2) (ellipse_x1,ellipse_y1,ellipse_a1+thickness ellipse / 2,ellipse_b1+thickness ellipse / 2) (2) extracting the elliptical frame of the righted seal image, stretching the elliptical frame into a strip state, calculating the proportion of white foreground in each row of the strip image, and recording the row number row1 of the first row with a white foreground proportion greater than 50% from the top row of the image, and recording the row number row2 of the first row with a white foreground proportion greater than 50% from the bottom row of the image; (ellipse_x Opt ,ellipse_y Opt ,ellipse_a Opt ,ellipse_b Opt ) Fill the ellipse stamp border: extend the optimal ellipse shape description parameters inwards and outwards by thickness pixels, resulting in two ellipses: ellipse one pixel, resulting in two ellipses: (ellipse_x Opt ,ellipse_y Opt ,ellipse_a Opt +thickness ellipse ,ellipse_b Opt +thickness ellipse ) (ellipse_x Opt , ellipse_y Opt , ellipse_a Opt , thickness ellipse , ellipse_b Opt , thickness ellipse ) Then two ellipses are constructed: An elliptical ring region is constructed from the two ellipses in the righted seal image, the number of white pixel points in the righted seal image in the elliptical ring region is counted, and the values of ellipse_x1, ellipse_y1, ellipse_a1 and ellipse_b1 are changed until the maximum number is found, and the elliptical shape description parameter at this time is the optimal elliptical shape description parameter, which is recorded as: An elliptical ring region is constructed from the two ellipses, and the following processing is performed on the seal image in the elliptical ring region: if there is a black hole inside the white foreground, the hole is filled with white; Step 5 comprises: The image in the elliptical ring area constructed according to the optimal elliptical shape description parameter is stretched into a strip image, and the proportion of white foreground in each row of the strip image is calculated; From top to bottom, record the row number of the first foreground proportion greater than 50% as row5, and from bottom to top, record the row number of the first foreground proportion greater than 50% as row6; Fill all the images in the strip image with row number less than row6 and greater than row5 with white, and then calculate the row number difference between the uppermost end and the lowermost end of each black connected region. If it is equal to |row6-row5|, then calculate the column number of the point at the leftmost end position and the point at the rightmost end position of each black connected region, and record them as col5 and col6 respectively. The total column number of the strip image is col, then according to the algorithm principle of stretching the elliptical ring into a strip, the angle of the ruling line relative to the center of the ellipse can be calculated: Start angle: angle start = (col5 / col) * 360 End angle: angle end = (col6 / col) * 360 This set of markings is labeled (angle) start ,angle end Repeat the above operation in all black connected areas to obtain the angle range of all engraved lines in the seal. Step 6 includes: Pack the following information into a compressed zip file, which is a chapter template file. Use this chapter template to add anti-counterfeiting watermark information to generate an electronic seal; Wherein: The packed information includes: Seal image; Signature image; Color, including stamp color color 印章 , signature color color 签名 ; Elliptical frame shape parameters (ellipse_x Optimal ,ellipse_y Optimal ,ellipse_a Optimal ,ellipse_b Optimal ), thickness ellipse ; Ruling line angle range; The square area (x, y, width, height) in the five-pointed star adds anti-counterfeiting watermark in the square area in the seal.
2. The method of automatically generating an electronic seal form with an added anti-counterfeit watermark according to claim 1, characterized in that Step 1 also includes: The white bottom seal scanning image and the white bottom signature scanning image are converted into HSV images respectively, H, S and V three channel parameters are extracted, the colors of the seal and the signature are determined respectively, and are respectively represented as color 印章 , color 签名 .
Citation Information
Patent Citations
Method and device for correcting inclination angle of circular electronic seal
CN113469888A