CN114219691A - Electronic document processing method and device, storage medium and electronic equipment - Google Patents

Electronic document processing method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN114219691A
CN114219691A CN202110750915.4A CN202110750915A CN114219691A CN 114219691 A CN114219691 A CN 114219691A CN 202110750915 A CN202110750915 A CN 202110750915A CN 114219691 A CN114219691 A CN 114219691A
Authority
CN
China
Prior art keywords
sub
seal
target
stamp
document
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
Application number
CN202110750915.4A
Other languages
Chinese (zh)
Inventor
颜欣
张作兵
徐阳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Kingsoft Office Software Inc
Zhuhai Kingsoft Office Software Co Ltd
Wuhan Kingsoft Office Software Co Ltd
Original Assignee
Beijing Kingsoft Office Software Inc
Zhuhai Kingsoft Office Software Co Ltd
Wuhan Kingsoft Office Software Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing Kingsoft Office Software Inc, Zhuhai Kingsoft Office Software Co Ltd, Wuhan Kingsoft Office Software Co Ltd filed Critical Beijing Kingsoft Office Software Inc
Priority to CN202110750915.4A priority Critical patent/CN114219691A/en
Publication of CN114219691A publication Critical patent/CN114219691A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/0021Image watermarking
    • G06T1/0042Fragile watermarking, e.g. so as to detect tampering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • G06T3/4038Image mosaicing, e.g. composing plane images from plane sub-images
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/60Rotation of whole images or parts thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/12Edge-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The invention discloses a method and a device for processing an electronic document, a storage medium and electronic equipment. Wherein, the method comprises the following steps: acquiring a target seal object, wherein the target seal object is used for verifying a document page sequence contained in an electronic document; dividing the target seal object into a plurality of sub-image seal objects according to the number of document pages in the document page sequence; and inserting the plurality of sub-seal objects into the corresponding object positions on each document page. The invention solves the technical problem of low document security caused by the fact that the electronic document is easy to be tampered or replaced due to the fact that the electronic document has no security mark.

Description

