CN107992869A - For tilting the method, apparatus and electronic equipment of word correction - Google Patents

For tilting the method, apparatus and electronic equipment of word correction Download PDF

Info

Publication number
CN107992869A
CN107992869A CN201610945094.9A CN201610945094A CN107992869A CN 107992869 A CN107992869 A CN 107992869A CN 201610945094 A CN201610945094 A CN 201610945094A CN 107992869 A CN107992869 A CN 107992869A
Authority
CN
China
Prior art keywords
image
text
standard deviation
correction
current
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201610945094.9A
Other languages
Chinese (zh)
Other versions
CN107992869B (en
Inventor
杨青
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
SuperD Co Ltd
Shenzhen Super Technology Co Ltd
Original Assignee
Shenzhen Super Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Super Technology Co Ltd filed Critical Shenzhen Super Technology Co Ltd
Priority to CN201610945094.9A priority Critical patent/CN107992869B/en
Publication of CN107992869A publication Critical patent/CN107992869A/en
Application granted granted Critical
Publication of CN107992869B publication Critical patent/CN107992869B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/14Image acquisition
    • G06V30/146Aligning or centring of the image pick-up or image-field
    • G06V30/1475Inclination or skew detection or correction of characters or of image to be recognised
    • G06V30/1478Inclination or skew detection or correction of characters or of image to be recognised of characters or characters lines
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/26Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion
    • G06V10/267Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion by performing operations on regions, e.g. growing, shrinking or watersheds
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/28Character recognition specially adapted to the type of the alphabet, e.g. Latin alphabet
    • G06V30/287Character recognition specially adapted to the type of the alphabet, e.g. Latin alphabet of Kanji, Hiragana or Katakana characters
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/28Character recognition specially adapted to the type of the alphabet, e.g. Latin alphabet
    • G06V30/293Character recognition specially adapted to the type of the alphabet, e.g. Latin alphabet of characters other than Kanji, Hiragana or Katakana

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Character Input (AREA)
  • Editing Of Facsimile Originals (AREA)
  • Image Processing (AREA)

Abstract

The present invention provides a kind of side, device and electronic equipment for being used to tilt word correction.The described method includes:Obtain the bianry image of image to be corrected;Image slant correction is carried out to the bianry image, the line of text in the bianry image is rotated to the first preset direction, image after being corrected;Line of text segmentation is carried out to image after the correction, cuts and selects multiple text images, there are a line of text in each of which text image;Shear Transform is carried out to the text image, is second preset direction vertical with the first preset direction by character transformation inclined in the text image, obtains image to be read.When this method can be solved using determining that text line space carries out slant correction line by line, the problem of inefficiency.

Description

For tilting the method, apparatus and electronic equipment of word correction
Technical field
The present invention relates to technical field of electronic equipment, refer in particular to a kind of method, apparatus for being used to tilt word correction and Electronic equipment.
Background technology
At present, when optical character identification is carried out to scanned document, photo, video image frame etc., can usually meet Cause the situation of the line of text and character tilt in image to italic printing type face and because of projection imaging.Due to image text Inclined line of text and character can cause character to be difficult to split in part, cause difficulty to follow-up optical character identification, therefore It must be corrected before carrying out character recognition to tilting word.
It is that cutting side is used to the line of text of single file used by being corrected in prior art image file into line tilt word Formula, it is necessary to determine text line space line by line, efficiency is more low, and necessarily requires the spacing between the line of text in image file Substantially, and for there is adhesion between line of text, applied to the ineffective of character correction.
The content of the invention
The purpose of technical solution of the present invention is to provide a kind of side, device and electronic equipment for being used to tilt word correction, solution When certainly the prior art using determining that text line space carries out slant correction line by line, the problem of inefficiency.
The present invention provides a kind of method for being used to tilt word correction, wherein, the described method includes:
Obtain the bianry image of image to be corrected;
Image slant correction is carried out to the bianry image, the line of text in the bianry image is rotated to first and is preset Direction, image after being corrected;
Line of text segmentation is carried out to image after the correction, cuts and selects multiple text images, deposited in each of which text image In a line of text;
Shear Transform is carried out to the text image, is and the by character transformation inclined in the text image The second vertical preset direction of one preset direction, obtains image to be read.
Preferably, method described above, wherein, it is described that image slant correction is carried out to the bianry image, by described in Line of text in bianry image is rotated to the first preset direction, is included after being corrected the step of image:
The bianry image is subjected to different angle rotation in predetermined angular range;
The bianry image after each rotation is projected on the second preset direction;
The bianry image obtains projection ordered series of numbers when being projected on the second preset direction after calculating rotation every time Standard deviation;
Determine when the standard deviation is maximum the bianry image after corresponding rotation, be image after the correction.
Preferably, method described above, wherein, it is described that the bianry image is carried out to difference in predetermined angular range The step of angle rotates includes:
Set the bianry image and carry out the rotating predetermined angular range of angle as [θ 1, θ 2], wherein θ 1<θ2;
Determine that it is s1 and present rotation angel degree t1=θ 1 to carry out the rotating adjusting step of angle;
Initial rotation is carried out with the present rotation angel degree t1=θ 1, the present rotation angel degree t1 is increased into the adjustment Step-length s1 obtains numerical value, is assigned to the present rotation angel degree t1 and is rotated next time, wherein t1+s1≤θ 2.
Preferably, method described above, wherein, the bianry image is in the second default side after the calculating rotates every time Upwards when being projected, after the step of obtaining the standard deviation for projecting ordered series of numbers, the method further includes:
By the standard deviation std of the bianry image after current rotation compared with current maximum standard deviation maxstd;
If the standard deviation std of the bianry image is more than the current maximum standard deviation maxstd after current rotation, will The standard deviation std of the bianry image is assigned to the current maximum standard deviation maxstd after current rotation, by present rotation angel degree T1 is assigned to an image slant correction angle [alpha], and is rotated next time;
If the standard deviation std of the bianry image is less than or equal to the current maximum standard deviation maxstd after current rotation, Then the current maximum standard deviation maxstd and described image slant correction angle [alpha] remain unchanged;
Wherein, when carrying out initial rotation, the current maximum standard deviation maxstd is zero, described image slant correction angle It is zero to spend α.
Preferably, method described above, wherein, the bianry image is being subjected to different angles in predetermined angular range Spend it is rotating during, obtain numerical value if the present rotation angel degree t1 increases the adjusting step s1 and be more than θ 2, stop Angle rotation is carried out to the bianry image;
Wherein, the bianry image after corresponding rotation when the definite standard deviation is maximum, to scheme after the correction The step of picture, includes:
Extract current described image slant correction angle [alpha];
Determine when the bianry image rotates current described image slant correction angle [alpha] the two-value after corresponding rotation Image, is image after the correction.
Preferably, method described above, wherein, it is described that Shear Transform is carried out to the text image, by the text The character transformation of the inclined word is second preset direction vertical with the first preset direction in image, is treated The step of reading image includes:
The text image is being made a reservation for cut the Shear Transform for carrying out the first preset direction, different tangent values in the range of value;
The text image after each progress Shear Transform is projected on the first preset direction;
The text image after carrying out Shear Transform every time is calculated, when being projected on the first preset direction, to be thrown The standard deviation of shadow ordered series of numbers;
Determine when the standard deviation is maximum the text image after corresponding Shear Transform, be the image to be read.
Preferably, method described above, wherein, it is described that the text image is carried out in the range of predetermined tangent value One preset direction, different tangent value Shear Transform the step of include:
Set the text image carry out the first preset direction, different tangent values Shear Transform the predetermined tangent value Scope is [k1, k2], wherein -1<k1<k2<1;
The adjusting step for determining to carry out Shear Transform is s2 and current tangent value t2 is k1;
Initial Shear Transform is carried out with the current tangent value t2=k1, the current tangent value t2 is increased into the adjustment Step-length s2 obtains numerical value, is assigned to the current tangent value t2, carries out Shear Transform, wherein t2+s2≤k2 next time.
Preferably, method described above, wherein, the text image is the after the calculating carries out Shear Transform every time When being projected on one preset direction, obtain projection ordered series of numbers standard deviation the step of after, the method further includes:
The standard deviation std of the text image after current Shear Transform and current maximum standard deviation maxstd are compared Compared with;
If the standard deviation std of the text image is more than the current maximum standard deviation maxstd after current Shear Transform, The standard deviation std of the text image after current Shear Transform is then assigned to the current maximum standard deviation maxstd, will be current Tangent value t2 is assigned to a character correction and confirms tangent value tan (β), and carries out Shear Transform next time;
If the standard deviation std of the text image is less than or equal to the current maximum standard deviation after current Shear Transform Maxstd, then the current maximum standard deviation maxstd and the character correction confirm that tangent value tan (β) remains unchanged;
Wherein, when carrying out initial Shear Transform, the current maximum standard deviation maxstd is zero, and the character correction is true It is zero to recognize tangent value tan (β).
Preferably, method described above, wherein, the text image is being carried out first in the range of predetermined tangent value Preset direction, different tangent value Shear Transform during, if the current tangent value t2 increases the adjusting step s2 institutes Obtain numerical value and be more than k2, then stop carrying out Shear Transform to the text image;
Wherein, the text image after corresponding Shear Transform, continues to be described when the definite standard deviation is maximum The step of taking image includes:
The current character correction of extraction confirms tangent value tan (β);
Determine that the text image confirms that tangent value tan (β) carries out the first preset direction with the current character correction Shear Transform when, the text image is the image to be read after corresponding Shear Transform.
Preferably, method described above, wherein, it is described that line of text segmentation is carried out to image after the correction, it is more to cut choosing The step of a text image, includes:
Image after the correction is projected on the second preset direction;
The accumulating values for projecting each pixel column are obtained, by the accumulating values compared with the first default value;
When the accumulating values are more than first default value, it is determined that corresponding pixel behavior line of text;
When the accumulating values are less than first default value, it is determined that the respective pixel behavior background row;
According to identified line of text, cut choosing and obtain the text image.
Other direction of the present invention provides a kind of device for being used to tilt word correction, wherein, described device includes:
Image processing module, for obtaining the bianry image of image to be corrected;
Line of text correction module, for carrying out image slant correction to the bianry image, by the bianry image Line of text is rotated to the first preset direction, image after being corrected;
Line of text splits module, for carrying out line of text segmentation to image after the correction, cuts and selects multiple text images, its In there are a line of text in each text image;
Character correction module, will be oblique in the text image for carrying out Shear Transform to the text image The character transformation of state is second preset direction vertical with the first preset direction, obtains image to be read.
Preferably, device described above, wherein, the line of text correction module includes:
Angle rotary unit, for the bianry image to be carried out different angle rotation in predetermined angular range;
First projection computing unit, for the bianry image after each rotation to be thrown on the second preset direction Shadow;
First standard deviation computing unit, carries out for the bianry image after calculating rotation every time on the second preset direction During projection, the standard deviation of projection ordered series of numbers is obtained;
First determination unit, the bianry image after corresponding rotation, is described during for determining that the standard deviation is maximum Image after correction.
Preferably, device described above, wherein, the angle rotary unit includes:
First setting subelement, the rotating predetermined angular range of angle is carried out as [θ for setting the bianry image 1, θ 2], wherein θ 1<θ2;
Second setting subelement, for determining that it is s1 and present rotation angel degree t1=θ to carry out the rotating adjusting step of angle 1;
Rotation performs subelement, for carrying out initial rotation with the present rotation angel degree t1=θ 1, by the current rotation Gyration t1 increases the adjusting step s1 and obtains numerical value, is assigned to the present rotation angel degree t1 and is rotated next time, Wherein t1+s1≤θ 2.
Preferably, device described above, wherein, the line of text correction module further includes:
First comparing unit, standard deviation std and current maximum standard deviation for the bianry image after currently rotating Maxstd is compared;
First execution unit, if the standard deviation std for the bianry image after currently rotating is more than the current maximum Standard deviation maxstd, then be assigned to the current maximum standard deviation by the standard deviation std of the bianry image after current rotation Maxstd, an image slant correction angle [alpha] is assigned to by present rotation angel degree t1, and is rotated next time;
Second execution unit, if the standard deviation std for the bianry image after currently rotating is current less than or equal to described Maximum standard deviation maxstd, then the current maximum standard deviation maxstd and described image slant correction angle [alpha] remain unchanged;
Wherein, when carrying out initial rotation, the current maximum standard deviation maxstd is zero, described image slant correction angle It is zero to spend α.
Preferably, device described above, wherein, the angle rotary unit further includes:
First stops determination subelement, for the bianry image to be carried out different angle rotation in predetermined angular range During turning, if the present rotation angel degree t1 increases adjusting step s1, which obtains numerical value, is more than θ 2, stop to institute State bianry image and carry out angle rotation;
Wherein, first determination unit includes:
Angle extraction subelement is corrected, for extracting current described image slant correction angle [alpha];
First correction chart is as determination subelement, for determining that the bianry image rotates current described image slant correction The bianry image after corresponding rotation during angle [alpha], is image after the correction.
Preferably, device described above, wherein, the character correction module includes:
Shear Transform unit, for the text image to be carried out to the first preset direction, no in the range of predetermined tangent value With the Shear Transform of tangent value;
Second projection computing unit, for the text image after carrying out Shear Transform every time in the first preset direction Projected;
Second standard deviation computing unit, for the text image after calculating progress Shear Transform every time in the first default side When being projected upwards, the standard deviation of projection ordered series of numbers is obtained;
Second determination unit, the text image after corresponding Shear Transform during for determining that the standard deviation is maximum, is The image to be read.
Preferably, device described above, wherein, the Shear Transform unit includes:
3rd setting subelement, carries out the first preset direction, the mistake of different tangent values is cut for setting the text image The predetermined tangent value scope of conversion is [k1, k2], wherein -1<k1<k2<1;
4th setting subelement, the adjusting step for determining to carry out Shear Transform is s2 and current tangent value t2 is k1;
Shear Transform performs subelement, for carrying out initial Shear Transform with the current tangent value t2=k1, by described in Current tangent value t2 increases the adjusting step s2 and obtains numerical value, is assigned to the current tangent value t2, carries out next time wrong Contact transformation, wherein t2+s2≤k2.
Preferably, device described above, wherein, the character correction module further includes:
Second comparing unit, for the standard deviation std of the text image after current Shear Transform and current maximum to be marked Quasi- difference maxstd is compared;
3rd execution unit, if the standard deviation std for the text image after current Shear Transform is current more than described Maximum standard deviation maxstd, then be assigned to the current maximum mark by the standard deviation std of the text image after current Shear Transform Quasi- difference maxstd, is assigned to a character correction by current tangent value t2 and confirms tangent value tan (β), and carries out Shear Transform next time;
4th execution unit, if the standard deviation std for the text image after current Shear Transform is less than or equal to described Current maximum standard deviation maxstd, then the current maximum standard deviation maxstd and the character correction confirm tangent value tan (β) Remain unchanged;
Wherein, when carrying out initial Shear Transform, the current maximum standard deviation maxstd is zero, and the character correction is true It is zero to recognize tangent value tan (β).
Preferably, device described above, wherein, the Shear Transform unit further includes:
Second stops determination subelement, for presetting the text image is carried out first in the range of predetermined tangent value Direction, different tangent value Shear Transform during, if the current tangent value t2 increases the adjusting step s2 and is obtained Numerical value is more than k2, then stops carrying out Shear Transform to the text image;
Wherein, second determination unit includes:
Tangent value extracts subelement, confirms tangent value tan (β) for extracting the current character correction;
Second correction chart is as determination subelement, for determining that the text image is confirmed just with the current character correction When cutting the Shear Transform of value tan (β) the first preset directions of progress, the text image continues to be described after corresponding Shear Transform Take image.
Preferably, device described above, wherein, the line of text segmentation module includes:
3rd projection computing unit, for image after the correction to be projected on the second preset direction;
3rd comparing unit, the accumulating values of each pixel column is projected for obtaining, by the accumulating values and first Default value is compared;
Line of text determination unit, for when the accumulating values are more than first default value, it is determined that corresponding Pixel behavior line of text;
Background row determination unit, for when the accumulating values are less than first default value, it is determined that described right Answer pixel behavior setting row;
Cut and select execution unit, for according to identified line of text, cutting choosing and obtaining the text image.
Another aspect of the present invention provides a kind of electronic equipment, wherein, including:
At least one processor;And
The memory being connected with least one processor;Wherein,
The memory storage has the instruction repertorie that can be performed by least one processor, and described instruction program is by institute State at least one processor to perform, so that at least one processor is used for:
Obtain the bianry image of image to be corrected;
Image slant correction is carried out to the bianry image, the line of text in the bianry image is rotated to first and is preset Direction, image after being corrected;
Line of text segmentation is carried out to image after the correction, cuts and selects multiple text images, deposited in each of which text image In a line of text;
Shear Transform is carried out to the text image, is and the by character transformation inclined in the text image The second vertical preset direction of one preset direction, obtains image to be read.
At least one in specific embodiment of the invention above-mentioned technical proposal has the advantages that:
It is used for the method and apparatus for tilting word correction described in the embodiment of the present invention, by overall first by image to be corrected Enterprising this line tilt correction of style of writing, line of text is rotated to the first preset direction (as being level), afterwards to including a text Capable image carries out Shear Transform, makes the character in line of text in the second preset direction (as being vertical state), using this method Text line space need not be determined line by line with device, therefore can solve the prior art must determine the character of text line space line by line The problem of trimming process inefficiency;In addition do not require intercharacter that there is clear obvious spacing using technical solution of the present invention, Recoverable adhesion character, can be applied widely, caused by the italic printing type face, projection imaging to language such as China and British, Korea Spro Character is tilted and can effectively corrected.
Brief description of the drawings
Fig. 1 shows a kind of flow diagram for the method for being used to tilt word correction described in the embodiment of the present invention;
Fig. 2 represents the flow diagram of step S120 in method shown in Fig. 1;
Fig. 3 represents the flow diagram of step S140 in method shown in Fig. 1;
Fig. 4 represents the structure diagram for being used to tilt the device of word correction described in the embodiment of the present invention;
Fig. 5 represents the structure diagram of the image processing module in described device of the embodiment of the present invention;
Fig. 6 represents the structure diagram of the line of text correction module in described device of the embodiment of the present invention;
Fig. 7 represents the structure diagram of the character correction module in described device of the embodiment of the present invention;
Fig. 8 shows the structure diagram of the line of text segmentation module in described device of the embodiment of the present invention.
Embodiment
Below in conjunction with the attached drawing in the embodiment of the present invention, the technical solution in the embodiment of the present invention is carried out clear, complete Site preparation describes, it is clear that described embodiment is only part of the embodiment of the present invention, instead of all the embodiments.It is based on Embodiment in the present invention, those of ordinary skill in the art are obtained every other without creative efforts Embodiment, belongs to the scope of protection of the invention.
As shown in fig.1, a kind of method for being used to tilt word correction described in the embodiment of the present invention, including step:
S110, obtains the bianry image of image to be corrected;
S120, carries out image slant correction to the bianry image, the line of text in the bianry image is rotated to the One preset direction, image after being corrected;
S130, carries out line of text segmentation to image after the correction, cuts and select multiple text images, each of which text image It is middle that there are a line of text;
S140, carries out Shear Transform, by character transformation inclined in the text image to the text image For second preset direction vertical with the first preset direction, image to be read is obtained.
The method for being used to tilt word correction described in the embodiment of the present invention, it is overall into style of writing by treating correction chart picture first The slant correction of the first preset direction of one's own profession (as being horizontal direction), carries out line of text segmentation, in a text being partitioned into afterwards One's own profession form text image on the basis of carry out Shear Transform so that inclined character transformation be and the first preset direction The second vertical preset direction, is such as vertical, therefore is solved during beginning without determining that text line space carries out slant correction line by line The problem of character correction process efficiency of the prior art is low.
The method of the embodiment of the present invention, above-mentioned steps S120, the line of text in bianry image is rotated to first and is preset During direction, the first preset direction therein can be horizontal direction, at this time step S140, will be inclined in text image During the character transformation of state is the second preset direction, the second preset direction therein is vertical direction;When using at this During reason mode, by the method for the invention, line of text inclined in bianry image is rotated to level, and is carried out wrong After contact transformation, the character in each line of text is vertical.
In addition, above-mentioned steps S120, during the line of text in bianry image is rotated to the first preset direction, wherein The first preset direction can be vertical direction, character transformation inclined in text image is by step S140 at this time During second preset direction, the second preset direction therein is horizontal direction;When using the processing mode, by this hair Bright the method, line of text inclined in bianry image is rotated to vertical, and the text in bianry image is in row at this time Ordered state, after carrying out Shear Transform, the character in each row text is level, perpendicular to the length direction of each row text.
Certainly, the first preset direction and the second preset direction are not limited to only horizontally and vertically direction, or other Direction.
Preferably, for the ease of the follow-up reading for tilting character after word correction, in above-mentioned steps S120, the first default side To for horizontal direction;In step S140, the second preset direction is vertical direction.
, will be using the first preset direction as level side below in relation to the specific implementation process of the method for the embodiment of the present invention Exemplified by being vertical direction to, the second preset direction, it is described.Specifically, in the method for the embodiment of the present invention, step The step of S110, the bianry image for obtaining image to be corrected, includes:
Binarization operation is carried out to the image to be corrected, obtains the bianry image of the image to be corrected.
The threshold value of binarization operation can be specifically determined using varimax (i.e. OTSU methods) between class, treats correction chart picture Carry out binarization operation processing.That is, the display pixel of image to be corrected is divided into two parts:Gray value is more than the threshold value Display pixel and gray value are less than the display pixel of the threshold value.Wherein, after binarization operation, gray value is more than the threshold value Display pixel is converted to the display pixel that white (either black) gray value is less than the threshold value and is converted to black (or white).
It is preferred that in order to obtain bianry image clear, that resolution ratio is higher, binarization operation is carried out treating correction chart picture Before, the image pretreatment operation that correction chart picture carries out image denoising and contrast stretching successively is first treated.
Further, in present invention method, after the bianry image of image to be corrected is obtained, the method is also wrapped Include:
Bianry image is marked, the character area in bianry image is labeled as the first numerical value, by bianry image Background area be labeled as second value.According to usual image processing method, graphics field and background area in bianry image It is respectively labeled as 1 and 0.In the embodiment of the present invention, character area is labeled as 1, background area is labeled as 0.
Before above-mentioned mark mode is used, the area of different colours display pixel in bianry image is counted respectively, due to The area of background area is more than the area of character area, therefore when 1 will be labeled as compared with the display pixel of small area color, will be larger When the display pixel of area color is labeled as 0, then character area is labeled as 1, background area is labeled as 0.
Due to that when the line of text in bianry image is not level, work can be handled to successive image and cause very big difficulty, Therefore need to carry out image slant correction to bianry image before word is extracted, the line of text in bianry image is corrected to water It is flat, namely step S120 is performed, image slant correction is carried out to the bianry image, the line of text in the bianry image is revolved Level is gone to, image after being corrected.
Specifically, step S120 includes:
S121, different angle rotation is carried out by the bianry image in predetermined angular range;
S122, the bianry image in the vertical direction after each rotation is projected;
S123, when the bianry image in the vertical direction is projected after calculating rotates every time, obtains projection ordered series of numbers Standard deviation;
S124, determines when the standard deviation is maximum the bianry image after corresponding rotation, is image after the correction.
Using above-mentioned processing mode, by carrying out different angle examination rotation to bianry image, determine that different angle rotates When bianry image in the vertical direction obtain when being projected projection ordered series of numbers standard deviation it is maximum when, corresponding rotation angle The angle rotated for bianry image from current state, corresponding postrotational bianry image when standard deviation is maximum, to scheme after correction Picture.
Trimming process during above-mentioned definite standard deviation maximum specifically includes the steps:
1) initial parameter setting is carried out
Set the bianry image and carry out the rotating predetermined angular range of angle as [θ 1, θ 2], wherein θ 1<θ 2, it is single Position is degree;In general, include the angle of inclination of the image of word within the specific limits, thus can rule of thumb selected digital image can Energy range of tilt angles [θ 1, θ 2], such as [- 15,15];
Determine that it is s1 and present rotation angel degree t1=θ 1 to carry out the rotating adjusting step of angle;
Current maximum standard deviation maxstd is arranged to 0, image slant correction angle [alpha] is arranged to 0;
2) image correction process is performed
By initial bianry image (this sentences Ibw and represents) rotation t1 angles, new bianry image is obtained (with Irot tables Show);
Bianry image Irot is projected to vertical direction, obtains the projection ordered series of numbers of bianry image Irot in the vertical directions Iproj;
Specifically, according to the above-mentioned mark to each display pixel in bianry image, calculate bianry image Irot and shown per a line Show the sum during projection of pixel in the vertical direction, obtain each projection ordered series of numbers Iproj;That is, by bianry image Irot The value of middle the first row display pixel is added summation, the Section 1 as projection ordered series of numbers Iproj;Again by second in bianry image Irot The value of row display pixel is added summation, the Section 2 as projection ordered series of numbers Iproj;……;Bianry image Irot is progressively scanned, directly To last column that bianry image Irot has been calculated, projection ordered series of numbers Iproj is obtained.
In the embodiment of the present invention, word segment is marked as 1 in bianry image Irot, and background parts are marked as 0, above-mentioned The projection ordered series of numbers Iproj that mode obtains, is the number for the pixel unit that word segment is corresponded in every a line.
The length of record projection ordered series of numbers Iproj is that the line number of display pixel in m, namely bianry image Irot is m, xiFor I-th of element of Iproj,To project the average value of ordered series of numbers Iproj, calculation formula is as follows:Calculate
Afterwards, according to the average value of IprojThe standard deviation std of projection ordered series of numbers Iproj is calculated, calculation formula is as follows:
The above process calculates the standard deviation std of acquisition, is also the standard deviation std of bianry image after current rotation.
Afterwards, by the standard deviation std of bianry image after current rotation compared with current maximum standard deviation maxstd, if The standard deviation std of bianry image is more than current maximum standard deviation maxstd, then bianry image after currently rotating after current rotation Standard deviation std be assigned to current maximum standard deviation maxstd, and the value of current rotation angle t1 is assigned to image slant correction Angle [alpha], is rotated next time afterwards;If the standard deviation std of bianry image is less than or equal to current maximum standard after current rotation Poor maxstd, then do not make assignment operation, namely current maximum standard deviation maxstd is remained unchanged, and image slant correction angle [alpha] is protected Hold constant.
Further, if present rotation angel degree t1 is less than θ 2, and during t1+s1≤θ 2, then institute is increased with present rotation angel degree t1 Adjusting step s1 values are stated, present rotation angel degree t1 (t1+s1 is also assigned to t1) is assigned to, re-starts and rotate next time Image correction process, obtain new postrotational bianry image;
If t1+s1>During θ 2, then current image slant correction angle [alpha] is extracted, initial bianry image rotation is current Image slant correction angle [alpha], bianry image after being rotated, for image after correction, rotated in bianry image from [θ 1, θ 2] Cheng Zhong, the standard deviation of in the vertical direction projection ordered series of numbers are maximum.
By above-mentioned execution step, the line of text in bianry image is set to rotate to level, image after being corrected.Herein On the basis of, it is further to the character in image after correction into line tilt correction, it is necessary to needing what is read in image after correction Character is intercepted, to obtain the text image for only including the character place line of text that needs are read.
Specifically, in above-mentioned steps S130, line of text segmentation is carried out to image after the correction, cuts and selects multiple text diagrams Picture, there are the step of line of text in each of which text image to include:
Image in the vertical direction after the correction is projected;
The accumulating values for projecting each pixel column are obtained, by the accumulating values compared with the first default value;
When the accumulating values are more than first default value, it is determined that corresponding pixel behavior line of text;
When the accumulating values are less than first default value, it is determined that the respective pixel behavior background row;
According to identified line of text, cut choosing and obtain the text image.
Wherein, according to identified line of text, cut in the step of choosing obtains the text image, due to an alphabetic character Usually be made of multiple respective rows of pixels (namely line of text), thus it is adjacent it is multiple be confirmed as line of text respective rows of pixels it is equal It is configured to word to be read to be expert at, each pixel column where treating reading characters carries out cutting choosing, and acquisition only includes text to be read The text image of word.
It is above-mentioned to be projected image in the vertical direction after correction, obtain the tool for projecting each pixel column accumulating values Body mode is identical with the trimming process corresponded manner of line of text in bianry image, and details are not described herein.
By above-mentioned processing mode, according to pre-set first default value, line of text and background row are distinguished Come, interception obtains the text image for only including word to be read.
Further, due in the line of text of text image, very greatly there may be italic printing type face or projecting into As the inclination of caused character, successive character can be split and identification process bring difficulty, therefore the method for the invention further includes Character transformation by the word inclined in text image is vertical, namely the step S140 of Fig. 1.
It is vertical mode by the character transformation of the word inclined in text image in the embodiment of the present invention For:The Shear Transform of horizontal direction is carried out to text image.
As shown in figure 3, specifically, in step S140, the Shear Transform of horizontal direction is carried out to the text image, by institute The character transformation for stating the word inclined in text image be it is vertical, obtain the image to be read the step of wrap Include:
The text image, is carried out the wrong shear of horizontal direction, different tangent values by S141 in the range of predetermined tangent value Change;
S142, the text image after each progress Shear Transform is projected in the horizontal direction;
S143, calculates the text image after carrying out Shear Transform every time and when being projected in the horizontal direction, is obtained Project the standard deviation of ordered series of numbers;
S144, determines when the standard deviation is maximum the text image after corresponding Shear Transform, is the figure to be read Picture.
Using above-mentioned processing mode, by carrying out horizontal direction, difference in the range of predetermined tangent value to text image The Shear Transform of tangent value, determines that text image is projected when institute in the horizontal direction after the Shear Transform of different tangent values When obtaining the standard deviation maximum of projection ordered series of numbers, the image after corresponding Shear Transform is image to be read.
Above-mentioned carry out horizontal direction, the process of Shear Transform of different tangent value specifically include the steps:
1) initial parameter setting is carried out
Set the text image carry out horizontal direction, different tangent values Shear Transform the predetermined tangent value scope For [k1, k2], wherein -1<k1<k2<1;In general, the angle of inclination of character in line of text is within the specific limits, therefore can basis Experience selectes the tangent value scope [k1, k2] at character angle of inclination, such as such as [- 0.3,0.3];
Required according to correction accuracy, the adjusting step s2 and current tangent value t2 for determining to carry out tangent value change are k1;
Current maximum standard deviation maxstd is arranged to 0, a character correction is confirmed that tangent value tan (β) is arranged to 0.
2) Shear Transform process is performed
To initial text image, namely only including the image after the word to be translated, (this sentences Itext tables for interception Show), the Shear Transform in horizontal direction is done, the display pixel coordinate correspondence of Shear Transform is:
Obtain image Ishear, wherein x after Shear Transformnew, ynewRespectively shown after Shear Transform in image Ishear The coordinate of pixel X-direction and Y-direction, xold, yoldThe seat of display pixel X-direction and Y-direction in image respectively before Shear Transform Mark.
Image Ishear after Shear Transform is projected in the horizontal direction, image Ishear is in level side after obtaining Shear Transform Upward projection ordered series of numbers Iproj;
Specifically, according to the mark to each display pixel in bianry image, image Ishear is each after calculating Shear Transform Sum when row display pixel projects in the horizontal direction, obtains each projection ordered series of numbers Iproj;That is, by Shear Transform The value of first row display pixel is added summation in image Ishear afterwards, the Section 1 as projection ordered series of numbers Iproj;By Shear Transform The value of secondary series display pixel is added summation in image Ishear afterwards, the Section 2 as projection ordered series of numbers Iproj;……;By column Image Ishear after scanning Shear Transform, last row of image Ishear, obtain projection number after Shear Transform has been calculated Arrange Iproj.
In the embodiment of the present invention, word segment is marked as 1 in image Ishear after Shear Transform, and background parts are labeled For 0.The projection ordered series of numbers Iproj that aforesaid way obtains, is the number for the pixel unit that word segment is corresponded in each row.
The length of record projection ordered series of numbers Iproj is that the columns of display pixel in image Ishear after m, namely Shear Transform is M, xi are i-th of element of Iproj,To project the average value of ordered series of numbers Iproj, calculation formula is as follows:
Afterwards, according to the average value of IprojThe standard deviation std of projection ordered series of numbers Iproj is calculated, calculation formula is as follows:
The above process calculates the standard deviation std of acquisition, also after as current Shear Transform text image Ishear mark Quasi- difference std.
Afterwards, by the standard deviation std of text image Ishear after current Shear Transform and current maximum standard deviation maxstd It is compared, will be current if the standard deviation std of text image is more than current maximum standard deviation maxstd after current Shear Transform The standard deviation std of text image Ishear is assigned to current maximum standard deviation maxstd after Shear Transform, and by current tangent value t2 Value be assigned to character correction and confirm tangent value tan (β), carry out the Shear Transform of horizontal direction next time afterwards;If current mistake is cut The standard deviation std of text image Ishear is less than or equal to current maximum standard deviation maxstd after conversion, then does not make assignment operation, I.e. current maximum standard deviation maxstd is remained unchanged, and character correction confirms that tangent value tan (β) is remained unchanged.
Further, if current tangent value t2 is less than k2, and during t2+s2≤k2, then the tune is increased with current tangent value t2 The long s2 values of synchronizing, are assigned to current tangent value t2 (t2+s2 also is assigned to t2), re-start rotating mistake next time and cut Conversion process, obtains image after new Shear Transform;
If t2+s2>During k2, then extract current character correction and confirm tangent value tan (β), to initial text image with Current character correction confirms that tangent value tan (β) carries out the Shear Transform of horizontal direction, obtains text diagram after Shear Transform Picture, is image to be read.The image to be read makees horizontal direction mistake shear for original text image with [k1, k2] angular range When changing, the standard deviation for projecting ordered series of numbers in the horizontal direction is maximum.
Specifically, initial text image and the pixel coordinate correspondence of display pixel in image to be read are:
Wherein xnew, ynewImage namely character respectively to be read have been corrected to without display pixel X in image when tilting Direction and the coordinate of Y-direction, xold, yoldThe coordinate of display pixel X-direction and Y-direction in respectively initial text image, tan () confirms tangent value tan (β) for character correction last during above-mentioned Shear Transform.
According to above-mentioned mode and process, the image to be read that character is switched to no heeling condition is obtained, this is to be read Image can be used for the segmentation and reading of further character.
Described in the embodiment of the present invention be used for tilt word correction method, can be used for read when word translation, when with In the reading process of family, the image of scene within sweep of the eye is read by shooting user, it is indicated when obtaining user's reading to need to turn over Instruction image during a wherein word is translated, by image analysis technology, determines the word indicated by user, and further use The method that word correction is tilted described in the embodiment of the present invention, text line tilt correction, user are carried out by captured instruction image Line of text where indicated word is intercepted, and the image progress horizontal direction mistake to line of text where indicated word is cut After conversion, it is no heeling condition that can make indicated text conversion, in order to the identification and translation of the follow-up indication character.
Certainly, the method for being used to tilt word correction described in the embodiment of the present invention, however it is not limited to be only applied to above-mentioned make With scene, this method can be applied to a variety of need in one image file of extraction and identification during character.
The method for being used to tilt word correction described in the embodiment of the present invention, can be by the inclination word school in image to be corrected Just it is being nonangular word, in order to follow-up character separation and character recognition.Due to using the method for the invention, first will Image to be corrected carries out text line tilt correction on the whole, and line of text is rotated to level, afterwards to including line of text Image carries out Shear Transform, and it is in vertical state to make the character in line of text, does not require intercharacter to have using this method clear bright Aobvious spacing, recoverable adhesion character, can be applied widely, italic printing type face, projection to language such as China and British, Korea Spro Character caused by imaging is tilted and can effectively corrected.
On the other hand the embodiment of the present invention also provides a kind of device for being used to tilt word correction, as shown in fig.4, described Device includes:
Image processing module 100, for obtaining the bianry image of image to be corrected;
Line of text correction module 200, for carrying out image slant correction to the bianry image, by the bianry image Line of text rotate to the first preset direction, image after being corrected;
Line of text splits module 300, for carrying out line of text segmentation to image after the correction, cuts and selects multiple text diagrams Picture, there are a line of text in each of which text image;
Character correction module 400, will be inclined in the text image for carrying out Shear Transform to the text image The character transformation of state is second preset direction vertical with the first preset direction, obtains image to be read.
Below using the first preset direction as horizontal direction, the second preset direction be vertical direction exemplified by, to above-mentioned each module 26S Proteasome Structure and Function be described in detail.
It is used for the device for tilting word correction described in the embodiment of the present invention, by first carrying out image to be corrected on the whole Text line tilt correction, line of text is rotated to level, Shear Transform is carried out to the image including a line of text afterwards, makes text Character in one's own profession is in vertical state, does not require intercharacter to have clear obvious spacing, recoverable adhesion word using the device Symbol, can be applied widely, and character caused by the italic printing type face, projection imaging to language such as China and British, Korea Spro tilts equal energy Effectively correct, be furthermore possible to solve the problems, such as that the character correction process efficiency of the prior art is low.
As shown in fig.5, in described device of the embodiment of the present invention, described image processing module 100 includes:
First pretreatment unit, for carrying out binarization operation to the image to be corrected, obtains the image to be corrected Bianry image.
The threshold value of binarization operation can be specifically determined using varimax (i.e. OTSU methods) between class, treats correction chart picture Carry out binarization operation processing.That is, the display pixel of image to be corrected is divided into two parts:Gray value is more than the threshold value Display pixel and gray value are less than the display pixel of the threshold value.Wherein, after binarization operation, gray value is more than the threshold value Display pixel is converted to the display pixel that white (either black) gray value is less than the threshold value and is converted to black (or white).
It is preferred that described image processing module 100 further includes:
Second pretreatment unit, for before binarization operation is carried out to the image to be corrected, to described to be corrected Image carries out denoising and contrast stretching processing respectively.
Before treating correction chart picture and carrying out binarization operation, image denoising and right is carried out successively by treating correction chart picture Stretched than degree, to obtain bianry image clear, that resolution ratio is higher.
On the other hand, as shown in fig.6, the line of text correction module 200 includes:
Angle rotary unit, for the bianry image to be carried out different angle rotation in predetermined angular range;
First projection computing unit, for the bianry image in the vertical direction after each rotation to be projected;
First standard deviation computing unit, is projected for the bianry image in the vertical direction after calculating rotation every time When, obtain the standard deviation for projecting ordered series of numbers;
First determination unit, the bianry image after corresponding rotation, is described during for determining that the standard deviation is maximum Image after correction.
Using above-mentioned processing unit, by carrying out different angle examination rotation to bianry image, determine that different angle rotates When bianry image in the vertical direction obtain when being projected projection ordered series of numbers standard deviation it is maximum when, corresponding rotation angle The angle rotated for bianry image from current state, corresponding postrotational bianry image when standard deviation is maximum, to scheme after correction Picture.
It is preferred that the angle rotary unit includes:
First setting subelement, the rotating predetermined angular range of angle is carried out as [θ for setting the bianry image 1, θ 2], wherein θ 1<θ2;
Second setting subelement, for determining that it is s1 and present rotation angel degree t1=θ to carry out the rotating adjusting step of angle 1;
Rotation performs subelement, for carrying out initial rotation with the present rotation angel degree t1=θ 1, by the current rotation Gyration t1 increases the adjusting step s1 and obtains numerical value, is assigned to the present rotation angel degree t1 and is rotated next time, Wherein t1+s1≤θ 2.
It is preferred that the line of text correction module further includes:
First comparing unit, standard deviation std and current maximum standard deviation for the bianry image after currently rotating Maxstd is compared;
First execution unit, if the standard deviation std for the bianry image after currently rotating is more than the current maximum Standard deviation maxstd, then be assigned to the current maximum standard deviation by the standard deviation std of the bianry image after current rotation Maxstd, an image slant correction angle [alpha] is assigned to by present rotation angel degree t1, and is rotated next time;
Second execution unit, if the standard deviation std for the bianry image after currently rotating is current less than or equal to described Maximum standard deviation maxstd, then the current maximum standard deviation maxstd and described image slant correction angle [alpha] remain unchanged;
Wherein, when carrying out initial rotation, the current maximum standard deviation maxstd is zero, described image slant correction angle It is zero to spend α.
It is preferred that the angle rotary unit further includes:
First stops determination subelement, for the bianry image to be carried out different angle rotation in predetermined angular range During turning, if the present rotation angel degree t1 increases adjusting step s1, which obtains numerical value, is more than θ 2, stop to institute State bianry image and carry out angle rotation;
Wherein, first determination unit includes:
Angle extraction subelement is corrected, for extracting current described image slant correction angle [alpha];
First correction chart is as determination subelement, for determining that the bianry image rotates current described image slant correction The bianry image after corresponding rotation during angle [alpha], is image after the correction.
Line of text correction module 200 including said structure, more than the specific process for carrying out line of text correction can refer to The description as described in method part.By this article one's own profession correction module 200, the line of text in bianry image is rotated to level, obtain Image after must correcting.
On the other hand, as shown in fig. 7, the character correction module 400 includes:
Shear Transform unit, for the text image to be carried out to horizontal direction, difference in the range of predetermined tangent value just Cut the Shear Transform of value;
Second projection computing unit, carries out in the horizontal direction for the text image after carrying out Shear Transform every time Projection;
Second standard deviation computing unit, for the text image after calculating progress Shear Transform every time in the horizontal direction When being projected, the standard deviation of projection ordered series of numbers is obtained;
Second determination unit, the text image after corresponding Shear Transform during for determining that the standard deviation is maximum, is The image to be read.
Specifically, the Shear Transform unit includes:
3rd setting subelement, for set the text image carry out horizontal direction, different tangent values Shear Transform The predetermined tangent value scope be [k1, k2], wherein -1<k1<k2<1;
4th setting subelement, the adjusting step for determining to carry out Shear Transform is s2 and current tangent value t2 is k1;
Shear Transform performs subelement, for carrying out initial Shear Transform with the current tangent value t2=k1, by described in Current tangent value t2 increases the adjusting step s2 and obtains numerical value, is assigned to the current tangent value t2, carries out next time wrong Contact transformation, wherein t2+s2≤k2.
Specifically, the character correction module further includes:
Second comparing unit, for the standard deviation std of the text image after current Shear Transform and current maximum to be marked Quasi- difference maxstd is compared;
3rd execution unit, if the standard deviation std for the text image after current Shear Transform is current more than described Maximum standard deviation maxstd, then be assigned to the current maximum mark by the standard deviation std of the text image after current Shear Transform Quasi- difference maxstd, is assigned to a character correction by current tangent value t2 and confirms tangent value tan (β), and carries out Shear Transform next time;
4th execution unit, if the standard deviation std for the text image after current Shear Transform is less than or equal to described Current maximum standard deviation maxstd, then the current maximum standard deviation maxstd and the character correction confirm tangent value tan (β) Remain unchanged;
Wherein, when carrying out initial Shear Transform, the current maximum standard deviation maxstd is zero, and the character correction is true It is zero to recognize tangent value tan (β).
Specifically, the Shear Transform unit further includes:
Second stops determination subelement, for the text image to be carried out level side in the range of predetermined tangent value To, different tangent value Shear Transform during, if the current tangent value t2 increases the adjusting step s2 and obtains number Value is more than k2, then stops carrying out Shear Transform to the text image;
Wherein, second determination unit includes:
Tangent value extracts subelement, confirms tangent value tan (β) for extracting the current character correction;
Second correction chart is as determination subelement, for determining that the text image is confirmed just with the current character correction When cutting the Shear Transform of value tan (β) progress horizontal directions, the text image is the figure to be read after corresponding Shear Transform Picture.
In described device of the embodiment of the present invention, include the character correction module of said structure, pass through horizontal direction mistake shear Change, character is switched to no heeling condition, for use in the segmentation and reading of further character.Specifically carry out level side To the specific implementation procedure of Shear Transform, the description of above method part can be referred to, details are not described herein.
Further, as shown in fig.8, line of text segmentation module 300 includes:
3rd projection computing unit, for image in the vertical direction after the correction to be projected;
3rd comparing unit, for obtain project after each pixel column accumulating values, by the accumulating values and the One default value is compared;
Line of text determination unit, for when the accumulating values are more than first default value, it is determined that corresponding Pixel behavior line of text;
Background row determination unit, for when the accumulating values are less than first default value, it is determined that described right Answer pixel behavior setting row;
Cut and select execution unit, for according to identified line of text, cutting choosing and obtaining the text image.
The line of text segmentation module of said structure, according to pre-set first default value, by line of text and background row Distinguish, interception obtains the corresponding text image of each line of text, for text image corresponding to follow-up each line of text Horizontal direction Shear Transform, the character in line of text is switched to no heeling condition.
Another aspect of the present invention provides a kind of electronic equipment, including:
At least one processor;And
The memory being connected with least one processor;Wherein,
The memory storage has the instruction repertorie that can be performed by least one processor, and described instruction program is by institute State at least one processor to perform, so that at least one processor is used for:
Obtain the bianry image of image to be corrected;
Image slant correction is carried out to the bianry image, the line of text in the bianry image is rotated to first and is preset Direction, image after being corrected;
Line of text segmentation is carried out to image after the correction, cuts and selects multiple text images, deposited in each of which text image In a line of text;
Shear Transform is carried out to the text image, is and the by character transformation inclined in the text image The second vertical preset direction of one preset direction, obtains image to be read.
Either a program described in the method for the present invention scheme, all can by least one processor of the electronic equipment come Memory-aided dependent instruction program is adjusted to perform completion.In description electronics portion, repeat no more.
Electronic equipment described in the embodiment of the present invention, can be applied to a variety of needs and extracts and identify character in an image file Implementation technology in.Inclination word in image to be corrected can be corrected to nonangular word by the electronic equipment, in order to Follow-up character separates and character recognition.
The above is the preferred embodiment of the present invention, it is noted that for those skilled in the art For, without departing from the principles of the present invention, some improvements and modifications can also be made, these improvements and modifications It should be regarded as protection scope of the present invention.

