Method and system for acquiring image information

By identifying and correcting lines in images during logistics distribution, the transportation box information is automatically extracted, which solves the problem of low efficiency and high error rate of manual input by contract fulfillment drivers, and achieves rapid and accurate acquisition of transportation box information.

CN118537847APending Publication Date: 2024-08-23ZHEJIANG CAINIAO SUPPLY CHAIN MANAGEMENT CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202410354125.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-03-26
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

In the existing technology, the manual input of container information by fulfillment drivers during the logistics distribution process is inefficient and has a high error rate, making it difficult for the system to quickly and accurately obtain transportation box information.

Method used

By determining the target area of ​​the target information in the image, line recognition and slope calculation are performed, lines are corrected, character recognition is performed, and transportation box information is extracted based on preset conditions to achieve automated identification and extraction.

Benefits of technology

Transportation box information can be quickly and accurately extracted without manual input, which improves the efficiency and accuracy of information acquisition and is suitable for complex scenarios such as transportation boxes with wrinkles.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118537847A
    Figure CN118537847A
Patent Text Reader

Abstract

The embodiment of the invention provides a method and system for obtaining image information, and the method comprises the steps: determining a target region of to-be-extracted target information in a target image, carrying out the line recognition of the target region, obtaining a line set in the target region, calculating the slope of each line in the line set, and obtaining the slope of each line in the line set; and according to the slope of the line, correcting a region picture corresponding to the line needing to be corrected in the target image, performing character recognition on a region picture corresponding to each line in the line set to obtain a to-be-extracted character, and extracting the target information based on a preset character extraction condition corresponding to the to-be-extracted character, the preset character extraction condition at least comprises a character type condition and a character quantity condition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present specification relate to the field of computer technology, and more particularly to a method and system for acquiring image information. Background Art

[0002] With the development of the e-commerce industry, logistics and distribution have become an important part of the industry's development. As a logistics platform, the fulfillment process relies on the return of fulfillment documents at each fulfillment node, one of which is the return of container information by the fulfillment driver, such as the container number and the net weight of the container. At present, the fulfillment driver generally takes a photo of the container seal number, sends it back through some instant messaging tools or manually uploads it to the system, and then the logistics platform's follow-up personnel manually enter the container number and net weight into the system for subsequent fulfillment.

[0003] However, manual information input is not only inefficient but also has a high error rate, making it difficult for the system to quickly and accurately obtain container information. Summary of the invention

[0004] In view of this, an embodiment of the present specification provides a method for obtaining image information. One or more embodiments of the present specification also relate to a system for obtaining transport box information, a computing device, a computer-readable storage medium, and a computer program product to solve the technical defect of low efficiency in obtaining transport box information in the prior art.

[0005] According to the first aspect of the embodiments of the present specification, a method for acquiring image information is provided, comprising: determining a target area in a target image of target information to be extracted; performing line recognition on the target area to obtain a line set in the target area; calculating the slope of each line in the line set; correcting, according to the slope of the line, an area picture corresponding to the lines to be corrected in the target image; performing character recognition on the area picture corresponding to each line in the line set to obtain characters to be extracted; extracting the target information based on preset character extraction conditions corresponding to the characters to be extracted, the preset character extraction conditions at least including a character type condition and a character quantity condition.

[0006] According to the second aspect of the embodiments of this specification, a system for acquiring transport box information is provided, including: a transport box image acquisition terminal, a robotic process automation server, an information extraction terminal and a client. The transport box image acquisition terminal is configured to acquire a transport box image and send the transport box image to the robotic process automation server; the robotic process automation server is configured to, in response to receiving the transport box image, send the transport box image to the information extraction terminal, acquire target information returned by the information extraction terminal, and send the target information to the client; the information extraction terminal is configured to receive the transport box image sent by the robotic process automation server, apply the method for acquiring image information as described in any embodiment of this specification, extract target information from the transport box image, and return the target information to the robotic process automation server.

[0007] According to a third aspect of an embodiment of this specification, a computing device is provided, comprising: a memory and a processor; the memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions, which, when executed by the processor, implement the steps of the method for acquiring image information described in any embodiment of this specification.

[0008] According to a fourth aspect of the embodiments of this specification, a computer-readable storage medium is provided, which stores a computer program / instruction, and when the computer program / instruction is executed by a processor, the steps of the method for obtaining image information described in any embodiment of this specification are implemented.

[0009] According to a fifth aspect of the embodiments of this specification, a computer program product is provided, including a computer program / instruction, which, when executed by a processor, implements the steps of the method for acquiring image information described in any embodiment of this specification.

[0010] An embodiment of the present specification implements a method for acquiring image information. The method determines the target area of ​​the target information to be extracted in the target image, performs line recognition on the target area, obtains a line set in the target area, calculates the slope of each line in the line set, and corrects the area image corresponding to the line to be corrected in the target image according to the slope of the line. Character recognition is performed on the area image corresponding to each line in the line set to obtain the character to be extracted, and the target information is extracted based on the preset character extraction conditions corresponding to the character to be extracted. The preset character extraction conditions at least include a character type condition and a character quantity condition. It can be seen that the method corrects the area image corresponding to the line to be corrected based on the slope of the line, so that the target information can be accurately extracted. In this way, even in complex application scenarios such as transport boxes where the information content is small and there are complex situations such as wrinkles on the box door, the transport box information can still be quickly and accurately extracted without manual input, and the transport box information can be accurately and efficiently obtained. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] Figure 1 is a framework diagram of a system for obtaining transport box information provided by an embodiment of this specification;

[0012] Figure 2 is a flow chart of a method for obtaining image information provided by an embodiment of this specification;

[0013] Figure 3 is a schematic diagram of a container image provided by an embodiment of this specification;

[0014] Figure 4 is a process flow chart of a method for obtaining image information provided by an embodiment of this specification;

[0015] Figure 5 is a schematic diagram of a structure of a device for acquiring image information provided by an embodiment of this specification;

[0016] Figure 6 It is a structural block diagram of a computing device provided by an embodiment of this specification. DETAILED DESCRIPTION

[0017] Many specific details are described in the following description to facilitate a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of this specification, so this specification is not limited to the specific implementation disclosed below.

[0018] The terms used in an optional embodiment of this specification are for the purpose of describing specific embodiments only and are not intended to limit an optional embodiment of this specification. The singular forms of "a", "said" and "the" used in an optional embodiment of this specification and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in an optional embodiment of this specification refers to and includes any or all possible combinations of one or more associated listed items.

[0019] It should be understood that, although the terms first, second, etc. may be used to describe various information in an optional embodiment of this specification, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of an optional embodiment of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0020] In addition, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in an optional embodiment of this specification are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions, and corresponding operation entrances are provided for users to choose to authorize or refuse.

[0021] First, the terms involved in an optional embodiment of this specification are explained.

[0022] RPA: Robotic Process Automation, robotic process automation.

[0023] OCR: Optical Character Recognition, optical character recognition.

[0024] At present, the fulfillment driver usually takes a photo of the container seal number and sends it back through some instant messaging tools or manually uploads it to the system. Then the logistics platform's order follow-up personnel manually enter the container number and net weight into the system for subsequent fulfillment. However, manual information input is not only inefficient but also has a high error rate, making it difficult for the system to quickly and accurately obtain container information.

[0025] In view of this, an embodiment of the present specification provides a method for acquiring image information. Since the method determines a target area in a target image where target information to be extracted is located, line recognition is performed on the target area to obtain a line set in the target area, the slope of each line in the line set is calculated, and according to the slope of the line, a region picture corresponding to the line to be corrected in the target image is corrected, character recognition is performed on the region picture corresponding to each line in the line set to obtain the character to be extracted, and based on a preset character extraction condition corresponding to the character to be extracted, the target information is extracted, and the preset character extraction condition includes at least a character type condition and a character quantity condition. Therefore, the method corrects the region picture corresponding to the line to be corrected based on the slope of the line, and can accurately extract the target information. In this way, even in complex application scenarios such as transport boxes where the information content is small and there are complex situations such as wrinkles on the box door, the transport box information can still be extracted quickly and accurately. No manual input is required, and the transport box information can be acquired accurately and efficiently.

[0026] Specifically, in this specification, a method for acquiring image information is provided. This specification also relates to an apparatus for acquiring image information, a system for acquiring transport box information, a computing device, a computer-readable storage medium, and a computer program product, which are described in detail one by one in the following embodiments.

[0027] See also Figure 1 , Figure 1 A framework diagram of a system for obtaining transport box information provided by an embodiment of the present specification is shown, wherein the system for obtaining transport box information may include a transport box image acquisition terminal 110, a robotic process automation service terminal 120, a client terminal 130 and an information extraction terminal 140;

[0028] The transport box image acquisition end 110 is configured to acquire a transport box image and send the transport box image to the robotic process automation service end.

[0029] The RPA server 120 is configured to, in response to receiving the transport box image, send the transport box image to the information extraction terminal, obtain the target information returned by the information extraction terminal, and send the target information to the client.

[0030] The information extraction terminal 140 is configured to receive the transport box image sent by the robotic process automation server, apply the method for obtaining image information as described in any embodiment of the present specification, extract target information from the transport box image, and return the target information to the robotic process automation server. Specifically, the information extraction terminal that applies the method for obtaining image information as described in any embodiment of the present specification will determine the target area of ​​the target information to be extracted in the target image, perform line recognition on the target area to obtain a line set in the target area, calculate the slope of each line in the line set, correct the area image corresponding to the line to be corrected in the target image according to the slope of the line, perform character recognition on the area image corresponding to each line in the line set to obtain the character to be extracted, and extract the target information based on the preset character extraction condition corresponding to the character to be extracted.

[0031] The transport box image acquisition terminal 110 may be one or more. In actual applications, the transport box image acquisition terminal may be a networked camera device, that is, a mobile device with an image acquisition device, such as a mobile phone, a tablet computer, etc. The transport box may be a container in a logistics scenario. The networked camera device may capture the seal number image at the door of the container and upload it to the robotic process automation server. The robotic process automation server is responsible for receiving the image uploaded by the networked camera device, and calling the algorithm system (i.e., the information extraction terminal) implemented according to the method for obtaining image information provided in the embodiment of this specification to identify the received image, obtain the target information, and then return the target information to the client. For example: the information extraction terminal can be used to extract the net weight information of the transport box and the transport box code number information in the transport box image.

[0032] The client 130 may be one or more. In actual applications, the client may be a third-party system for fulfilling contracts in a logistics scenario. When there are multiple clients 130, a communication connection may be established between the multiple clients 130 through the server. In an e-commerce logistics scenario, the server may be used to provide logistics services between multiple clients 130. Multiple clients 130 may serve as a sender or a receiver, respectively, and achieve communication through the server.

[0033] For example, the client 130 can be used to display the transport box information in the logistics management interface. The merchandiser, the transport service provider and the user of the logistics order can all see the transport box information in the logistics management interface. The user can track the delivery of the ordered goods based on the transport box information. Optionally, an electronic map can also be displayed in the logistics management interface of the client 130 to show the current location of the container and the location of the transport terminal. For the merchandiser's client, the logistics management interface can also provide a container image browsing button and an edit button so that the merchandiser can click on the image to view the container information, and can also click the edit button to pop up the input box for the container information. In this way, when the merchandiser finds that the container information needs to be corrected or added, the container information can be edited, and the input or cancellation of the container-related information can be confirmed through the "OK" control and the "Cancel" control. In actual applications, the user of the client 130 operates the control in any manner including clicking, double-clicking, touching, hovering the mouse, sliding, long pressing, voice control or shaking, etc., which is selected according to the actual situation, and the embodiments of this specification do not limit this in any way.

[0034] Among them, the transport box image acquisition terminal 110 and the robotic process automation server 120, the client 130 and the robotic process automation server 120, and the information extraction terminal 140 and the robotic process automation server 120 can be connected through the network. The network provides a medium for the communication link between the terminals. The network can include various connection types, such as wired, wireless communication links or optical fiber cables, etc. The transmitted data may need to be encoded, transcoded, compressed, etc. before being released to the server.

[0035] The client 130 can be deployed in an electronic device and needs to rely on the device to run or some APPs in the device to run. For example, the electronic device can have a display screen and support information browsing, such as a personal mobile terminal such as a mobile phone, a tablet computer, a personal computer and other end-side devices. Various other types of applications can also be configured in the electronic device, such as human-computer dialogue applications, model training applications, text processing applications, web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.

[0036] The client may include a browser, an APP (Application), or a web application such as an H5 (Hyper Text Markup Language 5, version 5 of Hypertext Markup Language) application, or a light application (also known as a mini-program, a lightweight application) or a cloud application, etc. The client application may be based on the software development kit (SDK, Software Development Kit) of the corresponding service provided by the server, such as being developed and obtained based on the real-time communication (RTC, Real Time Communication) SDK, etc. The client may be an electronic device or run by relying on certain APPs in the device, etc. For example, the electronic device may have a display screen and support information browsing, such as a personal mobile terminal such as a mobile phone, a tablet computer, a personal computer, etc. Various other types of applications may also be configured in the electronic device, such as human-computer dialogue applications, model training applications, text processing applications, web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.

[0037] The robotic process automation server 120 refers to a server that uses software robots or intelligent automation tools to simulate and automatically execute repetitive, regular, and highly structured processes and tasks. The robotic process automation server, also known as the RPA (Robot ic Process Automation) system, provides a graphical interface and configuration tool for the RPA tool, which is used to obtain target information in the transport box image by configuring and calling appropriate components, modules, algorithms, etc. For example, the information extraction terminal can be called by the RPA tool to extract the target information in the transport box image. The robotic process automation server 120 is deployed in the system for obtaining transport box information, and can trigger and execute the entire automated process of transport box image acquisition, transport box information extraction, and transport box information return to the client, and can also monitor the operating status and performance of the entire automated process.

[0038] The information extraction end refers to the server end that applies the method for obtaining image information provided in the embodiment of this specification. The information extraction end can be expressed as a server end that provides various services, such as a server end that provides communication services to multiple clients, a server end for background training that provides support for the model used on the client, and a server end that processes the data sent by the client. It should be noted that the server end can be implemented as a distributed server cluster composed of multiple server ends, or as a single server. The server end can also be a server end of a distributed system, or a server end combined with a blockchain. The server end can also be a cloud service, cloud database, cloud computing, cloud function, cloud storage, network service, cloud communication, middleware service, domain name service, security service, content distribution network (CDN, Content De l ivery Network), and cloud service voltage meter of basic cloud computing services such as big data and artificial intelligence platform, or an intelligent cloud computing server end or intelligent cloud host with artificial intelligence technology.

[0039] The robotic process automation server and the information extraction terminal can be deployed on the same server or different servers, and this specification does not limit this.

[0040] In a possible implementation, the interaction process between the transport box image acquisition end 110, the robotic process automation service end 120, the client end 130 and the information extraction end 140 is as follows:

[0041] Step 1: A network connection is pre-established between the robotic process automation service end 120 and the transport box image acquisition end 110, and between the robotic process automation service end 120 and the information extraction end 140 for subsequent data transmission;

[0042] Step 2, the transport box image acquisition terminal 110 acquires container images of one or more containers to be identified, and sends the images to the robotic process automation service terminal 120;

[0043] Step 3, the RPA server 120 sends the container image to the information extraction terminal 140 in response to receiving the container image;

[0044] Step 4, the information extraction end 140 extracts target information from the received container image, and returns the extracted target information to the robotic process automation server 120;

[0045] Step 5: The RPA server 120 returns the target information to the client 130 .

[0046] It is worth noting that the method for obtaining image information provided in the embodiments of this specification can be executed by the information extraction end. In other embodiments of this specification, the client or the robotic process automation server can also have similar functions as the information extraction end, thereby executing the method for obtaining image information provided in the embodiments of this specification; in other embodiments, the method for obtaining image information provided in the embodiments of this specification can also be executed jointly by the robotic process automation server and the client.

[0047] According to the system for obtaining transport box information provided by the embodiment of the present specification, the robotic process automation service end calls the algorithm service of the information extraction end, so that the information extraction end determines the target area of ​​the target information to be extracted in the target image, performs line recognition on the target area, obtains a line set in the target area, calculates the slope of each line in the line set, corrects the area image corresponding to the line to be corrected in the target image according to the slope of the line, performs character recognition on the area image corresponding to each line in the line set to obtain the character to be extracted, extracts the target information based on the preset character extraction condition corresponding to the character to be extracted, and the preset character extraction condition at least includes a character type condition and a character quantity condition, and then the robotic process automation service end sends the obtained target information to the client. It can be seen that the system corrects the area image corresponding to the line to be corrected based on the slope of the line, and can accurately extract the target information. Even in complex application scenarios such as transport boxes, where the information content is small and the box door has wrinkles and other complex situations, the transport box information can still be quickly and accurately extracted without manual input, and the transport box information can be accurately and efficiently obtained.

[0048] See also Figure 2 , Figure 2 A flowchart of a method for acquiring image information provided according to an embodiment of the present specification is shown, which specifically includes the following steps.

[0049] Step 202: Determine a target area in a target image where target information to be extracted is located.

[0050] The target image can be acquired by any image acquisition device according to the application scenario, and is an image containing the target information to be extracted. For example, in a logistics scenario, the target image can be a transport box image. The transport box can also be understood as a container. In order to facilitate the character recognition process, in this step, the target image can be first converted into a grayscale image, and then the subsequent character recognition process can be performed.

[0051] The target information may be any type of information in the image according to the application scenario, for example, the target information may be the net weight information, the container code and the container number information in the container image.

[0052] The target area is the area in the target image where the target information is located. The method for determining the target area is not limited. For example, the target image may be first subjected to OCR to obtain the characters contained in the target image, and then character matching and / or preset relative position search of the target information may be performed based on preset key characters of the target information to determine the target area of ​​the target information in the target image; for another example, based on historical experience, one or more positions where the preset target information may appear in the target image may be visually inspected to determine the target area containing the target information.

[0053] For example: Figure 3 The container door image shown in the figure is matched by the preset net weight key character and the preset maximum weight key character and / or searched for the preset relative position, and the target area corresponding to the net weight information of the container is found to be Figure 3 Rectangular frame 302 is shown.

[0054] Step 204: Perform line recognition on the target area to obtain a line set in the target area.

[0055] Performing line recognition on the target area refers to an image processing step of recognizing lines from an image within the target area. The line recognition method is not limited, for example, vertical filtering and edge detection can be performed on the target area to obtain a vertical edge detection result, and a line set can be obtained based on the vertical edge detection result.

[0056] For example: Figure 3As shown in the container image schematic diagram, vertical filtering is performed on the image of the target area shown in the rectangular frame 302, which can be implemented by the Sobel function of OpenCV (a programming language); edge detection can be implemented by the Canny function of OpenCV's edge detection function. After vertical filtering and edge detection, the detected result image edges_p can be obtained, and Hough transform is performed on edges_p (such as calling OpenCV's HoughLinesP function) to obtain the set of all lines lines = [line_1, line_2, ... line_q], where line_q represents the qth element in lines. Traverse lines and take the coordinates of the two endpoints of the line for each element in the set. For example: the HoughLinesP function returns an array, and the 0th bit content of the array is the coordinates of the two endpoints of the line. For each element, take its 0th bit to get the coordinates of the two endpoints, and get line_q = [x1_q, x2_q, y1_q, y2_q], where x1_q represents the x-coordinate value of one end of line line_q, y1_q represents the y-coordinate value of one end of line line_q, x2_q represents the x-coordinate value of the other end of line line_q, and y2_q represents the y-coordinate value of the other end of line line_q, and we get the line set linees_coord = [[x1_1, x2_1, y1_1, y2_1], [x1_2, x2_2, y1_2, y2_2], …, [x1_q, x2_q, y1_q, y2_q]].

[0057] It is understandable that characters are usually displayed as lines in an image. Therefore, the method provided in the embodiments of this specification recognizes lines in the target area and distinguishes individual lines, which is equivalent to the preliminary distinction of individual characters, which helps to accurately extract the characters corresponding to the target information later.

[0058] Step 206: Calculate the slope of each line in the line set.

[0059] The slope refers to the amount of inclination of a line (a line can be a straight line, a combination of multiple straight lines, a curve, a combination of multiple curves, or a combination of one / multiple straight lines and one / multiple curves) relative to the horizontal axis. The calculation method of the slope of the line is not limited. For example, in one possible embodiment, the absolute value of the difference between the horizontal coordinates of the two endpoints of the line can be divided by the absolute value of the difference between the vertical coordinates of the two endpoints to obtain the slope of the line; for example, in another possible embodiment, the tangent value of the angle between the line and the positive semi-axis direction of the horizontal coordinate axis of the plane rectangular coordinate system can be calculated to obtain the slope of the line.

[0060] Step 208: Correct the area image corresponding to the line to be corrected in the target image according to the slope of the line.

[0061] A line has a corresponding area in the target image, and the image within the range of the area in the target image can be understood as the area image corresponding to the line.

[0062] Since the slope of a line is used to indicate the degree of inclination of a line relative to the horizontal axis, and in complex situations such as wrinkles on the door of a container, the slope of the line used to represent the character will show an abnormal inclination. Therefore, through this step, the line that needs to be corrected can be determined according to the slope of the line, and the area image corresponding to the line that needs to be corrected in the target image can be corrected, so that the characters corresponding to the target information can be extracted more accurately later.

[0063] Step 210: Perform character recognition on the area image corresponding to each line in the line set to obtain the characters to be extracted.

[0064] In this step, the region images corresponding to each line in the line set include original region images corresponding to lines that do not need correction and corrected region images corresponding to lines that need correction. For example, if the line set includes 10 lines, and the 10 lines correspond to 10 region images, character recognition is performed on the 10 region images respectively, and 10 characters to be extracted can be obtained.

[0065] Step 212: extracting the target information based on the preset character extraction conditions corresponding to the characters to be extracted, wherein the preset character extraction conditions at least include a character type condition and a character quantity condition.

[0066] According to the preset character extraction condition, the extracted target information includes one or more characters that meet the character type condition and the character quantity condition.

[0067] It can be seen from the above embodiments that the method corrects the corresponding area image in the target image that needs to be corrected based on the slope of the line, so that the target information can be accurately extracted. In this way, even in complex application scenarios such as transport boxes where the information content is small and there are complex situations such as wrinkles on the box door, the transport box information can still be extracted quickly and accurately without manual input, and information can be obtained accurately and efficiently.

[0068] In one or more embodiments of the present specification, in order to more accurately extract the target information, the normal maximum slope and the normal minimum slope are determined to screen out the lines that need to be corrected, and the image area corresponding to the distorted lines is reasonably corrected to improve the OCR recognition accuracy. Specifically, the correction of the area image corresponding to the lines that need to be corrected according to the slope of the lines includes:

[0069] Determine, according to the slope of each line in the line set, a normal maximum slope and a normal minimum slope corresponding to each line in the line set;

[0070] Determine the lines in the line set whose slopes are not within the corresponding range of the normal maximum slope and the normal minimum slope as lines that need to be corrected;

[0071] The area image corresponding to the line to be corrected is transformed into a regular rectangle to obtain a corrected area image.

[0072] The normal maximum slope and the normal minimum slope are determined based on the slopes of the individual lines in the line set, and conform to the upper and lower limits of the slope range of normal, non-distorted lines.

[0073] For example: suppose the line set is line_coord, line_coord = [[x1_1,x2_1,y1_1,y2_1],[x1_2,x2_2,y1_2,y2_2],…,[x1_q,x2_q,y1_q,y2_q]].

[0074] Among them, [x1_q, x2_q, y1_q, y2_q] = line_q, x1_q represents the x-coordinate value of one end of line line_q, y1_q represents the y-coordinate value of one end of line line_q, x2_q represents the x-coordinate value of the other end of line line_q, and y2_q represents the y-coordinate value of the other end of line line_q.

[0075] According to the above embodiment, after obtaining the area image corresponding to each line in the line set line_coord, the lines in the line set whose slopes are not within the corresponding range of the normal maximum slope and the normal minimum slope can be determined as lines that need to be corrected, and then the area image corresponding to the lines that need to be corrected can be transformed into a regular rectangle. Specifically, line_coord can be traversed, and for each element line_q (that is, each line), a rectangular area with a height of height_q=abs(x2_q-x1_q) is calculated, and a point a_q(min(x1_q,x2_q),0) is used as the upper left corner, and then a rectangular area with a height of height_q and a width of width is cut out as the area image pts_q corresponding to the line. Among them, the width width refers to the width of the area image corresponding to the character. For example: in some application scenarios, the width of the target area is also the width of the area image corresponding to a single character. Based on this, when the target area is cut out from the target image, the width of the area image corresponding to the character can be obtained according to the target area. If the slope gradient_q corresponding to an element line_q is not within the range of the normal minimum slope low_gradient and the normal maximum slope up_gradient, the corresponding area image pts_q is corrected. Otherwise, the general OCR algorithm can be called to recognize the characters and store the recognized characters in the string list L2.

[0076] In order to correct the region image pts_q, it is necessary to calculate the coordinates of the four vertices of the region image dts_q after the region image pts_q is transformed into a regular rectangle. The calculation process is as follows:

[0077] First calculate the coordinates of the four vertices of pts_q. The calculation formula is as follows:

[0078] pts_q=[[min(x1_q,x2_q),0],[min(x1_q,x2_q)+height_q,0],[min(x1_q,x2_q),widt h],[min(x1_q,x2_q)+height,width]]

[0079] If the area image of pts_q is understood as a tilted parallelogram, it can be restored to a regular rectangle by projection transformation. Therefore, the calculation formula for the coordinates of the four vertices of dts_q is as follows:

[0080] dts_q=[[min(x1_q,x2_q),0],[min(x1_q,x2_q)+height_q / sqrt(1+grad ient_q 2 ),0],[

[0081] min(x1_q,x2_q),width+height_q*grad ient_q / sqrt(1+grad ient_q 2 )],[min(x1_q,x2_q)+height_q / sqrt(1+grad ient_q 2 ),width+height_q*grad ient_q / sqrt(1+grad ient_q 2 )]]

[0082] In the above calculation formula for the coordinates of the four vertices of dts_q, height_q / sqrt(1+gradient_q 2 ) represents the projection in the x-axis direction, height_q*gradient_q / sqrt(1+gradient 2 ) represents the projection in the y-axis direction; min represents the function of taking the minimum value, and sqrt represents the function of taking the square root.

[0083] After calculating the coordinates of the four vertices of dts_q, the function for implementing the four-point perspective transformation can be called to obtain the area image of dts_q converted from the area image of pts_q.

[0084] For example, you can call the getPerspectiveTransform function and the warpPerspective function in OpenCV (a programming language): first calculate matrix = getPerspectiveTransform (pts_q, dts_q), and then call the warpPerspective function to perform perspective transformation to obtain the corrected image area dts_q.

[0085] In this embodiment, the normal maximum slope and the normal minimum slope are used to find the lines that need to be corrected and transform them into regular rectangles, which helps to reduce the difficulty of subsequent OCR character recognition and improve accuracy.

[0086] In one or more embodiments of the present specification, in order to more accurately determine the normal maximum slope and the normal minimum slope corresponding to each line in the line set, the normal maximum slope and the normal minimum slope are determined by finding the slope range of most lines. Specifically, determining the normal maximum slope and the normal minimum slope corresponding to each line in the line set according to the slope of each line in the line set includes:

[0087] Sorting the lines in the line set according to their slopes from small to large or from large to small to obtain a sorted line set;

[0088] Calculating the slope difference between every two adjacent lines in the sorted line set;

[0089] Determine the positions of the two adjacent lines with the largest slope difference in the sorted line set;

[0090] Splitting the sorted line set into two subsets based on the positions, and obtaining the subset with a larger number of lines as the majority subset;

[0091] The maximum slope is found from each line in the majority subset as the normal maximum slope, and the minimum slope is found as the normal minimum slope.

[0092] Continuing with the above example, each line in the line set lines_coord is sorted in ascending or descending order according to the corresponding slope gradient_q, where gradient_q = abs(x1_q - x2_q) / abs(y1_q - y2_q), to obtain the sorted line set. The slope set of the sorted line set is lines_gradient = [gradient_1, gradient_2, …, gradient_q]. Calculate the difference between two adjacent numbers in the slope set to obtain the difference set diffs = [gradient_2 - gradient_1, gradient_3 - gradient_2, …]. Traverse the difference set diffs to find the position partition with the largest difference, where partition = diffs.index(max(diffs)). According to partition, the part most_lines with a larger number in the slope set lines_gradient can be determined. That is, if partition < len(lines_gradient) / 2, then most_lines = lines_gradient[partition + 1:], otherwise most_lines = lines_gradient[:partition + 1]. Therefore, the normal maximum slope value up_gradient and the normal minimum slope value low_gradient in the set are obtained according to most_lines, where up_gradient = most_lines[-1] and low_gradient = most_lines[0]. In this example, diffs can be a non-decreasing ordered set. Given that partition is a sequence in this set, then len(lines_gradient) / 2 represents the position where the set diffs is split into two subsets. If partition < len(lines_gradient) / 2, then the larger subset is the part with a serial number greater than the partition number, otherwise the larger subset is the part with a serial number less than the partition number. That is, partition is the serial number corresponding to the position with the largest difference in the set diffs. Through partition, the set diffs can be divided into two subsets, namely, the subset with a serial number less than partition and the subset with a serial number greater than partition. Compare the sizes of these two subsets, and take the larger subset as the majority subset most_lines.

[0093] In the above embodiment, the normal maximum slope and the normal minimum slope are determined by finding out the slope range of most lines, so that the normal maximum slope and the normal minimum slope corresponding to most lines in the line set can be determined more accurately.

[0094] In the following, taking the target image as a transport box image and the target information including the box net weight information as an example, the step of determining the target area of ​​the target information to be extracted in the target image in an optional embodiment of this specification is exemplarily described. For example, determining the target area of ​​the target information to be extracted in the target image may include:

[0095] Performing character recognition on the transport box image to obtain one or more character strings in the transport box image;

[0096] Finding a first character string matching a preset net weight key character from the one or more character strings;

[0097] According to the sequence of the one or more character strings in the transport box image, searching for a second character string that matches a preset maximum weight key character in the character string preceding the first character string;

[0098] Calculating a net weight character boundary according to a preset relative position calculation rule of a net weight character boundary relative to the coordinates of the first character string and the coordinates of the second character string;

[0099] Based on the net weight character boundary, a target area of ​​the target information in the transport box image is determined.

[0100] The character recognition, also known as optical character recognition, is the process of reading characters in an image using optical technology and computer technology to obtain characters. The character recognition can be implemented using a general OCR algorithm, which is not limited in this specification.

[0101] For example, by performing character recognition on the transport box image, a string list L1 in the transport box image can be obtained. In order to facilitate the subsequent positioning of the net weight character boundary, each string in the string list L1 not only lists the characters contained therein, but also lists the position coordinates of the circumscribed rectangle of the string. Specifically, for example, the i-th element group (i.e., the i-th string) in L1 is represented as a_i, a_i = [content_i, confidence_i, coordinates_i], where content_i represents the string content in the a_i element group, confidence_i represents the confidence of the corresponding string content in the a_i element group, and the confidence range can be [0,1], and coordinates_i represents the coordinates of the circumscribed rectangle of the area where the string is located. For example, Figure 3 The x-axis and y-axis directions of the circumscribed rectangle coordinates can be Figure 3 The coordinate axis shown in the figure represents that coordinates_i = [coorx_i, coory_i, width_i, height_i], where coorx_i represents the x-coordinate of the upper left corner of the circumscribed rectangle of the i-th string, coory_i represents the y-coordinate of the upper left corner of the circumscribed rectangle of the i-th string, width_i represents the width of the circumscribed rectangle of the i-th string, and height_i represents the height of the circumscribed rectangle of the i-th string.

[0102] The preset net weight key characters refer to the key characters that usually appear in the net weight information of the transport box image. The specific content of the key characters depends on the specific situation of the transport box in the actual application scenario, and this specification does not limit this. For example, the preset net weight key characters can be expressed as "TARE" or "TARE WT".

[0103] According to the above embodiment, after obtaining the string list L1, the string list L1 can be traversed to determine whether there is a string that matches the key characters "TARE" or "TARE WT". In order to facilitate character matching, the character content in the string can be converted to full case or full lowercase according to actual application needs. For example, if the net weight key characters are preset to be all uppercase, the content_i content in the i-th element group a_i in L1 can be converted to uppercase, and then character matching can be performed. In the process of character matching, a string whose character similarity is greater than a preset similarity threshold can be used as a string that matches the preset net weight key characters. For example: Assuming that the string similarity between content_i and "TARE" or "TARE WT" is greater than the preset similarity threshold of 0.7, it is considered that the string of the i-th element group a_i matches the preset net weight key characters.

[0104] In some application scenarios, the net weight information of a shipping container (which can also be referred to as a container) usually appears in a style as shown in Figure 3 the following figure. That is, the boundary of the net weight characters of the net weight information of the container actually exceeds the upper part of the key net weight characters "TARE" or "TARE WT", and is located below the maximum weight information. Therefore, according to the fact that the boundary of the net weight characters of the net weight information of the container usually appears before the key net weight characters and after the key maximum weight characters in the actual application scenario, in order to be able to extract the net weight information of the container more accurately, in the above embodiment, according to the front-to-back order of the one or more strings in the shipping container image, a second string that matches the preset key maximum weight character is found in the strings before the first string (i.e., the string that matches the preset key net weight character). In this way, according to the preset relative position where the net weight character boundary usually appears between the first string and the second string, by setting the preset relative position calculation rule, the net weight character boundary can be calculated according to the preset relative position calculation rule of the coordinates of the net weight character boundary, the first string, and the second string. Based on the net weight character boundary, the target area of the target information in the shipping container image is determined.

[0105] For example, in combination with the example of the above string list L1, traverse backward from the i-th string in L1 to find the string j in content_j (j < i) that contains the preset key maximum weight characters "max" or "gros". To facilitate the calculation of the net weight character boundary, when the string j is found, two key relative positions determined according to the coordinates of the string j can be returned. One key relative position is tara_pos (as shown in Figure 3 the figure, the coordinates of the circumscribed rectangle of the string i that matches the key net weight character of the container), and the other key relative position is maxg_pos (that is, the boundary of the string j that matches the key maximum weight character on the x-axis). Among them, the boundary of the string j on the x-axis can be calculated according to the height height_j of the string j and the x-axis coordinate of the upper left corner of the circumscribed rectangle of the string j. For example: the boundary of the string j on the x-axis is usually located at height_j - height_j / 4 below the x-axis coordinate of the upper left corner of the circumscribed rectangle of the string j, then the relative position maxg_pos = coorx_j + height_j - height_j / 4.

[0106] The preset relative position calculation rule can be set according to historical experience. For example: as shown in Figure 3In the container image shown, the left border of the net weight character boundary is usually located at the boundary of the string i on the y-axis, and the top border of the net weight character boundary is usually located at a distance below the boundary of the string j on the x-axis. The preset relative position calculation rule is: the left border of the net weight character left_border is coory_i in tara_pos, and the top border of the net weight character top_border is maxg_pos+20 (20 is only used to indicate the distance between the net weight character boundary and the boundary of the string j on the x-axis, and the specific length can be set according to the actual scenario). Figure 3 Based on the net weight character boundary, the target area of ​​the net weight information in the transport box image can be determined as Figure 3 Rectangular frame 302 is shown.

[0107] After determining the target area, the image corresponding to the target area can be further cropped from the shipping box image for subsequent processing steps such as line recognition. For example: Using the above example, based on the known left_border and top_border, point A can be obtained. The coordinates of point A are [maxg_pos+20, coory_j]. Based on point A, the image is cropped on the grayscale image of the shipping box image to obtain a new grayscale image of the target area. For example, the getRectSubPix function of OpenCV can be called for cropping, thereby obtaining a cropping result of a new grayscale image new_gray with point A as the upper left corner. The width of the new grayscale image width = new_gray.shape[1]. new_gray.shape is a function used to return the height and width of an image, where new_gray.shape[1] returns the width.

[0108] In the above embodiment, the target area corresponding to the net weight information is determined by the preset key characters related to the box net weight information and the maximum weight information and the relative position relationship between the two, so that the net weight information can be accurately extracted.

[0109] In one or more embodiments of the present specification, the preset character extraction conditions include: a net weight character type condition, a net weight character quantity condition, and a net weight character value range condition. The extracting the target information based on the preset character extraction conditions corresponding to the character to be extracted includes:

[0110] According to the net weight character type condition, the net weight character quantity condition and the net weight character value range condition, the box net weight information is extracted from the characters to be extracted.

[0111] The preset character extraction condition is specifically set according to the actual situation of the net weight characters in the application scenario, and this specification does not limit this. Among them, the net weight character type condition is used to constrain the character type that the characters to be extracted should satisfy. For example: in some application scenarios, the net weight characters are usually numbers, then the net weight character type condition is that the character type is a number. The net weight character quantity condition is used to constrain the number of characters (or length) that the characters to be extracted should satisfy. For example: in some application scenarios, the net weight characters are usually 4 characters, then the net weight character quantity condition is that the number of characters is 4. For another example: in some application scenarios, the net weight characters are usually numbers with a numerical value greater than or equal to 1800 and less than or equal to 6000, then the net weight character numerical range condition is greater than or equal to 1800 and less than or equal to 6000.

[0112] In the above embodiment, the net weight information of the box can be extracted more accurately by using the preset character extraction conditions including the net weight character type condition, the net weight character quantity condition and the net weight character value range condition.

[0113] In combination with the above-mentioned embodiment of obtaining the net weight information of the box, one or more embodiments of this specification also provide an embodiment of obtaining the box number information of the transport box code. Specifically, the method also includes:

[0114] According to the sequence of the one or more character strings in the transport image, the character string before the second character string is used as the transport box number text to be extracted;

[0115] Finding a third character string that satisfies a preset transport box code character extraction condition from the transport box number to be extracted text, and extracting the transport box code from the third character string, wherein the preset transport box code character extraction condition includes: a transport box code character type condition and a condition on the number of characters that meet the transport box code character type condition;

[0116] A fourth character string satisfying a preset character extraction condition for the transport box number is found from the text to be extracted from the transport box number, and the transport box number is extracted from the fourth character string. The preset character extraction condition for the transport box number includes: a transport box number character type condition and a condition on the number of characters satisfying the character type condition for the transport box number.

[0117] For example, continuing with the example of the previous string list L1, when a string j containing the characters "max" or "gros" is found in content_j (j < i), the string before string j is the text to be extracted for the shipping container number. Traverse the first j element groups in the string list L1 to find the third string that meets the preset shipping container code character extraction conditions and the fourth string that meets the preset shipping container number character extraction conditions, in order to extract the shipping container code and the container number. Specifically, during the traversal, if the length of content_m in the m-th element group a_m is 4 (in this example, the number condition for the characters that meet the shipping container code character type condition is 4), and the result screening variable code is empty (the result screening variable code is used to represent the shipping container code, and the empty value of this variable indicates that the shipping container code has not been extracted yet), if all the characters in content_m are English characters and the last character is "U" (in this example, the shipping container code character type condition is all English and the last character is U), then execute code = content_m (that is, the third string that meets the preset shipping container code character extraction conditions is found, and the shipping container code characters are extracted from it and assigned to code). During the traversal, if number is empty (the result screening variable number is used to represent the shipping container number, and the empty value of this variable indicates that the shipping container number has not been extracted yet), and the length of content_m is greater than or equal to 7 and all the characters in content_m are digits (in this example, the shipping container number character type condition is all digits and the length is greater than or equal to 7), then the first 7 digits are taken and assigned to number (that is, the fourth string that meets the preset shipping container number character extraction conditions is found, and the shipping container number characters are extracted from it and assigned to number). If both code and number are empty and the length is greater than or equal to 10 and the first 4 characters are all English characters and the characters from the 5th to the 11th are all digit characters, then directly return the first 11 characters in content_m and assign them to container_code (the container number variable).

[0118] Considering that in the OCR character recognition process, there may be cases of character recognition errors. In such cases, the shipping container code and number that should have been found cannot be found through the preset character conditions. To solve this problem, in one or more embodiments of this specification, the strings that may contain the shipping container code and number are added to a temporary list, so as to attempt to convert the incorrect characters into correct characters based on historical experience. Thus, once the converted string contains the correct shipping container code and number, the shipping container code and number can be extracted from it. Specifically, the method further includes:

[0119] If the third character string that meets the preset transport box code character extraction condition is not found, the fifth character string is added to the code temporary storage list, and the fifth character string is any character string of the one or more character strings or a character string that meets the transport box code pending condition;

[0120] If the fourth character string that meets the preset transport container number character extraction condition is not found, the sixth character string is added to the temporary container number storage list, where the sixth character string is any one of the one or more character strings or a character string that meets the transport container number pending condition;

[0121] Traversing the temporary code storage list, for any fifth character string, based on a preset error code character replacement rule, replacing a preset first character in any fifth character string with a preset second character to obtain a replaced fifth character string, and if the replaced fifth character string meets the preset transport box code character extraction condition, extracting the transport box code from the replaced fifth character string;

[0122] The temporary storage list of container numbers is traversed, and for any sixth character string, based on the preset wrong container number character replacement rule, the preset third character in any sixth character string is replaced with the preset fourth character to obtain a replaced sixth character string; if the replaced sixth character string meets the preset transport container number character extraction condition, the transport container number is extracted from the replaced sixth character string.

[0123] The box code pending condition is a condition that a character string that may contain the box code should satisfy, and the box number pending condition is a condition that a character string that may contain the box number should satisfy. The specific content of the condition can be set according to the needs of the scenario, and this specification does not limit this. The preset error code character replacement rule and the preset error box number character replacement rule can be set according to historical experience to replace possible error characters with possible correct characters.

[0124] For example, following the example of the string list L1 above, if the last digit of the content_m character is not "U", then content_m is inserted into the temporary encoding list cnd_code of code; if the length of content_m is greater than or equal to 7 but the characters of content_m are not all numbers, then content_m is inserted into the temporary box number list cnd_number of number. After traversing the first j element groups in list L1, traverse the temporary encoding list cnd_code and the temporary box number list cnd_number to start trying to convert the wrong characters into correct characters based on historical experience. Specifically, for the currently traversed code_s (code_s is an element in cnd_code), perform a string replacement operation such as "0" (Arabic numeral zero) replaced with "O" (English letter O), "6" replaced with "G", "1" replaced with "l", "8" replaced with "B", and so on. If the length of code_s after replacement is 4 and the characters are all English and the last digit is "U", then code = code_s, that is, the replaced content meets the preset transport box code character extraction condition, and the transport box code character is extracted. For the currently traversed number_s (number_s is an element in cnd_number), perform string replacement operations such as "O" (English letter O) replaced with "0" (Arabic numeral zero), "I" replaced with "1", "l" replaced with "1", "B" replaced with "8", "Z" replaced with "2", etc. If the length of number_s after replacement is greater than or equal to 6 and is all numbers, then number = number_s, that is, the content after replacement meets the preset transport box number character extraction condition, and the transport box number character is extracted.

[0125] The above embodiment attempts to convert erroneous characters into correct characters based on historical experience, so that once the converted character string contains the correct transport box code and box number, the transport box code and box number can be extracted therefrom, effectively improving the information extraction capability.

[0126] In order to ensure that the extracted transport box code and box number information are accurate, in one or more embodiments of this specification, the transport box code and box number information are also verified. Specifically, the method further includes:

[0127] If the transport box code and the transport box number are extracted, the transport box code and the transport box number are combined to obtain the transport box code and box number information;

[0128] Based on the pre-set number of digits of the transport box code number information, the code box number value to be verified and the actual verification value are obtained;

[0129] Utilizing the code box number value to be verified and the preset verification value calculation rule, the value to be verified is calculated;

[0130] The value to be verified is compared with the actual verification value. If they are consistent, the coded box number value to be verified and the actual verification value are combined to obtain the verified transport box coded box number information. If they are inconsistent, the coded limit value to be verified and the value to be verified are combined to obtain the verified transport box coded box number information.

[0131] The pre-set digits refer to the number of digits actually occupied by the transport box code, box number and check digit. The specific value is determined according to the actual situation in the application scenario. Figure 3 In the container image shown, the container code number is usually followed by a check digit for checking the code number. The preset check value calculation rule refers to the calculation rule of the check value of the container usually in the logistics application scenario. The specific content is determined according to the setting of the check digit in the actual application scenario, and this manual does not limit this.

[0132] For example, in some application scenarios, the preset verification value calculation rules include:

[0133] In the first 11 digits of the combined transport box code information, the first 4 English characters represent a value (such as AZ represents the numbers 10-38 respectively), then the corresponding values ​​of the first 11 digits are summed according to the following formula:

[0134]

[0135] Among them, x represents the p-th digit value, p represents the p-th digit, and the result of (total_num mod 11) mod 10 is the value to be checked.

[0136] In the above embodiment, the transport box code and box number information is verified based on the preset verification value calculation rules, so that more accurate transport box code and box number information can be accurately extracted to ensure the accuracy of the extracted information.

[0137] The following combination Figure 4 , taking the method for obtaining image information provided in this specification as an example, combined with the application of the above-mentioned multiple embodiments, the method for obtaining image information is further described. Among them, Figure 4 A processing flow chart of a method for acquiring image information provided by an embodiment of the present specification is shown, which specifically includes the following steps.

[0138] Step 402: Convert the shipping box image into a grayscale image.

[0139] Step 404: Perform OCR character recognition on the grayscale image to obtain a character string list L1.

[0140] Step 406: Find out from the string list L1 a string i whose similarity to "TARE" or "TARE WT" is greater than a preset similarity threshold.

[0141] Step 408: If the string i is found, continue to search for a string j whose similarity with "MAX" or "GROS" is greater than a preset similarity threshold, and calculate tara_pos and maxg_pos according to the coordinates of the string i and the string j.

[0142] According to the following steps 410 to 416, the transport box code box number information is extracted.

[0143] Step 410: In the character string before the character string j, find a character string whose first four characters are all in English (the last character is U) and whose fifth to eleventh characters are numbers, and extract the transport box code and box number from it.

[0144] Step 412: If the transport box code is not extracted, the character string that meets the transport box code pending condition before the character string j is replaced according to the preset error code character replacement rule to extract the transport box code from the replaced character string.

[0145] Step 414: If the transport container number is not extracted, the character string that meets the transport container number pending condition before the character string j is replaced according to the preset wrong container number character replacement rule to extract the transport container number from the replaced character string.

[0146] Step 416: concatenate the transport box code and the transport box number to obtain the transport box code and box number information, verify the transport box code and box number information, and obtain verified transport box code and box number information.

[0147] According to the following steps 418-428, the net weight information of the box is extracted.

[0148] Step 418: Determine the net weight character boundary according to tara_pos and maxg_pos, and determine the target area of ​​the box net weight information in the transport box image based on the net weight character boundary.

[0149] Step 420: Perform line recognition on the target area to obtain a line set lines_coord in the target area.

[0150] Step 422: Calculate the slope of each line in the line set.

[0151] Step 424: Correct the area image corresponding to the lines that need to be corrected according to the slopes of the lines.

[0152] Step 426: Perform character recognition on the area image corresponding to each line in the line set to obtain the characters to be extracted.

[0153] Step 428: Based on the net weight character type condition, the net weight character quantity condition and the net weight character value range condition, extract the box net weight information from the characters to be extracted.

[0154] The details not described in detail in the above steps 402 to 428 can be implemented with reference to the previous embodiments and will not be described in detail here.

[0155] It can be seen from the above embodiments that the method provided in the embodiments of this specification does not rely on a customized training recognition model, and there is no sample quantity requirement and training investment in the early stage. It can be implemented only by relying on a general OCR model. Through the processing of the above steps of this specification, high-precision container code box number and box net weight recognition under complex background interference can be obtained. In addition, in view of the problem that the net weight content area of ​​the container is much smaller than the container number, and there may be wrinkles on the door body, which makes recognition difficult, the above embodiments determine the box net weight character boundary through key characters and relative positions, recognize the lines therein, and correct the area image corresponding to the lines, so as to accurately locate and recognize the box net weight information.

[0156] Corresponding to the above method embodiment, this specification also provides an apparatus embodiment for acquiring image information. Figure 5 FIG. 1 is a schematic diagram showing a structure of a device for acquiring image information provided by an embodiment of the present specification. Figure 5 As shown, the device comprises:

[0157] The target region determination module 502 is configured to determine a target region in a target image from which target information to be extracted is located.

[0158] The line recognition module 504 is configured to perform line recognition on the target area to obtain a line set in the target area.

[0159] The slope calculation module 506 is configured to calculate the slope of each line in the line set.

[0160] The image correction module 508 is configured to correct the area image corresponding to the line to be corrected in the target image according to the slope of the line.

[0161] The character recognition module 510 is configured to perform character recognition on the area image corresponding to each line in the line set to obtain the character to be extracted.

[0162] The character extraction module 512 is configured to extract the target information based on a preset character extraction condition corresponding to the character to be extracted, wherein the preset character extraction condition at least includes a character type condition and a character quantity condition.

[0163] It can be seen from the above embodiments that the device corrects the corresponding area picture in the target image that needs to be corrected based on the slope of the line, so that the target information can be accurately extracted. In this way, even in complex application scenarios such as transport boxes, where the information content is small and there are wrinkles on the box door, the transport box information can still be extracted quickly and accurately without manual input, and information can be obtained accurately and efficiently.

[0164] In an optional embodiment of this specification, the image correction module includes:

[0165] A normal slope range determination submodule is configured to determine a normal maximum slope and a normal minimum slope corresponding to each line in the line set according to the slope of each line in the line set;

[0166] A correction line determination submodule is configured to determine a line in the line set whose slope is not within the corresponding range of the normal maximum slope and the normal minimum slope as a line that needs to be corrected;

[0167] The correction transformation submodule is configured to transform the area image corresponding to the line to be corrected into a regular rectangle to obtain a corrected area image.

[0168] In an optional embodiment of this specification, the normal slope range determination submodule includes:

[0169] A sorting submodule is configured to sort the lines in the line set according to the slope from small to large or from large to small to obtain a sorted line set;

[0170] A slope difference calculation submodule is configured to calculate the slope difference between every two adjacent lines in the sorted line set;

[0171] A split point calculation submodule is configured to determine the positions of the two adjacent lines with the largest slope difference in the sorted line set;

[0172] a set splitting submodule, configured to split the sorted line set into two subsets based on the positions, and obtain the subset with a larger number of lines as the majority subset;

[0173] The slope determination submodule is configured to find out the maximum slope from each line in the majority subset as the normal maximum slope, and find out the minimum slope as the normal minimum slope.

[0174] In an optional embodiment of the present specification, the target image is a transport box image, and the target information includes the box net weight information. The target area determination module includes:

[0175] a character string recognition submodule, configured to perform character recognition on the transport box image to obtain one or more character strings in the transport box image;

[0176] A net weight character matching submodule is configured to search for a first character string that matches a preset net weight key character from the one or more character strings;

[0177] The heaviest character matching submodule is configured to search for a second character string that matches a preset maximum weight key character in a character string preceding the first character string according to the front-to-back order of the one or more character strings in the transport box image;

[0178] a net weight character boundary determination submodule, configured to calculate the net weight character boundary according to a preset relative position calculation rule of the net weight character boundary relative to the coordinates of the first character string and the coordinates of the second character string;

[0179] The net weight area determination submodule is configured to determine a target area of ​​the target information in the transport box image based on the net weight character boundary.

[0180] In an optional embodiment of the present specification, the preset character extraction conditions include: a net weight character type condition, a net weight character quantity condition, and a net weight character value range condition.

[0181] The character extraction module is configured to extract the box net weight information from the characters to be extracted according to the net weight character type condition, the net weight character quantity condition and the net weight character value range condition.

[0182] In an optional embodiment of this specification, the device further includes:

[0183] a transport box number text determination module, configured to use, according to the sequence of the one or more character strings in the transport image, the character string before the second character string as the transport box number text to be extracted;

[0184] The transport box number character extraction module is configured to search for a third character string that meets the preset transport box code character extraction condition from the transport box number to be extracted text, and extract the transport box code from the third character string, wherein the preset transport box code character extraction condition includes: a transport box code character type condition and a condition on the number of characters that meet the transport box code character type condition; search for a fourth character string that meets the preset transport box number character extraction condition from the transport box number to be extracted text, and extract the transport box number from the fourth character string, wherein the preset transport box number character extraction condition includes: a transport box number character type condition and a condition on the number of characters that meet the transport box number character type condition.

[0185] In an optional embodiment of this specification, the device further includes:

[0186] an information merging module, configured to merge the transport box code and the transport box number if the transport box code and the transport box number are extracted, so as to obtain the transport box code and box number information;

[0187] A verification information extraction module is configured to obtain a value of the coded box number to be verified and an actual verification value based on a pre-set number of digits of the coded box number information of the transport box;

[0188] A verification information calculation module is configured to calculate the value to be verified by using the coded box number value to be verified and a preset verification value calculation rule;

[0189] The verification information comparison module is configured to compare the value to be verified with the actual verification value. If they are consistent, the coded box number value to be verified and the actual verification value are merged to obtain the verified transport box coded box number information. If they are inconsistent, the coded limit value to be verified and the value to be verified are merged to obtain the verified transport box coded box number information.

[0190] In an optional embodiment of this specification, the device further includes:

[0191] A code temporary storage module is configured to add the fifth character string to a code temporary storage list if the third character string that meets the preset transport box code character extraction condition is not found, wherein the fifth character string is any one of the one or more character strings or a character string that meets the transport box code pending condition;

[0192] A box number temporary storage module is configured to add the sixth character string to the box number temporary storage list if the fourth character string that meets the preset transport box number character extraction condition is not found, and the sixth character string is any character string of the one or more character strings or a character string that meets the transport box number pending condition;

[0193] The character replacement module is configured to traverse the temporary storage list of codes, and for any fifth character string, based on a preset error code character replacement rule, replace a preset first character in any fifth character string with a preset second character to obtain a replaced fifth character string; if the replaced fifth character string meets the preset transport box code character extraction condition, extract the transport box code from the replaced fifth character string; traverse the temporary storage list of box numbers, and for any sixth character string, based on a preset error box number character replacement rule, replace a preset third character in any sixth character string with a preset fourth character to obtain a replaced sixth character string; if the replaced sixth character string meets the preset transport box number character extraction condition, extract the transport box number from the replaced sixth character string.

[0194] The above is a schematic scheme of a device for acquiring image information of this embodiment. It should be noted that the technical scheme of the device for acquiring image information and the technical scheme of the method for acquiring image information are of the same concept, and the details not described in detail in the technical scheme of the device for acquiring image information can be referred to the description of the technical scheme of the method for acquiring image information.

[0195] Corresponding to the above method embodiment, this specification also provides a system embodiment for obtaining transport box information, the system for obtaining transport box information includes: a transport box image acquisition end, a robotic process automation service end, an information extraction end and a client end;

[0196] The transport box image acquisition end is configured to acquire the transport box image and send the transport box image to the robotic process automation service end;

[0197] The robotic process automation server is configured to, in response to receiving the transport box image, send the transport box image to the information extraction terminal, obtain target information returned by the information extraction terminal, and send the target information to the client;

[0198] The information extraction end is configured to receive the transport box image sent by the robotic process automation server, apply the method for obtaining image information as described in any embodiment of this specification, extract target information from the transport box image, and return the target information to the robotic process automation server.

[0199] The system for obtaining transport box information is based on the robotic process automation server and can universally adapt to data transmission between various heterogeneous systems without the need to implement interface docking with each system. In the case where the third-party system is a closed system and originally relies on manual input, the above system can be quickly deployed and implemented through the collaboration of the robotic process automation server, replacing the solution of manual automatic input of recognition results, thereby improving the efficiency of obtaining transport box information.

[0200] The above is a schematic scheme of a system for obtaining transport box information of this embodiment. It should be noted that the technical scheme of the system for obtaining transport box information and the technical scheme of the method for obtaining image information are of the same concept, and the details not described in detail in the technical scheme of the system for obtaining transport box information can be referred to the description of the technical scheme of the method for obtaining image information.

[0201] Figure 6 The block diagram of a computing device 600 according to an embodiment of the present specification is shown. The components of the computing device 600 include but are not limited to a memory 610 and a processor 620. The processor 620 is connected to the memory 610 via a bus 630, and the database 650 is used to store data.

[0202] The computing device 600 also includes an access device 640 that enables the computing device 600 to communicate via one or more networks 660. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 640 may include one or more of any type of network interface (e.g., a network interface card (NIC)) that is wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a Wi-MAX (Worldwide Interoperability for Microwave Access) interface, an Ethernet interface, a USB (Universal Serial Bus) interface, a cellular network interface, a Bluetooth interface, or a near field communication (NFC).

[0203] In one embodiment of the present specification, the above components of the computing device 600 and Figure 6 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Figure 6 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.

[0204] The computing device 600 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 600 may also be a mobile or stationary server.

[0205] The processor 620 is used to execute the following computer executable instructions, which, when executed by the processor, implement the steps of the above-mentioned method for acquiring image information.

[0206] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the method for obtaining image information are of the same concept, and the details not described in detail in the technical scheme of the computing device can be referred to the description of the technical scheme of the method for obtaining image information.

[0207] An embodiment of the present specification further provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the steps of the above-mentioned method for acquiring image information.

[0208] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the method for obtaining image information are of the same concept, and the details not described in detail in the technical scheme of the storage medium can be referred to the description of the technical scheme of the method for obtaining image information.

[0209] An embodiment of the present specification also provides a computer program product, including a computer program / instruction, which implements the steps of the above-mentioned method for obtaining image information when executed by a processor.

[0210] The above is a schematic scheme of a computer program of this embodiment. It should be noted that the technical scheme of the computer program and the technical scheme of the method for obtaining image information are of the same concept, and the details not described in detail in the technical scheme of the computer program can be found in the description of the technical scheme of the method for obtaining image information.

[0211] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0212] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.

[0213] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of this specification are not limited by the order of the actions described, because according to the embodiments of this specification, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the embodiments of this specification.

[0214] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0215] The preferred embodiments of this specification disclosed above are only used to help explain this specification. The optional embodiments do not describe all the details in detail, nor do they limit the invention to only the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the embodiments of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of this specification, so that technicians in the relevant technical field can well understand and use this specification. This specification is only limited by the claims and their full scope and equivalents.

Claims

1. A method for obtaining image information, comprising: Determine a target area of ​​the target information to be extracted in the target image; Performing line recognition on the target area to obtain a line set in the target area; Calculating the slope of each line in the line set; According to the slope of the line, correcting the area image corresponding to the line to be corrected in the target image; Performing character recognition on the area image corresponding to each line in the line set to obtain the character to be extracted; The target information is extracted based on a preset character extraction condition corresponding to the character to be extracted, wherein the preset character extraction condition at least includes a character type condition and a character quantity condition.

2. The method according to claim 1, wherein correcting the area image corresponding to the line to be corrected according to the slope of the line comprises: Determining a normal maximum slope and a normal minimum slope corresponding to each line in the line set according to the slope of each line in the line set; Determine the lines in the line set whose slopes are not within the corresponding range of the normal maximum slope and the normal minimum slope as lines that need to be corrected; The area image corresponding to the line to be corrected is transformed into a regular rectangle to obtain a corrected area image.

3. The method according to claim 2, wherein determining the normal maximum slope and the normal minimum slope corresponding to each line in the line set according to the slope of each line in the line set comprises: Sorting the lines in the line set according to their slopes from small to large or from large to small to obtain a sorted line set; Calculating the slope difference between every two adjacent lines in the sorted line set; Determine the positions of the two adjacent lines with the largest slope difference in the sorted line set; Splitting the sorted line set into two subsets based on the positions, and obtaining the subset with a larger number of lines as the majority subset; The maximum slope is found from each line in the majority subset as the normal maximum slope, and the minimum slope is found as the normal minimum slope.

4. The method according to claim 1, wherein the target image is a transport box image, and the target information includes box net weight information; The step of determining a target area of ​​the target information to be extracted in the target image includes: Performing character recognition on the transport box image to obtain one or more character strings in the transport box image; Finding a first character string matching a preset net weight key character from the one or more character strings; According to the sequence of the one or more character strings in the transport box image, searching for a second character string that matches a preset maximum weight key character in the character string preceding the first character string; Calculating a net weight character boundary according to a preset relative position calculation rule of a net weight character boundary relative to the coordinates of the first character string and the coordinates of the second character string; Based on the net weight character boundary, a target area of ​​the target information in the transport box image is determined.

5. The method according to claim 4, wherein the preset character extraction condition comprises: Net weight character type condition, net weight character quantity condition and net weight character value range condition; The extracting the target information based on the preset character extraction condition corresponding to the character to be extracted includes: According to the net weight character type condition, the net weight character quantity condition and the net weight character value range condition, the box net weight information is extracted from the characters to be extracted.

6. The method according to claim 4, further comprising: According to the sequence of the one or more character strings in the transport image, the character string before the second character string is used as the transport box number text to be extracted; Finding a third character string that satisfies a preset transport box code character extraction condition from the transport box number to be extracted text, and extracting the transport box code from the third character string, wherein the preset transport box code character extraction condition includes: a transport box code character type condition and a condition on the number of characters that meet the transport box code character type condition; A fourth character string satisfying a preset character extraction condition for the transport box number is found from the text to be extracted from the transport box number, and the transport box number is extracted from the fourth character string. The preset character extraction condition for the transport box number includes: a transport box number character type condition and a condition on the number of characters satisfying the character type condition for the transport box number.

7. The method according to claim 6, further comprising: If the transport box code and the transport box number are extracted, the transport box code and the transport box number are combined to obtain the transport box code and box number information; Based on the pre-set number of digits of the transport box code number information, the code box number value to be verified and the actual verification value are obtained; Utilizing the code box number value to be verified and the preset verification value calculation rule, the value to be verified is calculated; The value to be verified is compared with the actual verification value. If they are consistent, the coded box number value to be verified and the actual verification value are combined to obtain the verified transport box coded box number information. If they are inconsistent, the coded limit value to be verified and the value to be verified are combined to obtain the verified transport box coded box number information.

8. The method according to claim 6, further comprising: If the third character string that meets the preset transport box code character extraction condition is not found, the fifth character string is added to the code temporary storage list, and the fifth character string is any character string of the one or more character strings or a character string that meets the transport box code pending condition; If the fourth character string that meets the preset transport container number character extraction condition is not found, the sixth character string is added to the temporary container number storage list, where the sixth character string is any one of the one or more character strings or a character string that meets the transport container number pending condition; Traversing the temporary code storage list, for any fifth character string, based on a preset error code character replacement rule, replacing a preset first character in any fifth character string with a preset second character to obtain a replaced fifth character string, and if the replaced fifth character string meets the preset transport box code character extraction condition, extracting the transport box code from the replaced fifth character string; The temporary storage list of container numbers is traversed, and for any sixth character string, based on the preset wrong container number character replacement rule, the preset third character in any sixth character string is replaced with the preset fourth character to obtain a replaced sixth character string; if the replaced sixth character string meets the preset transport container number character extraction condition, the transport container number is extracted from the replaced sixth character string.

9. A system for obtaining transport box information, comprising: Transport box image acquisition end, robotic process automation server end, information extraction end and client end; The transport box image acquisition end is configured to acquire the transport box image and send the transport box image to the robotic process automation service end; The robotic process automation server is configured to, in response to receiving the transport box image, send the transport box image to the information extraction terminal, obtain target information returned by the information extraction terminal, and send the target information to the client; The information extraction end is configured to receive the transport box image sent by the robotic process automation server, apply the method for obtaining image information as described in any one of claims 1 to 8, extract target information from the transport box image, and return the target information to the robotic process automation server.

10. A computing device comprising: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer program / instructions are executed by the processor, the steps of the method for acquiring image information according to any one of claims 1 to 8 are implemented.

11. A computer-readable storage medium storing a computer program / instruction, wherein the computer program / instruction, when executed by a processor, implements the steps of the method for acquiring image information according to any one of claims 1 to 8.

12. A computer program product, comprising a computer program / instruction, which, when executed by a processor, implements the steps of the method for acquiring image information according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Container number identification method and device, and electronic device

    CN107832767A

  • Convolutional neural network classification-based container number recognition method

    CN108596166A

  • Container door image automatic identification method

    CN111144309A

  • Table image character intelligent identification method and device and storage medium

    CN116229476A

  • Area extracting method and apparatus

    IN201627007546A