Electronic document processing method and device, storage medium and electronic equipment
Technical Field
The invention relates to the field of computers, in particular to a method and a device for processing an electronic document, a storage medium and electronic equipment.
Background
In order to prevent others from replacing the document contents of the paper document or repudiating the confirmed document contents, the signer often covers the paper document with a perforation seal. The seal with the perforation is formed by adding the seal of the original seal on the side face of the paper document, so that each page of the paper document after the seal with the perforation is completely covered displays one part of the seal, and the seal with the perforation can be restored into the original seal when the paper document is unfolded according to pages, thereby preventing other people from counterfeiting or replacing the paper document.
However, at present, for an electronic document, a method of inserting a seal has not been provided, so that the electronic document is easily tampered or replaced, thereby causing a problem of low security of the electronic document.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
The embodiment of the invention provides a method and a device for processing an electronic document, a storage medium and electronic equipment, which are used for at least solving the technical problem of low document security caused by the fact that the document is easy to be tampered or replaced because the electronic document does not have a security mark.
According to an aspect of an embodiment of the present invention, there is provided an electronic document processing method, including: acquiring a target seal object, wherein the target seal object is used for verifying a document page sequence contained in an electronic document; dividing the target seal object into a plurality of sub-seal objects according to the number of document pages in the document page sequence; and inserting the plurality of sub-seal objects into the corresponding object positions on each document page.
Optionally, the inserting the plurality of sub-stamp objects into the corresponding object position on each document page includes: determining a first sub-image stamp object and a second sub-image stamp object from the target stamp object; inserting the first sub-image chapter object into an object position in a first page of the document page sequence, and inserting the second sub-image chapter object into an object position in a last page of the document page sequence; and inserting a third sub-stamp object in the plurality of sub-stamp objects into an object position in a corresponding intermediate page of the document page sequence, wherein the third sub-stamp object is a sub-stamp object except the first sub-stamp object and the second sub-stamp object in the plurality of sub-stamp objects, and the intermediate page is a page except the first page and the last page in the document page sequence.
Optionally, the inserting a third sub-stamp object of the plurality of sub-stamp objects into an object position in a corresponding intermediate page of the document page sequence includes: and determining the object position of the third sub-image chapter object in the middle page according to the page width of the document page and the object width of the third sub-image chapter object.
Optionally, before determining the first sub-image chapter object and the second sub-image chapter object from the target chapter object, the method further includes: performing edge recognition on the target seal object to obtain a contour array corresponding to the target seal object, wherein the target seal object comprises an effective seal part and a seal frame part; constructing an effective seal area corresponding to the effective seal part based on the outline array; and determining a seal frame region corresponding to the seal frame part based on the effective seal region, and determining a circumscribed rectangular region corresponding to the target seal object based on the seal frame region.
Optionally, the profile array at least includes: the target stamp object has point coordinates of edge points of the valid stamp portion therein.
Optionally, the determining a first sub-stamp object and a second sub-stamp object from the target stamp object includes: dividing the effective seal region according to the number of document pages in the document page sequence to obtain N sub-seal regions, wherein N is a positive integer equal to the number of the document pages in value; and determining the first sub-stamp object and the second sub-stamp object according to the N sub-stamp regions and the circumscribed rectangle region.
Optionally, determining the first sub-stamp object according to the N sub-stamp regions and the circumscribed rectangle region includes: determining a first frame region in the circumscribed rectangular region, wherein the first frame region is a region adjacent to a first sub-stamp region in the N sub-stamp regions; and determining the content of the seal displayed in the first sub-seal region and the seal frame displayed in the first frame region as the first sub-seal object.
Optionally, determining the second sub-stamp object according to the N sub-stamp regions and the circumscribed rectangle region includes: determining a second frame region in the circumscribed rectangular region, wherein the second frame region is a region adjacent to an nth sub-stamp region of the N sub-stamp regions; and determining the content of the seal displayed in the nth sub-seal region and the seal frame displayed in the second frame region as the second sub-seal.
Optionally, the edge recognition on the target stamp object to obtain the corresponding outline array of the target stamp object includes: performing contour detection on the target stamp object to obtain a detection result, wherein in the contour detection process, a group of continuous pixel points meeting a contour condition is determined as a contour line, and the detection result comprises a point coordinate set corresponding to each of a plurality of contour lines identified from the target stamp object; traversing the detection result to obtain the position relation between any two contour lines; determining the line abrupt change positions among the contour lines based on the position relation; determining the profile array based on the position coordinates of the abrupt line change positions, wherein the profile array further comprises: point coordinates of edge points of the frame portion of the stamp within the target stamp object.
Optionally, the obtaining the target seal object includes: creating an original seal object in the electronic document to be processed; and carrying out binarization processing and denoising processing on the original seal object to obtain the target seal object.
Optionally, after the performing binarization processing and denoising processing on the original seal object to obtain the target seal object, the method further includes: generating a random rotation angle using a random function; and rotating the target seal object according to the random rotation angle by taking the central point of the target seal object as a rotation center to obtain the updated target seal object.
According to another aspect of the embodiments of the present invention, there is also provided an electronic document processing apparatus, including: an acquisition unit configured to acquire a target seal object, wherein the target seal object is used to verify a document page sequence included in an electronic document; a dividing unit, configured to divide the target stamp object into a plurality of sub-stamp objects according to the number of document pages in the document page sequence; and the inserting unit is used for inserting the plurality of sub-image chapter objects into the corresponding object positions on each document page.
Optionally, the insertion unit includes: the first determining module is used for determining a first sub-image stamp object and a second sub-image stamp object from the target stamp object; the first inserting module is used for inserting the first sub-image chapter object into an object position in a first page of the document page sequence and inserting the second sub-image chapter object into an object position in a last page of the document page sequence; a second inserting module, configured to insert a third sub-image chapter object of the multiple sub-image chapter objects into an object position in a corresponding intermediate page of the document page sequence, where the third sub-image chapter object is a sub-image chapter object of the multiple sub-image chapter objects except the first sub-image chapter object and the second sub-image chapter object, and the intermediate page is a page of the document page sequence except the first page and the last page.
Optionally, the second inserting module is further configured to determine an object position of the third sub-image chapter object in the intermediate page according to a page width of the document page and an object width of the third sub-image chapter object.
Optionally, the apparatus for processing an electronic document further includes a recognition unit configured to determine, from the target stamp object, before the first sub-stamp object and the second sub-stamp object, the method includes: the identification module is used for carrying out edge identification on the target seal object to obtain a profile array corresponding to the target seal object, wherein the target seal object comprises an effective seal part and a seal frame part; the construction module is used for constructing an effective seal area corresponding to the effective seal part based on the outline array; and the second determining module is used for determining a seal frame area corresponding to the seal frame part based on the effective seal area and determining a circumscribed rectangular area corresponding to the target seal object based on the seal frame area.
Optionally, the profile array at least includes: the target stamp object has point coordinates of edge points of the valid stamp portion therein.
Optionally, the first determining module includes: a segmentation module, configured to segment the effective seal region according to the number of document pages in the document page sequence to obtain N sub-seal regions, where N is a positive integer equal in value to the number of document pages; and a third determining module, configured to determine the first sub-image chapter object and the second sub-image chapter object according to the N sub-image chapter areas and the circumscribed rectangle area.
Optionally, the third determining module includes: a first sub-module, configured to determine a first frame region in the circumscribed rectangular region, where the first frame region is a region adjacent to a first sub-stamp region in the N sub-stamp regions; the content of the seal displayed in the first sub-seal region and the seal frame displayed in the first frame region are determined as the first sub-seal object.
Optionally, the third determining module includes: a second sub-module, configured to determine a second bounding box region in the circumscribed rectangular region, where the second bounding box region is a region adjacent to an nth sub-stamp region in the N sub-stamp regions; and determining the content of the seal displayed in the Nth sub-seal region and the seal frame displayed in the second frame region as the second sub-seal.
Optionally, the identification module includes: the detection module is used for carrying out contour detection on the target seal object to obtain a detection result, wherein in the contour detection process, a group of continuous pixel points meeting the contour condition is determined as a contour line, and the detection result comprises a point coordinate set corresponding to each of a plurality of contour lines identified from the target seal object; the first acquisition module is used for traversing the detection result and acquiring the position relation between any two contour lines; a fourth determining module, configured to determine abrupt line change positions between the contour lines based on the position relationship; a fifth determining module, configured to determine the contour array based on the position coordinates of the abrupt change position of the line, where the contour array further includes: point coordinates of edge points of the frame portion of the stamp within the target stamp object.
Optionally, the obtaining unit includes: the creating module is used for creating an original stamp object in the electronic document to be processed; and the processing module is used for carrying out binarization processing and denoising processing on the original seal object to obtain the target seal object.
Optionally, the apparatus for processing an electronic document further includes an updating unit, where the updating unit is configured to generate a random rotation angle by using a random function after the binarization processing and the denoising processing are performed on the original seal object to obtain the target seal object; and rotating the target seal object by the random rotation angle with the center point of the target seal object as a rotation center to obtain the updated target seal object.
According to still another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned processing method of an electronic document when running.
According to still another aspect of the embodiments of the present invention, there is also provided an electronic device including a memory in which a computer program is stored and a processor configured to execute the processing method of the electronic document by the computer program.
In the embodiment of the invention, a mode of acquiring a target stamp object in an electronic document, dividing the target stamp object into a plurality of sub-stamp objects according to the number of document pages and respectively inserting the sub-stamp objects into the document pages is adopted. The sub-seal objects formed by segmenting the target seal object are respectively inserted into the document pages, so that each document page comprises the sub-seal object serving as a safety mark, and the sub-seal objects can be spliced into a complete target seal object, and the aims of marking each page of document page contained in the electronic document by the sub-seal object and splicing the sub-seal objects into the complete target seal object are fulfilled. Therefore, the technical effects of adding the safety mark to the document page contained in the electronic document, improving the difficulty of tampering or replacing the electronic document, realizing the verification of the integrity of the electronic document through the safety mark and improving the safety of the electronic document are achieved. And the technical problem that the document is easy to be tampered or replaced due to the fact that the electronic document has no security mark is solved, and the document security is low.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention to a proper form. In the drawings:
FIG. 1 is a diagram illustrating an application environment of an alternative method for processing an electronic document according to an embodiment of the present invention;
FIG. 2 is a flow diagram illustrating an alternative method of processing an electronic document according to an embodiment of the present invention;
FIG. 3 is a flow diagram illustrating an alternative method of processing an electronic document according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of an alternative stamp object rotation according to an embodiment of the present invention;
FIG. 5 is a flow diagram illustrating an alternative method of processing an electronic document according to an embodiment of the present invention;
FIG. 6 is a flow diagram illustrating an alternative method of processing an electronic document according to an embodiment of the present invention;
FIG. 7 is a flow diagram illustrating an alternative method of processing an electronic document according to an embodiment of the present invention;
FIG. 8 is a schematic diagram of an alternative stamp object valid stamp region and circumscribed rectangle according to an embodiment of the present invention;
FIG. 9 is a schematic structural diagram of an alternative electronic document processing apparatus according to an embodiment of the present invention;
fig. 10 is a schematic structural diagram of an alternative electronic device according to an embodiment of the invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in other sequences than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover non-exclusive inclusions, 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.
According to an aspect of the embodiments of the present invention, there is provided a processing method of an electronic document, which may be applied, but not limited to, to the environment shown in fig. 1. Terminal device 102 interacts with server 122 via network 110. A database 124 and a processing engine 126 run in the server 122. The database 124 is used for storing the data received and processed by the server 122, and the processing engine 126 performs corresponding data processing by retrieving the data to be processed in the database 124 and stores the obtained processing result in the database 124.
The terminal device 102 runs an electronic document, and the electronic document is a document to be processed to which a security mark is not added. The terminal device 102 transmits the pending electronic document to the server 122 via the network 110, and the server 122 stores the received pending electronic document in the database 124. The processing engine 126 sequentially executes S102 to S106. A target seal object is acquired, the target seal object being an image for verifying a document page sequence contained in an electronic document. And segmenting the target seal object into a plurality of sub-seal objects, and segmenting the target seal object according to the number of document pages in the document page sequence to obtain a plurality of sub-seal objects matched with the number of document pages. A plurality of sub-image chapter objects are inserted into the document pages, and corresponding sub-image chapter objects are inserted into the object positions on each document page. In the case where the sub-chapter object insertion is completed, an electronic document to which a security flag is added is obtained, the electronic document to which the security flag is added is stored in the database 124, and the electronic document to which the security flag is added is returned to the terminal device 102 via the network 110.
Optionally, in this embodiment, the terminal device may be a terminal device configured with a target client, and may include, but is not limited to, at least one of the following: mobile phones (such as Android phones, IOS phones, etc.), notebook computers, tablet computers, palm computers, MID (Mobile Internet Devices), PAD, desktop computers, smart televisions, etc. The target client can be a client with electronic document editing and browsing functions, and is not limited to a video client, an instant messaging client, a browser client, an education client and the like. Such networks may include, but are not limited to: a wired network, a wireless network, wherein the wired network comprises: a local area network, a metropolitan area network, and a wide area network, the wireless network comprising: bluetooth, WIFI, and other networks that enable wireless communication. The server may be a single server, a server cluster composed of a plurality of servers, or a cloud server. The above is merely an example, and this is not limited in this embodiment.
As an alternative implementation, as shown in fig. 2, the method for processing the electronic document includes:
s202, a target seal object is obtained, wherein the target seal object is used for verifying a document page sequence contained in the electronic document.
Alternatively, the target stamp object may be divided into, but not limited to, an effective stamp region and a stamp frame region in terms of effective content and a frame image.
S204, dividing the target seal object into a plurality of sub-image seal objects according to the number of the document pages in the document page sequence.
Optionally, the document page sequence is a page ordering of document pages formed by continuity in content. For electronic documents, the sequence of document pages is fixed after the document editing is complete. The number of document pages contained in the electronic document can be determined through the document page sequence, and the target stamp object is segmented according to the number of the document pages to form a plurality of sub-stamp objects which are consistent with the document pages in number.
Alternatively, the division of the target stamp object may be, but is not limited to, the division of the effective content contained in the target stamp object, and the effective content contained in the target stamp object is divided into a plurality of sub-stamp objects, so that each of the plurality of sub-stamp objects includes a part of the effective content in the target stamp object.
Alternatively, in the case where the number of document pages is one, the target chapter object is taken as one sub-image chapter object. In the case where the number of document pages is two, the target chapter object is divided into two sub-image chapter objects each containing a part of the effective content according to the effective content. In the case where the number of document pages is a positive integer N greater than two, the target seal object is divided into N sub-seal objects each containing a part of the effective content in accordance with the effective content.
S206, inserting a plurality of sub-image chapter objects into the corresponding object positions on each document page.
Optionally, the plurality of sub-images are sequentially inserted into corresponding document pages in the document page sequence according to the seal sequence of the sub-image seal object. The chapter sequence of the sub-chapter object may be a formed object sequence that is divided from left to right with respect to the target chapter object. And the sequence is the limit of the matching corresponding relation between the seal sequence of the sub-seal object and the document page sequence. For example, a first sub-chapter of the plurality of sub-chapters is inserted into the document page of the first page, a second sub-chapter of the plurality of sub-chapters is inserted … … into the document page of the second page, and so on, and an Nth sub-chapter of the plurality of sub-chapters is inserted into the document page of the Nth page. The order of the sub-image chapter objects is not limited to the order of insertion, and the insertion order of each sub-image chapter object may be different from the sequence of chapters of the sub-image chapter object. For example, the second sub-stamp is inserted into the document page of the second page first, and then the first sub-stamp is inserted into the document page of the first page, the first sub-stamp corresponds to the document page of the first page, and each sub-stamp has a corresponding document page.
Optionally, the object position is located at the edge of the document page, which may be, but is not limited to, the upper edge, the lower edge, the left edge, and the right edge. The specific edge locations are not limited herein. Taking the right edge as an example, the object position is at the right edge position inside the page of each document page, and a plurality of object positions can be displayed as a complete target seal object in a splicing manner.
Alternatively, in the case where the number of document pages is one, the coordinates of the object position may be a coordinate position randomly selected inside the document page.
In the embodiment of the application, an original stamp object used for indicating a security mark is created in an electronic document, the original stamp object is processed to obtain a target stamp object, the target stamp object is divided into a plurality of sub-stamp objects according to the number of document pages, the sub-stamp objects are respectively inserted into the document pages, the plurality of sub-stamp objects formed by dividing the target stamp object are respectively inserted into the document pages, so that each document page comprises the sub-stamp objects used as the security mark, and the sub-stamp objects can be spliced into a complete target stamp object, thereby achieving the purpose of marking each page of document included in the electronic document by the sub-stamp objects and splicing the sub-stamp objects into the complete target stamp object, and further realizing the purpose of adding the security mark to the document page included in the electronic document, the difficulty of tampering or replacing the electronic document is improved, so that the integrity of the electronic document can be verified through the safety mark, the technical effect of the safety of the electronic document is improved, and the technical problem of low document safety caused by the fact that the document is easily tampered or replaced due to the fact that the electronic document does not have the safety mark is solved.
As an optional implementation, acquiring the target stamp object includes:
s1, creating an original seal object in the electronic document to be processed;
and S2, performing binarization processing and denoising processing on the original seal object to obtain a target seal object.
Optionally, the original seal object may be a picture containing effective content, and the effective content includes at least one of the following: pattern, character. The pattern content is not limited, such as tissue marking patterns and the like. Characters are not limited to words, letters, numbers, and any combination thereof. The number of characters is not limited herein.
Alternatively, the original seal object may be a preset pattern picture, or may be a matching pattern picture generated according to an input instruction. The effective content of the preset style picture can be preset content, the picture size can be set according to attribute parameters related to the electronic document, for example, under the condition that the picture size is related to the page number attribute of the electronic document, the picture size of the preset style picture is adjusted to a size format matched with the page attribute of the electronic document.
Alternatively, the input indication of the matching pattern picture may include, but is not limited to, a picture background selection indication, a picture content input indication, and a picture size setting indication. The picture background selection instruction may be a background pattern to be an original image chapter object obtained by rendering and size-processing a picture stored in a preset database. The picture content input instruction is not limited to a setting for determining the characters, letters, numbers, and fonts and sizes of characters included therein. The picture size setting instruction may be a size determination of a picture including an input pattern, and it should be noted that the setting of the picture size has a settable range, and is not limited to setting a minimum size threshold to ensure definition, and setting a maximum size threshold to ensure complete display of an original chapter object in a document.
Alternatively, the original chapter object may be, but is not limited to, a picture including a frame pattern, and the frame pattern may be disposed on the periphery of the effective content composed of the pattern and the character. The shape of the frame is not limited herein, and may be rectangular, circular, or the like. There may be a gap between the bezel and the active content, and the size of the gap is not limited herein.
Alternatively, the processing on the original image seal object may be, but is not limited to, performing optimization processing on the original image seal object to facilitate identification of valid content in the original image seal object. The original seal object can be divided into, but not limited to, an effective seal and a seal frame according to the effective content and the frame image.
Alternatively, the identification process of the valid content in the original seal object may include, but is not limited to, image binarization, seal denoising, and seal edge detection. The binarization processing and the denoising processing have a preset processing sequence, and the processing sequence of the binarization processing is before the denoising processing. Firstly, binarization processing is carried out on an original seal object, and denoising processing is carried out on a binary image obtained through binarization processing.
Alternatively, the binarization processing of the stamp object is to convert the color stamp image into a binary image, and reduce the data amount in the stamp object so as to highlight the outline of the effective content in the stamp object. The stamp binarization may be, but is not limited to, implemented by open source computer vision (OpenCV). The implementation steps may be, but are not limited to, as follows:
the method comprises the following steps: reading the seal, and reading the matrix information mat _ src of the seal object based on the storage path of the seal object by using an immead function.
Step two: and creating a picture matrix, and respectively creating two picture matrix information mat _ gray and mat _ binary which are identical to the matrix information mat _ src in size and type by using a create function and taking the size and the type of the matrix information mat _ src as input parameters.
Step three: determining a GRAY image, using a cvtColor function, taking matrix information mat _ src as an input parameter and a picture matrix mat _ GRAY as an output parameter, setting action as COLOR _ BGR2GRAY, and converting an original chapter object into a matched GRAY image, wherein mat _ GRAY is the matrix information of the converted GRAY image.
Step four: and (3) image binarization conversion, namely using a threshold function, taking mat _ gray as an input parameter, taking mat _ BINARY as an output parameter, simultaneously setting a binarization threshold value, setting actions as THRESH _ BINARY, converting the gray level image into a BINARY image, wherein mat _ BINARY is matrix information of the converted BINARY image.
Optionally, the denoising processing of the seal object is to perform noise removal on the original seal object. The denoising operation can be performed by using, but not limited to, a mean filtering blu function of opencv, and other denoising methods can also be used. The prototype mean filtering blu function of opencv is:
void blur(InputArray src,OutputArray dst,Size ksize,Point anchor=Point(-1,-1),int orderType=BORDER_DEFAULT)
the parameter settings of the blu function may be, but are not limited to, as follows:
inputting parameters, wherein the binary image matrix mat _ bank is used as the input parameters;
an output parameter that creates an image matrix mat _ processed, which is the same as mat _ bind in type and size, as an output parameter using a create function;
kernel parameters, setting the kernel size of mean filtering, which can be limited to 3 × 3 or 5 × 5;
determining an anchor Point, and under the condition that a default value Point (-1, -1) exists and the Point coordinate of the default value is a negative value, indicating that the center Point of the kernel is taken as the anchor Point, and indicating that the anchor Point is in the center of the kernel by using Point (-1, -1);
determining a boundary pattern: but is not limited to, BORDER _ DEFAULT.
In the embodiment of the application, the binary image matrix mat _ binary is used as an input parameter, the input parameter is input to a blu function to perform image denoising, and the obtained output image matrix mat _ processed is used as a denoised seal object. By denoising the seal object, the region of the effective content in the seal object can be determined, so that the accuracy of edge detection of the effective content of the seal object is improved.
As an alternative embodiment, as shown in fig. 3, after performing binarization processing and denoising processing on the original seal object to obtain a target seal object, the method further includes:
s302, generating a random rotation angle by using a random function;
s304, the target seal object is rotated according to the random rotation angle by taking the central point of the target seal object as a rotation center, and the updated target seal object is obtained.
Alternatively, the generated random rotation angle may be, but is not limited to, a rotation angle α randomly generated using a rand function of C language (α greater than 0 means counterclockwise rotation, α less than 0 means clockwise rotation).
Alternatively, rotating the target seal object to obtain an updated target seal object may be, but is not limited to: and creating the seal object according to the path of the target seal object. The matrix object img _ matrix is generated, so that the target seal object performs matrix rotation transformation according to the img _ matrix, that is, the central point of the target seal object is used as a rotation center, and the target seal object is rotated by an angle α to obtain a rotated seal object (i.e., the updated target seal object), and the rotation of the target seal object is not limited to that shown in fig. 4. In the figure, the target seal object 402 is rotated clockwise by α degrees with the center point 404 as the rotation center to obtain an updated target seal object 412. The circumscribed rectangle 410 is the circumscribed rectangle of the updated target stamp object 412. Similarly, the target seal object 402 is rotated counterclockwise by α degrees around the center point 404 as the rotation center, as shown in the left diagram.
Alternatively, in the case of performing a rotation update on the target stamp object, a circumscribed rectangle of the updated target stamp object is determined. Taking the original rotation angle of the target seal object as 0 as an example, the schematic diagram of the circumscribed rectangle of the updated target seal object is not limited to the circumscribed rectangle 410 shown in fig. 4. The left diagram in fig. 4 illustrates a case where the rotation α angle is 0 or more, and the right diagram illustrates a case where the rotation α angle is less than 0. The target stamp object 402 and the updated target stamp object 412 have a width w and a height h, respectively. The circumscribed rectangle 410 of the updated target stamp object 412 has a width w0 and a height h 0. The circumscribed rectangle has a width w0 of w × cos | α | + h × sin | α |, and a height h0 of w × sin | α | + h × cos | α |.
In the embodiment of the application, the seal object can be further processed through the rotation of the target seal object, the seal object is cut and inserted relatively to the direct seal object, the seal object is cut again after being rotated and updated, deformation processing can be further carried out on the basis of the seal object, so that the sub-seal object formed by cutting is not easy to imitate and replace, the difficulty of tampering and replacing the electronic document is further improved, and the safety of the electronic document is improved by improving the difficulty of obtaining the target seal object.
As an alternative implementation, as shown in FIG. 5, the inserting the multiple sub-image chapter objects into the corresponding object positions on each document page includes:
s502, determining a first sub-image stamp object and a second sub-image stamp object from the target stamp object;
s504, inserting the first sub-image chapter object into an object position in a first page of a document page sequence, and inserting the second sub-image chapter object into an object position in a last page of the document page sequence;
s506, inserting a third sub-image chapter object in the multiple sub-image chapter objects into an object position in a corresponding middle page of the document page sequence, wherein the third sub-image chapter object is a sub-image chapter object except the first sub-image chapter object and the second sub-image chapter object in the multiple sub-image chapter objects, and the middle page is a page except a first page and a last page in the document page sequence.
Alternatively, in the case where the number of the plurality of sub-image chapter objects is one, that is, the number of document pages is one, the object position where the chapter object is inserted into the document page is determined. The object position may be determined by, but is not limited to, the stamp size, the rotation angle, and the page offset value. In the case where the object position is determined, the stamp object is rotationally updated. The rotation angle and the page offset value may be randomly generated or randomly acquired.
Alternatively, the coordinates of the circumscribed rectangle may be obtained from the dimensions of the circumscribed rectangle of the stamp object, thereby determining the coordinates of the object position. The page offset value may be obtained according to the page size. Assuming that the page width is page _ width and the page height is page _ height, a random number range ()% (page _ width-w1+1) is generated as a page offset value by a range function. If the x-axis coordinate of the circumscribed rectangle is pos _ x and the y-axis coordinate is pos _ y, then the coordinates of the upper left corner (x, y) of the object position where the stamp object is inserted can be obtained from the coordinates of the circumscribed rectangle, taking the example shown in fig. 4 as follows:
α > -0 (counter clockwise rotation): x & gt pos _ x, y & gt pos _ y + w × sin | α |;
α <0 (clockwise rotation): x & ltpos _ x & gt + h & ltx sin | α |, y & ltpos _ y.
Optionally, in the case that the number of the plurality of sub-image chapter objects is two, that is, the number of the document pages is two, the target chapter object is divided into a first sub-image chapter object and a second sub-image chapter object, the first sub-image chapter object is inserted into an object position in a first page of the document page sequence, and the second sub-image chapter object is inserted into an object position in a last page of the document page sequence.
Optionally, in the case that the number of the plurality of sub-image chapter objects is greater than two, that is, the number of the document pages is greater than two, the object position where the first sub-image chapter object is inserted, the object position where the second sub-image chapter object is inserted, and the object position where the plurality of third sub-image chapter objects are inserted are respectively calculated. And inserting the sub-image chapter object into the corresponding document page according to the mode that the seal sequence corresponds to the document page sequence.
In the embodiment of the application, the multiple sub-image chapter objects are sequentially inserted into the document pages arranged according to the document sequence according to the sequence, so that the multiple sub-image chapter objects can be spliced and restored into the target chapter object, and whether the electronic document containing the multiple document pages has the conditions of page deletion, tampering and replacement is verified through the restoration degree of the target chapter object, so that the safety of the electronic document is improved.
As an optional implementation, inserting a third sub-image chapter object of the plurality of sub-image chapter objects into an object position in a corresponding intermediate page of the document page sequence includes: and determining the object position of the third sub-image chapter object in the middle page according to the page width of the document page and the object width of the third sub-image chapter object.
Alternatively, the position of the object inserted into the document page is not limited to be determined in accordance with the number of the third sub-chapters. The number of the third sub-chapters is not limited to be determined in accordance with the number of document pages. And in the case that the number of the document pages is greater than two, the number of the third sub-chapters is the number of the document pages minus two.
Optionally, the object position of the third sub-seal is determined according to the object position of the first sub-seal, the object position of the second sub-seal, and the page width of the corresponding document page, so as to ensure that the plurality of sub-seal objects can be spliced into a complete target seal object.
Alternatively, determining the object position of the third sub-chapter object from the document page width and the object width of the third sub-chapter object is not limited to determining the upper left-hand corner coordinate of the object position using the document page width and the object width. The value of the abscissa of the upper left corner may be any value smaller than the difference between the document page width and the object width to ensure that the third sub-stamp object is inserted into the document page completely. The upper left corner of the object position. The value of the ordinate in the upper left corner is not limited to any value within the page height range.
Optionally, the object position corresponding to the first sub-badge object takes the upper left-hand coordinate of the object position as an example, and the upper left-hand x-axis coordinate x1Pos may be represented as: x1Pos is page1_ width-w1, where is the page width of the first page and w1 is the image width of the first sub-chapter object.
Alternatively, in the case where the object position is not set for the height, the y-coordinate yPos of the upper left corner of the object position may be generated using a random function rand (): and range ()% (page1_ height-h1+1), wherein page1_ height is the page height of the first page, and w1 is the image height of the first sub-chapter object.
Optionally, the determination of the coordinates of the object positions corresponding to the second sub-badge object and the third sub-badge object, taking the coordinate of the upper left corner as an example, may be expressed as:
xmPos=pagem_width-wm(ii) a Wherein, pagemWidth is the page width of the mth page, wmThe picture width of the mth sub-chapter object;
ymPos=yPos。
in the embodiment of the application, the coordinate of the inserted object position of each sub-stamp object is determined according to the page width and the image width of the sub-stamp object, so that the inserted position of the sub-stamp object is determined, and a plurality of third sub-stamp objects, the first sub-stamp object and the second sub-stamp object can be spliced to restore the complete target stamp object.
As an alternative implementation, as shown in fig. 6, before determining the first sub-image chapter object and the second sub-image chapter object from the target chapter object, the method further includes:
s602, performing edge recognition on a target seal object to obtain a profile array corresponding to the target seal object, wherein the target seal object comprises an effective seal part and a seal frame part;
s604, constructing an effective seal area corresponding to the effective seal part based on the outline array;
s606, determining a seal frame region corresponding to the seal frame part based on the effective seal region, and determining a circumscribed rectangular region corresponding to the target seal object based on the seal frame region.
Alternatively, the edge identification for the target stamp object may be edge identification for the effective content in the stamp object. The edge may refer to a discontinuity in the local characteristics of the stamp, a sudden change in information such as the gray scale or structure. The seal edge identification is to search the abrupt change position of the denoised seal object with abrupt change in the gray scale or structure information.
Optionally, the target stamp object is divided into an effective stamp portion and a stamp frame portion, and an effective stamp region corresponding to the effective stamp portion and a stamp frame region corresponding to the stamp frame portion are respectively constructed. The effective seal region is a region containing an effective seal portion, that is, the seal content. The stamp frame region is a region outside the effective stamp region, including a circumscribed rectangle formed by the rotation of the target stamp object.
In the embodiment of the application, the target seal object is divided into the effective seal area and the seal frame area, so that the effective seal area is conveniently divided averagely according to the number of the document pages, and each sub-seal object is ensured to contain partial content of the effective seal.
As an optional implementation, the profile array at least includes: point coordinates of edge points of the valid stamp portion within the target stamp object.
Alternatively, the outline array of the effective seal portion is constructed from the point coordinates of the edge points of the effective seal portion, thereby determining the effective seal region. A stamp frame region and a circumscribed rectangular region are determined based on the effective stamp region.
In the embodiment of the application, the effective seal area is determined through the contour array constructed by the point coordinates of the edge points of the effective seal part, and the seal frame area and the circumscribed rectangle area are further determined, so that the area identification and division of the seal object are realized.
As an optional implementation, determining the first sub-image chapter object and the second sub-image chapter object from the target chapter object includes:
s1, according to the number of document pages in the document page sequence, equally dividing the effective seal area to obtain N sub-seal areas, wherein N is a positive integer equal to the number of document pages in value;
s2, determining a first sub-badge object and a second sub-badge object according to the N sub-badge areas and the circumscribed rectangle area.
Optionally, the effective seal region is sequentially segmented according to the number of the document pages, so that N sub-seal regions corresponding to the number N of the document pages are obtained, and each sub-seal object is ensured to contain effective seal content.
Alternatively, the ordered division of the effective stamp region is not limited to the average division, and is not the average division. The average division means that the region widths of the N sub-stamp regions are the same, and the non-average division means that the region widths of the N sub-stamp regions are not completely the same. Under the condition that N sub-stamp regions are obtained through average segmentation, assuming that the width of each document page is consistent, the abscissa of the upper left corner of the position of an object inserted by each third sub-stamp is the same. In the case where the non-average division results in N sub-stamp regions, the object position inserted per third sub-stamp is related to the stamp width of each third sub-stamp.
In the embodiment of the application, the effective seal area is divided equally according to the number of the document pages, so that each sub-seal object is ensured to contain partial content of the effective seal. And simultaneously, determining the contents of the first sub-stamp object and the second sub-stamp object according to the circumscribed rectangular region and the sub-stamp region corresponding to the stamp frame region, so that the first sub-stamp object and the second sub-stamp object positioned at the head and the tail of the segmentation sequence can comprise effective image contents and can also be matched with the circumscribed rectangular region to form a complete target stamp object, thereby better verifying the integrity of the electronic document.
As an alternative embodiment, determining the first sub-stamp object from the N sub-stamp regions and the circumscribed rectangular region includes:
s11, determining a first frame region in the circumscribed rectangular region, wherein the first frame region is a region adjacent to a first sub-stamp region in the N sub-stamp regions;
s12, determining the seal content displayed in the first sub-seal region and the seal border displayed in the first border region as the first sub-seal object.
In the embodiment of the application, a first frame region and a first sub-stamp region adjacent to a first sub-stamp region are determined as a first sub-stamp object, so that the first sub-stamp object contains the first frame region on the basis of containing effective stamp content, so that the content of the head end of the target stamp object is completely included in the first sub-stamp object, and thus the first sub-stamp object can be spliced with a third sub-stamp object and a second sub-stamp object to form a complete target stamp object to realize verification of the integrity of the electronic document.
As an alternative embodiment, determining the second sub-stamp object according to the N sub-stamp regions and the circumscribed rectangular region includes:
s21, determining a second frame region in the circumscribed rectangular region, wherein the second frame region is a region adjacent to the Nth sub-stamp region in the N sub-stamp regions;
s22, the content of the seal displayed in the Nth sub-seal region and the seal frame displayed in the second frame region are determined as the second sub-seal.
In the embodiment of the application, the second frame region and the nth sub-stamp region adjacent to the nth sub-stamp region are determined as the second sub-stamp object, so that the second sub-stamp object contains the second frame region on the basis of containing effective stamp content, so that the tail end content of the target stamp object is completely included in the second sub-stamp object, and thus the second sub-stamp object can be spliced with the third sub-stamp object and the first sub-stamp object to form a complete target stamp object to verify the integrity of the electronic document.
As an alternative implementation, as shown in fig. 7, performing edge recognition on the target stamp object to obtain a corresponding outline array of the target stamp object includes:
s702, carrying out contour detection on the target seal object to obtain a detection result, wherein in the contour detection process, a group of continuous pixel points meeting the contour condition is determined as a contour line, and the detection result comprises a point coordinate set corresponding to each of a plurality of contour lines identified from the target seal object;
s704, traversing the detection result to obtain the position relation between any two contour lines;
s706, determining abrupt line changing positions among the contour lines based on the position relation;
s708, determining a contour array based on the position coordinates of the abrupt change positions of the lines, wherein the contour array further comprises: point coordinates of edge points of a frame portion of a stamp within the target stamp object.
Optionally, edge identification may be performed using, but not limited to, canny function of opencv. It is to be noted that; other methods may be used for edge recognition, and the canny function of opencv is not limited herein as a means for edge recognition.
canny function prototype:
void Canny(InputArray image,OutputArray edges,double threshold,double threshold2,int apertureSize=3,bool L2gradient=false)
the parameter settings for the canny function parameters may be, but are not limited to, as follows:
inputting parameters: taking the denoised seal object mat _ processed as an input parameter;
outputting parameters: creating an image matrix mat _ edge with the same type and size as mat _ processed as an output parameter using a create function;
first edge threshold: taking the first edge threshold value as 1 as an example, it indicates that the pixel point lower than the threshold value 1 is not considered as the edge of the effective content of the seal;
second edge threshold: taking the second edge threshold value set to 2 as an example, it means that a pixel point higher than the threshold value 2 will be considered as an edge of the valid content of the stamp;
pore size: setting the aperture size of the Sobel operator, for example, to 3;
amplitude identification: an indication of the gradient magnitude of the stamp image is calculated, for example set to false.
Optionally, the contour of the stamp image is detected according to the matrix mat _ edge subjected to the edge detection processing, so as to obtain a contour array.
Optionally, a group of continuous pixels meeting the contour condition is used as a contour line, corresponding pixel coordinate information forms a corresponding contour coordinate set, and the position coordinates of the sudden-change positions of the mahjong pieces at the sudden-change positions of the contour line are determined according to the position relationship among the contour lines to determine a contour array.
Optionally, the contour array includes at least three arrays, the first contour array may be an outer edge array of a stamp border of the stamp object, the second contour array may be an inner edge array of the stamp border of the stamp object, and the third contour array may be a border array of valid content of the stamp object. Each contour array contains data that is not limited to the point coordinates of the edge points to which the contour corresponds.
Alternatively, using opendct's findContours function, the detection of the outline of the stamp object can be, but is not limited to, parameter setting on the basis of a function prototype to obtain an outline array. It is to be noted that; other methods may be used for contour detection, and the findContours function of opencv is not limited herein as a method of contour detection. The findContours function prototype is shown below:
void findContours(InputOutputArray image,OutputArrayOfArrays contours,OutputArray hierarchy,int mode,int method,Point offset=Point())
the parameter settings are not limited to the following:
inputting parameters: using the image mat _ edge obtained by the edge detection processing as an input parameter;
contour array: contour arrays, one contour being a set of data points, returning to the contour array;
contour relationship set: a relationship set formed by the position relationship between any two contour lines;
contour retrieval mode: selecting CV _ RETR _ TREE for a pattern used for contour retrieval in the stamp object;
the method for constructing the contour array comprises the following steps: saving all continuous contour points on the image boundary to CV _ CHAIN _ APPROX _ NONE in the vectors of the constants;
offset amount: the offset amount of the outline data with respect to the input stamp object is set to (0, 0).
And after the outline array is obtained, traversing the outline array, and obtaining an effective seal area corresponding to the outline array by using a bounngrake function. Optionally, the three contour arrays are used to store the point coordinates of the outer edge, the inner edge, and the upper left corner left _ top _ point and the lower right corner right _ bottom _ point of the stamp frame, respectively, as an example. And obtaining the effective content area corresponding to the effective content frame based on the upper left corner coordinate and the lower right corner coordinate of the effective content frame. Meanwhile, the stamp frame area is determined based on the outline arrays corresponding to the outer edge and the inner edge of the stamp frame.
Optionally, a circumscribed rectangular region corresponding to the stamp object is created based on the effective content region and the stamp border region. The distance between the effective content area and the stamp frame area can also be determined, and the distance is not limited to the distance including four directions, namely, up, down, left and right.
Alternatively, the valid content region may be in the form of a QRect rectangular region text _ rect, and the dividing of the valid stamp region may be the dividing of the rectangular region text _ rect after the rotation.
In the embodiment of the application, the target seal object is subjected to contour detection to determine the contour array through the position relation of the contour lines, so that the target seal object is divided into the effective seal area and the seal frame area, and the identification of the effective seal part in the target seal object is realized. The effective seal part is segmented on the basis of identifying the effective seal part, so that each sub-image seal object can contain the effective seal part, the situation that the sub-image seal objects at the head end and the tail end only contain invalid frame parts is avoided, the identification of an effective seal area is realized through contour detection, and the safety of each sub-seal object and the verification effect on a document page are improved.
The division of the effective stamp region is not limited to that shown in fig. 8, and the target stamp object, as shown by the solid-line rectangular frame in the figure, has a width and a height represented by w, h, respectively, and includes the effective stamp region therein, as shown by the dotted-line rectangular frame in the figure, and the circumscribed rectangle of the target stamp object, as shown by the dotted-line rectangular frame in the figure, has a width and a height represented by w0, h0, respectively. The region between the target stamp object and the effective stamp region is a stamp frame region, and the side spacing between the effective stamp region and the target stamp object can be expressed as:
left ();
right pitch b ═ w-text.width () -text _ rect.left ();
top distance c ═ text _ rect.top ();
the lower distance d ═ h-text _ rect.height () -text _ rect.top ().
Text _ rect.left () represents the distance between the leftmost side of the valid stamp region and the leftmost side of the target stamp object; text _ rect.width () represents the width of the effective stamp region;
top () represents the distance between the topmost side of the valid stamp region and the topmost side of the target stamp object; text _ rect. height () the width of the valid stamp region.
Alternatively, the horizontal width w1 of the rotated valid stamp region may be expressed as:
w1=text_rect.width()×cos|α|+text_rect.height()×sin|α|
assuming that the number of pages of the document is n, the width of the effective area in the sub-chapter object on each page can be expressed as:
Figure BDA0003144360130000231
regarding the third sub-image chapter object, taking the width of the effective area as the width of each third sub-image chapter object; for the first sub-badge object, increasing the left space on the width of the effective area as the width of the first sub-badge object; and for the second sub-image chapter object, increasing the right spacing on the width of the effective area as the width of the second sub-image chapter object.
Alternatively, the width rect _ width and height rect _ height of the circumscribed rectangle of the target stamp object may be expressed as:
rect_width=h×sin|α|+w×cos|α|;
rect_height=w×sin|α|+h×cos|α|。
take the counterclockwise rotation angle α as an example (take α value in the calculation process to calculate):
left distance x1 after rotation is (a + c × tan | α |) × cos | α |;
take clockwise rotation of α as an example (taking α value in the calculation process for calculation):
left distance x1 after rotation is (a + d × tan | α |) × cos | α |;
the rectangular region corresponding to the first sub-badge object obtained through calculation can be represented as follows in a mode of representing the rectangular region by using two coordinate points and the coordinates of the upper left corner point and the lower right corner point of the rectangular region:
{QPoint(0,0),QPoint(x1+pic_width,rect_height)};
the rectangular region corresponding to the m (m < n) th sub-image chapter object (third sub-image chapter object) is represented as:
{QPoint(x1+(m-1)pic_width,0),QPoint(x1+m×pic_width, rect_height)};
the nth sub-image chapter object (second sub-image chapter object) corresponds to a rectangular region of the graph represented as: { QPoint (x1+ (n-1) pic _ width, 0), QPoint (rect _ width, rect _ height) }.
In the embodiment of the application, the rectangular area corresponding to each sub-seal object is sequentially calculated and stored. And generating a seal segment in the rectangular area corresponding to each sub-seal object, sequentially inserting the seal segment into the corresponding document page, and adding the sub-seal to each page included in the electronic document, thereby improving the difficulty of tampering and replacing the document page and achieving the technical effect of improving the safety of the electronic document.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the invention. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required by the invention.
According to another aspect of the embodiments of the present invention, there is also provided an electronic document processing apparatus for implementing the above-described electronic document processing method. As shown in fig. 9, the apparatus includes:
an obtaining unit 902, configured to obtain a target seal object, where the target seal object is used to verify a document page sequence included in an electronic document;
a dividing unit 904, configured to divide the target chapter object into a plurality of sub-chapter objects according to the number of document pages in the document page sequence;
an inserting unit 906 for inserting the plurality of sub-image chapter objects into corresponding object positions on each document page.
Optionally, the inserting unit 906 includes:
the first determining module is used for determining a first sub-image chapter object and a second sub-image chapter object from the target chapter object;
the first inserting module is used for inserting the first sub-image chapter object into an object position in a first page of a document page sequence and inserting the second sub-image chapter object into an object position in a tail page of the document page sequence;
the second inserting module is used for inserting a third sub-image chapter object in the multiple sub-image chapter objects into an object position in a corresponding middle page of the document page sequence, wherein the third sub-image chapter object is a sub-image chapter object except the first sub-image chapter object and the second sub-image chapter object in the multiple sub-image chapter objects, and the middle page is a page except a first page and a last page in the document page sequence.
Optionally, the second inserting module is further configured to determine an object position of the third sub-stamp object in the intermediate page according to the page width of the document page and the object width of the third sub-stamp object.
Optionally, the processing apparatus of the electronic document further includes a recognition unit, before determining the first sub-image chapter object and the second sub-image chapter object from the target chapter object, the recognition unit includes:
the identification module is used for carrying out edge identification on the target seal object to obtain a contour array corresponding to the target seal object, wherein the target seal object comprises an effective seal part and a seal frame part;
the construction module is used for constructing an effective seal area corresponding to the effective seal part based on the outline array;
and the second determining module is used for determining a seal frame region corresponding to the seal frame part based on the effective seal region and determining a circumscribed rectangular region corresponding to the target seal object based on the seal frame region.
Optionally, the profile array at least includes: point coordinates of edge points of the valid stamp portion within the target stamp object.
Optionally, the first determining module includes:
the segmentation module is used for segmenting the effective seal region according to the number of the document pages in the document page sequence to obtain N sub-seal regions, wherein N is a positive integer equal to the number of the document pages in terms of value;
and the third determining module is used for determining the first sub-stamp object and the second sub-stamp object according to the N sub-stamp regions and the circumscribed rectangle region.
Optionally, the third determining module includes a first sub-module, configured to determine a first bounding box region in the circumscribed rectangular region, where the first bounding box region is a region adjacent to a first sub-stamp region in the N sub-stamp regions; and determining the seal content displayed in the first sub-seal region and the seal border displayed in the first border region as a first sub-seal object.
Optionally, the third determining module includes a second sub-module, and determines a second bounding box region in the circumscribed rectangular region, where the second bounding box region is a region adjacent to an nth sub-stamp region in the N sub-stamp regions; and determining the seal content displayed in the Nth sub-seal area and the seal frame displayed in the second frame area as a second sub-seal.
Optionally, the identification module further includes:
the detection module is used for carrying out contour detection on the target seal object to obtain a detection result, wherein in the contour detection process, a group of continuous pixel points meeting the contour condition are determined as a contour line, and the detection result comprises a point coordinate set corresponding to each of a plurality of contour lines identified from the target seal object;
the first acquisition module is used for traversing the detection result and acquiring the position relation between any two contour lines;
the fourth determining module is used for determining the abrupt line change positions among the contour lines based on the position relation;
a fifth determining module, configured to determine a contour array based on the position coordinates of the abrupt change position of the line, where the contour array further includes: point coordinates of edge points of a frame portion of a stamp within the target stamp object.
Optionally, the obtaining unit 902 includes:
the creating module is used for creating an original seal object in the electronic document to be processed;
and the processing module is used for carrying out binarization processing and denoising processing on the original seal object to obtain a target seal object.
Optionally, the processing apparatus of the electronic document further includes an updating unit, where the updating unit is configured to generate a random rotation angle using a random function after obtaining the target seal object; and rotating the target seal object according to the random rotation angle by taking the central point of the target seal object as a rotation center to obtain an updated target seal object.
In the embodiment of the application, an original stamp object used for indicating a security mark is created in an electronic document, the original stamp object is processed to obtain a target stamp object, the target stamp object is divided into a plurality of sub-stamp objects according to the number of document pages, the sub-stamp objects are respectively inserted into the document pages, the plurality of sub-stamp objects formed by dividing the target stamp object are respectively inserted into the document pages, so that each document page comprises the sub-stamp objects used as the security mark, and the sub-stamp objects can be spliced into a complete target stamp object, thereby achieving the purpose of marking each page of document included in the electronic document by the sub-stamp objects and splicing the sub-stamp objects into the complete target stamp object, and further realizing the purpose of adding the security mark to the document page included in the electronic document, the difficulty of tampering or replacing the electronic document is improved, so that the integrity of the electronic document can be verified through the safety mark, the technical effect of the safety of the electronic document is improved, and the technical problem of low document safety caused by the fact that the document is easily tampered or replaced due to the fact that the electronic document does not have the safety mark is solved.
According to another aspect of the embodiment of the present invention, there is also provided an electronic device for implementing the electronic document processing method, where the electronic device may be a terminal device or a server shown in fig. 1. The present embodiment takes the electronic device as a server as an example for explanation. As shown in fig. 10, the electronic device comprises a memory 1002 and a processor 1004, the memory 1002 having stored therein a computer program, the processor 1004 being arranged to execute the steps of any of the method embodiments described above by means of the computer program.
Optionally, in this embodiment, the electronic device may be located in at least one network device of a plurality of network devices of a computer network.
Optionally, in this embodiment, the processor may be configured to execute the following steps by a computer program:
s1, acquiring a target seal object, wherein the target seal object is used for verifying a document page sequence contained in the electronic document;
s2, dividing the target seal object into a plurality of sub-seal objects according to the number of document pages in the document page sequence;
s3, inserting the sub-seal objects into the corresponding object positions on each document page.
Alternatively, it can be understood by those skilled in the art that the structure shown in fig. 10 is only an illustration, and the electronic device may also be a terminal device such as a smart phone (e.g., an Android phone, an IOS phone, etc.), a tablet computer, a palmtop computer, a Mobile Internet Device (MID), a PAD, and the like. Fig. 10 is a diagram illustrating a structure of the electronic device. For example, the electronics may also include more or fewer components (e.g., network interfaces, etc.) than shown in FIG. 10, or have a different configuration than shown in FIG. 10.
The memory 1002 may be used to store software programs and modules, such as program instructions/modules corresponding to the method and apparatus for processing an electronic document in the embodiment of the present invention, and the processor 1004 executes various functional applications and data processing by running the software programs and modules stored in the memory 1002, that is, implements the above-described method for processing an electronic document. The memory 1002 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 1002 may further include memory located remotely from the processor 1004, which may be connected to the terminal over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof. The memory 1002 may be used to store information such as an electronic document, a target stamp object, a subpicture object, and the like. As an example, as shown in fig. 10, the memory 1002 may include, but is not limited to, an acquisition unit 902, a division unit 904, and an insertion unit 906 in the processing apparatus of the electronic document. In addition, other module units in the processing device of the electronic document can be included, but are not limited to, and are not described in detail in this example.
Optionally, the above-mentioned transmission device 1006 is used for receiving or sending data via a network. Examples of the network may include a wired network and a wireless network. In one example, the transmission device 1006 includes a Network adapter (NIC) that can be connected to a router via a Network cable and other Network devices so as to communicate with the internet or a local area Network. In one example, the transmission device 1006 is a Radio Frequency (RF) module, which is used for communicating with the internet in a wireless manner.
In addition, the electronic device further includes: a display 1008 for displaying the electronic document and the seal object; and a connection bus 1010 for connecting the respective module parts in the above-described electronic apparatus.
In other embodiments, the terminal device or the server may be a node in a distributed system, where the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting a plurality of nodes through a network communication. Nodes can form a Peer-To-Peer (P2P, Peer To Peer) network, and any type of computing device, such as a server, a terminal, and other electronic devices, can become a node in the blockchain system by joining the Peer-To-Peer network.
According to an aspect of the application, a computer program product or computer program is provided, comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to cause the computer device to perform the methods provided in the various alternative implementations of the processing aspects of the electronic document described above. Wherein the computer program is arranged to perform the steps of any of the above method embodiments when executed.
Alternatively, in the present embodiment, the above-mentioned computer-readable storage medium may be configured to store a computer program for executing the steps of:
s1, a target seal object, wherein the target seal object is used for verifying the document page sequence contained in the electronic document;
s2, dividing the target seal object into a plurality of sub-seal objects according to the number of document pages in the document page sequence;
s3, inserting the sub-seal objects into the corresponding object positions on each document page.
Alternatively, in this embodiment, a person skilled in the art may understand that all or part of the steps in the methods of the foregoing embodiments may be implemented by a program instructing hardware related to the terminal device, where the program may be stored in a computer-readable storage medium, and the storage medium may include: flash disks, Read-Only memories (ROMs), Random Access Memories (RAMs), magnetic or optical disks, and the like.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
The integrated unit in the above embodiments, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in the above computer-readable storage medium. Based on such understanding, the technical solution of the present invention may be substantially implemented or a part of or all or part of the technical solution contributing to the prior art may be embodied in the form of a software product stored in a storage medium, and including instructions for causing one or more computer devices (which may be personal computers, servers, network devices, or the like) to execute all or part of the steps of the method according to the embodiments of the present invention.
In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed client may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one type of division of logical functions, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may also be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (14)

1. A method for processing an electronic document, comprising:
acquiring a target seal object, wherein the target seal object is used for verifying a document page sequence contained in an electronic document;
dividing the target seal object into a plurality of sub-image seal objects according to the number of document pages in the document page sequence;
and inserting the plurality of sub-image chapter objects into corresponding object positions on each document page.
2. The method of claim 1, wherein inserting the plurality of sub-badge objects into corresponding object positions on each document page comprises:
determining a first sub-image stamp object and a second sub-image stamp object from the target stamp object;
inserting the first sub-badge object into an object position in a first page of the document page sequence, and inserting the second sub-badge object into an object position in a last page of the document page sequence;
inserting a third sub-image chapter object in the plurality of sub-image chapter objects into an object position in a corresponding intermediate page of the document page sequence, wherein the third sub-image chapter object is a sub-image chapter object in the plurality of sub-image chapter objects except the first sub-image chapter object and the second sub-image chapter object, and the intermediate page is a page in the document page sequence except the first page and the last page.
3. The method of claim 2, wherein inserting a third sub-chapter object of the plurality of sub-chapter objects into an object position in a corresponding intermediate page of the sequence of document pages comprises:
and determining the object position of the third sub-image chapter object in the middle page according to the page width of the document page and the object width of the third sub-image chapter object.
4. The method of claim 2, prior to determining a first sub-image chapter object and a second sub-image chapter object from the target chapter objects, the method further comprising:
performing edge recognition on the target seal object to obtain a profile array corresponding to the target seal object, wherein the target seal object comprises an effective seal part and a seal frame part;
constructing an effective seal area corresponding to the effective seal part based on the outline array;
and determining a seal frame region corresponding to the seal frame part based on the effective seal region, and determining a circumscribed rectangular region corresponding to the target seal object based on the seal frame region.
5. The method of claim 4, wherein the profile array includes at least: the target seal object has point coordinates of edge points of the valid seal portion therein.
6. The method of claim 4, wherein determining a first sub-image chapter object and a second sub-image chapter object from the target chapter objects comprises:
dividing the effective seal region according to the number of document pages in the document page sequence to obtain N sub-seal regions, wherein N is a positive integer equal to the number of the document pages in value;
and determining the first sub-badge object and the second sub-badge object according to the N sub-badge areas and the circumscribed rectangle area.
7. The method of claim 6, wherein determining the first sub-badge object from the N sub-badge regions and the circumscribed rectangle region comprises:
determining a first bounding box region in the circumscribed rectangular region, wherein the first bounding box region is a region adjacent to a first sub-stamp region in the N sub-stamp regions;
and determining the seal content displayed in the first sub-seal region and the seal border displayed in the first border region as the first sub-seal object.
8. The method of claim 6, wherein determining the second sub-badge object from the N sub-badge regions and the circumscribed rectangle region comprises:
determining a second bounding box region in the circumscribed rectangular region, wherein the second bounding box region is a region adjacent to an Nth sub-seal region in the N sub-seal regions;
and determining the seal content displayed in the Nth sub-seal area and the seal border displayed in the second border area as the second sub-seal.
9. The method of claim 4, wherein performing edge recognition on the target stamp object to obtain a corresponding array of outlines for the target stamp object comprises:
performing contour detection on the target seal object to obtain a detection result, wherein in the contour detection process, a group of continuous pixel points meeting a contour condition is determined as a contour line, and the detection result comprises a point coordinate set corresponding to each of a plurality of contour lines identified from the target seal object;
traversing the detection result to obtain the position relation between any two contour lines;
determining abrupt line change positions among the contour lines based on the position relation;
determining the contour array based on the position coordinates of the abrupt line change positions, wherein the contour array further comprises: point coordinates of edge points of a frame portion of a stamp within the target stamp object.
10. The method according to any one of claims 1 to 9, wherein the acquiring a target seal object includes:
creating an original seal object in the electronic document to be processed;
and carrying out binarization processing and denoising processing on the original seal object to obtain the target seal object.
11. The method according to claim 10, wherein after the binarizing processing and denoising processing are performed on the original seal object to obtain the target seal object, the method further comprises:
generating a random rotation angle using a random function;
and rotating the target seal object according to the random rotation angle by taking the central point of the target seal object as a rotation center to obtain the updated target seal object.
12. An apparatus for processing an electronic document, comprising:
an acquisition unit configured to acquire a target seal object, wherein the target seal object is used to verify a document page sequence included in an electronic document;
the segmentation unit is used for segmenting the target seal object into a plurality of sub-seal objects according to the number of document pages in the document page sequence;
and the inserting unit is used for inserting the plurality of sub-image chapter objects into the corresponding object positions on each document page.
13. A computer-readable storage medium, characterized in that the computer-readable storage medium comprises a stored program which when executed performs the method of any of claims 1 to 11.
14. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to execute the method of any of claims 1 to 11 by means of the computer program.
CN202110750915.4A 2021-07-01 2021-07-01 Electronic document processing method and device, storage medium and electronic equipment Pending CN114219691A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110750915.4A CN114219691A (en) 2021-07-01 2021-07-01 Electronic document processing method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110750915.4A CN114219691A (en) 2021-07-01 2021-07-01 Electronic document processing method and device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN114219691A true CN114219691A (en) 2022-03-22

Family

ID=80695863

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110750915.4A Pending CN114219691A (en) 2021-07-01 2021-07-01 Electronic document processing method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN114219691A (en)

Similar Documents

Publication Publication Date Title
CN108961303B (en) Image processing method and device, electronic equipment and computer readable medium
CN110008809B (en) Method and device for acquiring form data and server
CN110427932B (en) Method and device for identifying multiple bill areas in image
US8515178B2 (en) Method and system for image feature extraction
JP6240199B2 (en) Method and apparatus for identifying object in image
JP5854802B2 (en) Image processing apparatus, image processing method, and computer program
JP4738469B2 (en) Image processing apparatus, image processing program, and image processing method
CN110866529A (en) Character recognition method, character recognition device, electronic equipment and storage medium
CN110163866A (en) A kind of image processing method, electronic equipment and computer readable storage medium
CN114331951A (en) Image detection method, image detection device, computer, readable storage medium, and program product
CN111784698A (en) Image self-adaptive segmentation method and device, electronic equipment and storage medium
CN112651953A (en) Image similarity calculation method and device, computer equipment and storage medium
CN113592720B (en) Image scaling processing method, device, equipment and storage medium
CN111260564A (en) Image processing method and device and computer storage medium
CN110765893B (en) Drawing file identification method, electronic equipment and related product
CN113570725A (en) Three-dimensional surface reconstruction method and device based on clustering, server and storage medium
CN108804978B (en) Layout analysis method and device
CN111741329B (en) Video processing method, device, equipment and storage medium
US9734610B2 (en) Image processing device, image processing method, and image processing program
CN113487473A (en) Method and device for adding image watermark, electronic equipment and storage medium
CN111133474B (en) Image processing apparatus, image processing method, and computer-readable recording medium
CN108804652B (en) Method and device for generating cover picture, storage medium and electronic device
CN114219691A (en) Electronic document processing method and device, storage medium and electronic equipment
CN112487943B (en) Key frame de-duplication method and device and electronic equipment
CN115205113A (en) Image splicing method, device, equipment and storage 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