Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
According to the technical scheme of the embodiment of the invention, the character frame is arranged for the segmented character, the characteristic character string is determined by utilizing the adjacent position relation of the character frames, and the inclined angle is determined according to the characteristic character string so as to rotate the image, so that the accurate correction of the inclined image is realized by using smaller calculation amount, the correction efficiency of the inclined image is greatly improved, a basis is provided for the subsequent identification of the character in the image, and the problems of large correction calculation amount and low correction efficiency in the prior art are solved; the method has the advantages that the character features of the image are extracted for correction, and the image contour does not need to be extracted, so that the problems that in the prior art, the number of interference lines is large, and the contour cannot be extracted under a high-noise background are solved; whether the image is inverted or not is detected by judging the position of the characteristic character string in the corrected image, and then the inverted image is adjusted, so that the defect that the inverted image cannot be processed in the prior art is overcome.
Fig. 2 is a schematic diagram of the main steps of a method of tilt image correction according to an embodiment of the present invention.
As shown in fig. 2, the method for correcting a tilted image according to an embodiment of the present invention mainly includes the following steps:
step S1: characters in the image are segmented. The purpose of this step is: extracting characters in the image, and segmenting the characters by using the character frame.
In the embodiment of the present invention, before step S1, a planar rectangular coordinate system is established with the center of the image as the origin and the target direction as the X-axis direction. The target direction may be a direction pointed by a characteristic line in the corrected image, where the characteristic line is specifically a straight line having a directional effect in the image, for example: for the identity card image, a straight line on the lower side of the rectangular outline or a straight line passing through the center of the character in the "citizen identity number xxxxxxxx" can be used as the characteristic line. In the embodiment of the invention, when the image is rotated to enable the characteristic line in the image to be in the target direction, the image is in a corrected state.
Preferably, in the embodiment of the present invention, step S1 may include: characters in the image are detected, and character frames containing the characters are established according to the end points of the detected characters. The end points of the character refer to two pixel points with the maximum and minimum horizontal coordinates of the character and two pixel points with the maximum and minimum vertical coordinates of the character, and a rectangular character frame is constructed in the X, Y direction based on the four end points, so that all the pixel points of the character can be included, namely, the character is contained.
In specific application, the character segmentation can be realized by using a maximum Stable extreme area (MSER) algorithm, which can be realized by a CvExtractMSER function of an Open Source Computer vision algorithm library (Open Source Computer vision algorithm library). Before the MSER algorithm processes the image, the image needs to be gray-processed first. The specific steps of the MSER algorithm are as follows:
1. and carrying out binarization processing on the image by using different gray thresholds.
2. And acquiring a corresponding black area and a corresponding white area for the binary image obtained by each threshold value.
3. And extracting a region for keeping the shape stable within a preset gray threshold value, namely the region of the maximum stable extreme value.
4. Minimum and maximum values x1, x2, y1 and y2 of horizontal and vertical coordinates of all pixel points in the same region are extracted, and four coordinate points (x1, y1), (x1, y2), (x2, y1), (x2 and y2) are obtained through combination.
5. And 4, taking the four coordinate points in the step 4 as four corners of a rectangle, wherein all pixel points in the same area are in a rectangular character frame formed by the four points.
Fig. 3 is a schematic diagram of creating a character frame of the method for correcting a tilted image according to an embodiment of the present invention, and the above steps 4 and 5 can be referred to in fig. 3 specifically.
Step S2: at least one characteristic character string is determined from the segmented characters. The purpose of this step is: and extracting characteristic character strings for determining the inclination angle of the image based on the segmented characters and character frames.
In the embodiment of the present invention, the characteristic character string is composed of a plurality of characters each corresponding to a character box, and therefore, the characteristic character string may also be considered to be composed of character boxes corresponding to the above-mentioned characters. In specific application, the characteristic character string is a linear character string, that is, a character string composed of a plurality of characters which are adjacent and arranged along a straight line, and the linear arrangement can be as follows: the arrangement of the central points of the character frames in the character string accords with a preset linear arrangement rule, and the linear arrangement rule can be flexibly set according to actual needs.
It should be noted that, in the embodiment of the present invention, the inclination angle of the oblique image is obtained by extracting the feature character string from the oblique image and calculating the inclination angle of the feature character string, while referring to the inherent position of the character string of this content in such an image. Therefore, the present invention can correct images having the above-described characteristic character strings, such as identification cards, driver licenses, license plate numbers, and the like. For example: when the identity card image is corrected, a character string 'citizen identity number xxxxxxxx' at the bottom of the identity card can be extracted as a characteristic character string, and the inclination angle of the character string is calculated. Because the character string is in the same direction as the characteristic line of the identity card, the identity card image can be rotated by the inclination angle to realize correction.
In the embodiment of the present invention, step S2 may be executed according to the following steps:
step S21: a starting character frame is determined from the character frames of the image.
Preferably, before determining the starting character box, a grid map may be established and the position of each character box marked.
Fig. 4 is a schematic diagram of a grid construction of a method of tilt image correction according to an embodiment of the present invention.
As shown in fig. 4, the oblique image is composed of two parts, a "robust MBD 726" and a "vehicle". The grid may be first established according to a preset distance, for example, with 1.5 times of the average of the lengths of all the character boxes as the length of the grid and 1.5 times of the average of the widths of all the character boxes as the width of the grid.
After the grid is established, each character box may be numbered and the position of each character box in the grid marked. Wherein: the position of each character frame in the grid refers to the position of the center point of each character frame in the grid.
For example: the characters "lu", "M", "B", "D", "7", "2", "6", "vehicle" may be numbered 0-8 in sequence and, in combination with their positions in the grid, generate the following arrays a [ n ] ═ { (4,3, 0), (4,4, 0), (4,4, 0), (4,4, 0), (4, 5, 0), (3, 5, 0), (3, 6, 0), (3, 6, 0), (3, 6, 0) }. Wherein, n takes the value of 0-8, the first two numbers of each item in the array represent the several rows and several columns of the center point of the character frame in the grid, the third number represents the processing state of the character frame, o is unprocessed, and 1 is processed.
In the above steps, the grid is established to mark the character frames, so that the area range to be judged can be quickly limited, and only one character frame needs to be judged whether to have an adjacent character frame meeting the rule in the area range, thereby avoiding the process of judging all other character frames in the whole disc range, and remarkably improving the correction efficiency.
In the embodiment of the present invention, any character frame in the image may be selected as the starting character frame, for example: "lu" in fig. 4 is selected as a start character box to extract a feature character string.
Step S22: and selecting the character frame to be distinguished which is positioned in the neighborhood of the initial character frame and meets the preset distinguishing condition as a characteristic character frame. Wherein: the neighborhood refers to an adjacent area of the initial character frame, and in practical application, the domain range can be set according to requirements. For example: the area inside the circle with the center point of the start character frame as the center and the preset length as the radius can be used as the field. In fig. 4, if "lu" is the initial character box, the grid where it is located and the adjacent grids, i.e. squared grids (4,3), (3,2), (3,3), (3,4), (4,2), (4,4), (5,2), (5,3), (5,4) may be their neighborhoods. Generally, the character frame to be discriminated is an unprocessed character frame, and the characteristic character frame is a processed character frame.
In the embodiment of the present invention, the preset determination condition may be any one of the following two conditions:
condition 1: the transverse distance between the character frame to be distinguished and the initial character frame is smaller than a first distance threshold value, and the longitudinal center distance between the character frame to be distinguished and the initial character frame is smaller than a second distance threshold value. The lateral distance refers to the distance between the closest vertical edges of the two character boxes, the longitudinal center distance refers to the longitudinal distance between the center points of the two character boxes, and the first distance threshold and the second distance threshold can be determined according to specific environments, for example: both the first distance threshold and the second distance threshold may be set to 25% of the length of the shortest vertical side of the two character boxes.
Condition 2: the longitudinal distance between the character frame to be distinguished and the starting character frame is smaller than a third distance threshold, and the transverse center distance between the character frame to be distinguished and the starting character frame is smaller than a fourth distance threshold.
The longitudinal distance refers to the distance between the closest lateral edges of the two character boxes, the lateral center distance refers to the lateral distance between the center points of the two character boxes, and the third distance threshold and the fourth distance threshold may be determined according to specific environments, for example: the third distance threshold and the fourth distance threshold may be set to be 25% of the length of the shortest lateral side of the two character boxes.
In fig. 4, if the "lu" character frame is used as the initial character frame, it is determined whether "lu", "M", "B", and "D" in the squared box satisfy the predetermined determination condition, and if it is determined that "M" satisfies the determination condition and "B" and "D" do not satisfy the determination condition, the "lu" and "M" character frames are marked as "processed" and used as the feature character frames.
Step S23: sequentially using the obtained characteristic character frames as initial character frames, and determining character frames to be distinguished which are in the neighborhood of the initial character frames and meet preset distinguishing conditions as the characteristic character frames until no new characteristic character frames are generated; and forming a characteristic character string by using all the obtained characteristic character frames.
Specifically, in step S23, with the feature character box as the start character box, steps S22, S23 are continuously performed; when no new feature character box is generated, the feature character string is composed of all the obtained feature character boxes. The purpose of this step is: and determining all adjacent character frames meeting the judgment condition to form a characteristic character string.
In fig. 4, if the "M" character frame is a feature character frame, it is used as an initial character frame to determine whether the character frames "B", "D", "7", and "2" to be determined in the squared figure satisfy the predetermined determination condition. If "B" is satisfied and the remaining three are not, the steps S22, S23 are executed with "B" as the characteristic character box and "B" as the start character box. Thus, until all the feature boxes derived from the "lu" boxes are determined, these feature boxes constitute the feature string "lu MBD 726".
Step S24: if the character frames to be distinguished still exist in the image, determining any character frame to be distinguished as a starting character frame, and executing steps S22, S23 and S24 in sequence; thereby acquiring all the characteristic character strings in the image.
Preferably, in the embodiment of the present invention, the starting character frame may be determined according to the number sequence of the character frames, and the character frame to be determined that has been executed in step S24 is not repeatedly executed.
For example: in fig. 4, after the characteristic string "robust MBD 726" is determined, if "car" or "vehicle" is determined to be unprocessed, steps S21-S23 are repeated with "car" or "vehicle" as the starting character frame, and the characteristic string "vehicle" is determined.
Fig. 5 is a schematic diagram of the characteristic character string generation of the method for correcting the oblique image according to the embodiment of the invention, and as shown in fig. 5, two characteristic character strings "robust MBD 726" and "vehicle" in the image are determined.
Through step S2, the method for oblique image correction according to the embodiment of the present invention can extract a feature string in an oblique image for image correction.
Step S3: the image is corrected by the characteristic character string. The purpose of this step is to obtain the angle of inclination of the image through the characteristic character string, rotate the image according to the angle of inclination and thus realize the correction of the image.
In the embodiment of the present invention, step S3 may be performed according to the following steps:
step S31: and calculating each joint camber angle of any characteristic character string, and removing any characteristic character string with the camber angle smaller than a preset angle threshold. Wherein, the undulation angle specifically is: and the included angle between the central point of one character frame and the connecting line of the central points of the adjacent character frames in the characteristic character string.
Fig. 6 is a schematic view of the relief angle generation of the method of tilt image correction according to an embodiment of the present invention.
As shown in fig. 6, the relief angle can be obtained by: according to the sequence that the abscissa or ordinate of the center point of the character frame in the characteristic character string is from small to large, the center points of the character frames are connected in sequence by straight lines, and the included angle between the straight lines, which is less than 180 degrees, is the starting angle. The preset angle threshold may be set according to the application environment, and may be set to 150 °, for example. In general, for a characteristic character string arranged in the horizontal direction, straight lines may be sequentially constructed from small to large abscissa to form a relief angle, and for a characteristic character string arranged in the vertical direction, straight lines may be sequentially constructed from small to large ordinate to form a relief angle. The meaning of transverse alignment and longitudinal alignment will be described in detail later.
The purpose of this step is: by judging the fluctuation angle of the characteristic character string, the characteristic character string with larger fluctuation and influencing the correction effect is removed, so that the image correction quality is improved.
Step S32: for any characteristic character string, connecting the center points of the end character frames of the characteristic character string by straight lines, and calculating the inclination angle of the straight lines as the inclination angle of the characteristic character string. The purpose of this step is to calculate the inclination angle of each characteristic character string, and the inclination angle of the image can be obtained by integrating the inclination angles of the characteristic character strings. The inclination angle is specifically an angle corresponding to the slope of a straight line, namely, an angle formed by rotating from the positive direction of the X axis to the straight line along the counterclockwise direction. The end character boxes refer to two character boxes in the feature character string, wherein the center point coordinates are the most significant coordinates in the center point coordinates of each character box.
Step S33: and if the number of the determined characteristic character strings is 1, rotating the image according to the inclination angle of the characteristic character string to realize correction.
In an embodiment of the present invention, the tilt angle of the image may be calculated by combining the tilt angle and the target direction. In the embodiment of the invention, the target direction is the X-axis direction, and the inclination angle is the inclination angle of the image, so that the image can be corrected by rotating the inclination angle.
Step S34: when a plurality of determined characteristic character strings are provided, if the inclination angles of the characteristic character strings are judged to be all in the preset angle range or not in the preset angle range, calculating the average value of the inclination angles of the characteristic character strings, and rotating the image according to the average value of the inclination angles to realize correction.
The preset angle range can be set according to actual requirements, for example, the preset angle range is set to (-45 degrees and 45 degrees). In step S34, if it is determined whether all the feature character strings are within the preset angle range or not, and if the arrangement of the feature character strings is considered to be similar, the average value of the inclination angles of the feature character strings is calculated to perform correction.
In the embodiment of the invention, the inclination angle of the image can be calculated by combining the average value of the inclination angle and the target direction. In the embodiment of the invention, the target direction is the X-axis direction, and the average value of the inclination angles is the inclination angle of the image, so that the average value of the rotation inclination angles of the image can be corrected.
Step S35: when a plurality of determined feature character strings are determined, if the inclination angles of part of the feature character strings in the plurality of feature character strings are judged to be in the preset angle range, counting the number of the feature character strings with the inclination angles in the preset angle range and the number of the feature character strings with the inclination angles out of the preset angle range, and removing the corresponding feature character strings with smaller number.
In practical application, besides the characteristic character string corresponding to the real character in the image, the characteristic character string composed of noise points can be extracted from the image. These feature strings composed of noise points are different from the strings corresponding to real characters in direction and in small number. Step S35 can cope with this. In step S35, it is first determined whether the characteristic character string is within a preset angle range, thereby dividing the characteristic character string into two groups; and then comparing the number of the characteristic character strings contained in the two groups, determining the group with smaller number as the character string consisting of noise points, and removing the character string.
Step S36: for the remaining feature character strings, an average value of the inclination angles of the respective feature character strings is calculated, and the image is rotated based on the average value to realize correction. In step S36, the average value of the inclination angles of the character string from which the noise has been removed is calculated to correct the image.
In the embodiment of the present invention, step S3 may be further performed according to the following steps:
step S37: and connecting the character frame center points with the minimum and maximum horizontal coordinates in the characteristic character string, and calculating a linear expression y of the center point connecting line in the plane rectangular coordinate system, wherein the linear expression y is ax + b. Judging whether the value of a is between-1 and 1: if yes, determining the characteristic character string to be transversely arranged; otherwise, determining the characteristic character string to be longitudinally arranged.
Step S38: for the characteristic character strings which are transversely arranged, connecting the center points of the character frames by straight lines in sequence according to the sequence from small to large of the abscissa of the center points of the character frames to form a starting angle; for the feature character strings which are longitudinally arranged, straight lines are sequentially connected with the center points of the character frames according to the sequence that the vertical coordinates of the center points of the character frames are from small to large to form a starting angle. And removing any characteristic character string with the undulation angle smaller than a preset angle threshold value.
Step S39: judging whether the remaining characteristic character strings are transversely arranged or longitudinally arranged: if yes, calculating the average value of the dip angles of the characteristic character strings to correct the image; otherwise, one group with smaller quantity in the two groups of the transversely arranged characteristic character strings and the longitudinally arranged characteristic character strings is removed, and the average value of the inclination angles of the residual characteristic character strings is calculated to correct the image. The inclination angle of the characteristic character string is the included angle of the central point connecting line of the end point character frame of the characteristic character string. For the horizontally arranged feature strings: two end point character frames are character frames with the maximum and minimum horizontal coordinates of the central point; for a vertically arranged characteristic string: the two end character boxes are the character boxes with the maximum and minimum vertical coordinates of the center point.
Preferably, after the image is corrected, the method for correcting the oblique image according to the embodiment of the invention can determine whether the image is inverted. If it is inverted, it is rotated by 180 ° to realize inversion correction of the image. Specifically, in the embodiment of the present invention, the inversion determination process is as follows:
1. and determining the position of the character string corresponding to the correction line in the real image. For example: the 'citizen identity number xxxxxxxx' corresponding to the correction line is arranged below the identity card.
2. And determining the position of the character string in the image to be judged.
3. And (4) inversion judgment: if the two positions are the same, the two positions are not inverted; otherwise, the process is inverted. For example: if the character string in the image to be judged is above the image, judging the image to be inverted; if it is below, it is judged that there is no inversion.
Next, if the image is not inverted, it is not processed. If the image is inverted, it is rotated 180 around the center of the image to obtain the final image.
According to the oblique image correction method, the character frames are arranged for the segmented characters, the characteristic character strings are determined by utilizing the adjacent position relation of the character frames, and the inclination angle is determined according to the characteristic character strings, so that the oblique image can be accurately corrected by using a smaller calculation amount, the correction efficiency of the oblique image can be greatly improved, a basis is provided for the subsequent identification of the characters in the image, and the problems of large correction calculation amount and low correction efficiency in the prior art can be solved; because the character features of the image are extracted for correction, the image contour does not need to be extracted, and the problems that the prior art has more interference lines and cannot extract the contour under the high-noise background are solved; whether the image is inverted or not is detected by judging the position of the characteristic character string in the corrected image, and then the inverted image is adjusted, so that the defect that the inverted image cannot be processed in the prior art is overcome.
Fig. 7 is a schematic diagram of a main part of an apparatus for tilt image correction according to an embodiment of the present invention.
As shown in fig. 7, the apparatus 70 for correcting a tilted image according to an embodiment of the present invention mainly includes: a segmentation module 701, a character string extraction module 702, and a correction module 703. Wherein:
the segmentation module 701 may be used to segment characters in an image.
The string extraction module 702 may be used to determine at least one characteristic string from the segmented characters.
The correction module 703 may be configured to correct the image by the at least one characteristic string.
Preferably, the segmentation module 701 may include a detection module and a character frame creation module. Wherein:
the detection module may be used to detect characters in an image.
The character box establishing module may be configured to establish a character box containing the character according to the detected end point of the character.
As an alternative, the character string extraction module 702 may include a start character box determination module, a feature character box selection module, and a feature character string generation module. Wherein:
the starting character box determination module may be operative to determine a starting character box from character boxes of the image.
The characteristic character frame selecting module can be used for selecting a character frame to be distinguished which is positioned in the neighborhood of the initial character frame and meets a preset distinguishing condition as a characteristic character frame.
The characteristic character string generation module can be used for sequentially using the obtained characteristic character frames as initial character frames, and determining character frames to be distinguished which are in the neighborhood of the initial character frames and meet preset distinguishing conditions as the characteristic character frames until no new characteristic character frames are generated; and forming a characteristic character string by using all the obtained characteristic character frames.
In an embodiment of the present invention, the correction module 703 may include: the device comprises an inclination angle calculation module, a first correction module, a second correction module and a third correction module. Wherein:
the inclination angle calculation module can be used for connecting the central points of the end character boxes of any feature character string by a straight line and calculating the inclination angle of the straight line as the inclination angle of the feature character string.
The first correction module may be configured to, when the determined feature character strings are multiple, calculate an average value of the inclination angles of the feature character strings if it is determined that the inclination angles of the feature character strings are all within the preset angle range or are not all within the preset angle range, and rotate the image according to the average value to implement correction.
The second correction module is used for counting the number of the characteristic character strings with the inclination angles within the preset angle range and the number of the characteristic character strings with the inclination angles not within the preset angle range if the inclination angles of part of the characteristic character strings in the plurality of characteristic character strings are judged to be within the preset angle range when the determined characteristic character strings are multiple, and removing the corresponding characteristic character strings with smaller number; and calculating the average value of the inclination angles of the characteristic character strings aiming at the rest characteristic character strings, and rotating the image according to the average value to realize correction.
And the third correction module is used for rotating the image according to the inclination angle of the characteristic character string to realize correction when the determined characteristic character string is one.
In addition, the apparatus 70 for correcting a tilted image according to an embodiment of the present invention further includes an inversion adjustment module, which is configured to determine whether the corrected image is inverted according to the position of the characteristic character string in the corrected image: if so, the image is rotated 180 °.
The apparatus 70 for correcting a tilt image according to the embodiment of the present invention may be installed in a computer, a mobile terminal, or the like as software.
As can be seen from the above description, because the technical means of setting the character frame for the segmented character, determining the characteristic character string by using the adjacent position relationship of the character frame, and determining the inclination angle according to the characteristic character string is adopted, the accurate correction of the inclined image can be realized with a small amount of computation, the correction efficiency of the inclined image can be greatly improved, a basis is provided for the subsequent recognition of the character in the image, and the problems of large amount of computation for correction and low correction efficiency in the prior art can be solved; because the character features of the image are extracted for correction, the image contour does not need to be extracted, and the problems that the prior art has more interference lines and cannot extract the contour under the high-noise background are solved; whether the image is inverted or not is detected by judging the position of the characteristic character string in the corrected image, and then the inverted image is adjusted, so that the defect that the inverted image cannot be processed in the prior art is overcome.
According to the disclosed embodiment of the invention, the invention further provides electronic equipment.
The electronic device of the embodiment of the invention comprises: one or more processors; a storage device for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement the method of tilt image correction provided by the present invention.
Referring now to FIG. 8, shown is a block diagram of a computer system 800 suitable for use in implementing an electronic device of an embodiment of the present invention. The electronic device shown in fig. 8 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 8, the computer system 800 includes a Central Processing Unit (CPU)801 that can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)802 or a program loaded from a storage section 808 into a Random Access Memory (RAM) 803. In the RAM803, various programs and data necessary for the operation of the computer system 800 are also stored. The CPU801, ROM 802, and RAM803 are connected to each other via a bus 804. An input/output (I/O) interface 805 is also connected to bus 804.
The following components are connected to the I/O interface 805: an input portion 806 including a keyboard, a mouse, and the like; an output section 807 including a signal such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 808 including a hard disk and the like; and a communication section 809 including a network interface card such as a LAN card, a modem, or the like. The communication section 809 performs communication processing via a network such as the internet. A drive 810 is also connected to the I/O interface 805 as necessary. A removable medium 811 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 810 as necessary, so that a computer program read out therefrom is mounted into the storage section 808 as necessary.
In particular, the processes described in the main step diagrams above may be implemented as computer software programs, according to embodiments of the present disclosure. For example, embodiments of the invention include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the main step diagram. In the above-described embodiment, the computer program can be downloaded and installed from a network via the communication section 809 and/or installed from the removable medium 811. The computer program, when executed by the central processing unit 801, performs the above-described functions defined in the system of the present invention.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present invention may be implemented by software or hardware. The described units may also be provided in a processor, and may be described as: a processor includes a transmitting unit, an obtaining unit, a determining unit, and a first processing unit. The names of these units do not in some cases constitute a limitation to the unit itself, and for example, the sending unit may also be described as a "unit sending a picture acquisition request to a connected server".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by the apparatus, cause the apparatus to perform steps comprising: segmenting characters in the image; determining at least one characteristic character string from the segmented characters; and correcting the image through the at least one characteristic character string.
According to the technical scheme of the embodiment of the invention, the character frame is arranged for the segmented character, the characteristic character string is determined by utilizing the adjacent position relation of the character frame, and the inclination angle is determined according to the characteristic character string so as to rotate the image, so that the accurate correction of the inclined image is realized by using smaller calculation amount, the correction efficiency of the inclined image is greatly improved, a basis is provided for the subsequent identification of the character in the image, and the problems of large correction calculation amount and low correction efficiency in the prior art are solved; because the character features of the image are extracted for correction, the image contour does not need to be extracted, thereby solving the problems that the prior art has more interference lines and can not extract the contour under the high-noise background; whether the image is inverted or not is detected by judging the position of the characteristic character string in the corrected image, and then the inverted image is adjusted, so that the defect that the inverted image cannot be processed in the prior art is overcome.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.