CN103714327A - Method and system for correcting image direction - Google Patents

Method and system for correcting image direction Download PDF

Info

Publication number
CN103714327A
CN103714327A CN201310746613.5A CN201310746613A CN103714327A CN 103714327 A CN103714327 A CN 103714327A CN 201310746613 A CN201310746613 A CN 201310746613A CN 103714327 A CN103714327 A CN 103714327A
Authority
CN
China
Prior art keywords
image
rotation
bar code
described
degree
Prior art date
Application number
CN201310746613.5A
Other languages
Chinese (zh)
Other versions
CN103714327B (en
Inventor
郭丰俊
罗希平
王晓立
Original Assignee
上海合合信息科技发展有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 上海合合信息科技发展有限公司 filed Critical 上海合合信息科技发展有限公司
Priority to CN201310746613.5A priority Critical patent/CN103714327B/en
Publication of CN103714327A publication Critical patent/CN103714327A/en
Application granted granted Critical
Publication of CN103714327B publication Critical patent/CN103714327B/en

Links

Abstract

The invention provides a method and system for correcting the image direction. The method comprises the steps that whether a bar code can be detected or not in an image is judged, and if it is detected that at least one bar code exists, the image is rotated every other rotation angle within the rotation angle range with the direction angle of each bar code as the center angle; whether characters exist in the image formed after each time of rotation of the rotation angle or not is detected, if yes, the characters in the image are recognized, and after each time of rotation of the rotation angle, the corresponding character confidence coefficients are calculated and obtained; whether character confidence coefficients larger than the preset threshold value exist in the corresponding character confidence coefficients generated after each time of rotation of the rotation angle or not is judged, if yes, the image rotation angle corresponding to the highest character confidence coefficient is selected as the image correction angle, and if not, the direction angle of any bar code is selected as the image correction angle, and the image direction is corrected according to the image correction angle. The method and system can reduce the image rotation misjudgment possibility and can fast and accurately judge the correction image angle.

Description

A kind of correcting direction of image method and system

Technical field

The invention belongs to technical field of image processing, relate to a kind of bearing calibration and system, particularly relate to a kind of correcting direction of image method and system.

Background technology

21 century is epoch that are full of information, and image, as the visual basis in the human perception world, is the important means of mankind's obtaining information, expressing information and transmission of information.Along with the widespread use of the mankind to image, digital image processing techniques are also arisen at the historic moment thereupon, and so-called Digital Image Processing is exactly to utilize computing machine to process to meet people's visual psychology or the behavior of application demand to image information.Be in fact one section and can be shown and be output as by computing machine reduction the numerical code of piece image.

In recent years, the application of image correlation is increasing, and common demand has information to utilize image format to preserve, significant information etc. in image index, Images Classification, extraction image.Due to digital camera, the application of the digital imaging apparatus such as scanner is more and more extensive, and the digital camera carrying at present has become the standard configuration of the mobile devices such as mobile phone.These digital imaging apparatus are often used to scanning or take comprise text image, character image, and picture with scenes is at interior various pictures.Use habit due to scanning or photographer, shooting angle, the difference of demand, the preservation direction etc. of finding a view, browsing or post-processed, the digitized video that scanning or shooting obtain is often with 90 degree, 180 degree, or the anglecs of rotation of 270 degree, scanning or take the text image obtain especially may be with 0 degree to rotation at any angle between 360 degree, user need to use picture browsing instrument to carry out correcting image direction as acdSee, photoshop etc. when browsing such digital picture.In daily life, people need to check the image of correct direction; In commercial affairs work, the identification of all kinds of documents and filing are also needed image direction to proofread and correct.In research work, OCR identification etc., also need correct correcting direction of image.Word message can more effectively be understood picture material, so in order to understand better the Deep Semantics of picture material, Word message is an important clue.

And in present picture, not only can comprise text image, and also can include bar code, so-called bar code (particularly two-dimensional bar) just refers to the railway line existing by straight line is arranged and black and white module interlaced with each other forms.The effect of railway line is that image coordinate by obtaining each module centers is to whole correct image.

But also do not exist in prior art, can not pass through word reliability information cross validation image rotation direction again by bar code reliability information, avoid spinning solution to occur that erroneous judgement is disconnected, and export the method for the image of correct direction.

Summary of the invention

The shortcoming of prior art in view of the above, the object of the present invention is to provide a kind of correcting direction of image method and system, be used for solving prior art when image direction is incorrect, quick and precisely correcting image direction, and the problem that the disconnected sense of rotation of erroneous judgement can occur in the process of correcting image direction.

For achieving the above object and other relevant objects, one aspect of the present invention provides a kind of correcting direction of image method, comprising: the raw image data that pre-service reads, judge and bar code in pretreated image, whether detected, if, angle centered by the orientation angle of bar code, in a rotation angle range, every a default anglec of rotation, rotate an image, detect in the rear image of rotation and whether have word, if, identify word, and calculate and to rotate each time corresponding word degree of confidence after the anglec of rotation, and judge whether that existence is greater than the word degree of confidence of a predetermined threshold value, if do not exist, image direction is without correction, if exist, select image rotation angle corresponding to high confidence level, according to its correcting image direction, if not, the orientation angle of selector bar shape code, according to bar code orientation angle correcting image direction, if not, in comprehensive scope, every another default anglec of rotation, rotate an image, detect and whether have word, if, identify word, and calculate and to rotate each time corresponding word degree of confidence after another anglec of rotation, judge whether to have the word degree of confidence that is greater than a predetermined threshold value, if do not exist, image direction is without correction, if exist, select image rotation angle corresponding to high confidence level, according to its correcting image direction, if not, image direction without correction.

Preferably, judge and bar code in pretreated image, whether detected, judge and bar code in pretreated image, whether detected, if not, by [0 °, 360 °] be arranged to some sub-ranges, in each sub-range, select the another anglec of rotation, every an another anglec of rotation rotation pretreatment image, and detect and whether have word in postrotational image, if, identify word, and calculate and to rotate each time corresponding word degree of confidence after the another anglec of rotation, and judge whether that existence is greater than the word degree of confidence of a predetermined threshold value, if do not exist, image direction is without correction, if exist, select image rotation angle corresponding to high confidence level, according to its correcting image direction, if not, image direction without correction.

Preferably, described correcting direction of image method also comprises and judges whether only to exist in pretreated image a bar code, if, angle centered by the orientation angle of bar code, in a rotation angle range, every a default anglec of rotation, rotate an image, detect in the rear image of rotation and whether have word, if, identify word, and calculate and to rotate each time corresponding word degree of confidence after the anglec of rotation, and judge whether that existence is greater than the word degree of confidence of a predetermined threshold value, if do not exist, image direction is without correction, if exist, select image rotation angle corresponding to high confidence level, according to its correcting image direction, if not, the orientation angle of selector bar shape code, according to bar code orientation angle correcting image direction, if not, angle centered by the orientation angle of each bar code respectively, in a rotation angle range corresponding to each bar code, every a default anglec of rotation, rotate an image respectively, detect in the rear image of rotation and whether have word, if, identify word, and calculate and to rotate each time corresponding word degree of confidence after the anglec of rotation, and judge whether that existence is greater than the word degree of confidence of a predetermined threshold value, if do not exist, image direction is without correction, if exist, select image rotation angle corresponding to high confidence level, according to its correcting image direction, if not, select the orientation angle of arbitrary bar code, according to bar code orientation angle correcting image direction.

Preferably, described rotation angle range is [center angle-i, center angle+i], and wherein, described i is greater than 0 degree, is less than or equal to 10 degree; The described anglec of rotation is greater than 0 degree, is less than 10 degree.

Preferably, judge that the step that bar code whether detected in pretreated image comprises: the arbitrary pixel column after scanning pre-service in image; Described pixel column is done to pixels statistics, add up black and white pixel continuous in described pixel column, the ratio sequence that calculating pixel is capable; The finger URL of the described ratio sequence calculating and pre-stored all kinds of bar codes is compared, if ratio is identical, represent to detect corresponding bar code; If ratio is not identical, represent not detect bar code, continue to carry out next step; Rotate described image, return to scanning step and continue to detect.

The present invention also provides a kind of correcting direction of image system on the other hand, comprising: barcode detection module is for detection of whether there being bar code in pretreated image; Bar code orientation angle determination module, be connected with described barcode detection module, for obtaining the orientation angle of the bar code that described barcode detection module detects, obtain after the orientation angle of bar code, angle centered by orientation angle, sets the rotation angle range corresponding with bar code; The described bar code orientation angle determination module anglec of rotation that prestores; Rotary module, is connected with described bar code orientation angle determination module, for when detecting while there is bar code in rotation angle range every an image of a default anglec of rotation rotation; Described rotary module, also for when bar code not detected, rotates an image every another default anglec of rotation within the scope of full method 360 degree.Text detection module, is connected with described rotary module, for detection of whether there being word in the image rotating each time after the anglec of rotation; Word identification module, is connected with described text detection module, and while there is word for detecting when described text detection module the image rotating each time after the anglec of rotation, existing word in the image after anglec of rotation degree is rotated in identification each time; Computing module, is connected with described word identification module, for calculating and obtain and rotating each time corresponding word degree of confidence after the anglec of rotation; Comparison module, be connected with described computing module, for judge rotate each time the anglec of rotation after corresponding word degree of confidence whether there is the word degree of confidence that is greater than a predetermined threshold value, if not, after representing to rotate each time the anglec of rotation, corresponding word degree of confidence is not high, and image direction is without correction; If so, select the word degree of confidence image rotation angle of high correspondence, according to its correcting image direction.

Preferably, described corrective system also comprises image correction module, and described image correction module is connected with described comparison module, for according to described image rectification angularity correction image direction.

Preferably, described rotary module is also for pre-stored another anglec of rotation and the another anglec of rotation, be used for when described barcode detection module is not when pretreated image detects bar code, within the scope of comprehensive 360 degree, every another anglec of rotation, pretreated image is rotated, wherein, another anglec of rotation is greater than 10 degree, is less than 30 degree; Or [0 °, 360 °] is arranged to some sub-ranges, in each sub-range, adopts another anglec of rotation, every an another anglec of rotation, pretreated image is rotated.

Preferably, described corrective system also comprises for reading the image reading module of raw image data, and the pretreatment image module of view data described in pre-service.

Preferably, described bar code detecting module comprises: scanning element, for scanning arbitrary pixel column of image after pre-service; Arithmetic element, is connected with described scanning element, for adding up described pixel column, adds up black and white pixel continuous in described pixel column, the ratio sequence that calculating pixel is capable; Comparing unit, is connected with described arithmetic element, for the described ratio sequence calculating and the finger URL of pre-stored wherein each class bar code are compared, if ratio is identical, represents to detect corresponding bar code; If ratio is not identical, represent not detect bar code; Rotary unit, is connected with described comparing unit.For bar code not detected when described scanning element, rotate described image, scanning element continues the arbitrary pixel column in scan image described in re invocation.

As mentioned above, correcting direction of image method and system of the present invention, have following beneficial effect:

1, correcting direction of image method and system of the present invention are utilized bar code orientation determination image rotation direction scope, within the scope of this by the detection and Identification of word are determined to image rectification angle, can reduce image rotation erroneous judgement possibility, can quick and precisely judge correcting image direction again simultaneously

2, correcting direction of image method and system of the present invention are browsed in daily life, commercial affairs work, research work etc. to user and other later image are processed to operate convenience is provided.

Accompanying drawing explanation

Fig. 1 is shown as correcting direction of image method flow schematic diagram of the present invention.

Fig. 2 is shown as the idiographic flow schematic diagram of step 2 in correcting direction of image method of the present invention.

Fig. 3 is shown as the idiographic flow schematic diagram of step 3 in correcting direction of image method of the present invention.

Fig. 4 is shown as correcting direction of image system architecture schematic diagram of the present invention.

Fig. 5 is shown as the structural representation of image pretreatment module in correcting direction of image system of the present invention.

Fig. 6 is shown as the structural representation of bar code detection module in correcting direction of image system of the present invention.

Element numbers explanation

1 correcting direction of image system

10 image reading modules

20 image pretreatment module

30 barcode detection modules

40 bar code orientation angle determination modules

50 rotary modules

60 text detection modules

70 word identification modules

80 computing modules

90 comparison modules

100 correction modules

201 image gray processing unit

202 image denoising unit

203 image binaryzation unit

301 scanning elements

302 arithmetic elements

303 comparing units

304 rotary units

S1~S23 step

Embodiment

Below, by specific instantiation explanation embodiments of the present invention, those skilled in the art can understand other advantages of the present invention and effect easily by the disclosed content of this instructions.The present invention can also be implemented or be applied by other different embodiment, and the every details in this instructions also can be based on different viewpoints and application, carries out various modifications or change not deviating under spirit of the present invention.It should be noted that, in the situation that not conflicting, the feature in following examples and embodiment can combine mutually.

It should be noted that, the diagram providing in following examples only illustrates basic conception of the present invention in a schematic way, satisfy and only show with assembly relevant in the present invention in graphic but not component count, shape and size drafting while implementing according to reality, during its actual enforcement, kenel, quantity and the ratio of each assembly can be a kind of random change, and its assembly layout kenel also may be more complicated.

The bar code direction that first the present invention exists in detected image, and according to the possible direction range detection of bar code and identification word, angle and degree of confidence in conjunction with the direction of word and bar code, direction to image is proofreaied and correct, can also be to there is the image of head portrait in the present invention in addition, by the method for detection head picture, utilize head portrait method information correction image.If in the present embodiment without explanation, sense of rotation can be regarded as clockwise direction, but scope of the present invention is not limited to this.

Embodiment mono-

Preserving before view data or display image data browse to user, or opening the image file of having preserved, after reads image data, the view data reading is being shown to before user browses, first view data being carried out to the automatic anglec of rotation detects and automatic rotation correction, thereby the image of seeing while guaranteeing user's image browsing is through rotation correction, reduce user's have to carry out with picture browsing instrument trouble of artificial rotation correction.

The present embodiment provides a kind of correcting direction of image method, refers to Fig. 1, is shown as the flow process of correcting direction of image method, and described correcting direction of image method comprises:

S1, reads raw image data.The raw image data reading can be: with digital camera, take the view data obtaining; Or the view data obtaining by scanner scanning; Or open one and be pre-existing in the file that includes view data, read data in this document and according to canonical algorithm, decompress after the view data that obtains.

S2, the raw image data that pre-service reads.Refer to Fig. 2, be shown as pretreatment process, pre-service comprises:

S201, raw image data described in gray processing; The original image reading due to great majority is all coloured image, and coloured image storage takies than the more spaces of gray level image, deals with also much longer than gray level image.The printing bar code simultaneously existing in image is printed according to black and white mode again, so in the process of identification bar code, actual photographed to bar code image in chromatic information component for not effect of the identification of bar code, thereby coloured image need to be converted to gray level image, to reduce the operation time of subsequent operation.The color of each pixel in coloured image is determined by R, G, tri-components of B, and a kind of special coloured image that gray level image is R, G, tri-components of B are identical, the variation range of one of them pixel is 0~255.

S202, continues denoising to described view data.Because the image reading generally all can contain noise because of the interference of surrounding environment, therefore, carry out denoising to the image reading.In the present embodiment, denoising method adopts medium filtering to process.Medium filtering is the Nonlinear Processing method of noise always, and its ultimate principle is that any the value in digital picture or Serial No. is replaced with the Mesophyticum of the value of each point in a field of this point.

S203, continues binary conversion treatment to described view data.The object of image binaryzation is in order to remove background, retains as much as possible bar code symbol and reduces noise magazine in symbol, is correct recognizing site detection figure and correctly read bar code code word basic guarantee is provided in follow-up barcode detection.Gray-scale value access L in the view data reading lowand L hightbetween pixel formed zone of transition.The basic thought of the image partition method of transition region extraction is by extracting the pixel of zone of transition, then using the gray average of zone of transition pixel, as segmentation threshold, image is carried out to binaryzation.

S3, judges in pretreated image bar code whether detected, if bar code detected, continues execution step S4; If bar code do not detected, continue execution step S18.In the present embodiment, described bar code is one-dimensional bar code or two-dimensional bar.Refer to Fig. 3, be shown as the flow process of detector bar shape code, barcode detection concrete steps comprise:

S301, the arbitrary pixel column after scanning pre-service in image; Pixel column due to the corresponding monochrome pixels value in each provisional capital in image.In the present embodiment, for fear of the impact of neighbourhood noise, the pixel column in step S31 in meeting Multiple-Scan image.

S302, does pixels statistics to described pixel column, adds up black and white pixel continuous in described pixel column, the ratio sequence that calculating pixel is capable; Due to the corresponding finger URL of each bar code, described finger URL is corresponding to a certain proportion of black and white bar empty sequence.

S303, compares the finger URL of the described ratio sequence calculating and pre-stored all kinds of bar codes, if ratio is identical, represents to detect corresponding bar code, execution step S4; If ratio is not identical, represent not detect bar code, continue to carry out next step.

S304, by described image rotation ω degree, returns to step S301, continues the arbitrary pixel column in scan image, and this row is done to pixels statistics, adds up the continuous black and white pixel of this row, calculates the ratio sequence of described row,

S4, judges whether only to have a bar code in pretreated image, if only there is a bar code, performs step S5; If there are a plurality of bar codes, perform step S12.

, there is a bar code in S5, utilizes bar code scanning line algorithm, obtains the orientation angle j of this bar code.Angle centered by the orientation angle j by this bar code, in [j-i, j+i] rotation angle range, sets an anglec of rotation θ, every an image of an anglec of rotation θ rotation.Wherein, the orientation angle j of described bar code is greater than 0 degree, is less than 360 degree, angle i is greater than 0 degree, is less than or equal to 10 degree, and described anglec of rotation θ is greater than 0 degree, be less than or equal to 10 degree, in the present embodiment, it is 5 degree that angle i is set, anglec of rotation θ is 1 degree, by bar code scanning line algorithm, get the orientation angle j of described bar code, in angle centered by described orientation angle j, in [j-5, j+5] rotation angle range, every 1 degree, rotate once pretreated image.

S6, detects to rotate each time in the image after θ degree whether have word, if there is word, performs step S7; If there is not word, perform step S11.

S7, existing word in the image after θ degree is rotated in identification each time, and calculate and rotate each time corresponding lteral data after θ degree and preset the similarity degree of correct direction word template data, obtain and rotate each time corresponding word degree of confidence after θ degree;

S8, after θ degree is rotated in judgement each time, whether corresponding word degree of confidence there is the word degree of confidence that is greater than a predetermined threshold value, if do not exist, after representing to rotate each time θ degree, corresponding word degree of confidence is not high, image rotation angle is from j-i+ θ, j-i+2 θ ... all insincere to j-i+n θ, perform step so S9; If there is the word degree of confidence that is greater than predetermined threshold value, perform step S10.

S9, setting image rectification angle is 0 degree, and image is without being rotated, and image direction is without correction.

S10, will be greater than predetermined threshold value, and the corresponding word degree of confidence of the different images anglec of rotation compares.Select the highest corresponding image rotation angle of word degree of confidence, be set as image rectification angle, according to described image rectification angle, correcting image direction, the image that output calibration is good.In the present embodiment, for example, if i equals 5 degree, θ equals 1 degree, if, when image is in rotation angle range, rotate after 10 times, and rotation 10 θ, after 10 degree, corresponding word degree of confidence is the highest, and the highest corresponding image rotation of word degree of confidence is told somebody what one's real intentions are as j-5+10=j+5 degree so, so image rectification angle is j+5 degree.

S11, the orientation angle of selecting described bar code is image rectification angle, according to image rectification angularity correction image direction, the image after output calibration, end process.

S12, there are a plurality of bar codes, utilize described bar code scanning line algorithm, obtain direction angle alpha, β, γ etc. of a plurality of bar codes, in angle centered by the direction angle alpha of each bar code, β, γ etc. respectively, at [α-i, α+i], in [β-i, β+i], [γ-i, γ+i] etc. rotation angle range, set another anglec of rotation θ, every an image of an anglec of rotation θ rotation.Wherein, the direction angle alpha of a plurality of bar codes, β, γ etc. is greater than 0 degree, be less than 360 degree, angle i is greater than 0 degree, be less than or equal to 10 degree, described anglec of rotation θ is greater than 0 degree, be less than or equal to 10 degree, in the present embodiment, it is 5 degree that angle i is set, anglec of rotation θ. be 1 degree, by bar code scanning line algorithm, obtain the direction angle alpha of a plurality of bar codes, β, γ etc., with each bar code direction angle alpha, β, angle centered by γ etc., at [α-i, α+i], [β-i, β+i], [γ-i, γ+i] etc. in rotation angle range every 1 degree rotation pretreated image once.

S13, detects to rotate each time in the image after θ degree whether have word, if there is word, performs step S14; If there is not word, perform step S17.

S14, existing word in the image after θ degree is rotated in identification each time, and calculate and rotate each time lteral data corresponding after θ degree and preset the similarity degree of correct direction word template data, obtain and rotate each time corresponding word degree of confidence after θ degree;

S15, after θ degree is rotated in judgement each time, whether corresponding word degree of confidence there is the word degree of confidence that is greater than a predetermined threshold value, if do not exist, after representing to rotate each time θ degree, corresponding word degree of confidence is not high, image rotation angle is from α-i+ θ/β-i+ θ/γ-i+ θ ... α-i+2 θ/β-i+2 θ/γ-i+2 θ ... ... to α-i+n θ/β-i+n θ/γ-i+n θ ... all insincere, perform step so S9; If there is the word degree of confidence that is greater than predetermined threshold value, perform step S16.

S16, will be greater than predetermined threshold value, and the corresponding word degree of confidence of the different images anglec of rotation compares.Select the highest image rotation angle of word degree of confidence, be set as image rectification angle, according to image rectification angularity correction image direction, the image that output calibration is good.In the present embodiment, by utilizing the confidence information of word identification within the scope of bar code direction and corresponding rotation, do cross validation image rotating method, avoided the erroneous judgement of image rotating method disconnected.In the present embodiment, for example, the angle centered by α if the direction of a bar code is told somebody what one's real intentions are, in [α-i, α+i] rotation angle range, if i equals 5 degree, θ equals 1 degree, if, when image is in rotation angle range, rotate after 12 times, and rotation 12 θ,, after 12 degree, corresponding word degree of confidence is the highest, the highest corresponding image rotation of word degree of confidence is told somebody what one's real intentions are as α-5+12=α+7 degree so, so image rectification angle is α+7 degree.

S17, the orientation angle of selecting arbitrary bar code in a plurality of bar codes is image rectification angle, according to image rectification angularity correction image direction, the image after output calibration, end process.

S18, does not detect bar code in image,, within the scope of comprehensive 360 degree, set an anglec of rotation every an anglec of rotation pretreated image is rotated, wherein the anglec of rotation be greater than 10 degree, be less than 30 degree; This step can also be arranged to n sub-range by [0 °, 360 °], selects another anglec of rotation in each sub-range rotation pretreatment image.

S19 detects whether there is word in postrotational image, has word if detect, and performs step S20; If word do not detected, image rotating not, end process;

S20, identification is rotation each time degree or existing word in image after degree, and calculate and rotation each time degree or the rear corresponding lteral data of degree and the similarity degree that presets correct direction word template data, obtain rotation each time degree or corresponding word degree of confidence after degree;

S21, judgement is rotation each time or after degree, whether corresponding word degree of confidence exists and is greater than a predetermined threshold value word degree of confidence, if do not exist, represents rotation each time degree or degree after corresponding word degree of confidence not high, image rotation angle from all insincere, perform step so S22; If there is the word degree of confidence that is greater than predetermined threshold value, perform step S23.

S22, setting image rectification angle is 0 degree, and image is without being rotated, and image direction is without correction.

S23, will be greater than predetermined threshold value, and the corresponding word degree of confidence of the different images anglec of rotation compares, select the highest image rotation angle of word degree of confidence, be set as image rectification angle, according to image rectification angularity correction image direction, the image that output calibration is good.

If in the present embodiment, if described image comprises people's face, described step S7 detects to rotate each time after the anglec of rotation whether have people's face in image, calculates people's face reliability index, according to the people's face reliability index correcting image direction calculating.

Embodiment bis-

The present embodiment provides a kind of correcting direction of image system 1, refer to Fig. 4, be shown as the structure of correcting direction of image system, described corrective system comprises: image reading module 10, image pretreatment module 20, barcode detection module 30, bar code orientation angle determination module 40, rotary module 50, text detection module 60, word identification module 70, computing module 80, comparison module 90 and correction module 100.

Described image reading module 10, for reading raw image data.

Described image pretreatment module 20, for carrying out pre-service to raw image data.Refer to Fig. 5, be shown as the structure of described image pretreatment module 20, described image pretreatment module 20 comprises: image gray processing unit 201, image denoising unit 202, image binaryzation unit 203.Wherein,

Described image gray processing unit 201 is for gray processing raw image data, and the original image reading due to great majority is all coloured image, and coloured image storage takies than the more spaces of gray level image, deals with also much longer than gray level image.The printing bar code simultaneously existing in image is printed according to black and white mode again, so in the process of identification bar code, actual photographed to bar code image in chromatic information component for not effect of the identification of bar code, thereby coloured image need to be converted to gray level image, to reduce the operation time of subsequent operation.The color of each pixel in coloured image is determined by R, G, tri-components of B, and a kind of special coloured image that gray level image is R, G, tri-components of B are identical, the variation range of one of them pixel is 0~255.Described image denoising unit 202 is used to described view data denoising.Because the image reading generally all can contain noise because of the interference of surrounding environment, therefore, carry out denoising to the image reading.In the present embodiment, denoising method adopts medium filtering to process.Medium filtering is the Nonlinear Processing method of noise always, and its ultimate principle is that any the value in digital picture or Serial No. is replaced with the Mesophyticum of the value of each point in a field of this point.Described image binaryzation unit 203 is for continuing binary conversion treatment to described view data.The object of image binaryzation is in order to remove background, retains as much as possible bar code symbol and reduces noise magazine in symbol, is correct recognizing site detection figure and correctly read bar code code word basic guarantee is provided in follow-up barcode detection.Gray-scale value access L in the view data reading lowand L hightbetween pixel formed zone of transition.The basic thought of the image partition method of transition region extraction is by extracting the pixel of zone of transition, then using the gray average of zone of transition pixel, as segmentation threshold, image is carried out to binaryzation.

Described barcode detection module 30 is connected with described image pretreatment unit 20, for detection of whether there being at least one bar code in pretreated image.Refer to Fig. 6, be shown as the structure of barcode detection module, described barcode detection module 30 comprises scanning element 301, arithmetic element 302, comparing unit 303 and rotary unit 304.In the present embodiment, described bar code is one-dimensional bar code or two-dimensional bar.

Described scanning element 301 is for scanning arbitrary pixel column of image after pre-service; Pixel column due to the corresponding monochrome pixels value in each provisional capital in image.In the present embodiment, for fear of the impact of neighbourhood noise, repeatedly call the pixel column in described scanning element scan image.

The described arithmetic element 302 being connected with described scanning element 301, for adding up described pixel column, is added up black and white pixel continuous in described pixel column, the ratio sequence that calculating pixel is capable.Due to the corresponding finger URL of each bar code, described finger URL is corresponding to a certain proportion of black and white bar empty sequence.

The described comparing unit 303 being connected with described arithmetic element 302 is compared the described ratio sequence calculating and the finger URL of pre-stored wherein each class bar code, if ratio is identical, represents to detect corresponding bar code; If ratio is not identical, represent not detect bar code.

The rotary unit 304 being connected with described comparing unit 303 is not for bar code being detected when described scanning element 301, described image is rotated according to predetermined anglec of rotation ω, arbitrary pixel column that described in re invocation, scanning element 301 continues in scan image, this row is done to pixels statistics, add up the continuous black and white pixel of this row, calculate the ratio sequence of described row.

Described barcode detection module 30 is also for detection of the number of bar code in pretreated image, and in described pretreated image, the number of bar code at least comprises a bar code.

The described bar code orientation angle determination module 40 being connected with described barcode detection module 30 is for orientation angle j, α, β, γ etc. of all bar codes of obtaining described barcode detection module 30 and detecting, obtain the orientation angle of all bar codes at described bar code orientation angle determination module 40 after, centered by orientation angle, tell somebody what one's real intentions are, setting and each bar code be rotation angle range [j-i one to one, j+i], [α-i, α+i], [β-i, β+i], [γ-i, γ+i] etc., pre-stored in this module have an anglec of rotation θ.

The rotary module 50 being connected with described bar code orientation angle determining unit 40 is for angle centered by orientation angle j, the α of each bar code, β, γ etc. respectively, at [j-i, j+i], [α-i, α+i], [β-i, β+i], [γ-i, γ+i] etc. in rotation angle range, every an image of an anglec of rotation θ rotation.Wherein, the orientation angle j of a plurality of bar codes, α, β, γ etc. is greater than 0 degree, be less than 360 degree, angle i is greater than 0 degree, be less than or equal to 10 degree, described anglec of rotation θ is greater than 0 degree, be less than or equal to 10 degree, in the present embodiment, it is 5 degree that angle i is set, anglec of rotation θ is 1 degree, by bar code scanning line algorithm, get the orientation angle j of described bar code, with described orientation angle j, α, β, angle centered by γ etc., at [j-5, j+5], [α-5, α+5], [β-5, β+5], [γ-5, γ+5] etc. in rotating range every 1 degree rotation pretreated image once.Pre-stored in described rotary module 50 have another anglec of rotation with the another anglec of rotation for bar code not detected at pretreated image when described barcode detection module 30, within the scope of comprehensive 360 degree, every an anglec of rotation pretreated image is rotated.The anglec of rotation wherein be greater than 10 degree, be less than 30 degree; Or described rotary module 50 can also be arranged to n sub-range by [0 °, 360 °], adopts another anglec of rotation in each sub-range pretreated image is rotated

The described text detection module 60 being connected with described rotary module 50 is for detection of whether there being word in the image rotating each time after θ degree.Described text detection module 60 can also be for people's face detection module 60 ' be for detection of whether there being people's face in the image rotating each time after θ degree.Computing module 80 ' is for calculating people's face reliability index, and correction module 100 ' is for according to the people's face reliability index correcting image direction calculating.Described text detection module 60 is also for when described barcode detection module 30 is not when pretreated image detects bar code, every an anglec of rotation after image rotating, detect rotation each time in image after degree, whether there is word.

When the described word identification module 70 being connected with described text detection module 60 exists word for detecting when described text detection module 60 image rotating each time after θ degree, existing word in the image after θ degree is rotated in identification each time.Described word identification module 70 is also for rotation each time being detected when described text detection module 60 identification rotation each time while there is word in the image after degree existing word in image after degree.

The computing module 80 being connected with described word identification module 70 rotates corresponding word degree of confidence after θ degree each time for calculating and rotate each time corresponding lteral data and the similarity degree that presets correct direction word template data after θ degree, obtaining; Described computing module 80 is also for calculating rotation each time corresponding lteral data and the similarity degree that presets correct direction word template data after degree, obtain rotation each time corresponding word degree of confidence after degree.

The described comparison module 90 being connected with described computing module 80 for judge rotate each time θ degree after corresponding word degree of confidence whether there is the word degree of confidence that is greater than a predetermined threshold value, if do not exist, after representing to rotate each time θ degree, corresponding word degree of confidence is not high, image rotation angle is from j-i+ θ/α-i+ θ/β-i+ θ/γ-i+ θ ... j-i+2 θ/α-i+2 θ/β-i-+2 θ/γ-i+2 θ ... to j-i+n θ/α-i+n θ/β-i+n θ/γ-i+n θ ... all insincere, pretreated image is without being rotated.If there is the word degree of confidence that is greater than predetermined threshold value, represent to continue to be greater than predetermined threshold value, the corresponding word degree of confidence of the different images anglec of rotation compares, select the highest image rotation angle of word degree of confidence, be set as image rectification angle, in the present embodiment, by utilizing the confidence information of word identification within the scope of bar code direction and corresponding rotation, do cross validation image rotating method, avoided the erroneous judgement of image rotating method disconnected.Described comparison module 90 is also for judgement rotation each time degree or after degree, whether corresponding word degree of confidence there is the word degree of confidence that is greater than a predetermined threshold value, if do not exist, represents rotation each time degree or degree after corresponding word degree of confidence not high, image rotation angle from all insincere, image is without correction; If exist, be greater than the word degree of confidence of predetermined threshold value, will be greater than predetermined threshold value, the corresponding word degree of confidence of the different images anglec of rotation compares, and selects the highest image rotation angle of word degree of confidence, be set as image rectification angle.

The described correction module 100 being connected with described comparison module 90 is for obtaining image rectification angle, according to image rectification angularity correction image direction, the image that output calibration is good.

For the image that comprises word and/or bar code, correcting direction of image method and system of the present invention are automatically according to angle and the confidence information detected image positive dirction of word and/or bar code direction, first utilize bar code orientation determination image rotation direction scope, within the scope of this by the detection and Identification of word are determined to image rectification angle, so, can reduce image rotation erroneous judgement possibility, can quick and precisely judge correcting image direction again simultaneously, give user in daily life, commercial affairs work, in research work etc., browse and other later image are processed operation convenience is provided.The present invention is also convenient to be arranged in the smart machines such as computing machine, mobile phone, panel computer.

So the present invention has effectively overcome various shortcoming of the prior art and tool high industrial utilization.

Above-described embodiment is illustrative principle of the present invention and effect thereof only, but not for limiting the present invention.Any person skilled in the art scholar all can, under spirit of the present invention and category, modify or change above-described embodiment.Therefore, such as in affiliated technical field, have and conventionally know that the knowledgeable, not departing from all equivalence modifications that complete under disclosed spirit and technological thought or changing, must be contained by claim of the present invention.

Claims (10)

1. a correcting direction of image method, is characterized in that, comprising:
The raw image data that pre-service reads;
Judge bar code in pretreated image, whether to be detected,
If, angle centered by the orientation angle of bar code, in a rotation angle range, every a default anglec of rotation, rotate an image, detect in the rear image of rotation and whether have word, if, identify word, and calculate and to rotate each time corresponding word degree of confidence after the anglec of rotation, and judge whether that existence is greater than the word degree of confidence of a predetermined threshold value, if do not exist, image direction is without correction, if exist, select image rotation angle corresponding to high confidence level, according to its correcting image direction; If not, the orientation angle of selector bar shape code, according to bar code orientation angle correcting image direction;
If not, in comprehensive scope, every another default anglec of rotation, rotate an image, detect and whether have word, if, identify word, and calculate and to rotate each time corresponding word degree of confidence after another anglec of rotation, judge whether to have the word degree of confidence that is greater than a predetermined threshold value, if do not exist, image direction is without correction, if exist, select image rotation angle corresponding to high confidence level, according to its correcting image direction; If not, image direction without correction.
2. correcting direction of image method according to claim 1, it is characterized in that: judge bar code in pretreated image, whether to be detected, if not, by [0 °, 360 °] be arranged to some sub-ranges, in each sub-range, select the another anglec of rotation, every an another anglec of rotation rotation pretreatment image, and detect and whether have word in postrotational image, if, identify word, and calculate and to rotate each time corresponding word degree of confidence after the another anglec of rotation, and judge whether that existence is greater than the word degree of confidence of a predetermined threshold value, if do not exist, image direction is without correction, if exist, select image rotation angle corresponding to high confidence level, according to its correcting image direction, if not, image direction without correction.
3. correcting direction of image method according to claim 1, is characterized in that: described correcting direction of image method also comprises and judge whether only to exist in pretreated image a bar code,
If, angle centered by the orientation angle of bar code, in a rotation angle range, every a default anglec of rotation, rotate an image, detect in the rear image of rotation and whether have word, if, identify word, and calculate and to rotate each time corresponding word degree of confidence after the anglec of rotation, and judge whether that existence is greater than the word degree of confidence of a predetermined threshold value, if do not exist, image direction is without correction, if exist, select image rotation angle corresponding to high confidence level, according to its correcting image direction; If not, the orientation angle of selector bar shape code, according to bar code orientation angle correcting image direction;
If not, angle centered by the orientation angle of each bar code respectively, in a rotation angle range corresponding to each bar code, every a default anglec of rotation, rotate an image respectively, detect in the rear image of rotation and whether have word, if, identify word, and calculate and to rotate each time corresponding word degree of confidence after the anglec of rotation, and judge whether that existence is greater than the word degree of confidence of a predetermined threshold value, if do not exist, image direction is without correction, if exist, select image rotation angle corresponding to high confidence level, according to its correcting image direction; If not, select the orientation angle of arbitrary bar code, according to bar code orientation angle correcting image direction.
4. correcting direction of image method according to claim 1, is characterized in that: described rotation angle range is [center angle-i, center angle+i], and wherein, described i is greater than 0 degree, is less than or equal to 10 degree; The described anglec of rotation is greater than 0 degree, is less than 10 degree.
5. correcting direction of image method according to claim 1, is characterized in that: judge that the step that bar code whether detected in pretreated image comprises:
Arbitrary pixel column after scanning pre-service in image;
Described pixel column is done to pixels statistics, add up black and white pixel continuous in described pixel column, the ratio sequence that calculating pixel is capable;
The finger URL of the described ratio sequence calculating and pre-stored all kinds of bar codes is compared, if ratio is identical, represent to detect corresponding bar code; If ratio is not identical, represent not detect bar code, continue to carry out next step;
Rotate described image, return to scanning step and continue to detect.
6. a correcting direction of image system, is characterized in that, comprising:
Barcode detection module is for detection of whether there being bar code in pretreated image;
Bar code orientation angle determination module, be connected with described barcode detection module, for obtaining the orientation angle of the bar code that described barcode detection module detects, obtain after the orientation angle of bar code, angle centered by orientation angle, sets the rotation angle range corresponding with bar code; The described bar code orientation angle determination module anglec of rotation that prestores;
Rotary module, is connected with described bar code orientation angle determination module, for when detecting while there is bar code in rotation angle range every an image of a default anglec of rotation rotation; Described rotary module, also for when bar code not detected, rotates an image every another default anglec of rotation within the scope of full method 360 degree.
Text detection module, is connected with described rotary module, for detection of whether there being word in the image rotating each time after the anglec of rotation;
Word identification module, is connected with described text detection module, and while there is word for detecting when described text detection module the image rotating each time after the anglec of rotation, existing word in the image after anglec of rotation degree is rotated in identification each time;
Computing module, is connected with described word identification module, for calculating and obtain and rotating each time corresponding word degree of confidence after the anglec of rotation;
Comparison module, be connected with described computing module, for judge rotate each time the anglec of rotation after corresponding word degree of confidence whether there is the word degree of confidence that is greater than a predetermined threshold value, if not, after representing to rotate each time the anglec of rotation, corresponding word degree of confidence is not high, and image direction is without correction; If so, select the word degree of confidence image rotation angle of high correspondence, according to its correcting image direction.
7. correcting direction of image system according to claim 6, is characterized in that: described corrective system also comprises image correction module, and described image correction module is connected with described comparison module, for according to described image rectification angularity correction image direction.
8. correcting direction of image system according to claim 6, it is characterized in that: described rotary module is also for pre-stored another anglec of rotation and the another anglec of rotation, be used for when described barcode detection module is not when pretreated image detects bar code, within the scope of comprehensive 360 degree, every another anglec of rotation, pretreated image is rotated, wherein, another anglec of rotation is greater than 10 degree, is less than 30 degree; Or [0 °, 360 °] is arranged to some sub-ranges, in each sub-range, adopts another anglec of rotation, every an another anglec of rotation, pretreated image is rotated.
9. correcting direction of image system according to claim 6, is characterized in that: described corrective system also comprises for reading the image reading module of raw image data, and the pretreatment image module of view data described in pre-service.
10. correcting direction of image system according to claim 6, is characterized in that: described bar code detecting module comprises:
Scanning element, for scanning arbitrary pixel column of image after pre-service;
Arithmetic element, is connected with described scanning element, for adding up described pixel column, adds up black and white pixel continuous in described pixel column, the ratio sequence that calculating pixel is capable;
Comparing unit, is connected with described arithmetic element, for the described ratio sequence calculating and the finger URL of pre-stored wherein each class bar code are compared, if ratio is identical, represents to detect corresponding bar code; If ratio is not identical, represent not detect bar code;
Rotary unit, is connected with described comparing unit.For bar code not detected when described scanning element, rotate described image, scanning element continues the arbitrary pixel column in scan image described in re invocation.
CN201310746613.5A 2013-12-30 2013-12-30 Method and system for correcting image direction CN103714327B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310746613.5A CN103714327B (en) 2013-12-30 2013-12-30 Method and system for correcting image direction

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310746613.5A CN103714327B (en) 2013-12-30 2013-12-30 Method and system for correcting image direction

Publications (2)

Publication Number Publication Date
CN103714327A true CN103714327A (en) 2014-04-09
CN103714327B CN103714327B (en) 2017-02-01

Family

ID=50407287

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310746613.5A CN103714327B (en) 2013-12-30 2013-12-30 Method and system for correcting image direction

Country Status (1)

Country Link
CN (1) CN103714327B (en)

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104537609A (en) * 2014-11-28 2015-04-22 上海理工大学 Rotated image correction method
CN104820968A (en) * 2015-04-22 2015-08-05 上海理工大学 Text draft angle correction method
CN105426887A (en) * 2015-10-30 2016-03-23 北京奇艺世纪科技有限公司 Method and device for text image correction
CN105631396A (en) * 2015-11-13 2016-06-01 东莞酷派软件技术有限公司 Method and device for obtaining soft copy of file
CN105765604A (en) * 2015-09-23 2016-07-13 深圳还是威健康科技有限公司 Method of recognizing bar code and intelligent wrist ring
CN106056156A (en) * 2016-05-31 2016-10-26 武汉明德生物科技股份有限公司 System and method of recognizing and detecting reagent card
CN106874845A (en) * 2016-12-30 2017-06-20 东软集团股份有限公司 The method and apparatus of image recognition
CN107038440A (en) * 2016-02-04 2017-08-11 株式会社理光 Image tilt calibration apparatus, image processing system and image tilt correction method
CN107608604A (en) * 2017-09-26 2018-01-19 维沃移动通信有限公司 A kind of method for displaying image and mobile terminal

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1073001A2 (en) * 1999-07-30 2001-01-31 Fujitsu Limited Document image correcting device and correcting method
CN1677441A (en) * 2004-03-31 2005-10-05 富士胶片株式会社 Image display control apparatus and method, and program for controlling image display control apparatus
CN101639933A (en) * 2009-07-16 2010-02-03 上海合合信息科技发展有限公司 Image rotation correction method and system and electronic device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1073001A2 (en) * 1999-07-30 2001-01-31 Fujitsu Limited Document image correcting device and correcting method
CN1677441A (en) * 2004-03-31 2005-10-05 富士胶片株式会社 Image display control apparatus and method, and program for controlling image display control apparatus
CN101639933A (en) * 2009-07-16 2010-02-03 上海合合信息科技发展有限公司 Image rotation correction method and system and electronic device

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104537609A (en) * 2014-11-28 2015-04-22 上海理工大学 Rotated image correction method
CN104820968A (en) * 2015-04-22 2015-08-05 上海理工大学 Text draft angle correction method
CN105765604A (en) * 2015-09-23 2016-07-13 深圳还是威健康科技有限公司 Method of recognizing bar code and intelligent wrist ring
CN105426887A (en) * 2015-10-30 2016-03-23 北京奇艺世纪科技有限公司 Method and device for text image correction
CN105426887B (en) * 2015-10-30 2019-04-12 北京奇艺世纪科技有限公司 A kind of method and device of text image correction
CN105631396A (en) * 2015-11-13 2016-06-01 东莞酷派软件技术有限公司 Method and device for obtaining soft copy of file
CN107038440A (en) * 2016-02-04 2017-08-11 株式会社理光 Image tilt calibration apparatus, image processing system and image tilt correction method
CN106056156A (en) * 2016-05-31 2016-10-26 武汉明德生物科技股份有限公司 System and method of recognizing and detecting reagent card
CN106874845A (en) * 2016-12-30 2017-06-20 东软集团股份有限公司 The method and apparatus of image recognition
CN107608604A (en) * 2017-09-26 2018-01-19 维沃移动通信有限公司 A kind of method for displaying image and mobile terminal
CN107608604B (en) * 2017-09-26 2019-06-07 维沃移动通信有限公司 A kind of image display method and mobile terminal

Also Published As

Publication number Publication date
CN103714327B (en) 2017-02-01

Similar Documents

Publication Publication Date Title
JP2016167273A (en) System and method for recognizing text information in object
CN104143094B (en) A kind of paper automatic marking processing method and system without answering card
US8733650B1 (en) Decoding barcodes from images with varying degrees of focus
CN102799850B (en) A kind of barcode recognition method and device
KR100556856B1 (en) Screen control method and apparatus in mobile telecommunication terminal equipment
US7400777B2 (en) Preprocessing for information pattern analysis
US8818095B2 (en) Image processing apparatus, image processing method, and computer-readable, non-transitory medium
EP1271403B1 (en) Method and device for character location in images from digital camera
JP4607633B2 (en) Character direction identification device, image forming apparatus, program, storage medium, and character direction identification method
Chang et al. A General Scheme for Extracting QR Code from a non-uniform background in Camera Phones and Applications
JP5896245B2 (en) How to crop a text image
KR100945809B1 (en) Binarization of an image
US6347156B1 (en) Device, method and storage medium for recognizing a document image
US6473523B1 (en) Portable text capturing method and device therefor
CN103400099B (en) Terminal and two-dimensional code identification method
US8023725B2 (en) Identification of a graphical symbol by identifying its constituent contiguous pixel groups as characters
TW452747B (en) Image status detecting and document image correcting apparatus and methods and computer readable and information storage media
US8189961B2 (en) Techniques in optical character recognition
JP3320759B2 (en) Document image inclination detecting apparatus and method
KR20010053109A (en) Image processor, image processing method, and medium on which image processing program is recorded
US7949157B2 (en) Interpreting sign language gestures
US6526161B1 (en) System and method for biometrics-based facial feature extraction
JP2004318879A (en) Automation technology of comparing image content
US20050121520A1 (en) Code type determining method and code boundary detecting method
KR100377531B1 (en) Face image processing apparatus employing two-dimensional template

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant