CN117456157A - Electronic signature method and device and electronic equipment - Google Patents
Electronic signature method and device and electronic equipment Download PDFInfo
- Publication number
- CN117456157A CN117456157A CN202311616485.2A CN202311616485A CN117456157A CN 117456157 A CN117456157 A CN 117456157A CN 202311616485 A CN202311616485 A CN 202311616485A CN 117456157 A CN117456157 A CN 117456157A
- Authority
- CN
- China
- Prior art keywords
- image
- target
- determining
- file
- signed
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 66
- 238000012545 processing Methods 0.000 claims abstract description 61
- 238000001914 filtration Methods 0.000 claims description 28
- 238000004590 computer program Methods 0.000 claims description 16
- 230000000694 effects Effects 0.000 abstract description 10
- 230000008569 process Effects 0.000 description 15
- 238000004891 communication Methods 0.000 description 8
- 238000010586 diagram Methods 0.000 description 5
- 230000011218 segmentation Effects 0.000 description 4
- 238000004422 calculation algorithm Methods 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 230000009286 beneficial effect Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000009467 reduction Effects 0.000 description 2
- 230000003044 adaptive effect Effects 0.000 description 1
- 238000004458 analytical method Methods 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 238000013473 artificial intelligence Methods 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 239000003086 colorant Substances 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000018109 developmental process Effects 0.000 description 1
- 239000011521 glass Substances 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000010801 machine learning Methods 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 238000005070 sampling Methods 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 230000001953 sensory effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
- G06V10/22—Image preprocessing by selection of a specific region containing or referencing a pattern; Locating or processing of specific regions to guide the detection or recognition
- G06V10/235—Image preprocessing by selection of a specific region containing or referencing a pattern; Locating or processing of specific regions to guide the detection or recognition based on user input or interaction
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/40—Extraction of image or video features
- G06V10/44—Local feature extraction by analysis of parts of the pattern, e.g. by detecting edges, contours, loops, corners, strokes or intersections; Connectivity analysis, e.g. of connected components
- G06V10/457—Local feature extraction by analysis of parts of the pattern, e.g. by detecting edges, contours, loops, corners, strokes or intersections; Connectivity analysis, e.g. of connected components by analysing connectivity, e.g. edge linking, connected component analysis or slices
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Multimedia (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Character Input (AREA)
Abstract
The invention discloses an electronic signature method, an electronic signature device and electronic equipment. The specific scheme is as follows: acquiring a slice image corresponding to a file to be signed; determining a filtered image corresponding to the slice image and a gray scale image; determining a binarized image based on the gray scale image and the filtered image; based on the binarized image, determining a target connected domain corresponding to the target text, and determining a target position associated with the target connected domain; and processing the received electronic signature based on the target position to obtain a target file signed on the file to be signed. The method and the device realize the rapid positioning of the signature position of the file to be signed, improve the efficiency of electronic signature processing, and achieve the effect of improving user experience.
Description
Technical Field
The present invention relates to the field of image processing technologies, and in particular, to an electronic signature method, an electronic signature device, and an electronic device.
Background
Along with the rapid development of electronic technology, traditional office mode is gradually changed to online office in all directions, more and more paper document contents are gradually changed into electronic documents, and file signature flow is also developed from signing paper documents to electronic file cloud signatures.
Currently, for a format-fixed standard file, a cloud signature can generally directly cover a signature image at a designated position of an electronic document. For non-standard files, the signature image is manually scaled and moved to a text area needing to be signed after signing, so that the picture is covered. However, the electronic signature corresponding to the non-standard file often cannot automatically and accurately place the signature image at the designated position. Based on the above, the invention provides a technical scheme for rapidly positioning the signature position in the file to be signed.
Disclosure of Invention
The invention provides an electronic signature method, an electronic signature device and electronic equipment, which realize the rapid positioning of the signature position of a file to be signed, improve the efficiency of electronic signature processing and achieve the effect of improving user experience.
According to an aspect of the present invention, there is provided an electronic signature method, the method comprising:
acquiring a slice image corresponding to a file to be signed;
determining a filtered image corresponding to the slice image and a gray scale image;
determining a binarized image based on the gray scale image and the filtered image;
based on the binarized image, determining a target connected domain corresponding to the target text, and determining a target position associated with the target connected domain;
and processing the received electronic signature based on the target position to obtain a target file signed on the file to be signed.
According to another aspect of the present invention, there is provided an electronic signature apparatus including:
the slice image acquisition module is used for acquiring a slice image corresponding to the file to be signed;
the filtering image and gray level image acquisition module is used for determining a filtering image and a gray level image corresponding to the slice image;
the binarization image acquisition module is used for determining a binarization image based on the gray level image and the filtering image;
the target position determining module is used for determining a target connected domain corresponding to the target text based on the binarized image and determining a target position associated with the target connected domain;
and the electronic signature processing module is used for processing the received electronic signature based on the target position to obtain a target file signed on the file to be signed.
According to another aspect of the present invention, there is provided an electronic device including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the electronic signature method of any one of the embodiments of the present invention.
According to another aspect of the present invention, there is provided a computer readable storage medium storing computer instructions for causing a processor to execute an electronic signature method of any embodiment of the present invention.
According to the technical scheme, a slice image corresponding to a file to be signed is obtained, a filtering image and a gray level image corresponding to the slice image are obtained based on the slice image, and then a binarization image is determined according to the gray level image and the filtering image, so that a target connected domain corresponding to target characters is determined according to the binarization image, and a target position associated with the target connected domain is determined; and processing the received electronic signature according to the target position to obtain the target file signed on the file to be signed. The method solves the problem that the signature position of the non-standard file cannot be accurately positioned in the prior art, realizes the rapid positioning of the signature position of the file to be signed, improves the efficiency of electronic signature processing, and achieves the effect of improving user experience.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the invention or to delineate the scope of the invention. Other features of the present invention will become apparent from the description that follows.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of an electronic signature method provided by an embodiment of the present invention;
FIG. 2 is a flow chart of an electronic signature method provided by an embodiment of the present invention;
fig. 3 is a schematic structural diagram of an electronic signature device according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an electronic device implementing the electronic signature method according to an embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example 1
Fig. 1 is a flowchart of an electronic signature method provided in an embodiment of the present invention, where the present embodiment is applicable to a case of determining a signature position in a file to be signed, the method may be performed by an electronic signature device, and the electronic signature device may be implemented in a form of hardware and/or software, and the electronic signature device may be configured in an electronic device such as a mobile phone, a computer, or a server. As shown in fig. 1, the method includes:
s110, acquiring a slice image corresponding to the file to be signed.
In the embodiment of the invention, the file to be signed can be understood as the file which needs to be signed currently. Wherein the file to be signed may comprise at least one page of file content. The file to be signed can be converted into an original image, and then the segmentation processing is performed based on the original image to obtain a segmented image. Wherein, the image containing the signature field can be selected from the images after the segmentation processing as the slice image. The slice image may be an image obtained after splitting an original image corresponding to the file to be signed according to actual requirements. Additionally, text, pictures, and other content may be included in the slice images. This embodiment is not limited thereto. The signature field may be used to characterize the region of the image to be processed where the signature is entered.
Specifically, a file to be signed can be used as a file to be signed. And converting at least one page of file content corresponding to the file to be signed into at least one original image, wherein the number of the original images corresponds to the number of pages of the file to be signed. The original image may then be segmented, from which a corresponding image containing the signature field, i.e. a slice image, is obtained. Alternatively, the slice image may be obtained from an original image corresponding to the content of a certain page of the file to be signed, or may be obtained from an image after the segmentation process of the original image. This embodiment is not limited thereto.
Optionally, acquiring a slice image corresponding to the file to be signed includes: converting file content of a file to be signed into an image to be processed; the image to be processed including the signature field is taken as a slice image.
In the embodiment of the invention, the image to be processed can be an original image obtained by converting the file content of the file to be signed, or can be an image obtained by cutting the original image. It should be noted that the number of images to be processed may be one or more. The signature field may be used to characterize the region of the image to be processed where the signature is entered.
Specifically, after the file to be signed is obtained, the file content of the file to be signed can be converted into an original image. Then, the original image can be subjected to segmentation processing to obtain an image to be processed. The entire original image can also be used as the image to be processed. Thus, a to-be-processed image including the signature field can be acquired in at least one to-be-processed image and taken as a slice image for subsequent processing.
And S120, determining a filtered image corresponding to the slice image and a gray level image.
In the embodiment of the present invention, the filtered image may be an image obtained after filtering the slice image. The grayscale image may be an image obtained after subjecting the slice image to grayscale processing. The gray level image is that the pixel points of the slice image can be divided into 256 levels in the [0,255] interval from the brightest white to the darkest black, and then the sampling value of each pixel point is in one level. Based on which all pixels are divided into different classes, thereby obtaining an image.
Specifically, after the slice image is determined, the slice image may be filtered by using a threshold value to eliminate noise points in the slice image, and at the same time, burrs in the slice image may be removed. Then, the slice image after the noise reduction pretreatment can be subjected to gray-scale conversion processing, so that a gray-scale image is obtained. Meanwhile, the mean value filtering processing can be carried out on the slice image after the noise reduction pretreatment so as to obtain a filtered image. The threshold filtering may be a way of processing the slice image by setting a threshold. The pixel value below the threshold will become 0 and the pixel value above the threshold will remain unchanged to obtain a slice image based thereon after noise point cancellation. The mean value filtering process may be a manner of calculating a mean value of pixels around each pixel in the slice image and replacing the mean value with the original pixel value to achieve the filtering effect.
Optionally, determining the filtered image corresponding to the slice image and the gray scale image includes: filtering the slice image to obtain a filtered image with noise points in the slice image removed; and converting the slice image into gray scale to obtain a gray scale image.
In the embodiment of the invention, the filtering processing can be a mode of processing the slice image by adopting a corresponding filtering method. Alternatively, the filtering process may be a threshold filtering process and an average filtering process. Noise points can be understood as isolated pixels in a slice image that affect the sharpness and accuracy of the slice image. The gradation process may be a process of converting a slice image from a color image to a gradation image.
Specifically, the noise point may be removed from the slice image through a threshold filtering process, and then the mean filtering process may be performed on the slice image from which the noise point is removed, so as to obtain a filtered image. And meanwhile, converting the slice image with noise points removed into gray scale, namely converting the slice image from a three-channel color image into a single-channel gray scale image, so as to obtain a gray scale image. Wherein the logarithmic relationship between white and black is divided into several levels, called gray levels. The gray scale is divided into 256 steps. The image represented in gray is called a gray image. The R, G, B color components of the gray scale map are all equal, with pixel values ranging from 0-255, white 255, and black 0.
S130, determining a binarized image based on the gray level image and the filtered image.
In the embodiment of the present invention, the binarized image may be used to represent that there are only two possibilities, namely, 0 and 255, for the pixel values corresponding to all the pixel points on the corresponding image. I.e. each pixel of the binarized image corresponds to only two colors, usually black and white, and the corresponding binarized image exhibits a distinct black and white effect.
Specifically, for the pixel values corresponding to the pixel points in the filtered image, they are substantially consistent with the pixel values of the background color in the slice image. After the gray image and the filtered image are obtained, a difference process may be performed based on pixel values of pixel points at corresponding positions of the gray image and the filtered image. And resetting the pixel value corresponding to each pixel point in the slice image according to the difference value of the two pixel points. Then, the slice image with the reset pixel values can be subjected to binarization processing, so that the difference between the background and the foreground in the slice image is more obvious, and the position needing to be signed is determined. Taking characters included in the slice image as an example, correspondingly, the foreground corresponds to the characters in the slice image, and the background is a part except the characters in the slice image. After the binary image is obtained based on the filtered image and the gray image, the effect that the pixel point corresponding to the background of the binary image is set to be black and the pixel point corresponding to the text is set to be white can be achieved.
And S140, determining a target connected domain corresponding to the target text based on the binarized image, and determining a target position associated with the target connected domain.
In the embodiment of the invention, the target connected domain can be understood as a connected domain formed by pixel points corresponding to the target characters, wherein the connected domain can be understood as an image area formed by pixel points which have the same pixel value and are adjacent in position in the binarized image. The target text may be understood as text content corresponding to a signature field included in the binarized image. For example, the signature field may be: "signature: ___ "or" signature: "and correspondingly, the target text may be a" signature ". The target location may be a location where a signature is required, i.e. a location to which the signature field corresponds. Alternatively, the target position may be represented by corresponding coordinates.
Specifically, in the binarized image, each connected domain in the target image may be determined according to a connected domain analysis algorithm. And then, marking the connected areas of each connected area, so that the connected areas corresponding to the text areas in the binarized image can be obtained. So as to determine the target connected domain corresponding to the target text based on the connected domains corresponding to the text regions. Meanwhile, the target position corresponding to the target text can be determined according to the target connected domain.
And S150, processing the received electronic signature based on the target position to obtain a target file signed on the file to be signed.
In the embodiment of the invention, the received electronic signature can be the electronic signature input by the user at the corresponding client. The target file is the file obtained after signing the file to be signed.
Specifically, the user may receive the electronic signature from the server after the electronic signature is input by the corresponding client. And then processing according to the received electronic signature. Accordingly, the size of the image corresponding to the electronic signature can be determined according to the length and the width corresponding to the target position, so that the image corresponding to the electronic signature is scaled. And determining the coordinates of the image corresponding to the electronic signature after processing according to the coordinates corresponding to the target position, and applying the image corresponding to the electronic signature to the target position to realize the effect of signing on the file to be signed, namely obtaining the target file.
According to the technical scheme, a slice image corresponding to a file to be signed is obtained, a filtering image and a gray level image corresponding to the slice image are obtained based on the slice image, and then a binarization image is determined according to the gray level image and the filtering image, so that a target connected domain corresponding to target characters is determined according to the binarization image, and a target position associated with the target connected domain is determined; and processing the received electronic signature according to the target position to obtain the target file signed on the file to be signed. The method solves the problem that the signature position of the non-standard file cannot be accurately positioned in the prior art, realizes the rapid positioning of the signature position of the file to be signed, improves the efficiency of electronic signature processing, and achieves the effect of improving user experience.
Example two
Fig. 2 is a flowchart of an electronic signature method according to an embodiment of the present invention, which is a preferred embodiment based on the above embodiment. The specific implementation manner can be seen in the technical scheme of the embodiment. Wherein, the technical terms identical to or corresponding to the above embodiments are not repeated herein. As shown in fig. 2, the method includes:
s210, acquiring a slice image corresponding to the file to be signed.
S220, a filtered image corresponding to the slice image and a gray scale image are determined.
S230, performing difference processing on pixel values of the same pixel positions of the gray image and the filtered image to obtain a to-be-processed image with reset pixel values.
In the embodiment of the present invention, the image to be processed may be an image obtained after resetting the pixel value of each pixel point in the slice image according to the difference value.
Specifically, after the gray image and the filtered image are obtained, the difference between the pixel values corresponding to the pixels at the same pixel position of the filtered image and the gray image can be calculated. And resetting the pixel value of each pixel point in the slice image according to the difference value of the two pixel points to achieve the aim of maximally distinguishing the difference between the pixel values corresponding to the characters and the background in the slice image. If the difference between the pixel value corresponding to the pixel point in the filtered image and the pixel value corresponding to the pixel point in the gray image is less than or equal to zero, the pixel point can be described as the background, and the pixel value can be set to zero, namely black. If the difference between the pixel value corresponding to the pixel point in the filtered image and the pixel value corresponding to the pixel point of the gray image is greater than zero, the pixel point is a word, and the pixel value can be set as the absolute value of the difference, namely gray. Correspondingly, a slice image with the reset pixel value can be obtained, namely the image to be processed.
Illustratively, the pixel value corresponding to the filtered image is set to Cfilter and the pixel value corresponding to the grayscale image is set to Cgrey. The pixel value difference for the same pixel location of the two images may be calculated, wherein the specific rules may be set as follows:
if Cfilter-Cgrey is less than or equal to 0, the pixel point is used as a background, and the pixel value can be set to be 0, namely black;
if Cfilter-Cgrey > 0, the pixel is text, the pixel value can be set to the absolute value of the difference, cfilter-Cgrey, i.e., gray.
Thus, according to the above rule, the image to be processed after the pixel value is reset is obtained.
S240, determining a binarized image based on the image to be processed.
Specifically, after obtaining the slice image with the reset pixel value, that is, the image to be processed may be subjected to binarization processing, and optionally, the pixel point corresponding to the background may be set to black, and the pixel point corresponding to the text may be set to white. Based on this, a binarized image can be obtained.
Optionally, determining the binarized image based on the image to be processed includes: adjusting the pixel value of the pixel point smaller than or equal to the preset pixel threshold value to be a first pixel value, and adjusting the pixel value of the pixel point larger than the preset pixel threshold value to be a second pixel value; based on the first pixel value and the second pixel value, a binarized image distinguishing the background from the text is obtained.
In the embodiment of the present invention, the preset pixel threshold may be a boundary value of pixel values set according to actual requirements. The first pixel value may be a pixel value corresponding to a background pixel point. Alternatively, the first pixel value may be set to 0, i.e. represent black. The second pixel value may be a pixel value corresponding to a text pixel point. Alternatively, the second pixel value may be set to 255, i.e. represent white.
Specifically, the corresponding preset pixel threshold value may be obtained according to an algorithm of the adaptive threshold value calculation, so that the pixel value of the pixel point in the image to be processed is compared with the preset pixel threshold value. If the pixel value of the pixel point in the image to be processed is smaller than or equal to a preset pixel threshold value, the pixel value of the corresponding pixel point is adjusted to be a first pixel value. And if the pixel value of the pixel point in the image to be processed is larger than the preset pixel threshold value, adjusting the pixel value of the corresponding pixel point to be a second pixel value. After the adjustment, the pixel points are divided into two types, namely, the pixel point corresponding to the first pixel value is the pixel point of the background, and the pixel point corresponding to the second pixel value is the pixel point of the text, so that a binary image for distinguishing the background and the text is obtained.
By way of example, the image to be processed is subjected to binarization processing, so that a binarized image with black background and white text can be obtained. Based on the method, the distinction between the text and the background can be highlighted, and the method is beneficial to the subsequent determination of the position where the signature is needed.
S250, determining a target connected domain corresponding to the target text based on the binarized image, and determining a target position associated with the target connected domain.
Optionally, determining the target connected domain corresponding to the target text based on the binarized image, and determining the target position associated with the target connected domain includes: performing connected domain processing on adjacent pixel points with the pixel value being the second pixel value in the binarized image, and determining at least one connected domain containing characters in the slice image; determining a target connected domain comprising target characters; and determining the target position of the target connected domain.
Specifically, in the binarized image, the pixel with the pixel value being the second pixel value is the pixel with the corresponding text, and the adjacent pixel with the second pixel value can be subjected to connected domain processing, that is, the connected domain formed by all the adjacent pixels with the pixel value being the second pixel value. Thereby obtaining one or more connected domains including text in the slice image. After the connected domain including the text is obtained, a target connected domain corresponding to the target text can be further determined therefrom. Then, the target position of the target connected domain in the binarized image can be determined.
Optionally, determining the target position of the target connected domain includes: and recording pixel coordinates of the target connected domain in the slice image, and representing the pixel coordinates in a four-component form to obtain the target position.
In the embodiment of the present invention, the pixel coordinates may be pixel coordinates corresponding to vertices of a rectangle corresponding to the target connected domain. The four components may be four components obtained based on pixel coordinate data of vertices of a rectangle corresponding to the target connected domain. The first component may be an abscissa of a pixel point corresponding to an upper left corner vertex of a rectangle corresponding to the target connected domain; the second component may be an ordinate of a pixel point corresponding to an upper left corner vertex of a rectangle corresponding to the target connected domain; the third component may be a width of a rectangle corresponding to the target connected domain; the fourth component may be the length of the rectangle to which the target connected domain corresponds. For example, the pixel coordinates may be (x, y, w, h), where x represents the first component, y represents the second component, w represents the third component, and h represents the fourth component.
Specifically, the pixel coordinates of the target connected domain corresponding to the target connected domain in the slice image can be recorded, and then the pixel coordinates can be expressed in a four-component form, so that the target position can be accurately obtained through the expression, and meanwhile, a basis is provided for processing of the electronic signature.
And S260, processing the received electronic signature based on the target position to obtain a target file signed on the file to be signed.
Optionally, processing the received electronic signature based on the target location to obtain a target file signed on the file to be signed, including: when the electronic signature is received, determining the length and the width corresponding to the target position; scaling the signature image corresponding to the electronic signature based on the length and the width to obtain an image to be pasted; and pasting the image to be pasted based on the four components in the target position to obtain the target file.
In the embodiment of the present invention, the length and the width may be the length and the width of the rectangle of the target connected domain corresponding to the target position. The signature image may be an image containing an electronic signature of the user. The image to be pasted may be an image after the signature image scaling process.
Specifically, when the electronic signature of the user is received, the length and the width of the rectangle of the target connected domain corresponding to the target position can be determined. And the electronic signature is subjected to scaling processing on the size corresponding to the signature image corresponding to the electronic signature, so that the scaled signature image is consistent with the length and width of the rectangle. Correspondingly, the image to be pasted is obtained. Then, the image to be pasted can be pasted according to the four components corresponding to the target position, so that a target file containing the electronic signature is obtained.
According to the technical scheme, a slice image corresponding to the file to be signed is obtained, and a filtering image and a gray level image corresponding to the slice image are determined. Then, the pixel values of the same pixel positions of the gray image and the filtered image can be subjected to difference processing to obtain a to-be-processed image with reset pixel values, so that a binarized image is determined based on the to-be-processed image. Based on the method, clearer characters and backgrounds can be obtained, so that distinction between the characters and the backgrounds is highlighted, and the target position can be determined conveniently. Further, a target connected domain corresponding to the target text is determined according to the binarized image, and a target position associated with the target connected domain is determined. And processing the received electronic signature based on the target position to obtain the target file signed on the file to be signed. The method solves the problem that the signature position of the non-standard file cannot be accurately positioned in the prior art, realizes the rapid positioning of the signature position of the file to be signed, improves the efficiency of electronic signature processing, and achieves the effect of improving user experience.
Example III
Fig. 3 is a schematic structural diagram of an electronic signature device according to an embodiment of the present invention. As shown in fig. 3, the apparatus includes: a slice image acquisition module 310, a filtered image and grayscale image acquisition module 320, a binarized image acquisition module 330, a target position determination module 340, and an electronic signature processing module 350.
A slice image acquisition module 310, configured to acquire a slice image corresponding to a file to be signed; a filtered image and grayscale image acquisition module 320 for determining a filtered image and a grayscale image corresponding to the slice image; a binarized image acquisition module 330 for determining a binarized image based on the gray scale image and the filtered image; the target position determining module 340 is configured to determine a target connected domain corresponding to the target text, and determine a target position associated with the target connected domain, based on the binarized image; the electronic signature processing module 350 is configured to process the received electronic signature based on the target location, so as to obtain a target file signed on the file to be signed.
According to the technical scheme, a slice image corresponding to a file to be signed is obtained, a filtering image and a gray level image corresponding to the slice image are obtained based on the slice image, and then a binarization image is determined according to the gray level image and the filtering image, so that a target connected domain corresponding to target characters is determined according to the binarization image, and a target position associated with the target connected domain is determined; and processing the received electronic signature according to the target position to obtain the target file signed on the file to be signed. The method solves the problem that the signature position of the non-standard file cannot be accurately positioned in the prior art, realizes the rapid positioning of the signature position of the file to be signed, improves the efficiency of electronic signature processing, and achieves the effect of improving user experience.
On the basis of the above embodiment, optionally, the slice image acquisition module includes: the image processing unit is used for processing the file content of the file to be signed; and the slice image acquisition unit is used for taking the image to be processed comprising the signature field as a slice image.
Optionally, the filtering image and gray scale image acquiring module includes: the filtering image acquisition unit is used for carrying out filtering processing on the slice image so as to obtain a filtering image with noise points in the slice image removed; and the gray image acquisition unit is used for converting the slice image into gray image to obtain the gray image.
Optionally, the binarized image acquisition module includes: the image to be processed acquisition unit is used for carrying out difference processing on pixel values of the same pixel positions of the gray level image and the filtered image to obtain an image to be processed with reset pixel values; and the binarization image acquisition unit is used for determining a binarization image based on the image to be processed.
Optionally, the binarized image acquisition unit includes: a pixel value adjusting subunit, configured to adjust a pixel value of a pixel point smaller than or equal to a preset pixel threshold to a first pixel value, and adjust a pixel value of a pixel point larger than the preset pixel threshold to a second pixel value; and the binarization graph acquisition subunit is used for acquiring a binarization image for distinguishing the background and the characters based on the first pixel value and the second pixel value.
Optionally, the target position determining module includes: the connected domain determining unit is used for performing connected domain processing on adjacent pixel points with the pixel value being a second pixel value in the binarized image and determining at least one connected domain containing characters in the slice image; a target connected domain determining unit for determining a target connected domain including a target text; and the target position determining unit is used for determining the target position of the target connected domain.
Optionally, the target position determining unit is configured to record pixel coordinates of the target connected domain in the slice image, and represent the pixel coordinates in a four-component form, so as to obtain the target position.
Optionally, the electronic signature processing module includes: a length and width determining unit, configured to determine, when the electronic signature is received, a length and width corresponding to the target position; the to-be-pasted image determining unit is used for performing scaling processing on the signature image corresponding to the electronic signature based on the length and the width to obtain the to-be-pasted image; and the target file acquisition unit is used for pasting the image to be pasted based on the four components in the target position to obtain the target file.
The electronic signature device provided by the embodiment of the invention can execute the electronic signature method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
Example IV
Fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present invention. The electronic device 10 is intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. Electronic equipment may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 4, the electronic device 10 includes at least one processor 11, and a memory, such as a Read Only Memory (ROM) 12, a Random Access Memory (RAM) 13, etc., communicatively connected to the at least one processor 11, in which the memory stores a computer program executable by the at least one processor, and the processor 11 may perform various appropriate actions and processes according to the computer program stored in the Read Only Memory (ROM) 12 or the computer program loaded from the storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 may also be stored. The processor 11, the ROM 12 and the RAM 13 are connected to each other via a bus 14. An input/output (I/O) interface 15 is also connected to bus 14.
Various components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16 such as a keyboard, a mouse, etc.; an output unit 17 such as various types of displays, speakers, and the like; a storage unit 18 such as a magnetic disk, an optical disk, or the like; and a communication unit 19 such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunication networks.
The processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, digital Signal Processors (DSPs), and any suitable processor, controller, microcontroller, etc. The processor 11 performs the various methods and processes described above, such as the electronic signature method.
In some embodiments, the electronic signature method may be implemented as a computer program tangibly embodied on a computer-readable storage medium, such as the storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the electronic signature method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the electronic signature method in any other suitable way (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
The computer program for implementing the electronic signature method of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be implemented. The computer program may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
Example five
The embodiment of the invention also provides a computer readable storage medium, wherein the computer readable storage medium stores computer instructions for causing a processor to execute an electronic signature method, the method comprising:
acquiring a slice image corresponding to a file to be signed; determining a filtered image corresponding to the slice image and a gray scale image; determining a binarized image based on the gray scale image and the filtered image; based on the binarized image, determining a target connected domain corresponding to the target text, and determining a target position associated with the target connected domain; and processing the received electronic signature based on the target position to obtain a target file signed on the file to be signed.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the internet.
The computing system may include clients and servers. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical hosts and VPS service are overcome.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps described in the present invention may be performed in parallel, sequentially, or in a different order, so long as the desired results of the technical solution of the present invention are achieved, and the present invention is not limited herein.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.
Claims (10)
1. An electronic signature method, comprising:
acquiring a slice image corresponding to a file to be signed;
determining a filtered image corresponding to the slice image and a gray scale image;
determining a binarized image based on the gray scale image and the filtered image;
determining a target connected domain corresponding to target characters based on the binarized image, and determining a target position associated with the target connected domain;
and processing the received electronic signature based on the target position to obtain a target file signed on the file to be signed.
2. The method of claim 1, wherein the acquiring a slice image corresponding to a document to be signed comprises:
converting the file content of the file to be signed into an image to be processed;
and taking the image to be processed comprising the signature field as the slice image.
3. The method of claim 1, wherein the determining the filtered image and the gray scale image corresponding to the slice image comprises:
filtering the slice image to obtain a filtered image with noise points removed from the slice image;
and converting the slice image into gray scale to obtain the gray scale image.
4. The method of claim 1, wherein the determining a binarized image based on the gray scale image and the filtered image comprises:
performing difference processing on pixel values of the same pixel positions of the gray image and the filter image to obtain an image to be processed with reset pixel values;
and determining the binarized image based on the image to be processed.
5. The method of claim 4, wherein the determining the binarized image based on the image to be processed comprises:
adjusting the pixel value of the pixel point smaller than or equal to a preset pixel threshold value to be a first pixel value, and adjusting the pixel value of the pixel point larger than the preset pixel threshold value to be a second pixel value;
and obtaining a binarized image for distinguishing the background from the text based on the first pixel value and the second pixel value.
6. The method according to claim 1, wherein determining a target connected domain corresponding to a target text and determining a target position associated with the target connected domain based on the binarized image comprises:
performing connected domain processing on adjacent pixel points with the pixel value being a second pixel value in the binarized image, and determining at least one connected domain including characters in the slice image;
determining a target connected domain comprising the target text;
and determining the target position of the target connected domain.
7. The method of claim 6, wherein the determining the target location of the target connected domain comprises:
and recording pixel coordinates of the target connected domain in the slice image, and representing the pixel coordinates in a four-component form to obtain the target position.
8. The method according to claim 1, wherein the processing the received electronic signature based on the target location to obtain the target file signed on the file to be signed comprises:
when the electronic signature is received, determining the length and the width corresponding to the target position;
scaling the signature image corresponding to the electronic signature based on the length and the width to obtain an image to be pasted;
and pasting the image to be pasted based on the four components in the target position to obtain the target file.
9. An electronic signature device, comprising:
the slice image acquisition module is used for acquiring a slice image corresponding to the file to be signed;
the filtered image and gray level image acquisition module is used for determining a filtered image and a gray level image corresponding to the slice image;
a binarized image acquisition module for determining a binarized image based on the gray scale image and the filtered image;
the target position determining module is used for determining a target connected domain corresponding to the target text based on the binarized image and determining a target position associated with the target connected domain;
and the electronic signature processing module is used for processing the received electronic signature based on the target position to obtain a target file signed on the file to be signed.
10. An electronic device, the electronic device comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the electronic signature method of any one of claims 1-8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311616485.2A CN117456157A (en) | 2023-11-29 | 2023-11-29 | Electronic signature method and device and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311616485.2A CN117456157A (en) | 2023-11-29 | 2023-11-29 | Electronic signature method and device and electronic equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117456157A true CN117456157A (en) | 2024-01-26 |
Family
ID=89593033
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311616485.2A Pending CN117456157A (en) | 2023-11-29 | 2023-11-29 | Electronic signature method and device and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117456157A (en) |
-
2023
- 2023-11-29 CN CN202311616485.2A patent/CN117456157A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109447154B (en) | Picture similarity detection method, device, medium and electronic equipment | |
CN113313111B (en) | Text recognition method, device, equipment and medium | |
CN114463586A (en) | Training and image recognition method, device, equipment and medium of image recognition model | |
RU2721188C2 (en) | Improved contrast and noise reduction on images obtained from cameras | |
CN112949767B (en) | Sample image increment, image detection model training and image detection method | |
CN113487473B (en) | Method and device for adding image watermark, electronic equipment and storage medium | |
CN116645678A (en) | Image processing method and device based on vector graphics drawing | |
CN118135381B (en) | Image blurring detection method, device, equipment and medium | |
CN113888635A (en) | Visual positioning method, related device and computer program product | |
CN117557777A (en) | Sample image determining method and device, electronic equipment and storage medium | |
CN115205163B (en) | Method, device and equipment for processing identification image and storage medium | |
CN111476800A (en) | Character region detection method and device based on morphological operation | |
CN117456157A (en) | Electronic signature method and device and electronic equipment | |
CN114511862B (en) | Form identification method and device and electronic equipment | |
CN117333443A (en) | Defect detection method and device, electronic equipment and storage medium | |
CN114120305B (en) | Training method of text classification model, and text content recognition method and device | |
CN115601616A (en) | Sample data generation method and device, electronic equipment and storage medium | |
CN114648751A (en) | Method, device, terminal and storage medium for processing video subtitles | |
CN114998906B (en) | Text detection method, training method and device of model, electronic equipment and medium | |
CN118570590B (en) | Simulation method, device, equipment and medium for image printing and photographing process | |
CN116542987B (en) | Image clipping method and device, electronic equipment and storage medium | |
CN114842485B (en) | Subtitle removing method and device and electronic equipment | |
WO2023134068A1 (en) | Digit recognition model training method and apparatus, device, and storage medium | |
CN117541801A (en) | Seal detection method, device, electronic equipment and medium | |
CN117237967A (en) | Image processing method, device, equipment and medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |