WO2022183907A1 - Image processing method and apparatus, intelligent invoice recognition device, and storage medium - Google Patents

Image processing method and apparatus, intelligent invoice recognition device, and storage medium Download PDF

Info

Publication number
WO2022183907A1
WO2022183907A1 PCT/CN2022/076400 CN2022076400W WO2022183907A1 WO 2022183907 A1 WO2022183907 A1 WO 2022183907A1 CN 2022076400 W CN2022076400 W CN 2022076400W WO 2022183907 A1 WO2022183907 A1 WO 2022183907A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
point
seal
unfolding
line
Prior art date
Application number
PCT/CN2022/076400
Other languages
French (fr)
Chinese (zh)
Inventor
徐青松
李青
Original Assignee
杭州睿胜软件有限公司
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 杭州睿胜软件有限公司 filed Critical 杭州睿胜软件有限公司
Publication of WO2022183907A1 publication Critical patent/WO2022183907A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/40Document-oriented image-based pattern recognition
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/24Aligning, centring, orientation detection or correction of the image
    • G06V10/245Aligning, centring, orientation detection or correction of the image by locating a pattern; Special marks for positioning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/46Descriptors for shape, contour or point-related descriptors, e.g. scale invariant feature transform [SIFT] or bags of words [BoW]; Salient regional features
    • G06V10/462Salient features, e.g. scale invariant feature transforms [SIFT]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/14Image acquisition
    • G06V30/148Segmentation of character regions
    • G06V30/153Segmentation of character regions using recognition of characters or words
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V2201/00Indexing scheme relating to image or video recognition or understanding
    • G06V2201/09Recognition of logos
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition

Definitions

  • Embodiments of the present disclosure relate to an image processing method, an image processing apparatus, an intelligent invoice recognition device, and a non-transitory computer-readable storage medium.
  • irregularly arranged characters are arcs, curved surfaces or have a perspective effect
  • the recognition of irregularly arranged characters is not accurate. Irregularly arranged text recognition has always been a technical difficulty in the field of text recognition.
  • At least one embodiment of the present disclosure provides an image processing method, including: acquiring an input image, wherein the input image includes an input seal, and the input seal includes a first object; identifying the input seal in the input image, To obtain a seal image, wherein, the seal image includes an intermediate seal corresponding to the input seal; feature extraction processing is performed on the seal image to obtain a feature point image; the seal image and the feature point image are processed.
  • the input seal is laterally expanded along the expansion line to obtain an expanded seal image; region recognition processing is performed on the expanded seal image to determine the first intermediate object region in the expanded seal image, wherein, The region corresponding to the first intermediate object region in the input image is the first object region, and the first object is located in the first object region; object recognition processing is performed on the first intermediate object region to obtain The identification obtains the first identification result.
  • the pixels corresponding to the middle seal in the seal image have a first pixel value
  • the seal image except for the pixels corresponding to the middle seal has a first pixel value
  • the pixels of have a second pixel value, and the first pixel value and the second pixel value are different.
  • identifying the input seal in the input image to obtain a seal image includes: using an image segmentation model to identify the input image to obtain The initial seal pixels corresponding to the input seal; the initial seal pixels are blurred to obtain a seal pixel mask area; according to the seal pixel mask area, determine the corresponding input seal in the input image. pixel; set the pixel value of the pixel corresponding to the input seal in the input image to the first pixel value and set the pixel value of the pixel other than the pixel corresponding to the input seal in the input image to the desired value. the second pixel value to obtain the stamp image.
  • the unfolding line includes a first annular unfolding line
  • the first annular unfolding line is an edge line of the input stamp.
  • the feature point image is processed to obtain the first unfolding point, the second unfolding point and the unfolding line, including: processing the seal image and the feature point image based on the algorithm of OpenCV to obtain the initial second unfolding point and an initial first annular unfolding line, wherein the initial second unfolding point and the initial first annular unfolding line are located in the seal image; processing to determine a characteristic object area corresponding to the first object in the seal image, determine an opening area in the seal image based on the characteristic object area, obtain any point in the opening area, and based on the
  • the arbitrary point and the initial first annular expansion line are used to determine the initial first expansion point, wherein the initial first expansion point is located in the seal image, and the arbitrary point, the initial first expansion point and all the The line segment between any two points in the initial second expansion point does not overlap with the feature object area, and
  • determining the initial first unfolding point based on the any point and the initial first annular unfolding line includes: obtaining the initial first unfolding point based on the any point A point corresponding to the any point on the initial first annular unfolding line is used as the initial first unfolding point.
  • the unfolding line includes a first annular unfolding line and a second annular unfolding line
  • the first annular unfolding line is an edge line of the input stamp
  • the second annular development line is located in an area surrounded by the first annular development line
  • the first object area is located in the area surrounded by the first annular development line and the second annular development line
  • the seal image and the feature point image are processed to obtain the first unfolding point, the second unfolding point and the unfolding line, including: using an algorithm based on OpenCV to analyze the seal image and the feature point image.
  • the extraction model processes the seal image and the feature point image to determine a feature object area corresponding to the first object in the seal image, and determines an opening area in the seal image based on the feature object area , obtain any point in the opening area, and determine the initial first expansion point and the initial second expansion point based on the arbitrary point, the initial first annular expansion line and the initial second annular expansion line, wherein , the initial first unfolding point and the initial second unfolding point are located in the stamp image, and any two points among the any point, the initial first unfolding point and the initial second unfolding point are located
  • the connecting line segment between is not overlapped with the feature object area; the initial first unfolding point, the initial second unfolding point, the initial first circular unfolding line and the initial second circular unfolding line are changed from The stamp image is mapped to the input image to obtain the first expansion point
  • an initial first development point and an initial first development point are determined.
  • Two expansion points including: based on the arbitrary point, acquiring a point on the initial first annular expansion line corresponding to the arbitrary point as the initial first expansion point; based on the arbitrary point, acquiring the initial first expansion point A point corresponding to the any point on the two-ring unfolding line is used as the initial second unfolding point.
  • the initial first unfolding point, the initial second unfolding point, and the any point are located on the same straight line.
  • the any point is a center point of the opening area.
  • the first annular expansion line is expanded into a straight line in the expanded seal image.
  • the first object is text
  • the shape of the first object area is an arc
  • the shape of the input stamp is a circle, and the second expansion point is the center of the circle; or, the shape of the input stamp is an ellipse, and the second expansion point is the midpoint of the line connecting the two foci of the ellipse.
  • the image processing method provided by an embodiment of the present disclosure further includes: determining a center point of the first intermediate object area; an intermediate object region is mapped back to the input image to determine the first object region, and a center point of the first intermediate object region is mapped back to the input image to determine a center point of the first object region; determining The center point of the input seal; the correction angle used to correct the input image is determined by the center point of the first object area and the center point of the input seal; the input image is corrected based on the correction angle Correction is performed to obtain a corrected input image.
  • the input stamp further includes a second object
  • the image processing method further includes: performing region recognition processing on the corrected input image to determine The second intermediate object area, wherein the area corresponding to the second intermediate object area in the input image is the second object area, and the second object is located in the second object area; The object area is subjected to object recognition processing to obtain a second recognition result.
  • acquiring an input image includes: acquiring an original image, wherein the original image includes an original seal; Determining a seal area, marking the seal area through a seal labeling frame, and slicing the seal labeling frame to obtain an intermediate input image, wherein the original seal is located in the seal area, and the seal labeling frame includes In the seal area, the intermediate input image includes the original seal, and the intermediate input image is processed to remove interference pixels in the intermediate input image to obtain the input image, wherein the interference pixels include Pixels of interfering objects in the intermediate input image that do not belong to the original seal, and the input seal corresponds to the original seal.
  • At least one embodiment of the present disclosure further provides an image processing apparatus, including: a memory for non-transitory storage of computer-readable instructions; and a processor for executing the computer-readable instructions, the computer-readable instructions being executed by The processor executes the image processing method according to any one of the above embodiments when running.
  • At least one embodiment of the present disclosure further provides an intelligent invoice recognition device, including: an image acquisition component for acquiring an invoice image of a paper invoice; a memory for storing the invoice image and computer-readable instructions; a processor for using upon reading the invoice image and determining the input image based on the invoice image, and executing the computer readable instructions, the computer readable instructions being executed by the processor to execute the above described embodiments image processing method.
  • At least one embodiment of the present disclosure further provides a non-transitory computer-readable storage medium for non-transitory storage of computer-readable instructions, which, when executed by a computer, can execute any of the foregoing embodiments. image processing method.
  • FIG. 1 is a schematic flowchart of an image processing method provided by some embodiments of the present disclosure
  • FIG. 2A is a schematic diagram of an original image provided by some embodiments of the present disclosure.
  • FIG. 2B is a schematic diagram of an intermediate input image determined based on the original image shown in FIG. 2A;
  • FIG. 2C is a schematic diagram of an input image obtained by identifying the intermediate input image shown in FIG. 2B;
  • FIG. 2D is a schematic diagram of a seal image obtained by recognizing the input image shown in FIG. 2C;
  • FIG. 2E is a schematic diagram of a feature point image obtained by performing feature extraction processing on the seal image shown in FIG. 2D;
  • 2F is a schematic diagram of another input image provided by some embodiments of the present disclosure.
  • FIG. 2G is another schematic diagram of a seal image obtained by recognizing the input image shown in FIG. 2C;
  • Fig. 2H is the schematic diagram of the expanded seal image obtained by expanding the input seal in Fig. 2C;
  • Fig. 2I is the schematic diagram of the first intermediate object region obtained by region recognition processing to the unfolded seal image in Fig. 2H;
  • 2J is a schematic diagram of a first recognition result obtained by performing object recognition processing on the first intermediate object region in FIG. 2I;
  • 3A is a schematic diagram of another original image provided by some embodiments of the present disclosure.
  • 3B is a schematic diagram of an intermediate input image determined based on the original image shown in FIG. 3A;
  • 3C is a schematic diagram of an input image obtained by identifying the intermediate input image shown in FIG. 3B;
  • 3D is a schematic diagram of a seal image obtained by recognizing the input image shown in FIG. 3C;
  • 3E is a schematic diagram of a feature point image obtained by performing feature extraction processing on the seal image shown in FIG. 3D;
  • 3F is a schematic diagram of an expanded seal image obtained by expanding the input seal in FIG. 3C;
  • 3G is a schematic diagram of a first intermediate object region obtained by performing region identification processing on the expanded seal image in FIG. 3F;
  • 3H is a schematic diagram of a first recognition result obtained by performing object recognition processing on the first intermediate object region in FIG. 3G;
  • FIG. 4 is a schematic block diagram of an image processing apparatus according to some embodiments of the present disclosure.
  • FIG. 5 is a schematic block diagram of an intelligent invoice recognition device according to some embodiments of the present disclosure.
  • FIG. 6 is a schematic diagram of a storage medium provided by some embodiments of the present disclosure.
  • seals such as official seals or invoice seals have irregularly arranged characters, for example, arc characters.
  • arc characters irregularly arranged characters
  • the recognition of these arc characters is not accurate.
  • the seal is tilted when stamping, it will also cause the regularly arranged characters in the image corresponding to the seal, such as horizontally arranged characters or vertically arranged characters, will also be slanted or reversed, making it impossible to judge the seal. forward direction, resulting in inaccurate recognition.
  • At least one embodiment of the present disclosure provides an image processing method, an image processing apparatus, an intelligent invoice recognition device, and a non-transitory computer-readable storage medium.
  • the image processing method includes: acquiring an input image, wherein the input image includes an input seal, and the input seal includes a first object; identifying the input seal in the input image to obtain a seal image, wherein the seal image includes an intermediate seal corresponding to the input seal; Perform feature extraction processing on the seal image to obtain the feature point image; process the seal image and the feature point image to obtain the first unfolding point, the second unfolding point and the unfolding line; take the difference between the first unfolding point and the second unfolding point.
  • the connecting line between them is used as the unfolding reference line and the first unfolding point is the unfolding starting point, and the input stamp is horizontally unfolded along the unfolding line to obtain the unfolding seal image;
  • the first intermediate object area wherein the area corresponding to the first intermediate object area in the input image is the first object area, and the first object is located in the first object area; object recognition processing is performed on the first intermediate object area, so as to obtain The first recognition result.
  • the image processing method can well realize the recognition of irregularly arranged objects (eg, characters, etc.) in the input image, improve the accuracy of identifying the irregularly arranged objects, and obtain accurate recognition results.
  • irregularly arranged objects eg, characters, etc.
  • “irregularly arranged objects” may mean that multiple objects (eg, characters) are not arranged in a row or column, that is, multiple objects are not arranged along the same straight line , for example, the centers of multiple objects are arranged along a curve (eg, a wavy line) or a polyline, etc.
  • the image processing method provided by the embodiment of the present disclosure can be applied to the image processing apparatus provided by the embodiment of the present disclosure, and the image processing apparatus can be configured on an electronic device.
  • the electronic device may be a personal computer, a mobile terminal, etc.
  • the mobile terminal may be a hardware device such as a mobile phone and a tablet computer.
  • FIG. 1 is a schematic flowchart of an image processing method provided by some embodiments of the present disclosure
  • FIG. 2A is a schematic diagram of an original image provided by some embodiments of the present disclosure
  • FIG. 2B is a determination based on the original image shown in FIG. 2A
  • the intermediate input image shown in FIG. 2C is an input image obtained by recognizing the intermediate input image shown in FIG. 2B
  • 3A is a schematic diagram of another original image provided by some embodiments of the present disclosure
  • FIG. 3B is an intermediate input image determined based on the original image shown in FIG. 3A
  • FIG. 3C is obtained by identifying the intermediate input image shown in FIG. 3B the input image.
  • step S10 of the image processing method provided by the embodiment of the present disclosure an input image is acquired.
  • the input image includes an input seal
  • the input seal may be various types of seals such as contract-specific seals, invoice-specific seals, and the like.
  • the input image can be any image that includes a seal, for example, as shown in FIG. 2C, in some embodiments, the input image can be an image including a company seal, as shown in FIG. 3C, in other embodiments, the input image can be For including the image of the special stamp for the invoice.
  • the input stamp may be a regular shape stamp such as a circular stamp, an oval stamp, a polygon stamp (for example, a rectangular stamp), or an irregular shape stamp.
  • the input image shown in FIG. 2C includes a circular seal
  • the input image shown in FIG. 3C includes an oval seal.
  • the input image may also be a document image or the like.
  • the input seal includes a first object
  • the first object may be a character
  • the character may be a number, a Chinese character (Chinese characters, Chinese words, etc.), foreign characters (eg, foreign letters, foreign words, etc., such as English, Japanese, Korean, German, etc.), special characters (eg, percent sign "%"), punctuation marks, etc.
  • the characters may also include graphics (eg, circles, rectangles, etc.), and the like.
  • the first object may be text. As shown in FIG. 2C and FIG. 3C , the first object may include a plurality of characters arranged irregularly, and the centers of the plurality of characters are arranged in a curve, for example , arranged in an arc.
  • the first object includes "Hangzhou Ruisheng Software Co., Ltd.”, and the centers of the characters in “Hangzhou Ruisheng Software Co., Ltd.” are arranged on an arc line; as shown in Fig. 3C, the first object An object includes “Hangzhou Ruisheng Software Co., Ltd.”, and the centers of the characters in “Hangzhou Ruisheng Software Co., Ltd.” are arranged on an elliptical arc.
  • step S10 includes: acquiring an original image; processing the original image through a seal area recognition model to determine the seal area, marking the seal area through the seal annotation frame, and slicing the seal annotation frame to Obtain an intermediate input image; process the intermediate input image to remove interfering pixels in the intermediate input image to obtain an input image.
  • both the original image and the intermediate input image include the original stamp, the original stamp is located within the stamp area, and the stamp callout box includes the stamp area.
  • the area of the original seal can be marked in the original image, and then the area corresponding to the original seal can be cut from the original image to obtain a separate intermediate input image, so that in subsequent operations, the cut intermediate input image can be directly obtained. to be processed.
  • the original image may be an image including a company seal
  • the intermediate input image shown in FIG. 2B can be obtained by processing the original image shown in FIG. 2A
  • the original image may be an image including a special seal for invoices
  • the intermediate input image shown in FIG. 3B can be obtained by processing the original image shown in FIG. 3A .
  • the stamp callout box can be a rectangular box, so that the intermediate input image can have a rectangular shape.
  • the dimensions of the stamp callout box can be the same as the dimensions of the intermediate input image.
  • the embodiments of the present disclosure are not limited to this, and the size of the seal annotation frame and the size of the intermediate input image may also be different.
  • the size of the seal annotation frame is larger than the size of the intermediate input image, that is, the intermediate input image is located in the seal annotation frame. inside the box.
  • seal marking frame may also be a diamond frame, an oval frame, a circular frame, and the like.
  • the seal area recognition model can be implemented using machine learning technology, and the seal area recognition model is a pre-trained model.
  • the seal region recognition model can be implemented by neural networks such as deep convolutional neural network (CNN) or deep residual network (Resnet).
  • CNN deep convolutional neural network
  • Resnet deep residual network
  • the size of the intermediate input image can be set by the user according to the actual situation.
  • the original image may be an image captured by a digital camera or a mobile phone, and the original image may be a grayscale image or a color image.
  • the original image may be an image directly collected by an image collection device, or may be an image obtained after preprocessing the directly collected image.
  • the image processing method provided by the embodiments of the present disclosure may further include an operation of preprocessing the original image. Preprocessing can eliminate irrelevant information or noise information in the original image, so as to better process the original image.
  • the preprocessing may include, for example, scaling, cropping, gamma correction, image enhancement, or noise reduction filtering on the original image.
  • acquiring the input image includes: acquiring the original image, processing the original image through the seal region recognition model to determine the intermediate input image; processing the intermediate input image to remove interference in the intermediate input image pixels to get the input image.
  • the area of the stamp annotation frame can be marked in the original image, and this area is the intermediate input image, so that in subsequent operations, the marked area can be directly processed, for example, to remove interference pixels. That is, the stamp callout box in the original image can not be cut.
  • the input stamp in the input image corresponds to the original stamp in the intermediate input image.
  • the size, shape, etc. of the input stamp and the original stamp are the same, except that the input stamp is located in the input image, and the original stamp is located in the original image and the intermediate input image.
  • some pixels of the original stamp may be removed, resulting in the original stamp and the input stamp being merged with each other.
  • the objects included in the original seal and the input image are the same, e.g. the original seal included the text "Hangzhou Ruisheng Software Co., Ltd.” and the input image also included the text "Hangzhou Ruisheng Software Co., Ltd.”.
  • interfering pixels include pixels of interfering objects in the intermediate input image that do not belong to the original stamp.
  • the interfering objects may include horizontal lines covered by the original seal or characters or numbers on the date of the seal, and may also include other characters, numbers or graphics that do not overlap with the original seal.
  • the interfering objects may be printed words, symbols, graphics, etc.
  • the intermediate input image includes horizontal lines and commas that do not belong to the original seal, and the horizontal lines and commas are Interfering objects, the pixel corresponding to the horizontal line and comma is the interference pixel.
  • the interfering objects can be handwritten words, symbols, graphics, etc.
  • the input image includes numbers and points that do not belong to the original seal (ie, handwritten 2021.1.7), the numbers and The point is the interference object, and the pixel corresponding to the number and the point is the interference pixel.
  • processing the intermediate input image to remove interfering pixels in the intermediate input image to obtain the input image may include: using an image segmentation model (such as U-Net model, Mask-RCNN model, etc.)
  • the input image is identified to obtain the initial interference pixels of the interference object; the initial interference pixels are blurred to obtain the interference pixel mask area; the interference pixels corresponding to the interference object are determined according to the interference pixel mask area; the interference pixels in the intermediate input image are removed.
  • Interfering pixels corresponding to interfering objects are obtained to obtain the input image.
  • the process of identifying and removing the interfering pixels may be performed based on the difference between the pixel value of the pixel corresponding to the interfering object and the pixel value of the pixel corresponding to the original seal.
  • Gaussian blurring can be performed on the initial interference pixels through the GaussianBlur function of Gaussian filtering based on OpenCV to expand the area corresponding to the initial interference pixels, thereby obtaining the interference pixel mask area.
  • the interference pixel corresponding to the interference object can be determined.
  • the interfering pixels corresponding to the interfering objects in the intermediate input image can be removed by the inpaint function based on OpenCV, so as to obtain an image from which the interfering objects are removed, that is, the input image is obtained.
  • FIG. 2D is a schematic diagram of a seal image obtained by recognizing the input image shown in FIG. 2C
  • FIG. 3D is a schematic diagram of a seal image obtained by recognizing the input image shown in FIG. 3C .
  • step S11 the input seal in the input image is recognized to obtain a seal image.
  • the seal image includes an intermediate seal corresponding to the input seal.
  • the size and shape of the input stamp and the intermediate stamp are the same.
  • the objects included in the input stamp and the objects included in the intermediate stamp and their relative positional relationships are also the same.
  • the difference between the input stamp and the intermediate stamp is the same. where: the input stamp is located in the input image, and the intermediate stamp is located in the stamp image.
  • step S11 includes: using an image segmentation model (such as U-Net model, Mask-RCNN model, etc.) to identify the input image to obtain initial seal pixels corresponding to the input seal; Blur processing to obtain the seal pixel mask area; determine the pixel corresponding to the input seal in the input image according to the seal pixel mask area; set the pixel value of the pixel corresponding to the input seal in the input image to the first pixel value and set the input
  • the pixel values of the pixels other than the pixels corresponding to the input seal in the image are the second pixel values, so as to obtain the seal image.
  • the seal image can be a black and white image with obvious black and white contrast, and the black and white image has less noise interference, which can effectively improve the recognition of the content in the seal image.
  • the pixels corresponding to the middle seal in the seal image have the first pixel value
  • the pixels in the seal image except the pixels corresponding to the middle seal have the second pixel value
  • the first pixel value and the second pixel value are different.
  • both the first pixel value and the second pixel value may be grayscale values
  • the first pixel value may be 255
  • the second pixel value may be 0.
  • both the image segmentation model for recognizing input images and the image segmentation model for recognizing intermediate input images can be implemented using machine learning technology (eg, deep learning technology), and both are pre-trained models.
  • the image segmentation model for recognizing the input image and the image segmentation model for recognizing the intermediate input image can be two different models, but both adopt the U-Net model structure.
  • FIG. 2E is a feature point image obtained by performing feature extraction processing on the seal image shown in FIG. 2D
  • FIG. 3E is a feature point image obtained by performing feature extraction processing on the seal image shown in FIG. 3D .
  • step S12 feature extraction processing is performed on the seal image to obtain feature point images.
  • step S12 feature extraction processing may be performed on the seal image through a pre-trained feature extraction model to obtain feature point images.
  • Feature extraction models can also be implemented based on machine learning techniques.
  • feature extraction processing is performed on the seal image shown in FIG. 2D to obtain the feature point image shown in FIG. 2E
  • feature extraction processing is performed on the seal image shown in FIG. 3D to obtain the feature point image shown in FIG. 3E .
  • the first object includes "Hangzhou Ruisheng Software Co., Ltd.”
  • the feature point image shown in FIG. 2E includes 11 features.
  • the 11 feature points correspond to each character in "Hangzhou Ruisheng Software Co., Ltd.” and the center point of the middle seal. For each character, the feature point corresponding to the character is located in the center of the region corresponding to the character.
  • each of the original image, the intermediate input image, the input image and the seal image includes the first object "Hangzhou Ruisheng Software Co., Ltd.”.
  • the image segmentation model is established by processing the input image or intermediate input image into a black and white image and labeling the sample, and then putting it into the U-net model for training; the feature extraction model is also by using the seal image as a sample. After labeling, it is established by training the neural network model.
  • FIG. 2F is a schematic diagram of another input image provided by an embodiment of the present disclosure.
  • step S13 the stamp image and the feature point image are processed to obtain the first development point, the second development point and the development line.
  • the unfolding line includes a first annular unfolding line
  • the first annular unfolding line is the edge line of the input stamp.
  • the edge line of the input stamp may be the circle shown in FIG. 2C .
  • the edge line of the input stamp may be an elliptical circle as shown in FIG. 3C .
  • step S13 includes: processing the seal image and the feature point image based on the algorithm of OpenCV to obtain the initial second expansion point and the initial first annular expansion line; processing the seal image and the feature point image through the expansion point extraction model, Determine the characteristic object area corresponding to the first object in the seal image, determine the opening area in the seal image based on the characteristic object area, and obtain any point in the opening area; an expansion point; the initial first expansion point, the initial second expansion point and the initial first circular expansion line are mapped from the stamp image to the input image to obtain the first expansion point, the second expansion point and the first circular expansion line.
  • the initial first unfolding point, the initial second unfolding point, and the initial first annular unfolding line are all located in the stamp image.
  • the connecting line segment between any two points among any point, the initial first unfolding point and the initial second unfolding point does not overlap with the feature object area, so that it can be ensured that when the input stamp is horizontally unfolded, the first The object is split into two parts.
  • the area 100 shown in FIG. 2D is the characteristic object area.
  • the first object "Hangzhou Ruisheng Software Co., Ltd.” is located in the characteristic object area.
  • the region corresponding to the characteristic object region 100 in the input image is the first object region 200 , and in the input image, the first object is located in the first object region 200 .
  • the shape of the characteristic object area 100 may be an arc, and the shape of the first object area 200 may also be an arc.
  • the initial first annular development line may be the edge line of the middle seal shown in FIG. 2D
  • the edge line of the middle seal may be the white circle shown in FIG. 2D .
  • an annular area may be determined based on the characteristic object area 100 , for example, an annular area, the annular area includes the characteristic object area 100 , and the part of the annular area that does not belong to the characteristic object area 100 is is the opening area 110 , and the arbitrary point B is a point in the opening area 110 .
  • the seal image and the feature point image may be processed based on the Hough gradient circle finding algorithm using OpenCV to obtain the initial second expansion point and the initial first annular expansion line.
  • Hough gradient circle finding algorithm of OpenCV For the specific implementation process of the Hough gradient circle finding algorithm of OpenCV, reference may be made to relevant descriptions in the prior art, and details are not described here. It should be noted that, in the embodiments of the present disclosure, other methods may also be used to obtain the initial second deployment point and the initial first annular deployment line. No restrictions apply.
  • the expansion point extraction model may be implemented based on machine learning, and the expansion point extraction model may be a neural network model.
  • determining the initial first expansion point based on any point and the initial first annular expansion line includes: based on any point, acquiring a point corresponding to any point on the initial first annular expansion line as the initial first expansion point.
  • the initial second unfolding point may be the center point of the middle seal.
  • the shape of the middle seal is a circle
  • the initial second unfolding point A1 is the center of the circle (ie The center point of the middle seal)
  • the initial first unfolding point C1 may be the intersection between the extension line connecting the initial second unfolding point A1 and any point B1 and the initial first annular unfolding line.
  • the second unfolding point may be the center point of the input stamp, eg, in some embodiments 2F
  • the initial first expansion point C1 is mapped to the first expansion point C2
  • the initial second expansion point A1 is mapped to the second expansion point A2
  • any point B1 is mapped to the point B2.
  • the shape of the input stamp is a circle
  • the second expansion point A2 is the center of the circle (ie, the center point of the input stamp).
  • the first expansion point C2 can be the connection between the second expansion point A2 and the point B2. The intersection between the extension line of the line and the first annular expansion line.
  • the shape of the middle seal is an ellipse
  • the initial second expansion point may be the midpoint (not shown) of the line connecting the two focal points of the ellipse.
  • the shape of the input stamp is also an ellipse, and after mapping, the second expansion point is also the midpoint of the line connecting the two focal points of the ellipse.
  • FIG. 2G is another schematic diagram of a seal image obtained by recognizing the input image shown in FIG. 2C .
  • the unfolding line includes a first annular unfolding line and a second annular unfolding line
  • the first annular unfolding line is an edge line of the input stamp
  • the second annular unfolding line is located in the first annular unfolding line.
  • the first object area is located in the annular area enclosed by the first annular expansion line and the second annular expansion line.
  • step S13 includes: processing the seal image and the feature point image based on the algorithm of OpenCV to obtain the initial first annular expansion line and the initial second annular expansion line; processing the seal image and the feature point image through the expansion point extraction model , to determine the characteristic object area corresponding to the first object in the seal image, determine the opening area in the seal image based on the characteristic object area, obtain any point in the opening area, and based on any point, the initial first annular expansion line and the initial first Two circular expansion lines, determine the initial first expansion point and the initial second expansion point; map the initial first expansion point, the initial second expansion point, the initial first circular expansion line and the initial second circular expansion line from the stamp image to An image is input to obtain a first unfolding point, a second unfolding point, a first circular unfolding line, and a second circular unfolding line.
  • the initial first annular development line, the initial second annular development line, the initial first development point, and the initial second development point are all located in the stamp image.
  • the connecting line segment between any two points among any point, the initial first unfolding point and the initial second unfolding point does not overlap with the feature object area.
  • the white circle 300 may be the initial second annular expansion line
  • the area 100 shown in FIG. 2G is the feature object area
  • the area 110 shown in FIG. 2G is the opening area.
  • step S13 determining the initial first expansion point and the initial second expansion point based on any point, the initial first annular expansion line and the initial second annular expansion line, including: obtaining the initial first annular expansion based on any point A point on the line corresponding to any point is used as an initial first expansion point; based on any point, a point corresponding to any point on the initial second annular expansion line is obtained as an initial second expansion point.
  • the any point B1 is a point in the opening area 110
  • the shape of the middle seal is a circle
  • the initial first expansion point C1 can be the radius of the circle including any point B1 and the initial first
  • the initial second development point A1 may be the intersection between the radius of the circle including any point B1 and the initial second annular development line 300 .
  • any point B1 may be the center point of the opening area.
  • the initial first unfolding point C1, the initial second unfolding point A1 and any point B1 are located on the same straight line, as shown in FIG. 2F, after the mapping, the first unfolding point C2, the second unfolding point A2 and the point B2 are also on the same straight line.
  • the initial first unfolding point C1 , the initial second unfolding point A1 and the arbitrary point B1 are located on a radius of the middle seal of the circle.
  • the distance between the initial first unfolding point C1 and the initial second unfolding point A1 is the radius of the middle seal of the circle.
  • the first unfolding point C2 the second unfolding point A2 and the point B2 are located on a radius of the circular input stamp, the first unfolding point C2 and the second unfolding point A2 The distance between is the radius of the input stamp for that circle.
  • first annular development line and the second annular development line are described as circles or elliptical circles as an example, the present disclosure is not limited to this, the first annular development line and/or the second annular development line are
  • the annular unfolding line may also be an unclosed arc or curve, and its specific shape is related to the shape of the first object area including the first object. For example, if the shape of the first object area is wavy, the first annular The unfolding line and/or the second annular unfolding line may also be a wavy line.
  • the first annular development line can also be a concentric ring line of the edge line of the input seal.
  • the edge line of the input seal is located in the area surrounded by the first annular development line.
  • the shape of the input seal is a circle
  • the shape of the first annular development line and the shape of the edge line of the input stamp may be the same, for example, both are circular, but the radius corresponding to the first annular development line is larger than the radius corresponding to the edge line of the input stamp.
  • FIG. 2H is a schematic diagram of an expanded seal image obtained by expanding the input seal in FIG. 2C
  • FIG. 3F is a schematic diagram of an expanded seal image obtained by expanding the input seal in FIG. 3C .
  • step S14 take the connecting line between the first development point and the second development point as the development reference line and the first development point as the development starting point, and place the input stamp along the development line Expand horizontally for expanded stamp image.
  • the unfolded seal image shown in FIG. 2H is based on the first unfolding point obtained by mapping the initial first unfolding point shown in FIG. 2G and the second unfolding point obtained by mapping the initial second unfolding point shown in FIG. 2G .
  • the connecting line is used as the unfolding reference line and the first unfolding point obtained by mapping the initial first unfolding point shown in FIG. 2G as the unfolding starting point, and is obtained by horizontally unfolding along the first annular unfolding line.
  • the first annular expansion line is expanded into a straight line in the expanded stamp image.
  • the straight line above the text is the expanded first circular expansion line; as shown in Figure 3F, the line above the text
  • the straight line is the first annular expansion line after expansion.
  • the second expansion point is also a point corresponding to any point on the second annular expansion line.
  • the shape of the expanded stamp image is a rectangle, the length of the rectangle is equal to the length of the first annular expansion line, and the width of the rectangle is the same as the first expansion point and the point obtained based on the mapping of any point (that is, the initial first The distance between the expansion point and any point) is equal.
  • the shape of the middle seal is a circle, the length of the rectangle is equal to the circumference of the circle, and the width of the rectangle is equal to the radius of the circle; for the example shown in Fig. 2G, the length of the middle seal is equal to the radius of the circle.
  • the shape is a circle, the length of the rectangle is equal to the circumference of the circle, and the width of the rectangle is less than the radius of the circle.
  • the connecting line between the initial first unfolding point and the initial second unfolding point may also be used as the unfolding reference line and the initial first unfolding point may be used as the unfolding starting point
  • the middle seal Expand horizontally along the expansion line to obtain the expanded stamp image, that is, at this time, the initial first expansion point is the first expansion point, the initial second expansion point is the second expansion point, and the initial first circular expansion line is the first expansion point.
  • the initial second annular expansion line is the second annular expansion line.
  • Fig. 2I is the schematic diagram of the first intermediate object region obtained by carrying out region recognition processing to the expanded seal image in Fig. 2H
  • Fig. 3G is the schematic diagram of the first intermediate object region obtained by performing region identification processing on the expanded seal image in Fig. 3F.
  • step S15 an area identification process is performed on the developed seal image to determine the first intermediate object area in the expanded seal image. For example, an area corresponding to the first intermediate object area in the input image is the first object area, and the first object is located in the first object area.
  • the shape of the first object area is an arc.
  • the shape of the first intermediate object area may be a rectangle. It should be noted that the specific unfolding methods of the circular seal and the oval seal may refer to the prior art, which will not be repeated here.
  • the first intermediate object region in the expanded stamp image can be identified by the region identification model.
  • the region recognition model can be implemented using machine learning technology, and the region recognition model is a pre-trained model.
  • the region recognition model can be implemented by neural networks such as deep convolutional neural network (CNN) or deep residual network (Resnet).
  • FIG. 2J is a schematic diagram of a first recognition result obtained by performing object recognition processing on the first intermediate object area in FIG. 2I ;
  • FIG. 3H is a schematic diagram of a first recognition result obtained by performing object recognition processing on the first intermediate object area in FIG. 3G .
  • step S16 an object recognition process is performed on the first intermediate object region to recognize and obtain a first recognition result.
  • the first recognition result is “Hangzhou Ruisheng Software Co., Ltd.”, that is, the first object.
  • the first object includes text
  • character recognition processing may be performed on the first intermediate object region through the first character recognition model to obtain the first recognition result, that is, the first object.
  • the accuracy of character recognition based on the first character recognition model is high.
  • the first character recognition model may be implemented based on technologies such as optical character recognition (Optical Character Recognition, OCR).
  • OCR Optical Character Recognition
  • the first character recognition model may also be a pre-trained model.
  • performing object recognition processing on the first intermediate object area to recognize and obtain the first recognition result may include: performing object recognition processing on the first intermediate object area to recognize and obtain the first intermediate recognition result; A check is performed to obtain the first identification result.
  • the first intermediate recognition result may have semantic errors, logical errors, etc. Therefore, it is necessary to verify the first intermediate recognition result, and correct the semantic errors and logical errors in the first intermediate recognition result, so as to obtain an accurate first intermediate recognition result. Identify the results.
  • the first intermediate recognition result may include "Hangzhou Ruisheng Software Co., Ltd.”, wherein the character “zhou” does not correspond to the text in the seal, and the word “Hangzhou” is in The semantics is wrong. After verification, "Hangzhou” can be corrected to "Hangzhou", so the first recognition result after verification is "Hangzhou Ruisheng Software Co., Ltd.”, thus obtaining an accurate recognition result .
  • the first identification result obtained by identification is "Hangzhou Ruisheng Software Co., Ltd.”, which is the first object in the input seal.
  • the image processing method can also determine the forward direction of the input image based on the regions corresponding to the irregularly arranged objects, so as to correct the input image and improve the recognition accuracy of the regularly arranged objects in the input image.
  • the image processing method further includes: determining the center point of the first intermediate object region; mapping the first intermediate object region back to the input image through the mapping relationship between the first intermediate object region and the input image to determine the first intermediate object region an object area, and mapping the center point of the first intermediate object area back to the input image to determine the center point of the first object area; determining the center point of the input seal; determining by the center point of the first object area and the center point of the input seal Correction angle for correcting the input image; correcting the input image based on the correction angle to obtain the corrected input image.
  • the first intermediate object region in the expanded seal image can be identified by the region recognition model, and the center point of the first intermediate object region can be determined, and the An intermediate object area is mapped into the input image (or the seal image), thereby determining the arc-shaped character area in the input image (or the seal image), that is, the first object area 200, and at the same time, the center point of the first intermediate object area is mapped to
  • the center point of the first object area is determined in the input image (or seal image), and the forward direction corresponding to the input image can be obtained through the center point of the first object area and the center point of the input seal (for example, the center of the circle of the input seal).
  • the angle between the forward direction and the reference direction (for example, the horizontal direction or the vertical direction) is the correction angle, Then, the input image can be corrected based on the correction direction, so that the forward direction and the reference direction overlap, so as to obtain the corrected input image, thus, it is convenient for the user to check and compare whether the first recognition result obtained by the recognition is correct, etc. , that is, it is determined whether the first recognition result obtained by the recognition is the same as the first object.
  • the first intermediate object region may also be mapped back to the intermediate input image, and a correction angle for correcting the intermediate input image is determined; and the intermediate input image is corrected based on the correction angle to obtain the correction After the intermediate input image.
  • the user can check whether the first recognition result obtained by the comparison and recognition based on the corrected intermediate input image is correct, etc.
  • the input stamp further includes a second object.
  • the image processing method further includes: performing region identification processing on the corrected input image to determine the second intermediate object region, wherein the region corresponding to the second intermediate object region in the input image is the second object region, and the second intermediate object region is the second object region.
  • the object is located in the second object area; the object recognition processing is performed on the second intermediate object area to obtain a second recognition result.
  • the shape of the second object area may be a rectangle.
  • the second object may include a plurality of characters arranged regularly, and a line connecting the center points of the plurality of characters is located on the same straight line.
  • the second object may include numbers and letters "91330108MA2CDKJ756", and the second object may also include the text "Invoice Special Seal”.
  • the center points of each character (numbers and letters) in "91330108MA2CDKJ756" are located on the same line (such as a horizontal line), and the center points of each character in the "Special Invoice Seal" are also located on the same line (such as a horizontal line).
  • character recognition processing can be performed on the second intermediate object area through the second character recognition model to obtain the second intermediate recognition result; the second intermediate recognition result is verified to obtain the second recognition result, and the second recognition result is for the second object.
  • the second character recognition model may be implemented based on technologies such as optical character recognition.
  • the second character recognition model may also be a pre-trained model.
  • first character recognition model and the second character recognition model may be the same model, or may be different models.
  • the image processing method may further include: outputting the first recognition result and the second recognition result.
  • the first recognition result and the second recognition result may be displayed on the display panel to achieve output.
  • the image processing method may further include: outputting the corrected input image and/or the corrected intermediate input image, so that the user can judge whether the outputted first recognition result and the second recognition result are correct.
  • the corrected input image and/or the corrected intermediate input image may also be displayed on the display panel for output.
  • the image processing method before acquiring the input image, the image processing method further includes: a training phase.
  • the training phase includes the process of training the models (image segmentation model, region recognition model, expansion point extraction model, seal region recognition model, character recognition model, etc.).
  • FIG. 4 is a schematic block diagram of an image processing apparatus according to some embodiments of the present disclosure.
  • At least one embodiment of the present disclosure further provides an image processing apparatus.
  • the image processing apparatus 400 includes a processor 402 and a memory 401 . It should be noted that the components of the image processing apparatus 400 shown in FIG. 4 are only exemplary and not restrictive, and the image processing apparatus 400 may also have other components according to actual application requirements.
  • the memory 401 is used for non-transitory storage of computer-readable instructions; the processor 402 is used for executing computer-readable instructions, and the computer-readable instructions are executed by the processor 402 when running the image processing method according to any of the above embodiments. one or more steps.
  • the network may include a wireless network, a wired network, and/or any combination of wireless and wired networks.
  • the network may include a local area network, the Internet, a telecommunication network, the Internet of Things (Internet of Things) based on the Internet and/or a telecommunication network, and/or any combination of the above networks, etc.
  • the wired network may use twisted pair, coaxial cable or optical fiber transmission for communication
  • the wireless network may use, for example, 3G/4G/5G mobile communication network, Bluetooth, Zigbee or WiFi and other communication methods.
  • the present disclosure does not limit the type and function of the network.
  • processor 402 may control other components in image processing apparatus 400 to perform desired functions.
  • the processor 402 may be a device with data processing capability and/or program execution capability, such as a central processing unit (CPU), a tensor processing unit (TPU), or a graphics processing unit (GPU).
  • the central processing unit (CPU) can be an X86 or an ARM architecture or the like.
  • the GPU can be individually integrated directly onto the motherboard, or built into the motherboard's Northbridge chip. GPUs can also be built into central processing units (CPUs).
  • memory 401 may include any combination of one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and/or non-volatile memory.
  • Volatile memory may include, for example, random access memory (RAM) and/or cache memory, among others.
  • Non-volatile memory may include, for example, read only memory (ROM), hard disk, erasable programmable read only memory (EPROM), portable compact disk read only memory (CD-ROM), USB memory, flash memory, and the like.
  • ROM read only memory
  • EPROM erasable programmable read only memory
  • CD-ROM portable compact disk read only memory
  • USB memory flash memory
  • One or more computer-readable instructions may be stored on the computer-readable storage medium, and the processor 402 may execute the computer-readable instructions to implement various functions of the image processing apparatus 400 .
  • Various application programs, various data and the like can also be stored in the storage medium.
  • FIG. 5 is a schematic block diagram of an intelligent invoice recognition device provided by some embodiments of the present disclosure.
  • the intelligent invoice recognition device 500 may include a memory 501 , a processor 502 and an image acquisition component 503 . It should be noted that the components of the smart invoice recognition device 500 shown in FIG. 5 are only exemplary, not limiting, and the smart invoice recognition device 500 may also have other components according to actual application requirements.
  • the image acquisition part 503 is used to acquire an invoice image of a paper invoice.
  • Memory 501 is used to store invoice images and computer readable instructions.
  • Processor 502 operates to read the invoice image and determine an input image based on the invoice image and execute computer readable instructions.
  • the computer readable instructions are executed by the processor 502 to perform one or more steps in the image processing method according to any of the above embodiments.
  • the invoice image may be the original image described in the embodiment of the image processing method.
  • the image acquisition component 503 is the image acquisition device described in the embodiments of the above image processing method.
  • the image acquisition component 503 may be a camera of a smartphone, a camera of a tablet computer, a camera of a personal computer, a lens of a digital camera, Or even a webcam.
  • the image of the invoice may be the image of the original invoice directly collected by the image acquisition component 503, or may be the image obtained after preprocessing the image of the original invoice.
  • Preprocessing can remove irrelevant information or noise information in the original invoice image to facilitate better processing of the invoice image.
  • the preprocessing may include, for example, performing image augmentation (Data Augment), image scaling, gamma (Gamma) correction, image enhancement or noise reduction filtering on the original invoice image.
  • processor 502 may control other components in intelligent invoice recognition device 500 to perform desired functions.
  • the processor 502 may be a device with data processing capability and/or program execution capability, such as a central processing unit (CPU), a tensor processing unit (TPU), or a graphics processing unit (GPU).
  • the central processing unit (CPU) can be an X86 or an ARM architecture or the like.
  • the GPU can be individually integrated directly onto the motherboard, or built into the motherboard's Northbridge chip. GPUs can also be built into central processing units (CPUs).
  • memory 501 may include any combination of one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and/or non-volatile memory.
  • Volatile memory may include, for example, random access memory (RAM) and/or cache memory, among others.
  • Non-volatile memory may include, for example, read only memory (ROM), hard disk, erasable programmable read only memory (EPROM), portable compact disk read only memory (CD-ROM), USB memory, flash memory, and the like.
  • ROM read only memory
  • EPROM erasable programmable read only memory
  • CD-ROM portable compact disk read only memory
  • USB memory flash memory, and the like.
  • One or more computer-readable instructions may be stored on the computer-readable storage medium, and the processor 502 may execute the computer-readable instructions to implement various functions of the intelligent invoice recognition device 500.
  • FIG. 6 is a schematic diagram of a storage medium provided by some embodiments of the present disclosure.
  • one or more computer-readable instructions 601 may be non-transitory stored on storage medium 600 .
  • the computer readable instructions 601 when executed by a computer, one or more steps in the image processing method according to the above description may be performed.
  • storage medium 600 is a non-transitory computer-readable storage medium.
  • the storage medium 600 can be applied to the above-mentioned image processing apparatus 400 and/or the smart invoice recognition apparatus 500 , for example, it can be the memory 401 in the image processing apparatus 400 and/or the memory 501 in the smart invoice recognition apparatus 500 .
  • the description of the storage medium 600 reference may be made to the description of the memory in the embodiments of the image processing apparatus 400 and/or the smart invoice recognition device 500, and the repetition will not be repeated.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Multimedia (AREA)
  • Artificial Intelligence (AREA)
  • Biophysics (AREA)
  • General Health & Medical Sciences (AREA)
  • Biomedical Technology (AREA)
  • Health & Medical Sciences (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Image Analysis (AREA)

Abstract

At least one embodiment of the present disclosure provides an image processing method, an image processing apparatus, an intelligent invoice recognition device, and a storage medium. The image processing method comprises: obtaining an input image, wherein the input image comprises an input seal; recognizing the input seal in the input image to obtain a seal image, wherein the seal image comprises an intermediate seal corresponding to the input seal; performing feature extraction processing on the seal image to obtain a feature point image; processing the seal image and the feature point image to obtain a first unfolding point, a second unfolding point, and a unfolding line; by using the connecting line between the first unfolding point and the second unfolding point as an unfolding reference line and the first unfolding point as an unfolding starting point, unfolding the input seal horizontally along the unfolding line to obtain an unfolded seal image; performing area recognition processing on the unfolded seal image to determine a first intermediate object area; and performing object recognition processing on the first intermediate object area to obtain a first recognition result.

Description

图像处理方法及装置、智能发票识别设备和存储介质Image processing method and device, intelligent invoice recognition device and storage medium 技术领域technical field
本公开的实施例涉及一种图像处理方法、图像处理装置、智能发票识别设备和非瞬时性计算机可读存储介质。Embodiments of the present disclosure relate to an image processing method, an image processing apparatus, an intelligent invoice recognition device, and a non-transitory computer-readable storage medium.
背景技术Background technique
由于不规则排列文字是弧形、曲面或者具有透视效果,因此,对于不规则排列文字的识别(例如,公章或者发票章等印章的图像中的弧形文字识别或者其他类型的弧形文字识别等)并不准确。不规则排列文字识别一直是文字识别领域的一个技术难点。Since the irregularly arranged characters are arcs, curved surfaces or have a perspective effect, the recognition of irregularly arranged characters (for example, the recognition of arcuate characters in images of seals such as official seals or invoice seals or other types of arc character recognition, etc. ) is not accurate. Irregularly arranged text recognition has always been a technical difficulty in the field of text recognition.
发明内容SUMMARY OF THE INVENTION
本公开至少一实施例提供一种图像处理方法,包括:获取输入图像,其中,所述输入图像包括输入印章,所述输入印章包括第一对象;识别所述输入图像中的所述输入印章,以得到印章图像,其中,所述印章图像包括与所述输入印章对应的中间印章;对所述印章图像进行特征提取处理,以得到特征点图像;对所述印章图像和所述特征点图像进行处理,以获取第一展开点、第二展开点和展开线;以所述第一展开点和所述第二展开点之间的连线作为展开基准线和以所述第一展开点为展开起始点,将所述输入印章沿着所述展开线横向展开以得到展开印章图像;对所述展开印章图像进行区域识别处理,以确定所述展开印章图像中的第一中间对象区域,其中,所述输入图像中与所述第一中间对象区域对应的区域为第一对象区域,所述第一对象位于所述第一对象区域内;对所述第一中间对象区域进行对象识别处理,以识别得到第一识别结果。At least one embodiment of the present disclosure provides an image processing method, including: acquiring an input image, wherein the input image includes an input seal, and the input seal includes a first object; identifying the input seal in the input image, To obtain a seal image, wherein, the seal image includes an intermediate seal corresponding to the input seal; feature extraction processing is performed on the seal image to obtain a feature point image; the seal image and the feature point image are processed. processing to obtain a first unfolding point, a second unfolding point and a unfolding line; taking the connecting line between the first unfolding point and the second unfolding point as the unfolding reference line and the first unfolding point as the unfolding At the starting point, the input seal is laterally expanded along the expansion line to obtain an expanded seal image; region recognition processing is performed on the expanded seal image to determine the first intermediate object region in the expanded seal image, wherein, The region corresponding to the first intermediate object region in the input image is the first object region, and the first object is located in the first object region; object recognition processing is performed on the first intermediate object region to obtain The identification obtains the first identification result.
可选地,在本公开一实施例提供的图像处理方法中,所述印章图像中所述中间印章对应的像素具有第一像素值,所述印章图像中除了所述中间印章对应的像素之外的像素具有第二像素值,所述第一像素值和所述第二像素值不相同。Optionally, in the image processing method provided by an embodiment of the present disclosure, the pixels corresponding to the middle seal in the seal image have a first pixel value, and the seal image except for the pixels corresponding to the middle seal has a first pixel value. The pixels of have a second pixel value, and the first pixel value and the second pixel value are different.
可选地,在本公开一实施例提供的图像处理方法中,识别所述输入图像中的所述输入印章,以得到印章图像,包括:利用图像分割模型对所述输入图像进行识别,以得到所述输入印章对应的初始印章像素;对所述初始印章像素进行模糊处理,以得到印章像素掩膜区域;根据所述印章像素掩膜区域,确定所述输入图像中的所述输入印章对应的像素;设置所述输入图像中的所述输入印章对应的像素的像素值为所述第一像素值和设置所述输入图像中除了所述输入印章对应的像素之外的像素的像素值为所述第二像素值,以得到所述印章图像。Optionally, in the image processing method provided by an embodiment of the present disclosure, identifying the input seal in the input image to obtain a seal image includes: using an image segmentation model to identify the input image to obtain The initial seal pixels corresponding to the input seal; the initial seal pixels are blurred to obtain a seal pixel mask area; according to the seal pixel mask area, determine the corresponding input seal in the input image. pixel; set the pixel value of the pixel corresponding to the input seal in the input image to the first pixel value and set the pixel value of the pixel other than the pixel corresponding to the input seal in the input image to the desired value. the second pixel value to obtain the stamp image.
可选地,在本公开一实施例提供的图像处理方法中,所述展开线包括第一环形展开线,所述第一环形展开线为所述输入印章的边缘线,对所述印章图像和所述特征点图像进行处理,以获取第一展开点、第二展开点和展开线,包括:基于OpenCV的算法对所述印章图像和所述特征点图像进行处理,以获取初始第二展开点和初始第一环形展开线,其中,所述初始第二展开点和所述初始第一环形展开线位于所述印章图像中;通过展开点提取模型对所述印章图像和所述特征点图像进行处理,以确定所述印章图像中与所述第一对象对应的特征对象区域,基于所述特征对象区域确定所述印章图像中的开口区域,获取所述开口区域的中的任一点,基于所述任一点和所述初始第一环形展开线,确定初始第一展开点,其中,所述初始第一展开点位于所述印章图像中,所述任一点、所述初始第一展开点和所述初始第二展开点中的任意两个点之间的连线段不与所述特征对象区域交叠,将所述初始第一展开点、所述初始第二展开点和所述初始第一环形展开线从所述印章图像中映射到所述输入图像,以得到所述第一展开点、所述第二展开点和所述第一环形展开线。Optionally, in the image processing method provided by an embodiment of the present disclosure, the unfolding line includes a first annular unfolding line, and the first annular unfolding line is an edge line of the input stamp. The feature point image is processed to obtain the first unfolding point, the second unfolding point and the unfolding line, including: processing the seal image and the feature point image based on the algorithm of OpenCV to obtain the initial second unfolding point and an initial first annular unfolding line, wherein the initial second unfolding point and the initial first annular unfolding line are located in the seal image; processing to determine a characteristic object area corresponding to the first object in the seal image, determine an opening area in the seal image based on the characteristic object area, obtain any point in the opening area, and based on the The arbitrary point and the initial first annular expansion line are used to determine the initial first expansion point, wherein the initial first expansion point is located in the seal image, and the arbitrary point, the initial first expansion point and all the The line segment between any two points in the initial second expansion point does not overlap with the feature object area, and the initial first expansion point, the initial second expansion point and the initial first expansion point A circular unfolding line is mapped from the stamp image to the input image to obtain the first unfolding point, the second unfolding point and the first circular unfolding line.
可选地,在本公开一实施例提供的图像处理方法中,基于所述任一点和所述初始第一环形展开线,确定初始第一展开点,包括:基于所述任一点,获取所述初始第一环形展开线上与所述任一点对应的点作为所述初始第一展开点。Optionally, in the image processing method provided by an embodiment of the present disclosure, determining the initial first unfolding point based on the any point and the initial first annular unfolding line includes: obtaining the initial first unfolding point based on the any point A point corresponding to the any point on the initial first annular unfolding line is used as the initial first unfolding point.
可选地,在本公开一实施例提供的图像处理方法中,所述展开线包括第一环形展开线和第二环形展开线,所述第一环形展开线为所述输入印章的边 缘线,在所述输入图像中,所述第二环形展开线位于所述第一环形展开线包围的区域内,所述第一对象区域位于所述第一环形展开线和所述第二环形展开线围成的环形区域内,对所述印章图像和所述特征点图像进行处理,以获取第一展开点、第二展开点和展开线,包括:基于OpenCV的算法对所述印章图像和所述特征点图像进行处理,以获取初始第一环形展开线和初始第二环形展开线,其中,所述初始第一环形展开线和所述初始第二环形展开线位于所述印章图像中;通过展开点提取模型对所述印章图像和所述特征点图像进行处理,以确定所述印章图像中与所述第一对象对应的特征对象区域,基于所述特征对象区域确定所述印章图像中的开口区域,获取所述开口区域的中的任一点,基于所述任一点、所述初始第一环形展开线和所述初始第二环形展开线,确定初始第一展开点和初始第二展开点,其中,所述初始第一展开点和所述初始第二展开点位于所述印章图像中,所述任一点、所述初始第一展开点和所述初始第二展开点中的任意两个点之间的连线段不与所述特征对象区域交叠;将所述初始第一展开点、所述初始第二展开点、所述初始第一环形展开线和所述初始第二环形展开线从所述印章图像中映射到所述输入图像,以得到所述第一展开点、所述第二展开点、所述第一环形展开线和所述第二环形展开线。Optionally, in the image processing method provided by an embodiment of the present disclosure, the unfolding line includes a first annular unfolding line and a second annular unfolding line, and the first annular unfolding line is an edge line of the input stamp, In the input image, the second annular development line is located in an area surrounded by the first annular development line, and the first object area is located in the area surrounded by the first annular development line and the second annular development line In the annular area formed, the seal image and the feature point image are processed to obtain the first unfolding point, the second unfolding point and the unfolding line, including: using an algorithm based on OpenCV to analyze the seal image and the feature point image. point images are processed to obtain an initial first annular development line and an initial second annular development line, wherein the initial first annular development line and the initial second annular development line are located in the stamp image; through the development point The extraction model processes the seal image and the feature point image to determine a feature object area corresponding to the first object in the seal image, and determines an opening area in the seal image based on the feature object area , obtain any point in the opening area, and determine the initial first expansion point and the initial second expansion point based on the arbitrary point, the initial first annular expansion line and the initial second annular expansion line, wherein , the initial first unfolding point and the initial second unfolding point are located in the stamp image, and any two points among the any point, the initial first unfolding point and the initial second unfolding point are located The connecting line segment between is not overlapped with the feature object area; the initial first unfolding point, the initial second unfolding point, the initial first circular unfolding line and the initial second circular unfolding line are changed from The stamp image is mapped to the input image to obtain the first expansion point, the second expansion point, the first annular expansion line and the second annular expansion line.
可选地,在本公开一实施例提供的图像处理方法中,基于所述任一点、所述初始第一环形展开线和所述初始第二环形展开线,确定初始第一展开点和初始第二展开点,包括:基于所述任一点,获取所述初始第一环形展开线上与所述任一点对应的点作为所述初始第一展开点;基于所述任一点,获取所述初始第二环形展开线上与所述任一点对应的点作为所述初始第二展开点。Optionally, in the image processing method provided by an embodiment of the present disclosure, based on the arbitrary point, the initial first annular development line and the initial second annular development line, an initial first development point and an initial first development point are determined. Two expansion points, including: based on the arbitrary point, acquiring a point on the initial first annular expansion line corresponding to the arbitrary point as the initial first expansion point; based on the arbitrary point, acquiring the initial first expansion point A point corresponding to the any point on the two-ring unfolding line is used as the initial second unfolding point.
可选地,在本公开一实施例提供的图像处理方法中,所述初始第一展开点、所述初始第二展开点和所述任一点位于同一条直线上。Optionally, in the image processing method provided by an embodiment of the present disclosure, the initial first unfolding point, the initial second unfolding point, and the any point are located on the same straight line.
可选地,在本公开一实施例提供的图像处理方法中,所述任一点为所述开口区域的中心点。Optionally, in the image processing method provided by an embodiment of the present disclosure, the any point is a center point of the opening area.
可选地,在本公开一实施例提供的图像处理方法中,所述第一环形展开线被展开成为所述展开印章图像中的一条直线。Optionally, in the image processing method provided by an embodiment of the present disclosure, the first annular expansion line is expanded into a straight line in the expanded seal image.
可选地,在本公开一实施例提供的图像处理方法中,所述第一对象为文本,所述第一对象区域的形状为弧形。Optionally, in the image processing method provided by an embodiment of the present disclosure, the first object is text, and the shape of the first object area is an arc.
可选地,在本公开一实施例提供的图像处理方法中,所述输入印章的形状为圆形,所述第二展开点为所述圆形的圆心;或者,所述输入印章的形状为椭圆形,所述第二展开点为所述椭圆形的两个焦点连线的中点。Optionally, in the image processing method provided by an embodiment of the present disclosure, the shape of the input stamp is a circle, and the second expansion point is the center of the circle; or, the shape of the input stamp is an ellipse, and the second expansion point is the midpoint of the line connecting the two foci of the ellipse.
可选地,本公开一实施例提供的图像处理方法还包括:确定所述第一中间对象区域的中心点;通过所述第一中间对象区域和所述输入图像的映射关系,将所述第一中间对象区域映射回所述输入图像以确定所述第一对象区域,以及将所述第一中间对象区域的中心点映射回所述输入图像以确定所述第一对象区域的中心点;确定所述输入印章的中心点;通过所述第一对象区域的中心点和所述输入印章的中心点确定用于对所述输入图像进行校正的校正角度;基于所述校正角度对所述输入图像进行校正,以得到校正后的输入图像。Optionally, the image processing method provided by an embodiment of the present disclosure further includes: determining a center point of the first intermediate object area; an intermediate object region is mapped back to the input image to determine the first object region, and a center point of the first intermediate object region is mapped back to the input image to determine a center point of the first object region; determining The center point of the input seal; the correction angle used to correct the input image is determined by the center point of the first object area and the center point of the input seal; the input image is corrected based on the correction angle Correction is performed to obtain a corrected input image.
可选地,在本公开一实施例提供的图像处理方法中,所述输入印章还包括第二对象,所述图像处理方法还包括:对所述校正后的输入图像进行区域识别处理,以确定第二中间对象区域,其中,所述输入图像中与所述第二中间对象区域对应的区域为第二对象区域,所述第二对象位于所述第二对象区域内;对所述第二中间对象区域进行对象识别处理,以得到第二识别结果。Optionally, in the image processing method provided by an embodiment of the present disclosure, the input stamp further includes a second object, and the image processing method further includes: performing region recognition processing on the corrected input image to determine The second intermediate object area, wherein the area corresponding to the second intermediate object area in the input image is the second object area, and the second object is located in the second object area; The object area is subjected to object recognition processing to obtain a second recognition result.
可选地,在本公开一实施例提供的图像处理方法中,获取输入图像包括:获取原始图像,其中,所述原始图像包括原始印章;通过印章区域识别模型对所述原始图像进行处理,以确定印章区域,通过印章标注框标注出所述印章区域,对所述印章标注框进行切片处理,以得到中间输入图像,其中,所述原始印章位于所述印章区域内,所述印章标注框包括所述印章区域,所述中间输入图像包括所述原始印章,对所述中间输入图像进行处理以去除所述中间输入图像中的干扰像素,以得到所述输入图像,其中,所述干扰像素包括所述中间输入图像中不属于所述原始印章的干扰物体的像素,所述输入印章与所述原始印章对应。Optionally, in the image processing method provided by an embodiment of the present disclosure, acquiring an input image includes: acquiring an original image, wherein the original image includes an original seal; Determining a seal area, marking the seal area through a seal labeling frame, and slicing the seal labeling frame to obtain an intermediate input image, wherein the original seal is located in the seal area, and the seal labeling frame includes In the seal area, the intermediate input image includes the original seal, and the intermediate input image is processed to remove interference pixels in the intermediate input image to obtain the input image, wherein the interference pixels include Pixels of interfering objects in the intermediate input image that do not belong to the original seal, and the input seal corresponds to the original seal.
本公开至少一实施例还提供一种图像处理装置,包括:存储器,用于非暂时性存储计算机可读指令;以及处理器,用于运行所述计算机可读指令,所述计算机可读指令被所述处理器运行时执行根据上述任一实施例所述的图 像处理方法。At least one embodiment of the present disclosure further provides an image processing apparatus, including: a memory for non-transitory storage of computer-readable instructions; and a processor for executing the computer-readable instructions, the computer-readable instructions being executed by The processor executes the image processing method according to any one of the above embodiments when running.
本公开至少一实施例还提供一种智能发票识别设备,包括:图像获取部件,用于获得纸质发票的发票图像;存储器,用于存储所述发票图像以及计算机可读指令;处理器,用于读取所述发票图像并基于所述发票图像确定所述输入图像,并运行所述计算机可读指令,所述计算机可读指令被所述处理器运行时执行根据上述任一实施例所述的图像处理方法。At least one embodiment of the present disclosure further provides an intelligent invoice recognition device, including: an image acquisition component for acquiring an invoice image of a paper invoice; a memory for storing the invoice image and computer-readable instructions; a processor for using upon reading the invoice image and determining the input image based on the invoice image, and executing the computer readable instructions, the computer readable instructions being executed by the processor to execute the above described embodiments image processing method.
本公开至少一实施例还提供一种非瞬时性计算机可读存储介质,非暂时性地存储计算机可读指令,当所述计算机可读指令由计算机执行时可以执行根据上述任一实施例所述的图像处理方法。At least one embodiment of the present disclosure further provides a non-transitory computer-readable storage medium for non-transitory storage of computer-readable instructions, which, when executed by a computer, can execute any of the foregoing embodiments. image processing method.
附图说明Description of drawings
为了更清楚地说明本公开实施例的技术方案,下面将对实施例的附图作简单地介绍,显而易见地,下面描述中的附图仅仅涉及本公开的一些实施例,而非对本公开的限制。In order to explain the technical solutions of the embodiments of the present disclosure more clearly, the accompanying drawings of the embodiments will be briefly introduced below. Obviously, the drawings in the following description only relate to some embodiments of the present disclosure, rather than limit the present disclosure. .
图1为本公开一些实施例提供的一种图像处理方法的示意性流程图;FIG. 1 is a schematic flowchart of an image processing method provided by some embodiments of the present disclosure;
图2A为本公开一些实施例提供的一种原始图像的示意图;2A is a schematic diagram of an original image provided by some embodiments of the present disclosure;
图2B为基于图2A所示的原始图像确定的中间输入图像的示意图;2B is a schematic diagram of an intermediate input image determined based on the original image shown in FIG. 2A;
图2C为对图2B所示的中间输入图像进行识别得到的输入图像的示意图;2C is a schematic diagram of an input image obtained by identifying the intermediate input image shown in FIG. 2B;
图2D为对图2C所示的输入图像进行识别得到的印章图像的一种示意图;2D is a schematic diagram of a seal image obtained by recognizing the input image shown in FIG. 2C;
图2E为对图2D所示的印章图像进行特征提取处理得到的特征点图像的示意图;2E is a schematic diagram of a feature point image obtained by performing feature extraction processing on the seal image shown in FIG. 2D;
图2F为本公开一些实施例提供的另一种输入图像的示意图;2F is a schematic diagram of another input image provided by some embodiments of the present disclosure;
图2G为对图2C所示的输入图像进行识别得到的印章图像的另一种示意图;2G is another schematic diagram of a seal image obtained by recognizing the input image shown in FIG. 2C;
图2H为将图2C中的输入印章展开得到的展开印章图像的示意图;Fig. 2H is the schematic diagram of the expanded seal image obtained by expanding the input seal in Fig. 2C;
图2I为对图2H中的展开印章图像进行区域识别处理得到的第一中间对象区域的示意图;Fig. 2I is the schematic diagram of the first intermediate object region obtained by region recognition processing to the unfolded seal image in Fig. 2H;
图2J为对图2I中的第一中间对象区域进行对象识别处理得到的第一识别结果的示意图;2J is a schematic diagram of a first recognition result obtained by performing object recognition processing on the first intermediate object region in FIG. 2I;
图3A为本公开一些实施例提供的另一种原始图像的示意图;3A is a schematic diagram of another original image provided by some embodiments of the present disclosure;
图3B为基于图3A所示的原始图像确定的中间输入图像的示意图;3B is a schematic diagram of an intermediate input image determined based on the original image shown in FIG. 3A;
图3C为对图3B所示的中间输入图像进行识别得到的输入图像的示意图;3C is a schematic diagram of an input image obtained by identifying the intermediate input image shown in FIG. 3B;
图3D为对图3C所示的输入图像进行识别得到的印章图像的一种示意图;3D is a schematic diagram of a seal image obtained by recognizing the input image shown in FIG. 3C;
图3E为对图3D所示的印章图像进行特征提取处理得到的特征点图像的示意图;3E is a schematic diagram of a feature point image obtained by performing feature extraction processing on the seal image shown in FIG. 3D;
图3F为将图3C中的输入印章展开得到的展开印章图像的示意图;3F is a schematic diagram of an expanded seal image obtained by expanding the input seal in FIG. 3C;
图3G为对图3F中的展开印章图像进行区域识别处理得到的第一中间对象区域的示意图;3G is a schematic diagram of a first intermediate object region obtained by performing region identification processing on the expanded seal image in FIG. 3F;
图3H为对图3G中的第一中间对象区域进行对象识别处理得到的第一识别结果的示意图;3H is a schematic diagram of a first recognition result obtained by performing object recognition processing on the first intermediate object region in FIG. 3G;
图4为本公开一些实施例提供的一种图像处理装置的示意性框图;FIG. 4 is a schematic block diagram of an image processing apparatus according to some embodiments of the present disclosure;
图5为本公开一些实施例提供的一种智能发票识别设备的示意性框图;FIG. 5 is a schematic block diagram of an intelligent invoice recognition device according to some embodiments of the present disclosure;
图6为本公开一些实施例提供的一种存储介质的示意图。FIG. 6 is a schematic diagram of a storage medium provided by some embodiments of the present disclosure.
具体实施方式Detailed ways
为了使得本公开实施例的目的、技术方案和优点更加清楚,下面将结合本公开实施例的附图,对本公开实施例的技术方案进行清楚、完整地描述。显然,所描述的实施例是本公开的一部分实施例,而不是全部的实施例。基于所描述的本公开的实施例,本领域普通技术人员在无需创造性劳动的前提下所获得的所有其他实施例,都属于本公开保护的范围。In order to make the purposes, technical solutions and advantages of the embodiments of the present disclosure more clear, the technical solutions of the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present disclosure. Obviously, the described embodiments are some, but not all, embodiments of the present disclosure. Based on the described embodiments of the present disclosure, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the protection scope of the present disclosure.
除非另外定义,本公开使用的技术术语或者科学术语应当为本公开所属领域内具有一般技能的人士所理解的通常意义。本公开中使用的“第一”、“第二”以及类似的词语并不表示任何顺序、数量或者重要性,而只是用来区分不同的组成部分。“包括”或者“包含”等类似的词语意指出现该词前面的元件或者物件涵盖出现在该词后面列举的元件或者物件及其等同,而不排除其他元件或者物件。“连接”或者“相连”等类似的词语并非限定于物理的或者机械的连接,而是可以包括电性的连接,不管是直接的还是间接的。“上”、“下”、“左”、“右”等仅用于表示相对位置关系,当被描述对象的绝对位置改变后,则 该相对位置关系也可能相应地改变。Unless otherwise defined, technical or scientific terms used in this disclosure shall have the ordinary meaning as understood by one of ordinary skill in the art to which this disclosure belongs. As used in this disclosure, "first," "second," and similar terms do not denote any order, quantity, or importance, but are merely used to distinguish the various components. "Comprises" or "comprising" and similar words mean that the elements or things appearing before the word encompass the elements or things recited after the word and their equivalents, but do not exclude other elements or things. Words like "connected" or "connected" are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "Down", "Left", "Right", etc. are only used to indicate the relative positional relationship. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.
为了保持本公开实施例的以下说明清楚且简明,本公开省略了部分已知功能和已知部件的详细说明。In order to keep the following description of the embodiments of the present disclosure clear and concise, the present disclosure omits a detailed description of some well-known functions and well-known components.
公章或者发票章等印章的图像中具有不规则排列的文字,例如,弧形文字,目前,针对这些弧形文字的识别并不准确。此外,如果在盖章时印章倾斜,其也会导致该印章对应的图像中的规则排列的文字,例如水平排列的文字或竖直排列的文字,也会倾斜或者颠倒,从而导致无法判断该印章的正向方向,从而导致识别不准确。The images of seals such as official seals or invoice seals have irregularly arranged characters, for example, arc characters. At present, the recognition of these arc characters is not accurate. In addition, if the seal is tilted when stamping, it will also cause the regularly arranged characters in the image corresponding to the seal, such as horizontally arranged characters or vertically arranged characters, will also be slanted or reversed, making it impossible to judge the seal. forward direction, resulting in inaccurate recognition.
本公开至少一实施例提供一种图像处理方法、图像处理装置、智能发票识别设备和非瞬时性计算机可读存储介质。图像处理方法包括:获取输入图像,其中,输入图像包括输入印章,输入印章包括第一对象;识别输入图像中的输入印章,以得到印章图像,其中,印章图像包括与输入印章对应的中间印章;对印章图像进行特征提取处理,以得到特征点图像;对印章图像和特征点图像进行处理,以获取第一展开点、第二展开点和展开线;以第一展开点和第二展开点之间的连线作为展开基准线和以第一展开点为展开起始点,将输入印章沿着展开线横向展开以得到展开印章图像;对展开印章图像进行区域识别处理,以确定展开印章图像中的第一中间对象区域,其中,输入图像中与第一中间对象区域对应的区域为第一对象区域,第一对象位于第一对象区域内;对第一中间对象区域进行对象识别处理,以识别得到第一识别结果。At least one embodiment of the present disclosure provides an image processing method, an image processing apparatus, an intelligent invoice recognition device, and a non-transitory computer-readable storage medium. The image processing method includes: acquiring an input image, wherein the input image includes an input seal, and the input seal includes a first object; identifying the input seal in the input image to obtain a seal image, wherein the seal image includes an intermediate seal corresponding to the input seal; Perform feature extraction processing on the seal image to obtain the feature point image; process the seal image and the feature point image to obtain the first unfolding point, the second unfolding point and the unfolding line; take the difference between the first unfolding point and the second unfolding point. The connecting line between them is used as the unfolding reference line and the first unfolding point is the unfolding starting point, and the input stamp is horizontally unfolded along the unfolding line to obtain the unfolding seal image; The first intermediate object area, wherein the area corresponding to the first intermediate object area in the input image is the first object area, and the first object is located in the first object area; object recognition processing is performed on the first intermediate object area, so as to obtain The first recognition result.
该图像处理方法在能够很好地实现对输入图像中的不规则排列的对象(例如,文字等)进行识别,提高识别不规则排列的对象的准确性,获得精确的识别结果。The image processing method can well realize the recognition of irregularly arranged objects (eg, characters, etc.) in the input image, improve the accuracy of identifying the irregularly arranged objects, and obtain accurate recognition results.
需要说明的是,在本公开的实施例中,“不规则排列的对象”可以表示多个对象(例如,文字)没有排列为一行或一列,也就是说,多个对象没有沿同一条直线排列,例如,多个对象的中心沿一条曲线(例如,波浪线)或折线等排列。It should be noted that, in the embodiments of the present disclosure, “irregularly arranged objects” may mean that multiple objects (eg, characters) are not arranged in a row or column, that is, multiple objects are not arranged along the same straight line , for example, the centers of multiple objects are arranged along a curve (eg, a wavy line) or a polyline, etc.
本公开实施例提供的图像处理方法可应用于本公开实施例提供的图像处理装置,该图像处理装置可被配置于电子设备上。该电子设备可以是个人计 算机、移动终端等,该移动终端可以是手机、平板电脑等硬件设备。The image processing method provided by the embodiment of the present disclosure can be applied to the image processing apparatus provided by the embodiment of the present disclosure, and the image processing apparatus can be configured on an electronic device. The electronic device may be a personal computer, a mobile terminal, etc., and the mobile terminal may be a hardware device such as a mobile phone and a tablet computer.
下面结合附图对本公开的实施例进行详细说明,但是本公开并不限于这些具体的实施例。The embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings, but the present disclosure is not limited to these specific embodiments.
图1为本公开一些实施例提供的一种图像处理方法的示意性流程图,图2A为本公开一些实施例提供的一种原始图像的示意图,图2B为基于图2A所示的原始图像确定的中间输入图像,图2C为对图2B所示的中间输入图像进行识别得到的输入图像。图3A为本公开一些实施例提供的另一种原始图像的示意图,图3B为基于图3A所示的原始图像确定的中间输入图像,图3C为对图3B所示的中间输入图像进行识别得到的输入图像。FIG. 1 is a schematic flowchart of an image processing method provided by some embodiments of the present disclosure, FIG. 2A is a schematic diagram of an original image provided by some embodiments of the present disclosure, and FIG. 2B is a determination based on the original image shown in FIG. 2A . The intermediate input image shown in FIG. 2C is an input image obtained by recognizing the intermediate input image shown in FIG. 2B . 3A is a schematic diagram of another original image provided by some embodiments of the present disclosure, FIG. 3B is an intermediate input image determined based on the original image shown in FIG. 3A , and FIG. 3C is obtained by identifying the intermediate input image shown in FIG. 3B the input image.
如图1所示,首先,本公开实施例提供的图像处理方法在步骤S10,获取输入图像。As shown in FIG. 1 , first, in step S10 of the image processing method provided by the embodiment of the present disclosure, an input image is acquired.
例如,在步骤S10中,输入图像包括输入印章,例如,输入印章可以为合同专用章、发票专用章等各种类型的印章。输入图像可以为任何包括印章的图像,例如,如图2C所示,在一些实施例中,输入图像可以为包括公司印章的图像,如图3C所示,在另一些实施例中,输入图像可以为包括发票专用章的图像。输入印章可以为圆形印章、椭圆形印章、多边形印章(例如,矩形印章)等规则形状印章,也可以为不规则形状印章。图2C所示的输入图像包括一个圆形印章,图3C所示的输入图像包括一个椭圆形印章。For example, in step S10, the input image includes an input seal, for example, the input seal may be various types of seals such as contract-specific seals, invoice-specific seals, and the like. The input image can be any image that includes a seal, for example, as shown in FIG. 2C, in some embodiments, the input image can be an image including a company seal, as shown in FIG. 3C, in other embodiments, the input image can be For including the image of the special stamp for the invoice. The input stamp may be a regular shape stamp such as a circular stamp, an oval stamp, a polygon stamp (for example, a rectangular stamp), or an irregular shape stamp. The input image shown in FIG. 2C includes a circular seal, and the input image shown in FIG. 3C includes an oval seal.
需要说明的是,本公开不限于此,输入图像也可以文档图像等。It should be noted that the present disclosure is not limited to this, and the input image may also be a document image or the like.
例如,输入印章包括第一对象,第一对象可以为字符,字符可以为数字、中文字(中文汉字、中文单词等)、外文字(例如,外文字母、外文单词等,例如,英文、日文、韩文、德文等)、特殊字符(例如,百分号“%”)、标点符号等。此外,字符还可以包括图形(例如,圆形、矩形等)等。例如,在一些实施例中,第一对象可以为文本,如图2C和图3C所示,第一对象可以包括不规则排列的多个文字,且该多个文字的中心排列在一条曲线,例如,排列在一条弧线上。For example, the input seal includes a first object, the first object may be a character, and the character may be a number, a Chinese character (Chinese characters, Chinese words, etc.), foreign characters (eg, foreign letters, foreign words, etc., such as English, Japanese, Korean, German, etc.), special characters (eg, percent sign "%"), punctuation marks, etc. In addition, the characters may also include graphics (eg, circles, rectangles, etc.), and the like. For example, in some embodiments, the first object may be text. As shown in FIG. 2C and FIG. 3C , the first object may include a plurality of characters arranged irregularly, and the centers of the plurality of characters are arranged in a curve, for example , arranged in an arc.
例如,如图2C所示,第一对象包括“杭州睿胜软件有限公司”,“杭州睿胜软件有限公司”中的各个文字的中心排列在一条圆弧线上;如图3C所示,第一对象包括“杭州睿胜软件有限公司”,“杭州睿胜软件有限公司”中的各 个文字的中心排列在一条椭圆弧线上。For example, as shown in Fig. 2C, the first object includes "Hangzhou Ruisheng Software Co., Ltd.", and the centers of the characters in "Hangzhou Ruisheng Software Co., Ltd." are arranged on an arc line; as shown in Fig. 3C, the first object An object includes "Hangzhou Ruisheng Software Co., Ltd.", and the centers of the characters in "Hangzhou Ruisheng Software Co., Ltd." are arranged on an elliptical arc.
例如,在一些实施例中,步骤S10包括:获取原始图像;通过印章区域识别模型对原始图像进行处理,以确定印章区域,通过印章标注框标注出印章区域,对印章标注框进行切片处理,以得到中间输入图像;对中间输入图像进行处理以去除中间输入图像中的干扰像素,以得到输入图像。For example, in some embodiments, step S10 includes: acquiring an original image; processing the original image through a seal area recognition model to determine the seal area, marking the seal area through the seal annotation frame, and slicing the seal annotation frame to Obtain an intermediate input image; process the intermediate input image to remove interfering pixels in the intermediate input image to obtain an input image.
例如,原始图像和中间输入图像均包括原始印章,原始印章位于印章区域内,印章标注框包括印章区域。可以在原始图像中标注出原始印章的区域,然后从原始图像中将原始印章对应的区域进行切割,以得到单独的中间输入图像,从而在后续操作中,可以直接对该切割得到的中间输入图像进行处理。For example, both the original image and the intermediate input image include the original stamp, the original stamp is located within the stamp area, and the stamp callout box includes the stamp area. The area of the original seal can be marked in the original image, and then the area corresponding to the original seal can be cut from the original image to obtain a separate intermediate input image, so that in subsequent operations, the cut intermediate input image can be directly obtained. to be processed.
例如,如图2A所示,在一些实施例中,原始图像可以为包括公司印章的图像,通过对图2A所示的原始图像进行处理即可得到图2B所示的中间输入图像。如图3A所示,在另一些实施例中,原始图像可以为包括发票专用章的图像,通过对图3A所示的原始图像进行处理即可得到图3B所示的中间输入图像。For example, as shown in FIG. 2A , in some embodiments, the original image may be an image including a company seal, and the intermediate input image shown in FIG. 2B can be obtained by processing the original image shown in FIG. 2A . As shown in FIG. 3A , in other embodiments, the original image may be an image including a special seal for invoices, and the intermediate input image shown in FIG. 3B can be obtained by processing the original image shown in FIG. 3A .
例如,印章标注框可以为矩形框,从而中间输入图像可以具有矩形形状。例如,印章标注框的尺寸与中间输入图像的尺寸可以相同。但本公开的实施例不限于此,印章标注框的尺寸与中间输入图像的尺寸也可以不相同,例如,印章标注框的尺寸大于中间输入图像的尺寸,也就是说,中间输入图像位于印章标注框内。For example, the stamp callout box can be a rectangular box, so that the intermediate input image can have a rectangular shape. For example, the dimensions of the stamp callout box can be the same as the dimensions of the intermediate input image. However, the embodiments of the present disclosure are not limited to this, and the size of the seal annotation frame and the size of the intermediate input image may also be different. For example, the size of the seal annotation frame is larger than the size of the intermediate input image, that is, the intermediate input image is located in the seal annotation frame. inside the box.
需要说明的是,印章标注框也可以为菱形框、椭圆形框、圆形框等。It should be noted that the seal marking frame may also be a diamond frame, an oval frame, a circular frame, and the like.
例如,印章区域识别模型可以采用机器学习技术实现,且该印章区域识别模型为预先训练好的模型。印章区域识别模型可以采用深度卷积神经网络(CNN)或者深度残差网络(Resnet)等神经网络实现。For example, the seal area recognition model can be implemented using machine learning technology, and the seal area recognition model is a pre-trained model. The seal region recognition model can be implemented by neural networks such as deep convolutional neural network (CNN) or deep residual network (Resnet).
例如,中间输入图像的尺寸可以由用户根据实际情况自行设定。For example, the size of the intermediate input image can be set by the user according to the actual situation.
例如,原始图像可以为通过数码相机或手机拍摄的图像,原始图像可以为灰度图像,也可以为彩色图像。For example, the original image may be an image captured by a digital camera or a mobile phone, and the original image may be a grayscale image or a color image.
例如,原始图像可以为图像采集装置直接采集到的图像,也可以是对直接采集到的图像进行预处理之后获得的图像。例如,为了避免原始图像的数据质量、数据不均衡等对于输入图像的识别的影响,在处理原始图像前,本 公开实施例提供的图像处理方法还可以包括对原始图像进行预处理的操作。预处理可以消除原始图像中的无关信息或噪声信息,以便于更好地对原始图像进行处理。预处理例如可以包括对原始图像进行缩放、剪裁、伽玛(Gamma)校正、图像增强或降噪滤波等处理。For example, the original image may be an image directly collected by an image collection device, or may be an image obtained after preprocessing the directly collected image. For example, in order to avoid the influence of the data quality and data imbalance of the original image on the recognition of the input image, before processing the original image, the image processing method provided by the embodiments of the present disclosure may further include an operation of preprocessing the original image. Preprocessing can eliminate irrelevant information or noise information in the original image, so as to better process the original image. The preprocessing may include, for example, scaling, cropping, gamma correction, image enhancement, or noise reduction filtering on the original image.
需要说明的是,在另一些示例,获取输入图像包括:获取原始图像,通过印章区域识别模型对原始图像进行处理,以确定中间输入图像;对中间输入图像进行处理以去除中间输入图像中的干扰像素,以得到输入图像。可以在原始图像中标注出印章标注框的区域,该区域即为中间输入图像,从而在后续操作中,可以直接对该标注出的区域进行处理,例如,进行去除干扰像素的处理。也就是说,可以不对原始图像中的印章标注框进行切割操作。It should be noted that, in other examples, acquiring the input image includes: acquiring the original image, processing the original image through the seal region recognition model to determine the intermediate input image; processing the intermediate input image to remove interference in the intermediate input image pixels to get the input image. The area of the stamp annotation frame can be marked in the original image, and this area is the intermediate input image, so that in subsequent operations, the marked area can be directly processed, for example, to remove interference pixels. That is, the stamp callout box in the original image can not be cut.
例如,输入图像中的输入印章与中间输入图像中的原始印章对应。需要说明的是,输入印章和原始印章的尺寸、形状等均相同,不同之处在于:输入印章位于输入图像中,原始印章位于原始图像和中间输入图像中。此外,如图2B和图2C所示,在一些实施例中,在对中间输入图像进行去除干扰像素的处理的过程中,原始印章的某些像素可能被去除,从而导致原始印章和输入印章并不完全相同,然而,值得注意的是,原始印章中包括的对象和输入图像中包括的对象是相同的,例如,原始印章中包括文字“杭州睿胜软件有限公司”,输入图像中也包括文字“杭州睿胜软件有限公司”。For example, the input stamp in the input image corresponds to the original stamp in the intermediate input image. It should be noted that the size, shape, etc. of the input stamp and the original stamp are the same, except that the input stamp is located in the input image, and the original stamp is located in the original image and the intermediate input image. Furthermore, as shown in Figures 2B and 2C, in some embodiments, during the process of removing interfering pixels on the intermediate input image, some pixels of the original stamp may be removed, resulting in the original stamp and the input stamp being merged with each other. Not exactly the same, however, it is worth noting that the objects included in the original seal and the input image are the same, e.g. the original seal included the text "Hangzhou Ruisheng Software Co., Ltd." and the input image also included the text "Hangzhou Ruisheng Software Co., Ltd.".
例如,干扰像素包括中间输入图像中不属于原始印章的干扰物体的像素。例如,干扰物体可以包括原始印章所覆盖的横线或盖章日期的文字或数字等,也可以包括与原始印章不交叠的其他文字、数字或图形等。For example, interfering pixels include pixels of interfering objects in the intermediate input image that do not belong to the original stamp. For example, the interfering objects may include horizontal lines covered by the original seal or characters or numbers on the date of the seal, and may also include other characters, numbers or graphics that do not overlap with the original seal.
例如,在一些实施例中,干扰物体可以为打印文字、符号、图形等,如图2B所示,中间输入图像中包括不属于原始印章的横线和顿号,该横线和顿号即为干扰物体,该横线和顿号所对应的像素即为干扰像素。例如,在另一些实施例中,干扰物体可以手写文字、符号、图形等,如图3B所示,输入图像中包括不属于原始印章的数字和点(即手写的2021.1.7),该数字和点即为干扰物体,该数字和点所对应的像素即为干扰像素。For example, in some embodiments, the interfering objects may be printed words, symbols, graphics, etc. As shown in FIG. 2B , the intermediate input image includes horizontal lines and commas that do not belong to the original seal, and the horizontal lines and commas are Interfering objects, the pixel corresponding to the horizontal line and comma is the interference pixel. For example, in other embodiments, the interfering objects can be handwritten words, symbols, graphics, etc. As shown in FIG. 3B, the input image includes numbers and points that do not belong to the original seal (ie, handwritten 2021.1.7), the numbers and The point is the interference object, and the pixel corresponding to the number and the point is the interference pixel.
例如,在步骤S10中,对中间输入图像进行处理以去除中间输入图像中的干扰像素,以得到输入图像,可以包括:利用图像分割模型(例如U-Net 模型、Mask-RCNN模型等)对中间输入图像进行识别,以得到干扰物体的初始干扰像素;对初始干扰像素进行模糊处理,以得到干扰像素掩膜区域;根据干扰像素掩膜区域确定干扰物体对应的干扰像素;去除中间输入图像中的干扰物体对应的干扰像素,以得到输入图像。For example, in step S10, processing the intermediate input image to remove interfering pixels in the intermediate input image to obtain the input image may include: using an image segmentation model (such as U-Net model, Mask-RCNN model, etc.) The input image is identified to obtain the initial interference pixels of the interference object; the initial interference pixels are blurred to obtain the interference pixel mask area; the interference pixels corresponding to the interference object are determined according to the interference pixel mask area; the interference pixels in the intermediate input image are removed. Interfering pixels corresponding to interfering objects are obtained to obtain the input image.
例如,可以基于干扰物体对应的像素的像素值和原始印章对应的像素的像素值不同而进行干扰像素的识别和去除过程。For example, the process of identifying and removing the interfering pixels may be performed based on the difference between the pixel value of the pixel corresponding to the interfering object and the pixel value of the pixel corresponding to the original seal.
例如,可以通过基于OpenCV的高斯滤波GaussianBlur函数对初始干扰像素进行高斯模糊处理,扩大初始干扰像素对应的区域,从而得到干扰像素掩膜区域。根据干扰像素掩膜区域,就可以确定干扰物体对应的干扰像素。接下来,可以通过基于OpenCV的inpaint函数去除中间输入图像中的干扰物体对应的干扰像素,以得到去除干扰物体的图像,即得到输入图像。For example, Gaussian blurring can be performed on the initial interference pixels through the GaussianBlur function of Gaussian filtering based on OpenCV to expand the area corresponding to the initial interference pixels, thereby obtaining the interference pixel mask area. According to the mask area of the interference pixel, the interference pixel corresponding to the interference object can be determined. Next, the interfering pixels corresponding to the interfering objects in the intermediate input image can be removed by the inpaint function based on OpenCV, so as to obtain an image from which the interfering objects are removed, that is, the input image is obtained.
例如,在图2C所示的输入图像中,图2B所示的中间输入图像中的横线和顿号等已经被去除;在图3C所示的输入图像中,图3B所示的中间输入图像中的手写数字和点等已经被去除。For example, in the input image shown in FIG. 2C, the horizontal lines and commas in the intermediate input image shown in FIG. 2B have been removed; in the input image shown in FIG. 3C, the intermediate input image shown in FIG. 3B has been removed. Handwritten numerals and dots etc. have been removed from .
图2D为对图2C所示的输入图像进行识别得到的印章图像的一种示意图,图3D为对图3C所示的输入图像进行识别得到的印章图像的一种示意图。FIG. 2D is a schematic diagram of a seal image obtained by recognizing the input image shown in FIG. 2C , and FIG. 3D is a schematic diagram of a seal image obtained by recognizing the input image shown in FIG. 3C .
接下来,如图1所示,在步骤S11,识别输入图像中的输入印章,以得到印章图像。Next, as shown in FIG. 1, in step S11, the input seal in the input image is recognized to obtain a seal image.
例如,印章图像包括与输入印章对应的中间印章。需要说明的是,输入印章和中间印章的尺寸、形状等均相同,另外,输入印章中包括的对象和中间印章中包括的对象及其相对位置关系等也相同,输入印章和中间印章的不同之处在于:输入印章位于输入图像中,中间印章位于印章图像中。For example, the seal image includes an intermediate seal corresponding to the input seal. It should be noted that the size and shape of the input stamp and the intermediate stamp are the same. In addition, the objects included in the input stamp and the objects included in the intermediate stamp and their relative positional relationships are also the same. The difference between the input stamp and the intermediate stamp is the same. where: the input stamp is located in the input image, and the intermediate stamp is located in the stamp image.
例如,在一些实施例中,步骤S11包括:利用图像分割模型(例如U-Net模型、Mask-RCNN模型等)对输入图像进行识别,以得到输入印章对应的初始印章像素;对初始印章像素进行模糊处理,以得到印章像素掩膜区域;根据印章像素掩膜区域,确定输入图像中的输入印章对应的像素;设置输入图像中的输入印章对应的像素的像素值为第一像素值和设置输入图像中除了输入印章对应的像素之外的像素的像素值为第二像素值,以得到印章图像。For example, in some embodiments, step S11 includes: using an image segmentation model (such as U-Net model, Mask-RCNN model, etc.) to identify the input image to obtain initial seal pixels corresponding to the input seal; Blur processing to obtain the seal pixel mask area; determine the pixel corresponding to the input seal in the input image according to the seal pixel mask area; set the pixel value of the pixel corresponding to the input seal in the input image to the first pixel value and set the input The pixel values of the pixels other than the pixels corresponding to the input seal in the image are the second pixel values, so as to obtain the seal image.
例如,如图2D和图3D所示,印章图像可以为黑白对比较为明显的黑白 图像,黑白图像的噪声干扰较少,可以有效提高印章图像中的内容的辨识度。印章图像中的中间印章对应的像素具有第一像素值,印章图像中除了中间印章对应的像素之外的像素具有第二像素值,第一像素值和第二像素值不相同。例如,第一像素值和第二像素值均可以灰阶值,且第一像素值可以为255,第二像素值可以为0。For example, as shown in Figure 2D and Figure 3D, the seal image can be a black and white image with obvious black and white contrast, and the black and white image has less noise interference, which can effectively improve the recognition of the content in the seal image. The pixels corresponding to the middle seal in the seal image have the first pixel value, the pixels in the seal image except the pixels corresponding to the middle seal have the second pixel value, and the first pixel value and the second pixel value are different. For example, both the first pixel value and the second pixel value may be grayscale values, and the first pixel value may be 255, and the second pixel value may be 0.
需要说明的是,对输入图像进行识别的图像分割模型和对中间输入图像进行识别的图像分割模型均可以采用机器学习技术(例如,深度学习技术)实现,均为预先训练好的模型。对输入图像进行识别的图像分割模型和对中间输入图像进行识别的图像分割模型可以为两个不同的模型,但均采用U-Net模型结构。It should be noted that both the image segmentation model for recognizing input images and the image segmentation model for recognizing intermediate input images can be implemented using machine learning technology (eg, deep learning technology), and both are pre-trained models. The image segmentation model for recognizing the input image and the image segmentation model for recognizing the intermediate input image can be two different models, but both adopt the U-Net model structure.
图2E为对图2D所示的印章图像进行特征提取处理得到的特征点图像,图3E为对图3D所示的印章图像进行特征提取处理得到的特征点图像。FIG. 2E is a feature point image obtained by performing feature extraction processing on the seal image shown in FIG. 2D , and FIG. 3E is a feature point image obtained by performing feature extraction processing on the seal image shown in FIG. 3D .
接下来,如图1所示,在步骤S12,对印章图像进行特征提取处理,以得到特征点图像。Next, as shown in FIG. 1, in step S12, feature extraction processing is performed on the seal image to obtain feature point images.
例如,在步骤S12中,可以通过预先训练的特征提取模型对印章图像进行特征提取处理,以得到特征点图像。特征提取模型也可以基于机器学习技术实现。For example, in step S12, feature extraction processing may be performed on the seal image through a pre-trained feature extraction model to obtain feature point images. Feature extraction models can also be implemented based on machine learning techniques.
例如,对图2D所示的印章图像进行特征提取处理以得到图2E所示的特征点图像,对图3D所示的印章图像进行特征提取处理以得到图3E所示的特征点图像。以图2E所示的特征点图像为例,如图2C所示,第一对象包括“杭州睿胜软件有限公司”,在图2E所示的特征点图像中,特征点图像中包括11个特征点,11个特征点分别对应“杭州睿胜软件有限公司”中的每一个文字和该中间印章的中心点。对于每个文字,该文字对应的特征点位于该文字所对应的区域的中心。For example, feature extraction processing is performed on the seal image shown in FIG. 2D to obtain the feature point image shown in FIG. 2E , and feature extraction processing is performed on the seal image shown in FIG. 3D to obtain the feature point image shown in FIG. 3E . Taking the feature point image shown in FIG. 2E as an example, as shown in FIG. 2C , the first object includes "Hangzhou Ruisheng Software Co., Ltd.", and in the feature point image shown in FIG. 2E , the feature point image includes 11 features. The 11 feature points correspond to each character in "Hangzhou Ruisheng Software Co., Ltd." and the center point of the middle seal. For each character, the feature point corresponding to the character is located in the center of the region corresponding to the character.
需要说明的是,如图2A-2D所示,原始图像、中间输入图像、输入图像和印章图像中的每一个图像中均包括第一对象“杭州睿胜软件有限公司”。It should be noted that, as shown in FIGS. 2A-2D , each of the original image, the intermediate input image, the input image and the seal image includes the first object "Hangzhou Ruisheng Software Co., Ltd.".
例如,图像分割模型是通过将输入图像或中间输入图像处理成黑白图像并进行样本标注,然后投入例如U-net模型中进行训练后建立的;特征提取模型也是通过将印章图像作为样本进行特征点标注后利用神经网络模型训练建 立的。For example, the image segmentation model is established by processing the input image or intermediate input image into a black and white image and labeling the sample, and then putting it into the U-net model for training; the feature extraction model is also by using the seal image as a sample. After labeling, it is established by training the neural network model.
图2F为本公开的实施例提供的另一种输入图像的示意图。FIG. 2F is a schematic diagram of another input image provided by an embodiment of the present disclosure.
接下来,如图1所示,在步骤S13,对印章图像和特征点图像进行处理,以获取第一展开点、第二展开点和展开线。Next, as shown in FIG. 1, in step S13, the stamp image and the feature point image are processed to obtain the first development point, the second development point and the development line.
例如,在一些实施例中,展开线包括第一环形展开线,第一环形展开线为输入印章的边缘线,例如,在一些实施例中,输入印章的边缘线可以为图2C所示的圆圈;在另一些实施例中,输入印章的边缘线可以为图3C所示的椭圆圈。For example, in some embodiments, the unfolding line includes a first annular unfolding line, and the first annular unfolding line is the edge line of the input stamp. For example, in some embodiments, the edge line of the input stamp may be the circle shown in FIG. 2C . ; In other embodiments, the edge line of the input stamp may be an elliptical circle as shown in FIG. 3C .
例如,步骤S13包括:基于OpenCV的算法对印章图像和特征点图像进行处理,以获取初始第二展开点和初始第一环形展开线;通过展开点提取模型对印章图像和特征点图像进行处理,以确定印章图像中与第一对象对应的特征对象区域,基于特征对象区域确定印章图像中的开口区域,获取开口区域的中的任一点;基于任一点和初始第一环形展开线,确定初始第一展开点;将初始第一展开点、初始第二展开点和初始第一环形展开线从印章图像中映射到输入图像,以得到第一展开点、第二展开点和第一环形展开线。For example, step S13 includes: processing the seal image and the feature point image based on the algorithm of OpenCV to obtain the initial second expansion point and the initial first annular expansion line; processing the seal image and the feature point image through the expansion point extraction model, Determine the characteristic object area corresponding to the first object in the seal image, determine the opening area in the seal image based on the characteristic object area, and obtain any point in the opening area; an expansion point; the initial first expansion point, the initial second expansion point and the initial first circular expansion line are mapped from the stamp image to the input image to obtain the first expansion point, the second expansion point and the first circular expansion line.
例如,初始第一展开点、初始第二展开点和初始第一环形展开线均位于印章图像中。任一点、初始第一展开点和初始第二展开点中的任意两个点之间的连线段不与特征对象区域交叠,从而可以保证在将输入印章进行横向展开时可以避免将第一对象分割为两个部分。For example, the initial first unfolding point, the initial second unfolding point, and the initial first annular unfolding line are all located in the stamp image. The connecting line segment between any two points among any point, the initial first unfolding point and the initial second unfolding point does not overlap with the feature object area, so that it can be ensured that when the input stamp is horizontally unfolded, the first The object is split into two parts.
例如,图2D所示的区域100即为特征对象区域,在图2D所示的印章图像中,第一对象“杭州睿胜软件有限公司”位于该特征对象区域中。如图2F所示,输入图像中与特征对象区域100对应的区域为第一对象区域200,在输入图像中,第一对象位于第一对象区域200内。特征对象区域100的形状可以为弧形,第一对象区域200的形状也可以为弧形。For example, the area 100 shown in FIG. 2D is the characteristic object area. In the seal image shown in FIG. 2D , the first object "Hangzhou Ruisheng Software Co., Ltd." is located in the characteristic object area. As shown in FIG. 2F , the region corresponding to the characteristic object region 100 in the input image is the first object region 200 , and in the input image, the first object is located in the first object region 200 . The shape of the characteristic object area 100 may be an arc, and the shape of the first object area 200 may also be an arc.
例如,初始第一环形展开线可以为图2D所示的中间印章的边缘线,中间印章的边缘线可以为图2D所示的白色圆圈。For example, the initial first annular development line may be the edge line of the middle seal shown in FIG. 2D , and the edge line of the middle seal may be the white circle shown in FIG. 2D .
例如,如图2D所示,基于特征对象区域100可以确定一个环形区域,例如,圆环区域,该环形区域包括该特征对象区域100,而该环形区域中不属于该特征对象区域100的部分即为开口区域110,该任一点B为开口区域110 中的一点。For example, as shown in FIG. 2D , an annular area may be determined based on the characteristic object area 100 , for example, an annular area, the annular area includes the characteristic object area 100 , and the part of the annular area that does not belong to the characteristic object area 100 is is the opening area 110 , and the arbitrary point B is a point in the opening area 110 .
例如,可以基于采用OpenCV的霍夫梯度找圆算法对印章图像和特征点图像进行处理,以获取初始第二展开点和初始第一环形展开线。关于OpenCV的霍夫梯度找圆算法的具体实现过程可以参考现有技术中的相关说明,在此不赘述。需要说明的是,在本公开的实施例中,还可以采样其他方式获取初始第二展开点和初始第一环形展开线,本公开对获取初始第二展开点和初始第一环形展开线的方式不作限制。For example, the seal image and the feature point image may be processed based on the Hough gradient circle finding algorithm using OpenCV to obtain the initial second expansion point and the initial first annular expansion line. For the specific implementation process of the Hough gradient circle finding algorithm of OpenCV, reference may be made to relevant descriptions in the prior art, and details are not described here. It should be noted that, in the embodiments of the present disclosure, other methods may also be used to obtain the initial second deployment point and the initial first annular deployment line. No restrictions apply.
例如,展开点提取模型可以基于机器学习实现,展开点提取模型可以为神经网络模型。For example, the expansion point extraction model may be implemented based on machine learning, and the expansion point extraction model may be a neural network model.
例如,在步骤S13中,基于任一点和初始第一环形展开线,确定初始第一展开点,包括:基于任一点,获取初始第一环形展开线上与任一点对应的点作为初始第一展开点。For example, in step S13, determining the initial first expansion point based on any point and the initial first annular expansion line includes: based on any point, acquiring a point corresponding to any point on the initial first annular expansion line as the initial first expansion point.
例如,初始第二展开点可以为中间印章的中心点,例如,在一些实施例中,如图2D所示,中间印章的形状为圆形,初始第二展开点A1为圆形的圆心(即中间印章的中心点),此时,初始第一展开点C1可以为将初始第二展开点A1和该任一点B1的连线的延伸线与初始第一环形展开线之间的交点。For example, the initial second unfolding point may be the center point of the middle seal. For example, in some embodiments, as shown in FIG. 2D , the shape of the middle seal is a circle, and the initial second unfolding point A1 is the center of the circle (ie The center point of the middle seal), at this time, the initial first unfolding point C1 may be the intersection between the extension line connecting the initial second unfolding point A1 and any point B1 and the initial first annular unfolding line.
例如,在将初始第一展开点、初始第二展开点和初始第一环形展开线从印章图像中映射到输入图像后,第二展开点可以为输入印章的中心点,例如,在一些实施例中,如图2F所示,初始第一展开点C1映射为第一展开点C2,初始第二展开点A1映射为第二展开点A2,任一点B1映射为点B2。例如,输入印章的形状为圆形,第二展开点A2为圆形的圆心(即输入印章的中心点),此时,第一展开点C2可以为将第二展开点A2和点B2的连线的延伸线与第一环形展开线之间的交点。For example, after mapping the initial first unfolding point, the initial second unfolding point, and the initial first circular unfolding line from the stamp image to the input image, the second unfolding point may be the center point of the input stamp, eg, in some embodiments 2F, the initial first expansion point C1 is mapped to the first expansion point C2, the initial second expansion point A1 is mapped to the second expansion point A2, and any point B1 is mapped to the point B2. For example, the shape of the input stamp is a circle, and the second expansion point A2 is the center of the circle (ie, the center point of the input stamp). At this time, the first expansion point C2 can be the connection between the second expansion point A2 and the point B2. The intersection between the extension line of the line and the first annular expansion line.
例如,在另一些实施例中,如图3D所示,中间印章的形状为椭圆形,初始第二展开点可以为椭圆形的两个焦点连线的中点(未示出),此时,输入印章的形状也为椭圆形,在映射之后,第二展开点也为椭圆形的两个焦点连线的中点。For example, in other embodiments, as shown in FIG. 3D , the shape of the middle seal is an ellipse, and the initial second expansion point may be the midpoint (not shown) of the line connecting the two focal points of the ellipse. At this time, The shape of the input stamp is also an ellipse, and after mapping, the second expansion point is also the midpoint of the line connecting the two focal points of the ellipse.
图2G为对图2C所示的输入图像进行识别得到的印章图像的另一种示意图。FIG. 2G is another schematic diagram of a seal image obtained by recognizing the input image shown in FIG. 2C .
例如,在另一些实施例中,展开线包括第一环形展开线和第二环形展开线,第一环形展开线为输入印章的边缘线,在输入图像中,第二环形展开线位于第一环形展开线包围的区域内,第一对象区域位于第一环形展开线和第二环形展开线围成的环形区域内。For example, in other embodiments, the unfolding line includes a first annular unfolding line and a second annular unfolding line, the first annular unfolding line is an edge line of the input stamp, and in the input image, the second annular unfolding line is located in the first annular unfolding line. In the area enclosed by the expansion line, the first object area is located in the annular area enclosed by the first annular expansion line and the second annular expansion line.
例如,步骤S13包括:基于OpenCV的算法对印章图像和特征点图像进行处理,以获取初始第一环形展开线和初始第二环形展开线;通过展开点提取模型对印章图像和特征点图像进行处理,以确定印章图像中与第一对象对应的特征对象区域,基于特征对象区域确定印章图像中的开口区域,获取开口区域的中的任一点,基于任一点、初始第一环形展开线和初始第二环形展开线,确定初始第一展开点和初始第二展开点;将初始第一展开点、初始第二展开点、初始第一环形展开线和初始第二环形展开线从印章图像中映射到输入图像,以得到第一展开点、第二展开点、第一环形展开线和第二环形展开线。For example, step S13 includes: processing the seal image and the feature point image based on the algorithm of OpenCV to obtain the initial first annular expansion line and the initial second annular expansion line; processing the seal image and the feature point image through the expansion point extraction model , to determine the characteristic object area corresponding to the first object in the seal image, determine the opening area in the seal image based on the characteristic object area, obtain any point in the opening area, and based on any point, the initial first annular expansion line and the initial first Two circular expansion lines, determine the initial first expansion point and the initial second expansion point; map the initial first expansion point, the initial second expansion point, the initial first circular expansion line and the initial second circular expansion line from the stamp image to An image is input to obtain a first unfolding point, a second unfolding point, a first circular unfolding line, and a second circular unfolding line.
例如,初始第一环形展开线、初始第二环形展开线、初始第一展开点和初始第二展开点均位于印章图像中。任一点、初始第一展开点和初始第二展开点中的任意两个点之间的连线段不与特征对象区域交叠。For example, the initial first annular development line, the initial second annular development line, the initial first development point, and the initial second development point are all located in the stamp image. The connecting line segment between any two points among any point, the initial first unfolding point and the initial second unfolding point does not overlap with the feature object area.
例如,如图2G所示,白色圆圈300可以为初始第二环形展开线,图2G所示的区域100为特征对象区域,图2G所示的区域110为开口区域。For example, as shown in FIG. 2G , the white circle 300 may be the initial second annular expansion line, the area 100 shown in FIG. 2G is the feature object area, and the area 110 shown in FIG. 2G is the opening area.
例如,在步骤S13中,基于任一点、初始第一环形展开线和初始第二环形展开线,确定初始第一展开点和初始第二展开点,包括:基于任一点,获取初始第一环形展开线上与任一点对应的点作为初始第一展开点;基于任一点,获取初始第二环形展开线上与任一点对应的点作为初始第二展开点。For example, in step S13, determining the initial first expansion point and the initial second expansion point based on any point, the initial first annular expansion line and the initial second annular expansion line, including: obtaining the initial first annular expansion based on any point A point on the line corresponding to any point is used as an initial first expansion point; based on any point, a point corresponding to any point on the initial second annular expansion line is obtained as an initial second expansion point.
例如,如图2G所示,该任一点B1为开口区域110中的一点,中间印章的形状为圆形,初始第一展开点C1可以为该圆形的包括任一点B1的半径与初始第一环形展开线之间的交点,初始第二展开点A1可以为该圆形的包括任一点B1的半径与初始第二环形展开线300之间的交点。For example, as shown in FIG. 2G, the any point B1 is a point in the opening area 110, the shape of the middle seal is a circle, and the initial first expansion point C1 can be the radius of the circle including any point B1 and the initial first For the intersection between the annular development lines, the initial second development point A1 may be the intersection between the radius of the circle including any point B1 and the initial second annular development line 300 .
例如,任一点B1可以为开口区域的中心点。For example, any point B1 may be the center point of the opening area.
例如,初始第一展开点C1、初始第二展开点A1和任一点B1位于同一条直线上,如图2F所示,在映射后,第一展开点C2、第二展开点A2和点B2 也位于同一条直线上。例如,如图2D和图2G所示,初始第一展开点C1、初始第二展开点A1和该任一点B1位于该圆形的中间印章的一条半径上。例如,在图2D所示的示例中,初始第一展开点C1和初始第二展开点A1之间的距离即为该圆形的中间印章的半径。类似地,如图2F所示,在映射后,第一展开点C2、第二展开点A2和点B2位于该圆形的输入印章的一条半径上,第一展开点C2和第二展开点A2之间的距离即为该圆形的输入印章的半径。For example, the initial first unfolding point C1, the initial second unfolding point A1 and any point B1 are located on the same straight line, as shown in FIG. 2F, after the mapping, the first unfolding point C2, the second unfolding point A2 and the point B2 are also on the same straight line. For example, as shown in FIGS. 2D and 2G , the initial first unfolding point C1 , the initial second unfolding point A1 and the arbitrary point B1 are located on a radius of the middle seal of the circle. For example, in the example shown in FIG. 2D , the distance between the initial first unfolding point C1 and the initial second unfolding point A1 is the radius of the middle seal of the circle. Similarly, as shown in Figure 2F, after mapping, the first unfolding point C2, the second unfolding point A2 and the point B2 are located on a radius of the circular input stamp, the first unfolding point C2 and the second unfolding point A2 The distance between is the radius of the input stamp for that circle.
需要说明的是,虽然在本公开中,以第一环形展开线和第二环形展开线为圆圈或椭圆圈为例进行描述,但本公开不限于此,第一环形展开线和/或第二环形展开线也可以为不闭合的弧线或曲线等,其具体形状与包括第一对象的第一对象区域的形状相关,例如,若第一对象区域的形状为波浪形,则该第一环形展开线和/或第二环形展开线也可以为波浪线。It should be noted that, although in the present disclosure, the first annular development line and the second annular development line are described as circles or elliptical circles as an example, the present disclosure is not limited to this, the first annular development line and/or the second annular development line are The annular unfolding line may also be an unclosed arc or curve, and its specific shape is related to the shape of the first object area including the first object. For example, if the shape of the first object area is wavy, the first annular The unfolding line and/or the second annular unfolding line may also be a wavy line.
此外,第一环形展开线也可以为输入印章的边缘线的同心环线,在输入图像中,输入印章的边缘线位于第一环形展开线包围的区域内,例如,当输入印章的形状为圆形时,第一环形展开线的形状和输入印章的边缘线的形状可以相同,例如,均为圆形,但第一环形展开线对应的半径大于输入印章的边缘线对应的半径。In addition, the first annular development line can also be a concentric ring line of the edge line of the input seal. In the input image, the edge line of the input seal is located in the area surrounded by the first annular development line. For example, when the shape of the input seal is a circle , the shape of the first annular development line and the shape of the edge line of the input stamp may be the same, for example, both are circular, but the radius corresponding to the first annular development line is larger than the radius corresponding to the edge line of the input stamp.
图2H为将图2C中的输入印章展开得到的展开印章图像的示意图;图3F为将图3C中的输入印章展开得到的展开印章图像的示意图。2H is a schematic diagram of an expanded seal image obtained by expanding the input seal in FIG. 2C ; FIG. 3F is a schematic diagram of an expanded seal image obtained by expanding the input seal in FIG. 3C .
接下来,如图1所示,在步骤S14,以第一展开点和第二展开点之间的连线作为展开基准线和以第一展开点为展开起始点,将输入印章沿着展开线横向展开以得到展开印章图像。Next, as shown in FIG. 1, in step S14, take the connecting line between the first development point and the second development point as the development reference line and the first development point as the development starting point, and place the input stamp along the development line Expand horizontally for expanded stamp image.
例如,图2H所示的展开印章图像是基于图2G所示的初始第一展开点映射得到的第一展开点、图2G所示的初始第二展开点映射得到的第二展开点之间的连线作为展开基准线和以图2G所示的初始第一展开点映射得到的第一展开点为展开起始点,沿着第一环形展开线横向展开得到的。For example, the unfolded seal image shown in FIG. 2H is based on the first unfolding point obtained by mapping the initial first unfolding point shown in FIG. 2G and the second unfolding point obtained by mapping the initial second unfolding point shown in FIG. 2G . The connecting line is used as the unfolding reference line and the first unfolding point obtained by mapping the initial first unfolding point shown in FIG. 2G as the unfolding starting point, and is obtained by horizontally unfolding along the first annular unfolding line.
例如,第一环形展开线被展开成为展开印章图像中的一条直线,如图2H所示,位于文字上方的直线即为展开后的第一环形展开线;如图3F所示,位于文字上方的直线即为展开后的第一环形展开线。对于图3F所示的展开印章图像,在展开的过程中,第二展开点也为第二环形展开线上与任一点对应的 点。For example, the first annular expansion line is expanded into a straight line in the expanded stamp image. As shown in Figure 2H, the straight line above the text is the expanded first circular expansion line; as shown in Figure 3F, the line above the text The straight line is the first annular expansion line after expansion. For the expanded seal image shown in FIG. 3F, during the expansion process, the second expansion point is also a point corresponding to any point on the second annular expansion line.
例如,如图2H所示,展开印章图像的形状为矩形,矩形的长和第一环形展开线的长度相等,矩形的宽与第一展开点和基于任一点映射得到的点(即初始第一展开点和任一点)之间的距离相等。对于图2D所示的示例,中间印章的形状为圆形,矩形的长和该圆形的圆周长相等,矩形的宽与该圆形的半径相等;对于图2G所示的示例,中间印章的形状为圆形,矩形的长和该圆形的圆周长相等,矩形的宽小于该圆形的半径。For example, as shown in Fig. 2H, the shape of the expanded stamp image is a rectangle, the length of the rectangle is equal to the length of the first annular expansion line, and the width of the rectangle is the same as the first expansion point and the point obtained based on the mapping of any point (that is, the initial first The distance between the expansion point and any point) is equal. For the example shown in Fig. 2D, the shape of the middle seal is a circle, the length of the rectangle is equal to the circumference of the circle, and the width of the rectangle is equal to the radius of the circle; for the example shown in Fig. 2G, the length of the middle seal is equal to the radius of the circle. The shape is a circle, the length of the rectangle is equal to the circumference of the circle, and the width of the rectangle is less than the radius of the circle.
需要说明的是,在另一些实施例中,也可以以初始第一展开点和初始第二展开点之间的连线作为展开基准线和以初始第一展开点为展开起始点,将中间印章沿着展开线横向展开以得到展开印章图像,即此时,初始第一展开点即为第一展开点,初始第二展开点即为第二展开点,初始第一环形展开线即为第一环形展开线,初始第二环形展开线即为第二环形展开线。It should be noted that, in other embodiments, the connecting line between the initial first unfolding point and the initial second unfolding point may also be used as the unfolding reference line and the initial first unfolding point may be used as the unfolding starting point, and the middle seal Expand horizontally along the expansion line to obtain the expanded stamp image, that is, at this time, the initial first expansion point is the first expansion point, the initial second expansion point is the second expansion point, and the initial first circular expansion line is the first expansion point. For the annular expansion line, the initial second annular expansion line is the second annular expansion line.
图2I为对图2H中的展开印章图像进行区域识别处理得到的第一中间对象区域的示意图;图3G为对图3F中的展开印章图像进行区域识别处理得到的第一中间对象区域的示意图。Fig. 2I is the schematic diagram of the first intermediate object region obtained by carrying out region recognition processing to the expanded seal image in Fig. 2H; Fig. 3G is the schematic diagram of the first intermediate object region obtained by performing region identification processing on the expanded seal image in Fig. 3F.
接下来,如图1所示,在步骤S15,对展开印章图像进行区域识别处理,以确定展开印章图像中的第一中间对象区域。例如,输入图像中与第一中间对象区域对应的区域为第一对象区域,第一对象位于第一对象区域内。Next, as shown in FIG. 1 , in step S15 , an area identification process is performed on the developed seal image to determine the first intermediate object area in the expanded seal image. For example, an area corresponding to the first intermediate object area in the input image is the first object area, and the first object is located in the first object area.
例如,第一对象区域的形状为弧形。For example, the shape of the first object area is an arc.
将圆形或者椭圆形印章按照第一展开点、第二展开点和展开线横线展开为矩形,这样原先弧形的文字区域被展开为具有一定形变的长条文字区域,即第一中间对象区域,如图2I和图3G所示,第一中间对象区域的形状可以为矩形。需要说明的是,圆形印章和椭圆形印章的具体展开方式可以参考现有技术,在此不作赘述。Expand the circular or oval stamp into a rectangle according to the first expansion point, the second expansion point and the horizontal line of the expansion line, so that the original arc-shaped text area is expanded into a long text area with a certain deformation, that is, the first intermediate object area, as shown in FIG. 2I and FIG. 3G , the shape of the first intermediate object area may be a rectangle. It should be noted that the specific unfolding methods of the circular seal and the oval seal may refer to the prior art, which will not be repeated here.
例如,在步骤S15中,可以通过区域识别模型识别展开印章图像中的第一中间对象区域。区域识别模型可以采用机器学习技术实现,且该区域识别模型为预先训练好的模型。区域识别模型可以采用深度卷积神经网络(CNN)或者深度残差网络(Resnet)等神经网络实现。For example, in step S15, the first intermediate object region in the expanded stamp image can be identified by the region identification model. The region recognition model can be implemented using machine learning technology, and the region recognition model is a pre-trained model. The region recognition model can be implemented by neural networks such as deep convolutional neural network (CNN) or deep residual network (Resnet).
图2J为对图2I中的第一中间对象区域进行对象识别处理得到的第一识别 结果的示意图;图3H为对图3G中的第一中间对象区域进行对象识别处理得到的第一识别结果的示意图。2J is a schematic diagram of a first recognition result obtained by performing object recognition processing on the first intermediate object area in FIG. 2I ; FIG. 3H is a schematic diagram of a first recognition result obtained by performing object recognition processing on the first intermediate object area in FIG. 3G . Schematic.
最后,如图1所示,在步骤S16,对第一中间对象区域进行对象识别处理,以识别得到第一识别结果。例如,如图2J和图3H所示,第一识别结果为“杭州睿胜软件有限公司”,即第一对象。Finally, as shown in FIG. 1 , in step S16 , an object recognition process is performed on the first intermediate object region to recognize and obtain a first recognition result. For example, as shown in FIG. 2J and FIG. 3H , the first recognition result is “Hangzhou Ruisheng Software Co., Ltd.”, that is, the first object.
例如,第一对象包括文本,可以通过第一字符识别模型对第一中间对象区域进行字符识别处理,以识别得到第一识别结果,即第一对象。基于第一字符识别模型进行字符识别的准确度较高。例如,第一字符识别模型可以基于光学字符识别(Optical Character Recognition,OCR)等技术实现,例如,第一字符识别模型也可以为预先训练好的模型。For example, the first object includes text, and character recognition processing may be performed on the first intermediate object region through the first character recognition model to obtain the first recognition result, that is, the first object. The accuracy of character recognition based on the first character recognition model is high. For example, the first character recognition model may be implemented based on technologies such as optical character recognition (Optical Character Recognition, OCR). For example, the first character recognition model may also be a pre-trained model.
例如,对第一中间对象区域进行对象识别处理,以识别得到第一识别结果,可以包括:对第一中间对象区域进行对象识别处理,以识别得到第一中间识别结果;对第一中间识别结果进行校验,以得到第一识别结果。For example, performing object recognition processing on the first intermediate object area to recognize and obtain the first recognition result may include: performing object recognition processing on the first intermediate object area to recognize and obtain the first intermediate recognition result; A check is performed to obtain the first identification result.
例如,第一中间识别结果可能存在语义错误、逻辑错误等,因此,需要对第一中间识别结果进行校验,纠正第一中间识别结果中的语义错误、逻辑错误等,以得到准确的第一识别结果。例如,对于图2I所示的示例,第一中间识别结果可能包括“杭洲睿胜软件有限公司”,其中,“洲”这个字符与印章中的文字是不对应的,且“杭洲”这个词在语义上是错误的,经过校验,则可以将“杭洲”修正为“杭州”,从而经过校验后的第一识别结果为“杭州睿胜软件有限公司”,由此得到准确的识别结果。For example, the first intermediate recognition result may have semantic errors, logical errors, etc. Therefore, it is necessary to verify the first intermediate recognition result, and correct the semantic errors and logical errors in the first intermediate recognition result, so as to obtain an accurate first intermediate recognition result. Identify the results. For example, for the example shown in Figure 2I, the first intermediate recognition result may include "Hangzhou Ruisheng Software Co., Ltd.", wherein the character "zhou" does not correspond to the text in the seal, and the word "Hangzhou" is in The semantics is wrong. After verification, "Hangzhou" can be corrected to "Hangzhou", so the first recognition result after verification is "Hangzhou Ruisheng Software Co., Ltd.", thus obtaining an accurate recognition result .
例如,如图2J和图3H所示,识别得到的第一识别结果为“杭州睿胜软件有限公司”,即为输入印章中的第一对象。For example, as shown in FIG. 2J and FIG. 3H , the first identification result obtained by identification is "Hangzhou Ruisheng Software Co., Ltd.", which is the first object in the input seal.
此外,该图像处理方法还可以基于不规则排列的对象对应的区域确定输入图像的正向方向,从而对输入图像进行校正,提高输入图像中规则排列的对象的识别准确性。In addition, the image processing method can also determine the forward direction of the input image based on the regions corresponding to the irregularly arranged objects, so as to correct the input image and improve the recognition accuracy of the regularly arranged objects in the input image.
例如,在一些实施例中,图像处理方法还包括:确定第一中间对象区域的中心点;通过第一中间对象区域和输入图像的映射关系,将第一中间对象区域映射回输入图像以确定第一对象区域,以及将第一中间对象区域的中心点映射回输入图像以确定第一对象区域的中心点;确定输入印章的中心点; 通过第一对象区域的中心点和输入印章的中心点确定用于对输入图像进行校正的校正角度;基于校正角度对输入图像进行校正,以得到校正后的输入图像。For example, in some embodiments, the image processing method further includes: determining the center point of the first intermediate object region; mapping the first intermediate object region back to the input image through the mapping relationship between the first intermediate object region and the input image to determine the first intermediate object region an object area, and mapping the center point of the first intermediate object area back to the input image to determine the center point of the first object area; determining the center point of the input seal; determining by the center point of the first object area and the center point of the input seal Correction angle for correcting the input image; correcting the input image based on the correction angle to obtain the corrected input image.
例如,可以通过区域识别模型识别展开印章图像中的第一中间对象区域,且确定第一中间对象区域的中心点,通过第一中间对象区域和圆形或椭圆形的输入印章的映射关系将第一中间对象区域映射到输入图像(或印章图像)中,从而确定输入图像(或印章图像)中的弧形文字区域,即第一对象区域200,同时将第一中间对象区域的中心点映射到输入图像(或印章图像)中以确定该第一对象区域的中心点,通过第一对象区域的中心点和输入印章的中心点(例如,输入印章的圆心)可以该输入图像对应的正向方向(从输入印章的中心点出发连接到第一对象区域的中心点就是正向方向),该正向方向和基准方向(例如,水平方向或竖直方向)之间的夹角即为校正角度,然后基于校正方向可以对该输入图像进行校正,以使得该正向方向和基准方向重叠,从而得到校正后的输入图像,由此,可以便于用户查看和对比识别得到的第一识别结果是否正确等,即判断识别得到的第一识别结果是否与第一对象相同。For example, the first intermediate object region in the expanded seal image can be identified by the region recognition model, and the center point of the first intermediate object region can be determined, and the An intermediate object area is mapped into the input image (or the seal image), thereby determining the arc-shaped character area in the input image (or the seal image), that is, the first object area 200, and at the same time, the center point of the first intermediate object area is mapped to The center point of the first object area is determined in the input image (or seal image), and the forward direction corresponding to the input image can be obtained through the center point of the first object area and the center point of the input seal (for example, the center of the circle of the input seal). (From the center point of the input stamp to the center point of the first object area is the forward direction), the angle between the forward direction and the reference direction (for example, the horizontal direction or the vertical direction) is the correction angle, Then, the input image can be corrected based on the correction direction, so that the forward direction and the reference direction overlap, so as to obtain the corrected input image, thus, it is convenient for the user to check and compare whether the first recognition result obtained by the recognition is correct, etc. , that is, it is determined whether the first recognition result obtained by the recognition is the same as the first object.
例如,在另一些实施例中,还可以将第一中间对象区域映射回中间输入图像,并确定用于对中间输入图像进行校正的校正角度;基于校正角度对中间输入图像进行校正,以得到校正后的中间输入图像。用户可以基于该校正后的中间输入图像查看和对比识别得到的第一识别结果是否正确等For example, in other embodiments, the first intermediate object region may also be mapped back to the intermediate input image, and a correction angle for correcting the intermediate input image is determined; and the intermediate input image is corrected based on the correction angle to obtain the correction After the intermediate input image. The user can check whether the first recognition result obtained by the comparison and recognition based on the corrected intermediate input image is correct, etc.
例如,在一些实施例中,输入印章还包括第二对象。此时,图像处理方法还包括:对校正后的输入图像进行区域识别处理,以确定第二中间对象区域,其中,输入图像中与第二中间对象区域对应的区域为第二对象区域,第二对象位于第二对象区域内;对第二中间对象区域进行对象识别处理,以得到第二识别结果。For example, in some embodiments, the input stamp further includes a second object. At this time, the image processing method further includes: performing region identification processing on the corrected input image to determine the second intermediate object region, wherein the region corresponding to the second intermediate object region in the input image is the second object region, and the second intermediate object region is the second object region. The object is located in the second object area; the object recognition processing is performed on the second intermediate object area to obtain a second recognition result.
例如,第二对象区域的形状可以为矩形。For example, the shape of the second object area may be a rectangle.
例如,第二对象可以包括规则排列的多个文字,该多个文字的中心点的连线位于同一条直线上。如图3D所示,第二对象可以包括数字和字母“91330108MA2CDKJ756”,第二对象也可以包括文字“发票专用章”。 “91330108MA2CDKJ756”中的各个字符(数字和字母)的中心点位于同一条直线(例如水平直线)上,“发票专用章”中的各个文字的中心点也位于同一条直线(例如水平直线)上。For example, the second object may include a plurality of characters arranged regularly, and a line connecting the center points of the plurality of characters is located on the same straight line. As shown in FIG. 3D, the second object may include numbers and letters "91330108MA2CDKJ756", and the second object may also include the text "Invoice Special Seal". The center points of each character (numbers and letters) in "91330108MA2CDKJ756" are located on the same line (such as a horizontal line), and the center points of each character in the "Special Invoice Seal" are also located on the same line (such as a horizontal line).
需要说明的是,“91330108MA2CDKJ756”和“发票专用章”可以分别位于两个第二对象区域中。It should be noted that "91330108MA2CDKJ756" and "Invoice Special Seal" can be located in the two second object areas respectively.
例如,可以通过第二字符识别模型对第二中间对象区域进行字符识别处理,以得到第二中间识别结果;对第二中间识别结果进行校验,以得到第二识别结果,第二识别结果即为第二对象。由此,输入印章中的弧形区域的对象和矩形区域的对象均被识别出来。For example, character recognition processing can be performed on the second intermediate object area through the second character recognition model to obtain the second intermediate recognition result; the second intermediate recognition result is verified to obtain the second recognition result, and the second recognition result is for the second object. Thereby, both the object in the arc area and the object in the rectangular area in the input stamp are recognized.
例如,第二字符识别模型可以基于光学字符识别等技术实现,例如,第二字符识别模型也可以为预先训练好的模型。For example, the second character recognition model may be implemented based on technologies such as optical character recognition. For example, the second character recognition model may also be a pre-trained model.
需要说明的是,第一字符识别模型和第二字符识别模型可以为同一个模型,也可以为不同的模型。It should be noted that the first character recognition model and the second character recognition model may be the same model, or may be different models.
例如,在一些实施例中,图像处理方法还可以包括:输出第一识别结果和第二识别结果。例如,第一识别结果和第二识别结果可以在显示面板上显示以实现输出。For example, in some embodiments, the image processing method may further include: outputting the first recognition result and the second recognition result. For example, the first recognition result and the second recognition result may be displayed on the display panel to achieve output.
例如,图像处理方法还可以包括:输出校正后的输入图像和/或校正后的中间输入图像,从而可以供用户判断该输出的第一识别结果和第二识别结果是否正确。例如,校正后的输入图像和/或校正后的中间输入图像也可以在显示面板上显示以实现输出。For example, the image processing method may further include: outputting the corrected input image and/or the corrected intermediate input image, so that the user can judge whether the outputted first recognition result and the second recognition result are correct. For example, the corrected input image and/or the corrected intermediate input image may also be displayed on the display panel for output.
应了解,在本公开的实施例中,在获取输入图像前,图像处理方法还包括:训练阶段。训练阶段包括对模型(图像分割模型、区域识别模型、展开点提取模型、印章区域识别模型和字符识别模型等)进行训练的过程。It should be understood that, in the embodiment of the present disclosure, before acquiring the input image, the image processing method further includes: a training phase. The training phase includes the process of training the models (image segmentation model, region recognition model, expansion point extraction model, seal region recognition model, character recognition model, etc.).
图4为本公开一些实施例提供的一种图像处理装置的示意性框图。FIG. 4 is a schematic block diagram of an image processing apparatus according to some embodiments of the present disclosure.
本公开至少一实施例还提供一种图像处理装置,如图4所示,该图像处理装置400包括处理器402和存储器401。应当注意,图4所示的图像处理装置400的组件只是示例性的,而非限制性的,根据实际应用需要,该图像处理装置400还可以具有其他组件。At least one embodiment of the present disclosure further provides an image processing apparatus. As shown in FIG. 4 , the image processing apparatus 400 includes a processor 402 and a memory 401 . It should be noted that the components of the image processing apparatus 400 shown in FIG. 4 are only exemplary and not restrictive, and the image processing apparatus 400 may also have other components according to actual application requirements.
例如,存储器401用于非暂时性存储计算机可读指令;处理器402用于 运行计算机可读指令,计算机可读指令被处理器402运行时执行根据上述任一实施例所述的图像处理方法中的一个或多个步骤。For example, the memory 401 is used for non-transitory storage of computer-readable instructions; the processor 402 is used for executing computer-readable instructions, and the computer-readable instructions are executed by the processor 402 when running the image processing method according to any of the above embodiments. one or more steps.
例如,处理器402和存储器401等组件之间可以通过网络连接进行通信。网络可以包括无线网络、有线网络、和/或无线网络和有线网络的任意组合。网络可以包括局域网、互联网、电信网、基于互联网和/或电信网的物联网(Internet of Things)、和/或以上网络的任意组合等。有线网络例如可以采用双绞线、同轴电缆或光纤传输等方式进行通信,无线网络例如可以采用3G/4G/5G移动通信网络、蓝牙、Zigbee或者WiFi等通信方式。本公开对网络的类型和功能在此不作限制。For example, components such as processor 402 and memory 401 may communicate through a network connection. The network may include a wireless network, a wired network, and/or any combination of wireless and wired networks. The network may include a local area network, the Internet, a telecommunication network, the Internet of Things (Internet of Things) based on the Internet and/or a telecommunication network, and/or any combination of the above networks, etc. For example, the wired network may use twisted pair, coaxial cable or optical fiber transmission for communication, and the wireless network may use, for example, 3G/4G/5G mobile communication network, Bluetooth, Zigbee or WiFi and other communication methods. The present disclosure does not limit the type and function of the network.
例如,处理器402可以控制图像处理装置400中的其它组件以执行期望的功能。处理器402可以是中央处理单元(CPU)、张量处理器(TPU)或者图形处理器(GPU)等具有数据处理能力和/或程序执行能力的器件。中央处理元(CPU)可以为X86或ARM架构等。GPU可以单独地直接集成到主板上,或者内置于主板的北桥芯片中。GPU也可以内置于中央处理器(CPU)上。For example, processor 402 may control other components in image processing apparatus 400 to perform desired functions. The processor 402 may be a device with data processing capability and/or program execution capability, such as a central processing unit (CPU), a tensor processing unit (TPU), or a graphics processing unit (GPU). The central processing unit (CPU) can be an X86 or an ARM architecture or the like. The GPU can be individually integrated directly onto the motherboard, or built into the motherboard's Northbridge chip. GPUs can also be built into central processing units (CPUs).
例如,存储器401可以包括一个或多个计算机程序产品的任意组合,计算机程序产品可以包括各种形式的计算机可读存储介质,例如易失性存储器和/或非易失性存储器。易失性存储器例如可以包括随机存取存储器(RAM)和/或高速缓冲存储器(cache)等。非易失性存储器例如可以包括只读存储器(ROM)、硬盘、可擦除可编程只读存储器(EPROM)、便携式紧致盘只读存储器(CD-ROM)、USB存储器、闪存等。在所述计算机可读存储介质上可以存储一个或多个计算机可读指令,处理器402可以运行所述计算机可读指令,以实现图像处理装置400的各种功能。在存储介质中还可以存储各种应用程序和各种数据等。For example, memory 401 may include any combination of one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and/or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and/or cache memory, among others. Non-volatile memory may include, for example, read only memory (ROM), hard disk, erasable programmable read only memory (EPROM), portable compact disk read only memory (CD-ROM), USB memory, flash memory, and the like. One or more computer-readable instructions may be stored on the computer-readable storage medium, and the processor 402 may execute the computer-readable instructions to implement various functions of the image processing apparatus 400 . Various application programs, various data and the like can also be stored in the storage medium.
例如,关于图像处理装置400执行图像处理的过程的详细说明可以参考图像处理方法的实施例中的相关描述,重复之处不再赘述。For example, for a detailed description of the process of image processing performed by the image processing apparatus 400, reference may be made to the relevant descriptions in the embodiments of the image processing method, and repeated descriptions will not be repeated.
图5为本公开一些实施例提供的一种智能发票识别设备的示意性框图。FIG. 5 is a schematic block diagram of an intelligent invoice recognition device provided by some embodiments of the present disclosure.
本公开至少一实施例还提供一种智能发票识别设备。如图5所示,智能发票识别设备500可以包括存储器501、处理器502和图像获取部件503。应 当注意,图5所示的智能发票识别设备500的组件只是示例性的,而非限制性的,根据实际应用需要,该智能发票识别设备500还可以具有其他组件。At least one embodiment of the present disclosure further provides an intelligent invoice recognition device. As shown in FIG. 5 , the intelligent invoice recognition device 500 may include a memory 501 , a processor 502 and an image acquisition component 503 . It should be noted that the components of the smart invoice recognition device 500 shown in FIG. 5 are only exemplary, not limiting, and the smart invoice recognition device 500 may also have other components according to actual application requirements.
例如,图像获取部件503用于获得纸质发票的发票图像。存储器501用于存储发票图像以及计算机可读指令。处理器502用于读取发票图像并基于发票图像确定输入图像,并运行计算机可读指令。计算机可读指令被处理器502运行时执行根据上述任一实施例所述的图像处理方法中的一个或多个步骤。例如,发票图像可以为图像处理方法的实施例中描述的原始图像。For example, the image acquisition part 503 is used to acquire an invoice image of a paper invoice. Memory 501 is used to store invoice images and computer readable instructions. Processor 502 operates to read the invoice image and determine an input image based on the invoice image and execute computer readable instructions. The computer readable instructions are executed by the processor 502 to perform one or more steps in the image processing method according to any of the above embodiments. For example, the invoice image may be the original image described in the embodiment of the image processing method.
例如,图像获取部件503即为上述图像处理方法的实施例中描述的图像采集装置,例如,图像获取部件503可以是智能手机的摄像头、平板电脑的摄像头、个人计算机的摄像头、数码照相机的镜头、或者甚至可以是网络摄像头。For example, the image acquisition component 503 is the image acquisition device described in the embodiments of the above image processing method. For example, the image acquisition component 503 may be a camera of a smartphone, a camera of a tablet computer, a camera of a personal computer, a lens of a digital camera, Or even a webcam.
例如,发票图像可以是图像获取部件503直接采集到的原始发票图像,也可以是对原始发票图像进行预处理之后获得的图像。预处理可以消除原始发票图像中的无关信息或噪声信息,以便于更好地对发票图像进行处理。预处理例如可以包括对原始发票图像进行图像扩充(Data Augment)、图像缩放、伽玛(Gamma)校正、图像增强或降噪滤波等处理。For example, the image of the invoice may be the image of the original invoice directly collected by the image acquisition component 503, or may be the image obtained after preprocessing the image of the original invoice. Preprocessing can remove irrelevant information or noise information in the original invoice image to facilitate better processing of the invoice image. The preprocessing may include, for example, performing image augmentation (Data Augment), image scaling, gamma (Gamma) correction, image enhancement or noise reduction filtering on the original invoice image.
例如,处理器502可以控制智能发票识别设备500中的其它组件以执行期望的功能。处理器502可以是中央处理单元(CPU)、张量处理器(TPU)或者图形处理器(GPU)等具有数据处理能力和/或程序执行能力的器件。中央处理元(CPU)可以为X86或ARM架构等。GPU可以单独地直接集成到主板上,或者内置于主板的北桥芯片中。GPU也可以内置于中央处理器(CPU)上。For example, processor 502 may control other components in intelligent invoice recognition device 500 to perform desired functions. The processor 502 may be a device with data processing capability and/or program execution capability, such as a central processing unit (CPU), a tensor processing unit (TPU), or a graphics processing unit (GPU). The central processing unit (CPU) can be an X86 or an ARM architecture or the like. The GPU can be individually integrated directly onto the motherboard, or built into the motherboard's Northbridge chip. GPUs can also be built into central processing units (CPUs).
例如,存储器501可以包括一个或多个计算机程序产品的任意组合,计算机程序产品可以包括各种形式的计算机可读存储介质,例如易失性存储器和/或非易失性存储器。易失性存储器例如可以包括随机存取存储器(RAM)和/或高速缓冲存储器(cache)等。非易失性存储器例如可以包括只读存储器(ROM)、硬盘、可擦除可编程只读存储器(EPROM)、便携式紧致盘只读存储器(CD-ROM)、USB存储器、闪存等。在所述计算机可读存储介质上可以存储一个或多个计算机可读指令,处理器502可以运行所述计算机可读指令,以 实现智能发票识别设备500的各种功能。For example, memory 501 may include any combination of one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and/or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and/or cache memory, among others. Non-volatile memory may include, for example, read only memory (ROM), hard disk, erasable programmable read only memory (EPROM), portable compact disk read only memory (CD-ROM), USB memory, flash memory, and the like. One or more computer-readable instructions may be stored on the computer-readable storage medium, and the processor 502 may execute the computer-readable instructions to implement various functions of the intelligent invoice recognition device 500.
例如,关于智能发票识别设备500执行图像处理的过程的详细说明可以参考图像处理方法的实施例中的相关描述,重复之处不再赘述。For example, for a detailed description of the process of image processing performed by the intelligent invoice recognition device 500, reference may be made to the relevant descriptions in the embodiments of the image processing method, and repeated descriptions will not be repeated.
图6为本公开一些实施例提供的一种存储介质的示意图。例如,如图6所示,在存储介质600上可以非暂时性地存储一个或多个计算机可读指令601。例如,当所述计算机可读指令601由计算机执行时可以执行根据上文所述的图像处理方法中的一个或多个步骤。FIG. 6 is a schematic diagram of a storage medium provided by some embodiments of the present disclosure. For example, as shown in FIG. 6 , one or more computer-readable instructions 601 may be non-transitory stored on storage medium 600 . For example, when the computer readable instructions 601 are executed by a computer, one or more steps in the image processing method according to the above description may be performed.
例如,存储介质600为非瞬时性计算机可读存储介质。For example, storage medium 600 is a non-transitory computer-readable storage medium.
例如,该存储介质600可以应用于上述图像处理装置400和/或智能发票识别设备500中,例如,其可以为图像处理装置400中的存储器401和/或智能发票识别设备500中的存储器501。For example, the storage medium 600 can be applied to the above-mentioned image processing apparatus 400 and/or the smart invoice recognition apparatus 500 , for example, it can be the memory 401 in the image processing apparatus 400 and/or the memory 501 in the smart invoice recognition apparatus 500 .
例如,关于存储介质600的说明可以参考图像处理装置400和/或智能发票识别设备500的实施例中对于存储器的描述,重复之处不再赘述。For example, for the description of the storage medium 600, reference may be made to the description of the memory in the embodiments of the image processing apparatus 400 and/or the smart invoice recognition device 500, and the repetition will not be repeated.
对于本公开,还有以下几点需要说明:For the present disclosure, the following points need to be noted:
(1)本公开实施例附图只涉及到与本公开实施例涉及到的结构,其他结构可参考通常设计。(1) The accompanying drawings of the embodiments of the present disclosure only relate to the structures involved in the embodiments of the present disclosure, and other structures may refer to general designs.
(2)为了清晰起见,在用于描述本发明的实施例的附图中,层或结构的厚度和尺寸被放大。可以理解,当诸如层、膜、区域或基板之类的元件被称作位于另一元件“上”或“下”时,该元件可以“直接”位于另一元件“上”或“下”,或者可以存在中间元件。(2) In the drawings for describing the embodiments of the present invention, the thickness and size of layers or structures are exaggerated for clarity. It will be understood that when an element such as a layer, film, region or substrate is referred to as being "on" or "under" another element, it can be "directly on" or "under" the other element, Or intermediate elements may be present.
(3)在不冲突的情况下,本公开的实施例及实施例中的特征可以相互组合以得到新的实施例。(3) The embodiments of the present disclosure and the features in the embodiments may be combined with each other to obtain new embodiments without conflict.
以上所述仅为本公开的具体实施方式,但本公开的保护范围并不局限于此,本公开的保护范围应以所述权利要求的保护范围为准。The above descriptions are only specific embodiments of the present disclosure, but the protection scope of the present disclosure is not limited thereto, and the protection scope of the present disclosure should be subject to the protection scope of the claims.

Claims (18)

  1. 一种图像处理方法,其特征在于,包括:An image processing method, comprising:
    获取输入图像,其中,所述输入图像包括输入印章,所述输入印章包括第一对象;acquiring an input image, wherein the input image includes an input seal, and the input seal includes a first object;
    识别所述输入图像中的所述输入印章,以得到印章图像,其中,所述印章图像包括与所述输入印章对应的中间印章;Identifying the input seal in the input image to obtain a seal image, wherein the seal image includes an intermediate seal corresponding to the input seal;
    对所述印章图像进行特征提取处理,以得到特征点图像;Perform feature extraction processing on the seal image to obtain feature point images;
    对所述印章图像和所述特征点图像进行处理,以获取第一展开点、第二展开点和展开线;Process the seal image and the feature point image to obtain a first unfolding point, a second unfolding point and an unfolding line;
    以所述第一展开点和所述第二展开点之间的连线作为展开基准线和以所述第一展开点为展开起始点,将所述输入印章沿着所述展开线横向展开以得到展开印章图像;Taking the connecting line between the first unfolding point and the second unfolding point as the unfolding reference line and the first unfolding point as the unfolding starting point, unfold the input stamp laterally along the unfolding line to get the expanded stamp image;
    对所述展开印章图像进行区域识别处理,以确定所述展开印章图像中的第一中间对象区域,其中,所述输入图像中与所述第一中间对象区域对应的区域为第一对象区域,所述第一对象位于所述第一对象区域内;Performing region identification processing on the expanded seal image to determine the first intermediate object region in the expanded seal image, wherein the region corresponding to the first intermediate object region in the input image is the first object region, the first object is located within the first object area;
    对所述第一中间对象区域进行对象识别处理,以识别得到第一识别结果。Perform object recognition processing on the first intermediate object area to recognize and obtain a first recognition result.
  2. 根据权利要求1所述的图像处理方法,其特征在于,所述印章图像中所述中间印章对应的像素具有第一像素值,所述印章图像中除了所述中间印章对应的像素之外的像素具有第二像素值,所述第一像素值和所述第二像素值不相同。The image processing method according to claim 1, wherein the pixels corresponding to the middle seal in the seal image have a first pixel value, and the pixels in the seal image other than the pixels corresponding to the middle seal have a first pixel value. Having a second pixel value, the first pixel value and the second pixel value are not the same.
  3. 根据权利要求2所述的图像处理方法,其特征在于,识别所述输入图像中的所述输入印章,以得到印章图像,包括:The image processing method according to claim 2, wherein identifying the input seal in the input image to obtain a seal image comprises:
    利用图像分割模型对所述输入图像进行识别,以得到所述输入印章对应的初始印章像素;Use an image segmentation model to identify the input image to obtain initial seal pixels corresponding to the input seal;
    对所述初始印章像素进行模糊处理,以得到印章像素掩膜区域;Blur the initial seal pixels to obtain the seal pixel mask area;
    根据所述印章像素掩膜区域,确定所述输入图像中的所述输入印章对应的像素;According to the seal pixel mask area, determine the pixel corresponding to the input seal in the input image;
    设置所述输入图像中的所述原始印章对应的像素的像素值为所述第一像 素值和设置所述输入图像中除了所述输入印章对应的像素之外的像素的像素值为所述第二像素值,以得到所述印章图像。Setting the pixel value of the pixel corresponding to the original seal in the input image to the first pixel value and setting the pixel value of the pixel other than the pixel corresponding to the input seal in the input image to the first pixel value Two pixel values to obtain the stamp image.
  4. 根据权利要求1所述的图像处理方法,其特征在于,所述展开线包括第一环形展开线,所述第一环形展开线为所述输入印章的边缘线,The image processing method according to claim 1, wherein the unfolding line comprises a first annular unfolding line, and the first annular unfolding line is an edge line of the input stamp,
    对所述印章图像和所述特征点图像进行处理,以获取第一展开点、第二展开点和展开线,包括:The seal image and the feature point image are processed to obtain the first unfolding point, the second unfolding point and the unfolding line, including:
    基于OpenCV的算法对所述印章图像和所述特征点图像进行处理,以获取初始第二展开点和初始第一环形展开线,其中,所述初始第二展开点和所述初始第一环形展开线位于所述印章图像中;The seal image and the feature point image are processed by the algorithm based on OpenCV to obtain the initial second expansion point and the initial first circular expansion line, wherein the initial second expansion point and the initial first circular expansion the line is located in the stamp image;
    通过展开点提取模型对所述印章图像和所述特征点图像进行处理,以确定所述印章图像中与所述第一对象对应的特征对象区域,基于所述特征对象区域确定所述印章图像中的开口区域,获取所述开口区域的中的任一点,基于所述任一点和所述初始第一环形展开线,确定初始第一展开点,其中,所述初始第一展开点位于所述印章图像中,所述任一点、所述初始第一展开点和所述初始第二展开点中的任意两个点之间的连线段不与所述特征对象区域交叠,The seal image and the feature point image are processed through the expansion point extraction model to determine the feature object area corresponding to the first object in the seal image, and the seal image is determined based on the feature object area. The opening area is obtained, and any point in the opening area is obtained, and based on the arbitrary point and the initial first annular expansion line, the initial first expansion point is determined, wherein the initial first expansion point is located at the seal In the image, the line segment between any two points in the any point, the initial first unfolding point and the initial second unfolding point does not overlap with the feature object area,
    将所述初始第一展开点、所述初始第二展开点和所述初始第一环形展开线从所述印章图像中映射到所述输入图像,以得到所述第一展开点、所述第二展开点和所述第一环形展开线。Mapping the initial first unfolding point, the initial second unfolding point and the initial first circular unfolding line from the stamp image to the input image to obtain the first unfolding point, the first unfolding point Two deployment points and the first annular deployment line.
  5. 根据权利要求4所述的图像处理方法,其特征在于,基于所述任一点和所述初始第一环形展开线,确定初始第一展开点,包括:The image processing method according to claim 4, wherein determining the initial first expansion point based on the arbitrary point and the initial first annular expansion line comprises:
    基于所述任一点,获取所述初始第一环形展开线上与所述任一点对应的点作为所述初始第一展开点。Based on the arbitrary point, a point on the initial first annular expansion line corresponding to the arbitrary point is acquired as the initial first expansion point.
  6. 根据权利要求1所述的图像处理方法,其特征在于,所述展开线包括第一环形展开线和第二环形展开线,所述第一环形展开线为所述输入印章的边缘线,在所述输入图像中,所述第二环形展开线位于所述第一环形展开线包围的区域内,所述第一对象区域位于所述第一环形展开线和所述第二环形展开线围成的环形区域内,The image processing method according to claim 1, wherein the unfolding line comprises a first annular unfolding line and a second annular unfolding line, and the first annular unfolding line is an edge line of the input stamp. In the input image, the second annular development line is located in the area enclosed by the first annular development line, and the first object area is located in the area enclosed by the first annular development line and the second annular development line. in the annular area,
    对所述印章图像和所述特征点图像进行处理,以获取第一展开点、第二 展开点和展开线,包括:Described seal image and described feature point image are processed, to obtain the first unfolding point, the second unfolding point and unfolding line, including:
    基于OpenCV的算法对所述印章图像和所述特征点图像进行处理,以获取初始第一环形展开线和初始第二环形展开线,其中,所述初始第一环形展开线和所述初始第二环形展开线位于所述印章图像中;An algorithm based on OpenCV processes the seal image and the feature point image to obtain an initial first annular development line and an initial second annular development line, wherein the initial first annular development line and the initial second annular development line a circular spread line is located in the stamp image;
    通过展开点提取模型对所述印章图像和所述特征点图像进行处理,以确定所述印章图像中与所述第一对象对应的特征对象区域,基于所述特征对象区域确定所述印章图像中的开口区域,获取所述开口区域的中的任一点,基于所述任一点、所述初始第一环形展开线和所述初始第二环形展开线,确定初始第一展开点和初始第二展开点,其中,所述初始第一展开点和所述初始第二展开点位于所述印章图像中,所述任一点、所述初始第一展开点和所述初始第二展开点中的任意两个点之间的连线段不与所述特征对象区域交叠;The seal image and the feature point image are processed through the expansion point extraction model to determine the feature object area corresponding to the first object in the seal image, and the seal image is determined based on the feature object area. the opening area of point, wherein the initial first unfolding point and the initial second unfolding point are located in the stamp image, any two of the any point, the initial first unfolding point and the initial second unfolding point The line segments between the points do not overlap with the feature object area;
    将所述初始第一展开点、所述初始第二展开点、所述初始第一环形展开线和所述初始第二环形展开线从所述印章图像中映射到所述输入图像,以得到所述第一展开点、所述第二展开点、所述第一环形展开线和所述第二环形展开线。The initial first unfolding point, the initial second unfolding point, the initial first circular unfolding line and the initial second circular unfolding line are mapped from the stamp image to the input image to obtain the The first deployment point, the second deployment point, the first annular deployment line and the second annular deployment line.
  7. 根据权利要求6所述的图像处理方法,其特征在于,基于所述任一点、所述初始第一环形展开线和所述初始第二环形展开线,确定初始第一展开点和初始第二展开点,包括:The image processing method according to claim 6, wherein an initial first unfolding point and an initial second unfolding are determined based on the arbitrary point, the initial first circular unfolding line and the initial second circular unfolding line points, including:
    基于所述任一点,获取所述初始第一环形展开线上与所述任一点对应的点作为所述初始第一展开点;Based on the arbitrary point, acquiring a point corresponding to the arbitrary point on the initial first annular expansion line as the initial first expansion point;
    基于所述任一点,获取所述初始第二环形展开线上与所述任一点对应的点作为所述初始第二展开点。Based on the arbitrary point, a point corresponding to the arbitrary point on the initial second annular expansion line is acquired as the initial second expansion point.
  8. 根据权利要求4-7任一项所述的图像处理方法,其特征在于,所述初始第一展开点、所述初始第二展开点和所述任一点位于同一条直线上。The image processing method according to any one of claims 4-7, wherein the initial first unfolding point, the initial second unfolding point and the any point are located on the same straight line.
  9. 根据权利要求4-7任一项所述的图像处理方法,其特征在于,所述任一点为所述开口区域的中心点。The image processing method according to any one of claims 4-7, wherein the any point is a center point of the opening area.
  10. 根据权利要求4-7任一项所述的图像处理方法,其特征在于,所述第一环形展开线被展开成为所述展开印章图像中的一条直线。The image processing method according to any one of claims 4-7, wherein the first annular development line is expanded into a straight line in the expanded seal image.
  11. 根据权利要求1-7任一项所述的图像处理方法,其特征在于,所述第 一对象为文本,所述第一对象区域的形状为弧形。The image processing method according to any one of claims 1-7, wherein the first object is text, and the shape of the first object area is an arc.
  12. 根据权利要求1-5任一项所述的图像处理方法,其特征在于,所述输入印章的形状为圆形,所述第二展开点为所述圆形的圆心;或者,The image processing method according to any one of claims 1-5, wherein the shape of the input stamp is a circle, and the second expansion point is the center of the circle; or,
    所述输入印章的形状为椭圆形,所述第二展开点为所述椭圆形的两个焦点连线的中点。The shape of the input stamp is an ellipse, and the second expansion point is the midpoint of a line connecting two focal points of the ellipse.
  13. 根据权利要求1-7任一项所述的图像处理方法,其特征在于,还包括:The image processing method according to any one of claims 1-7, further comprising:
    确定所述第一中间对象区域的中心点;determining the center point of the first intermediate object area;
    通过所述第一中间对象区域和所述输入图像的映射关系,将所述第一中间对象区域映射回所述输入图像以确定所述第一对象区域,以及将所述第一中间对象区域的中心点映射回所述输入图像以确定所述第一对象区域的中心点;According to the mapping relationship between the first intermediate object area and the input image, the first intermediate object area is mapped back to the input image to determine the first object area, and the first intermediate object area is mapped mapping the center point back to the input image to determine the center point of the first object region;
    确定所述输入印章的中心点;determining the center point of the input stamp;
    通过所述第一对象区域的中心点和所述输入印章的中心点确定用于对所述输入图像进行校正的校正角度;Determine a correction angle for correcting the input image by the center point of the first object area and the center point of the input stamp;
    基于所述校正角度对所述输入图像进行校正,以得到校正后的输入图像。The input image is corrected based on the correction angle to obtain a corrected input image.
  14. 根据权利要求13所述的图像处理方法,其特征在于,所述输入印章还包括第二对象,The image processing method according to claim 13, wherein the input seal further comprises a second object,
    所述图像处理方法还包括:The image processing method further includes:
    对所述校正后的输入图像进行区域识别处理,以确定第二中间对象区域,其中,所述输入图像中与所述第二中间对象区域对应的区域为第二对象区域,所述第二对象位于所述第二对象区域内;Performing region identification processing on the corrected input image to determine a second intermediate object region, wherein the region corresponding to the second intermediate object region in the input image is the second object region, and the second object region is located within the second object area;
    对所述第二中间对象区域进行对象识别处理,以得到第二识别结果。Perform object recognition processing on the second intermediate object area to obtain a second recognition result.
  15. 根据权利要求1-7任一项所述的图像处理方法,其特征在于,获取输入图像包括:The image processing method according to any one of claims 1-7, wherein acquiring the input image comprises:
    获取原始图像,其中,所述原始图像包括原始印章;obtaining an original image, wherein the original image includes an original seal;
    通过印章区域识别模型对所述原始图像进行处理,以确定印章区域,通过印章标注框标注出所述印章区域,对所述印章标注框进行切片处理,以得到中间输入图像,其中,所述原始印章位于所述印章区域内,所述印章标注框包括所述印章区域,所述中间输入图像包括所述原始印章,The original image is processed by a seal area recognition model to determine the seal area, the seal area is marked by a seal labeling frame, and the seal labeling frame is sliced to obtain an intermediate input image, wherein the original The seal is located in the seal area, the seal labeling frame includes the seal area, and the intermediate input image includes the original seal,
    对所述中间输入图像进行处理以去除所述中间输入图像中的干扰像素,以得到所述输入图像,其中,所述干扰像素包括所述中间输入图像中不属于所述原始印章的干扰物体的像素,所述输入印章与所述原始印章对应。The intermediate input image is processed to remove interfering pixels in the intermediate input image to obtain the input image, wherein the interfering pixels include interfering objects in the intermediate input image that do not belong to the original seal; pixel, the input stamp corresponds to the original stamp.
  16. 一种图像处理装置,其特征在于,包括:An image processing device, comprising:
    存储器,用于非暂时性存储计算机可读指令;以及memory for non-transitory storage of computer readable instructions; and
    处理器,用于运行所述计算机可读指令,所述计算机可读指令被所述处理器运行时执行根据权利要求1-15任一项所述的图像处理方法。a processor, configured to execute the computer-readable instructions, and when the computer-readable instructions are executed by the processor, the image processing method according to any one of claims 1-15 is executed.
  17. 一种智能发票识别设备,其特征在于,包括:An intelligent invoice identification device, characterized in that it includes:
    图像获取部件,用于获得纸质发票的发票图像;Image acquisition component for acquiring invoice images of paper invoices;
    存储器,用于存储所述发票图像以及计算机可读指令;memory for storing the invoice image and computer readable instructions;
    处理器,用于读取所述发票图像并基于所述发票图像确定所述输入图像,并运行所述计算机可读指令,所述计算机可读指令被所述处理器运行时执行根据权利要求1-15任一项所述的图像处理方法。a processor for reading the invoice image and determining the input image based on the invoice image, and executing the computer readable instructions, the computer readable instructions being executed by the processor according to claim 1 - The image processing method of any one of 15.
  18. 一种非瞬时性计算机可读存储介质,非暂时性地存储计算机可读指令,当所述计算机可读指令由计算机执行时可以执行根据权利要求1-15任一项所述的图像处理方法。A non-transitory computer-readable storage medium storing non-transitory computer-readable instructions, when the computer-readable instructions are executed by a computer, the image processing method according to any one of claims 1-15 can be performed.
PCT/CN2022/076400 2021-03-04 2022-02-16 Image processing method and apparatus, intelligent invoice recognition device, and storage medium WO2022183907A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110241290.9A CN113033325A (en) 2021-03-04 2021-03-04 Image processing method and device, intelligent invoice recognition equipment and storage medium
CN202110241290.9 2021-03-04

Publications (1)

Publication Number Publication Date
WO2022183907A1 true WO2022183907A1 (en) 2022-09-09

Family

ID=76467781

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/076400 WO2022183907A1 (en) 2021-03-04 2022-02-16 Image processing method and apparatus, intelligent invoice recognition device, and storage medium

Country Status (2)

Country Link
CN (1) CN113033325A (en)
WO (1) WO2022183907A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113033325A (en) * 2021-03-04 2021-06-25 杭州睿胜软件有限公司 Image processing method and device, intelligent invoice recognition equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105631447A (en) * 2015-12-18 2016-06-01 杭州仁盈科技股份有限公司 Method of recognizing characters in round seal
CN110659647A (en) * 2019-09-11 2020-01-07 杭州睿琪软件有限公司 Seal image identification method and device, intelligent invoice identification equipment and storage medium
CN111178355A (en) * 2019-12-27 2020-05-19 中化资本有限公司 Seal identification method and device and storage medium
CN111767911A (en) * 2020-06-22 2020-10-13 平安科技(深圳)有限公司 Seal character detection and identification method, device and medium oriented to complex environment
CN113033325A (en) * 2021-03-04 2021-06-25 杭州睿胜软件有限公司 Image processing method and device, intelligent invoice recognition equipment and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP7209161B2 (en) * 2019-05-20 2023-01-20 京都電子計算株式会社 Character reader and program for character reader
CN110443250B (en) * 2019-07-31 2022-06-10 天津车之家数据信息技术有限公司 Method and device for identifying category of contract seal and computing equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105631447A (en) * 2015-12-18 2016-06-01 杭州仁盈科技股份有限公司 Method of recognizing characters in round seal
CN110659647A (en) * 2019-09-11 2020-01-07 杭州睿琪软件有限公司 Seal image identification method and device, intelligent invoice identification equipment and storage medium
CN111178355A (en) * 2019-12-27 2020-05-19 中化资本有限公司 Seal identification method and device and storage medium
CN111767911A (en) * 2020-06-22 2020-10-13 平安科技(深圳)有限公司 Seal character detection and identification method, device and medium oriented to complex environment
CN113033325A (en) * 2021-03-04 2021-06-25 杭州睿胜软件有限公司 Image processing method and device, intelligent invoice recognition equipment and storage medium

Also Published As

Publication number Publication date
CN113033325A (en) 2021-06-25

Similar Documents

Publication Publication Date Title
CN110659647B (en) Seal image identification method and device, intelligent invoice identification equipment and storage medium
US9811749B2 (en) Detecting a label from an image
US20190304066A1 (en) Synthesis method of chinese printed character images and device thereof
CN110866495A (en) Bill image recognition method, bill image recognition device, bill image recognition equipment, training method and storage medium
US11823358B2 (en) Handwritten content removing method and device and storage medium
US20230222631A1 (en) Method and device for removing handwritten content from text image, and storage medium
CN113486828B (en) Image processing method, device, equipment and storage medium
US9959475B2 (en) Table data recovering in case of image distortion
JP2014524085A (en) Method and system for recognizing text information in an object
WO2020097909A1 (en) Text detection method and apparatus, and storage medium
WO2022134771A1 (en) Table processing method and apparatus, and electronic device and storage medium
CN111709414A (en) AR device, character recognition method and device thereof, and computer-readable storage medium
WO2022166833A1 (en) Image processing method and apparatus, and electronic device and storage medium
WO2022183907A1 (en) Image processing method and apparatus, intelligent invoice recognition device, and storage medium
CN112149561A (en) Image processing method and apparatus, electronic device, and storage medium
CN113436222A (en) Image processing method, image processing apparatus, electronic device, and storage medium
WO2022166707A1 (en) Image processing method and apparatus, electronic device, and storage medium
CN116597466A (en) Engineering drawing text detection and recognition method and system based on improved YOLOv5s
CN111767924B (en) Image processing method, image processing apparatus, electronic device, and storage medium
KR20160146355A (en) Method and device for detecting text in image
CN116030472A (en) Text coordinate determining method and device
CN111914840A (en) Text recognition method, model training method, device and equipment
CN113449686A (en) Identification method, device, equipment and medium for identity card counterfeiting
US9020295B1 (en) Image glyph enhancement
CN111898602A (en) Certificate number area identification method, device and equipment in image

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22762373

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 22762373

Country of ref document: EP

Kind code of ref document: A1