Claims (12)

  1. A kind of 1. method for being used to tilt word correction, it is characterised in that the described method includes:
    Obtain the bianry image of image to be corrected;
    Image slant correction is carried out to the bianry image, the line of text in the bianry image is rotated to the first default side To image after being corrected;
    Line of text segmentation is carried out to image after the correction, cuts and selects multiple text images, there are one in each of which text image A line of text;
    Shear Transform is carried out to the text image, by character transformation inclined in the text image be with it is first pre- The second vertical preset direction of set direction, obtains image to be read.
  2. 2. according to the method described in claim 1, it is characterized in that, it is described to the bianry image carry out image slant correction, Line of text in the bianry image is rotated to the first preset direction, is included after being corrected the step of image:
    The bianry image is subjected to different angle rotation in predetermined angular range;
    The bianry image after each rotation is projected on the second preset direction;
    The bianry image obtains the standard of projection ordered series of numbers when being projected on the second preset direction after calculating rotation every time Difference;
    Determine when the standard deviation is maximum the bianry image after corresponding rotation, be image after the correction.
  3. 3. according to the method described in claim 2, it is characterized in that, it is described by the bianry image in predetermined angular range into The step of row different angle rotates includes:
    Set the bianry image and carry out the rotating predetermined angular range of angle as [θ 1, θ 2], wherein θ 1<θ2;
    Determine that it is s1 and present rotation angel degree t1=θ 1 to carry out the rotating adjusting step of angle;
    Initial rotation is carried out with the present rotation angel degree t1=θ 1, the present rotation angel degree t1 is increased into the adjusting step S1 obtains numerical value, is assigned to the present rotation angel degree t1 and is rotated next time, wherein t1+s1≤θ 2.
  4. 4. according to the method described in claim 3, it is characterized in that, the bianry image is second after each rotation of the calculating When being projected on preset direction, obtain projection ordered series of numbers standard deviation the step of after, the method further includes:
    By the standard deviation std of the bianry image after current rotation compared with current maximum standard deviation maxstd;
    If the standard deviation std of the bianry image is more than the current maximum standard deviation maxstd after current rotation, will be current The standard deviation std of the bianry image is assigned to the current maximum standard deviation maxstd after rotation, and present rotation angel degree t1 is assigned To an image slant correction angle [alpha], and rotated next time;
    If the standard deviation std of the bianry image is less than or equal to the current maximum standard deviation maxstd, institute after current rotation State current maximum standard deviation maxstd and described image slant correction angle [alpha] remains unchanged;
    Wherein, when carrying out initial rotation, the current maximum standard deviation maxstd is zero, described image slant correction angle [alpha] It is zero.
  5. 5. according to the method described in claim 4, it is characterized in that, carried out by the bianry image in predetermined angular range During different angle is rotating, if the present rotation angel degree t1 increases adjusting step s1 obtains numerical value and is more than θ 2, Then stop carrying out angle rotation to the bianry image;
    Wherein, the bianry image after corresponding rotation, is image after the correction when the definite standard deviation is maximum Step includes:
    Extract current described image slant correction angle [alpha];
    Determine when the bianry image rotates current described image slant correction angle [alpha] the binary map after corresponding rotation Picture, is image after the correction.
  6. 6. according to the method described in claim 1, it is characterized in that, described carry out Shear Transform to the text image, by institute The character transformation for stating the word inclined in text image is second preset direction vertical with the first preset direction, The step of obtaining image to be read includes:
    The text image is being made a reservation for cut the Shear Transform for carrying out the first preset direction, different tangent values in the range of value;
    The text image after each progress Shear Transform is projected on the first preset direction;
    Calculate the text image after carrying out Shear Transform every time and, when being projected on the first preset direction, obtain projection number The standard deviation of row;
    Determine when the standard deviation is maximum the text image after corresponding Shear Transform, be the image to be read.
  7. 7. according to the method described in claim 6, it is characterized in that, it is described by the text image in the range of predetermined tangent value The step of Shear Transform for carrying out the first preset direction, different tangent values, includes:
    Set the text image carry out the first preset direction, different tangent values Shear Transform the predetermined tangent value scope For [k1, k2], wherein -1<k1<k2<1;
    The adjusting step for determining to carry out Shear Transform is s2 and current tangent value t2 is k1;
    Initial Shear Transform is carried out with the current tangent value t2=k1, the current tangent value t2 is increased into the adjusting step S2 obtains numerical value, is assigned to the current tangent value t2, carries out Shear Transform, wherein t2+s2≤k2 next time.
  8. 8. the method according to the description of claim 7 is characterized in that the calculating carries out the text diagram after Shear Transform every time After the step of standard deviation of ordered series of numbers is projected as when being projected on the first preset direction, obtaining, the method further includes:
    By the standard deviation std of the text image after current Shear Transform compared with current maximum standard deviation maxstd;
    If the standard deviation std of the text image is more than the current maximum standard deviation maxstd after current Shear Transform, will The standard deviation std of the text image is assigned to the current maximum standard deviation maxstd after current Shear Transform, by current tangent Value t2 is assigned to a character correction and confirms tangent value tan (β), and carries out Shear Transform next time;
    If the standard deviation std of the text image is less than or equal to the current maximum standard deviation maxstd after current Shear Transform, Then the current maximum standard deviation maxstd and the character correction confirm that tangent value tan (β) remains unchanged;
    Wherein, when carrying out initial Shear Transform, the current maximum standard deviation maxstd is zero, and the character correction confirms just It is zero to cut value tan (β).
  9. 9. according to the method described in claim 8, it is characterized in that, by the text image in the range of predetermined tangent value into The first preset direction of row, different tangent value Shear Transform during, if the current tangent value t2 increases adjustment step Long s2 obtains numerical value and is more than k2, then stops carrying out Shear Transform to the text image;
    Wherein, the text image after corresponding Shear Transform, is the figure to be read when the definite standard deviation is maximum The step of picture, includes:
    The current character correction of extraction confirms tangent value tan (β);
    Determine that the text image confirms that tangent value tan (β) carries out the mistake of the first preset direction with the current character correction During contact transformation, the text image is the image to be read after corresponding Shear Transform.
  10. 10. according to the method described in claim 1, it is characterized in that, it is described to after the correction image carry out line of text segmentation, Cutting the step of selecting multiple text images includes:
    Image after the correction is projected on the second preset direction;
    The accumulating values for projecting each pixel column are obtained, by the accumulating values compared with the first default value;
    When the accumulating values are more than first default value, it is determined that corresponding pixel behavior line of text;
    When the accumulating values are less than first default value, it is determined that the respective pixel behavior background row;
    According to identified line of text, cut choosing and obtain the text image.
  11. 11. a kind of device for being used to tilt word correction, it is characterised in that described device includes:
    Image processing module, for obtaining the bianry image of image to be corrected;
    Line of text correction module, for carrying out image slant correction to the bianry image, by the text in the bianry image Row rotation is to the first preset direction, image after being corrected;
    Line of text splits module, for carrying out line of text segmentation to image after the correction, cuts and selects multiple text images, wherein often There are a line of text in one text image;
    Character correction module, will be inclined in the text image for carrying out Shear Transform to the text image Character transformation is second preset direction vertical with the first preset direction, obtains image to be read.
  12. 12. a kind of electronic equipment, it is characterised in that including:
    At least one processor;And
    The memory being connected with least one processor;Wherein,
    The memory storage has an instruction repertorie that can be performed by least one processor, described instruction program by it is described extremely A few processor performs, so that at least one processor is used for:
    Obtain the bianry image of image to be corrected;
    Image slant correction is carried out to the bianry image, the line of text in the bianry image is rotated to the first default side To image after being corrected;
    Line of text segmentation is carried out to image after the correction, cuts and selects multiple text images, there are one in each of which text image A line of text;
    Shear Transform is carried out to the text image, by character transformation inclined in the text image be with it is first pre- The second vertical preset direction of set direction, obtains image to be read.
CN201610945094.9A 2016-10-26 2016-10-26 Method and device for correcting tilted characters and electronic equipment Active CN107992869B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610945094.9A CN107992869B (en) 2016-10-26 2016-10-26 Method and device for correcting tilted characters and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610945094.9A CN107992869B (en) 2016-10-26 2016-10-26 Method and device for correcting tilted characters and electronic equipment

Publications (2)

Publication Number Publication Date
CN107992869A true CN107992869A (en) 2018-05-04
CN107992869B CN107992869B (en) 2020-09-22

Family

ID=62028772

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610945094.9A Active CN107992869B (en) 2016-10-26 2016-10-26 Method and device for correcting tilted characters and electronic equipment

Country Status (1)

Country Link
CN (1) CN107992869B (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108647681A (en) * 2018-05-08 2018-10-12 重庆邮电大学 A kind of English text detection method with text orientation correction
CN108681729A (en) * 2018-05-08 2018-10-19 腾讯科技(深圳)有限公司 Text image antidote, device, storage medium and equipment
CN110705546A (en) * 2019-09-06 2020-01-17 平安科技(深圳)有限公司 Text image angle deviation rectifying method and device and computer readable storage medium
CN111723610A (en) * 2019-03-20 2020-09-29 北京沃东天骏信息技术有限公司 Image recognition method, device and equipment
CN111967474A (en) * 2020-09-07 2020-11-20 北京凌云光技术集团有限责任公司 Projection-based text line character segmentation method and device
CN112241737A (en) * 2020-11-12 2021-01-19 瞬联软件科技(北京)有限公司 Character image correction method and device
CN112651401A (en) * 2020-12-30 2021-04-13 凌云光技术股份有限公司 Method and system for automatically correcting code-spraying characters

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104156718A (en) * 2014-08-20 2014-11-19 电子科技大学 Vehicle license plate image vertical tilt correction method
CN105069456A (en) * 2015-07-30 2015-11-18 北京邮电大学 License plate character segmentation method and apparatus
CN105426887A (en) * 2015-10-30 2016-03-23 北京奇艺世纪科技有限公司 Method and device for text image correction

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104156718A (en) * 2014-08-20 2014-11-19 电子科技大学 Vehicle license plate image vertical tilt correction method
CN105069456A (en) * 2015-07-30 2015-11-18 北京邮电大学 License plate character segmentation method and apparatus
CN105426887A (en) * 2015-10-30 2016-03-23 北京奇艺世纪科技有限公司 Method and device for text image correction

Cited By (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108681729A (en) * 2018-05-08 2018-10-19 腾讯科技(深圳)有限公司 Text image antidote, device, storage medium and equipment
CN108647681B (en) * 2018-05-08 2019-06-14 重庆邮电大学 A kind of English text detection method with text orientation correction
CN108647681A (en) * 2018-05-08 2018-10-12 重庆邮电大学 A kind of English text detection method with text orientation correction
CN111723610A (en) * 2019-03-20 2020-09-29 北京沃东天骏信息技术有限公司 Image recognition method, device and equipment
CN111723610B (en) * 2019-03-20 2024-03-08 北京沃东天骏信息技术有限公司 Image recognition method, device and equipment
CN110705546B (en) * 2019-09-06 2023-12-19 平安科技(深圳)有限公司 Text image angle deviation correcting method and device and computer readable storage medium
CN110705546A (en) * 2019-09-06 2020-01-17 平安科技(深圳)有限公司 Text image angle deviation rectifying method and device and computer readable storage medium
WO2021042509A1 (en) * 2019-09-06 2021-03-11 平安科技(深圳)有限公司 Method and apparatus for rectifying deflection of angle of text image, and computer-readable storage medium
CN111967474A (en) * 2020-09-07 2020-11-20 北京凌云光技术集团有限责任公司 Projection-based text line character segmentation method and device
CN111967474B (en) * 2020-09-07 2024-04-26 凌云光技术股份有限公司 Text line character segmentation method and device based on projection
CN112241737A (en) * 2020-11-12 2021-01-19 瞬联软件科技(北京)有限公司 Character image correction method and device
CN112241737B (en) * 2020-11-12 2024-01-26 瞬联软件科技(北京)有限公司 Text image correction method and device
WO2022100698A1 (en) * 2020-11-12 2022-05-19 瞬联软件科技(北京)有限公司 Text image correction method and apparatus
CN112651401B (en) * 2020-12-30 2024-04-02 凌云光技术股份有限公司 Automatic correction method and system for code spraying character
CN112651401A (en) * 2020-12-30 2021-04-13 凌云光技术股份有限公司 Method and system for automatically correcting code-spraying characters

Also Published As

Publication number Publication date
CN107992869B (en) 2020-09-22

Similar Documents

Publication Publication Date Title
CN107992869A (en) For tilting the method, apparatus and electronic equipment of word correction
JP4505362B2 (en) Red-eye detection apparatus and method, and program
CN107590494B (en) Answer sheet picture positioning method and device, readable storage medium and electronic equipment
CN103714327A (en) Method and system for correcting image direction
CN110647882A (en) Image correction method, device, equipment and storage medium
CN110533036B (en) Rapid inclination correction method and system for bill scanned image
CN107038440B (en) Image tilt correction device, image processing system, and image tilt correction method
WO2009094446A1 (en) Method and apparatus for cropping images
CN108133216A (en) The charactron Recognition of Reading method that achievable decimal point based on machine vision is read
CN108241859A (en) The bearing calibration of car plate and device
CN107992483A (en) The method, apparatus and electronic equipment of translation are given directions for gesture
CN107992867A (en) The method, apparatus and electronic equipment of translation are given directions for gesture
CN110288040B (en) Image similarity judging method and device based on topology verification
CN108052936A (en) A kind of braille image wing drop bearing calibration and system
CN107392203A (en) Regular picture information identifying method and system
CN114267046A (en) Method and device for correcting direction of document image
CN114463770A (en) Intelligent question-cutting method for general test paper questions
CN110610163B (en) Table extraction method and system based on ellipse fitting in natural scene
US7616837B2 (en) Image processing apparatus, image processing method, program, and storage medium
CN108710877A (en) A kind of image-pickup method
CN111079738B (en) Image processing method, system and terminal equipment
CN104408452B (en) A kind of Latin character correcting inclination method and system based on rotation projection width
CN104408430B (en) License plate positioning method and device
CN108133205B (en) Method and device for copying text content in image
CN115187989A (en) Image processing method and device, electronic equipment, scanning pen and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant