CN108573473A - Picture rotation method, apparatus, computer equipment and storage medium - Google Patents

Picture rotation method, apparatus, computer equipment and storage medium Download PDF

Info

Publication number
CN108573473A
CN108573473A CN201810391961.8A CN201810391961A CN108573473A CN 108573473 A CN108573473 A CN 108573473A CN 201810391961 A CN201810391961 A CN 201810391961A CN 108573473 A CN108573473 A CN 108573473A
Authority
CN
China
Prior art keywords
target
angle
target photo
rotation
deflection angle
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.)
Pending
Application number
CN201810391961.8A
Other languages
Chinese (zh)
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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen 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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201810391961.8A priority Critical patent/CN108573473A/en
Priority to PCT/CN2018/102863 priority patent/WO2019205400A1/en
Publication of CN108573473A publication Critical patent/CN108573473A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/60Rotation of whole images or parts thereof

Landscapes

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

Abstract

The invention discloses a kind of method, apparatus of picture rotation, computer equipment and storage mediums, including:Obtain deflection angle of the target text in Target Photo relative to preset reference line;The rotation angle of the Target Photo is generated according to the deflection angle;The Target Photo is rotated according to the rotation angle.The present invention is by obtaining deflection angle of the target text in Target Photo relative to reference line, to obtain the rotation angle of Target Photo, rotate the Target Photo, the target text in target image is set to show in front of the user in a manner of most suitable reading, user is set to read more convenient, raising customer experience degree.

Description

Picture rotation method, apparatus, computer equipment and storage medium
Technical field
The present invention relates to technical field of picture display, specifically, the present invention relates to a kind of picture rotation method, apparatus, Computer equipment and storage medium.
Background technology
With the development of science and technology, the function of showing with picture of taking pictures is stronger and stronger, people come frequently by photo terminal People in record life and object, with keep here or with other people shared fine moments at one's side.Meanwhile people are reading relevant information When, blotter can be also carried out by the way of taking pictures, and in order to subsequently unified arrangement and looked back, the life taken pictures to people Living, it is convenient to bring.
But many times, the problem of due to photo angle, relevant target text letter cannot be read from photo well Breath, or the problem of due to photo angle, bring inconvenience to the information identification of photo content, for example need constantly to convert display screen Angle the information content in photo to be identified, in the case of display screen is fixed, read get up it is very inconvenient.
The inventor of the invention has found that the method for picture rotation in the prior art is according to picture under study for action The unified extending direction of middle target text is rotated relative to the angle of display interface horizontal plane, is only applicable to mesh in picture Mark word is the case where unified direction tilts, can not in the case that multiple target texts are respectively at different angle directions The identification of rotation angle is carried out, application scenarios are single.
Invention content
The purpose of the present invention is intended at least solve above-mentioned one of technological deficiency, especially solves the target text in picture Word is not shown in the same angle, according at the problem for reading inconvenience.
In order to achieve the above object, the present invention provides a kind of picture rotation method, including:
Deflection angle of the baseline of the target text in Target Photo relative to preset reference line is obtained, the reference line hangs down Directly in the gravity direction of terminal;
The rotation angle of the Target Photo is generated according to the deflection angle;
The Target Photo is rotated according to the rotation angle.
Further, the baseline for obtaining the target text in the Target Photo is relative to the inclined of preset reference line Before the step of corner, further include:
Identify the pixel value of target text described in the Target Photo;
Calculate the ratio between the pixel value of the target text and the total pixel value of the Target Photo;
Judge whether the ratio more than or equal to preset first compares threshold value;Described in being greater than or equal to when the ratio First when comparing threshold value, triggers deflection angle of the target text obtained in Target Photo relative to preset reference line.
Further, the baseline for obtaining the target text in the Target Photo is relative to the inclined of preset reference line The method of corner includes:
The baseline of the target text is obtained, the baseline is the horizontal line on the horizontally long direction of the target text;
The angle number of degrees between the baseline and the reference line are calculated, the angle number of degrees are the deflection of the deflection angle Angle.
Further, it when in the target text including the direction of multiple baselines, is corresponded to and is given birth to according to the multiple baseline At multiple deflection angles, the method for the rotation angle that the Target Photo is generated according to the deflection angle includes:
The multiple deflection angle is counted using angle value as statistical condition;
Statistical result is arranged by drop power mode;
The rotation angle for rotating the Target Photo is generated according to the rank results.
Further, the method for the rotation Target Photo includes:
It obtains and is located at the first deflection angle in the rank results;
It is located at the first deflection angle rotation Target Photo according to described.
Further, the method for the rotation Target Photo includes:
Pending control instruction is obtained, the control instruction is used to switch the rotation angle of the Target Photo;
The Target Photo is rotated according to the deflection angle that the control instruction arranges along the rank results successively.
Further, it when in the target text including the direction of multiple baselines, is corresponded to and is given birth to according to the multiple baseline At multiple deflection angles, the method for the rotation angle that the Target Photo is generated according to the deflection angle includes:
Calculate the average angle number of degrees of deflection angle in the Target Photo;
The average angle number of degrees are set to rotation angle.
Invention additionally discloses a kind of picture rotation devices, including:
Acquisition module:It is described for obtaining deflection angle of the target text in Target Photo relative to preset reference line Gravity direction of the reference line perpendicular to terminal;
Processing module:Rotation angle for generating the Target Photo according to the deflection angle;
Execution module:For rotating the Target Photo according to the rotation angle.
Further, the picture rotation device further includes:
Identification module:The pixel value of target text described in the Target Photo for identification;
Computing module:Ratio between pixel value for calculating the target text and the total pixel value of the Target Photo Value;
Judgment module:For judging whether the ratio more than or equal to preset first compares threshold value;When the ratio When comparing threshold value more than or equal to described first, the target text obtained in Target Photo is triggered relative to preset reference The deflection angle of line.
Further, the picture rotation device further includes:
First acquisition module:The baseline of the target text is obtained, the baseline is on the horizontally long direction of the target text Horizontal line;
First computing module:The angle number of degrees between the baseline and the reference line are calculated, the angle number of degrees are institute State the deflection angle of deflection angle.
Further, when in the target text including multiple base directions, the picture rotation device also wraps It includes:
Statistical module:For being counted to the deflection angle using angle value as statistical condition;
Queue generation module:For statistical result to be arranged by drop power mode;
Angle generation module:For generating the rotation angle for rotating the Target Photo according to the rank results.
Further, when in the target text including multiple base directions, the picture rotation device also wraps It includes:
Second computing module:The average angle number of degrees for calculating deflection angle in the Target Photo;
Angle generation module:For the average angle number of degrees to be set to rotation angle.
Further, the picture rotation device includes:
Second acquisition module:It is located at the first deflection angle in the rank results for obtaining;
First execution module:For rotating the Target Photo according to the deflection angle.
Further, the picture rotation device includes:
Third acquisition module:For obtaining pending control instruction, the control instruction is for switching the target figure The rotation angle of piece;
Second execution module:Deflection angle rotation for being arranged along the rank results successively according to the control instruction The Target Photo.
Invention additionally discloses a kind of computer equipment, including memory and processor, calculating is stored in the memory Machine readable instruction, when the computer-readable instruction is executed by the processor so that the processor is executed as any of the above-described The item picture rotation method.
Invention additionally discloses a kind of storage mediums being stored with computer-readable instruction, and the computer-readable instruction is by one When a or multiple processors execute so that one or more processors execute picture rotation method as described in any one of the above embodiments Step.
The beneficial effects of the invention are as follows:The method and apparatus of picture rotation disclosed by the invention, by obtaining Target Photo In deflection angle of the target text relative to reference line rotate the Target Photo to obtain the rotation angle of Target Photo, So that the target text in target image is showed in front of the user in a manner of most suitable reading, so that user's reading is got up more convenient, carry High customer experience degree.
The additional aspect of the present invention and advantage will be set forth in part in the description, these will become from the following description Obviously, or practice through the invention is recognized.
Description of the drawings
Above-mentioned and/or additional aspect and advantage of the invention will become from the following description of the accompanying drawings of embodiments Obviously and it is readily appreciated that, wherein:
Fig. 1 is picture rotation method flow diagram of the present invention;
Fig. 2 is the flow chart for the method that the target text in Target Photo is obtained in the present invention;
Fig. 3 is the side for deflection angle of the target text relative to preset reference line that the present invention obtains in the Target Photo The flow chart of method;
Fig. 4 is display interface schematic diagram of the present invention;
Schematic diagram when Fig. 5 puts for display interface of the present invention is angled;
Fig. 6 is Target Photo of the present invention using horizontal line as the rotation schematic diagram of reference line;
Fig. 7 is the extending direction schematic diagram of the target text baseline on Target Photo of the present invention;
Fig. 8 is the deflection angle schematic diagram of the target text of the different baselines of the present invention;
Fig. 9 is the processing mode flow in the different target text generation rotation angle first embodiment of baseline of the present invention Figure;
Figure 10 is the method flow diagram of the first embodiment for the rotation angle that the present invention generates the Target Photo;
Figure 11 is the method flow diagram of the second embodiment for the rotation angle that the present invention generates the Target Photo;
Figure 12 is the processing mode flow in the different target text generation rotation angle second embodiment of baseline of the present invention Figure;
Figure 13 is the module connection diagram of the device of picture rotation of the present invention;
Figure 14 is computer equipment basic structure block diagram of the present invention.
Specific implementation mode
The embodiment of the present invention is described below in detail, examples of the embodiments are shown in the accompanying drawings, wherein from beginning to end Same or similar label indicates same or similar element or element with the same or similar functions.Below with reference to attached The embodiment of figure description is exemplary, and is only used for explaining the present invention, and is not construed as limiting the claims.
Those skilled in the art of the present technique are appreciated that unless expressly stated, singulative " one " used herein, " one It is a ", " described " and "the" may also comprise plural form.It is to be further understood that is used in the specification of the present invention arranges It refers to there are the feature, integer, step, operation, element and/or component, but it is not excluded that presence or addition to take leave " comprising " Other one or more features, integer, step, operation, element, component and/or their group.It should be understood that when we claim member Part is " connected " or when " coupled " to another element, it can be directly connected or coupled to other elements, or there may also be Intermediary element.In addition, " connection " used herein or " coupling " may include being wirelessly connected or wirelessly coupling.It is used herein to arrange Diction "and/or" includes that the whole of one or more associated list items or any cell are combined with whole.
Those skilled in the art of the present technique are appreciated that unless otherwise defined, all terms used herein (including technology art Language and scientific terminology), there is meaning identical with the general understanding of the those of ordinary skill in fields of the present invention.Should also Understand, those terms such as defined in the general dictionary, it should be understood that have in the context of the prior art The consistent meaning of meaning, and unless by specific definitions as here, the meaning of idealization or too formal otherwise will not be used To explain.
It includes wireless communication that those skilled in the art of the present technique, which are appreciated that " terminal " used herein above, " terminal device " both, The equipment of number receiver, only has the equipment of the wireless signal receiver of non-emissive ability, and includes receiving and transmitting hardware Equipment, have on bidirectional communication link, can execute two-way communication reception and emit hardware equipment.This equipment May include:Honeycomb or other communication equipments are shown with single line display or multi-line display or without multi-line The honeycomb of device or other communication equipments;PCS (Personal Communications Service, PCS Personal Communications System), can With combine voice, data processing, fax and/or communication ability;PDA (Personal Digital Assistant, it is personal Digital assistants), may include radio frequency receiver, pager, the Internet/intranet access, web browser, notepad, day It goes through and/or GPS (Global Positioning System, global positioning system) receiver;Conventional laptop and/or palm Type computer or other equipment, have and/or the conventional laptop including radio frequency receiver and/or palmtop computer or its His equipment." terminal " used herein above, " terminal device " they can be portable, can transport, be mounted on the vehicles (aviation, Sea-freight and/or land) in, or be suitable for and/or be configured in local runtime, and/or with distribution form, operate in the earth And/or any other position operation in space." terminal " used herein above, " terminal device " can also be communication terminal, on Network termination, music/video playback terminal, such as can be PDA, MID (Mobile Internet Device, mobile Internet Equipment) and/or mobile phone with music/video playing function, can also be the equipment such as smart television, set-top box.
In order to allow Target Photo 500 to be shown in display screen interface according to the mode of the most suitable reading of target text, this hair It is bright that a kind of method of picture rotation is provided, referring to Fig. 1, including the following steps:
S100, obtain Target Photo 500 in target text phase baseline for preset reference line deflection angle, it is described Gravity direction of the reference line perpendicular to terminal;
The Target Photo 500 is the picture rotated, the target text, in Target Photo 500 In word, the present invention in, target text can be single word, can also be multiple words, application scenarios master of the invention It is in display interface 400, according to the deflection angle between the baseline and reference line of the target text in Target Photo to figure Piece is rotated, and is showed with the angle for being more suitable for reading to make target text.
The rotation of Target Photo 500 is executed according to the target text on Target Photo 500 and the deflection between reference line , therefore before deflection angle of the baseline of the target text in obtaining Target Photo 500 relative to preset reference line, also need Obtain the target text in Target Photo 500.In one embodiment of this invention, a kind of acquisition Target Photo 500 is provided In target text method, referring to Fig. 2, including:
The pixel value of target text described in S110, the identification Target Photo 500;
Target text in identification Target Photo 500 can be identified by target text engine openCV or OCR.With For OCR identifications, the method for identifying the target text in the Target Photo 500 includes:
Target image comprising target text is processed for subsequently to carry out feature extraction, study.This process Main purpose is the garbage reduced in the Target Photo 500, so as to subsequent processing.Usually have in the step:Ash Degreeization, noise reduction, binaryzation, character cutting and these sub-steps are normalized, it should be noted that the step of gray processing is working as mesh Piece 500 of marking on a map carries out when being color image.After binaryzation, image is only left two kinds of colors, i.e., black and white, wherein one A is image background, another color seeks to the target text of identification.Noise reduction is carried out to target text, in order to preferably Carry out target text processing.Character cutting is then that the target text in image is divided into single target word, to identify list A target text.
Have identified single target text, you can calculate the pixel value of target text in Target Photo 500.Pixel value It is the value assigned by computer when original image is digitized, it represents the average luminance information of a certain blockage of original copy, or Person say be the blockage average reflection (transmission) density information.Using first identifying target text part, then calculate mesh Mark word pixel value, can more accurately obtain the pixel value of target text, avoid because with target text shape or color Similar image is erroneously interpreted as target text, improves the accuracy of target text pixel value.
S120, ratio between 500 total pixel value of pixel value and the Target Photo of the target text is calculated;
S130, judge whether the ratio more than or equal to preset first compares threshold value;When the ratio is more than or waits When described first compares threshold value, the target text obtained in Target Photo 500 is triggered relative to preset reference line Deflection angle.
After all target texts all extract one by one, then total pixel value of Target Photo 500 is calculated, counted simultaneously The pixel value for going out target text in Target Photo 500 accounts for the ratio of total pixel value.
The pixel value of target text accounts for the purpose of the ratio of total pixel value in calculating Target Photo 500, is to judge to be It is no that it is necessary to implement picture rotations.When not having target text or target text seldom in Target Photo 500, it is not enough to influence When reading, then It is not necessary to be rotated to picture.But when in Target Photo 500 target text it is more, it is irregular aobvious When the Target Photo 500 shown can bring certain reading difficulty to user, rotation processing just is carried out to Target Photo 500.
Further, specific judgment method is to judge that the pixel value of target text in Target Photo 500 accounts for total pixel value Ratio whether be more than preset first to compare threshold value, when the ratio be more than described first compare threshold value when, just obtain target Deflection angle of the target text relative to preset reference line in picture 500.
Here it is the reference value pre-entered that first, which compares threshold value, this reference value can be arbitrary value, can be with The languages read according to user are configured, because of different language, the composition of target text is different, corresponding pixel value ratio Regular meeting is different, for example the ratio shared by single English alphabet is usually fewer than individual Chinese character, therefore for commonly using under normal conditions In the case of showing the Target Photo 500 with English, what is be arranged in system first compares threshold value and is less than and be usually used in showing First of Target Photo 500 with Chinese compares threshold value.It is with the Target Photo 500 for being usually used in showing Chinese in the present invention Example, when Chinese text accounts for the 10% of the pixel ratio of Target Photo 500, it would be possible to influence normal for reading, therefore being arranged One compare threshold value be 10%, when the pixel value of target text be greater than or equal to total pixel value 10% when, then execute acquisition target Target text in picture 500 relative to preset reference line deflection angle this with step, to carry out the rotation of Target Photo 500 Turn.
Further, the baseline for obtaining the target text in the Target Photo 500 is relative to preset reference line The method of deflection angle include step S140 and step S150.
It should be noted that preset reference line refers to a normal line of the inclined direction for judging target text, Reference line can have following two modes in the present invention, the first reference line refers to being set as with the edge line of display interface 400 Reference line, it is to be understood that display interface 400 usually has two groups of parallel edge lines, referring to Fig. 4, display interface 400 wraps Edge line A and edge line B are included, edge line A and edge line B is to be vertically arranged, and edge line A1 is parallel with edge line A2, edge line B1 Parallel with edge line B2, position as shown in Figure 4, then reference line is A1, when display interface 400 carries out 180 degree rotation, ginseng It is that edge line A2 further on the basis of current display interface 400, rotates clockwise 90 degree to examine line, then reference line is side Edge line B2, is rotated by 90 ° when counterclockwise, and reference line is that edge line B1 is set different according to the location of display interface 400 Reference line, to facilitate user to read.
Further, the selection of reference line can also be another way in the present invention, i.e. reference line is level side always To.In this way, no matter the rotation of display interface 400 is to which kind of angle, the level monitored always according to the gyroscope in display equipment Subject to direction, referring to Fig. 5, when display interface 400 is angled put when, reference line is then horizontal line, in figure shown in " C " Lines then be reference line, finally, the target text on Target Photo 500 is rotated and is shown using horizontal line as reference line, As shown in fig. 6, being Target Photo 500 using horizontal line as the rotation schematic diagram of reference line.This mode more due in first with aobvious Show that the edge line at interface 400 is the mode of reference line, first way is only in horizontal and vertical side in display interface 400 To display when reading effect it is best, but when display interface 400 when other angles are put target text with The edge line of display interface 400 shows that reading effect is bad, and the second way always using horizontal line as reference line, then without How to be rotated by display interface 400, can ensure that the angle that Target Photo 500 rotates is the angle for being most suitable for reading.
Specifically, the target text phase by reference line to illustrate to obtain in the Target Photo 500 in a manner of horizontal For the method for the deflection angle of preset reference line, referring to Fig. 3, including:
S140, the baseline for obtaining the target text, the baseline are the horizontal line on the horizontally long direction of the target text;
Baseline is font design and a conception of species of typesetting, is originated from the bottom part body of letter word to its position, for For Chinese character, the baseline is the horizontal line on the horizontally long direction of the word;Chinese character is using the square frame of a word square as base Certainly position, stroke is wide interior placed in the middle in word and is full of word frame, therefore can analyze a baseline, referring to Fig. 7, indicated by " D " Lines are then the extending direction of baseline.
The angle number of degrees between S150, the calculating baseline and the reference line, the angle number of degrees are the deflection angle Deflection angle.
Fig. 7 is further regarded to, the angle that " θ " is indicated is then the angle number of degrees between the baseline and reference line of target text, Namely deflection angle.It can be seen from the figure that under present case, it is only necessary to picture are rotated in a clockwise direction " θ " angle, i.e., It can be by the status display as described in Figure 6 of the target text on Target Photo 500.
S200, the rotation angle that the Target Photo 500 is generated according to the deflection angle;
In the introduction of above-mentioned S150 steps, by way of illustrating that Target Photo 500 is rotated in conjunction with Fig. 6 and Fig. 7, still It can be seen from the figure that in this embodiment, the baseline of the target text in Target Photo 500 all in one direction, this Sample, it is only necessary to calculate deflection of the baseline of the target text of certain a line either between the baseline and reference line of some word Angle, you can obtain the rotation angle of Target Photo 500, in such cases, it is assumed that Target Photo 500 be rotated in a clockwise direction for Forward direction is rotated in the counterclockwise direction as negative sense, then the rotation angle rotated clockwise is "+θ ", the rotation angle rotated counterclockwise Acquisition modes for "-θ ", rotation angle are relatively simple.
But in another embodiment, the target text in Target Photo 500 includes a variety of base directions, such as Fig. 8 institutes Show, each target text has different baselines respectively in Target Photo 500, and the target text has different deflection Angle, the deflection angle only obtained merely between the baseline and reference line of one of target text cannot access Target Photo 500 Rotation angle, therefore need further processing.In the present invention when in the target text including the direction of multiple baselines, root It is corresponded to according to the multiple baseline and generates multiple deflection angles, the rotation angle that the Target Photo is generated according to the deflection angle Method include the following steps, please refer to Fig. 9:
S210, the deflection angle is counted using angle value as statistical condition;
Due in step s 110, using target text engine openCV or OCR by each mesh in Target Photo 500 Mark word all identifies, therefore can obtain the baseline of each target text simultaneously, records the base of each target text Deflection angle between line and reference line, and counted.Deflection angle preferably with direction angle, for example, when with horizontal line For horizontal axis X, numerical value line is the coordinate of the longitudinal axis Y compositions when being reference coordinate, and deflection angle is located at first and fourth quadrant is positive value, table Show that Target Photo 500 can be rotated in a clockwise direction, when deflection angle is located at second and third quadrant, is defined as bearing Value indicates that Target Photo 500 is rotated along defence line counterclockwise to reach optimal read direction." to joyously celebrate a festival " in attached drawing 8, this is several A word is decomposed, and the deflection angle of these words is respectively θ 1, θ 2, θ 3 and θ 4, and as can be seen from the figure θ 1, θ 2 are all located at first Quadrant, therefore be positive value, font can be shown in the horizontal direction with rotating clockwise, and θ 3, θ 4 are all located at fourth quadrant, therefore be negative Value, rotates in a counter-clockwise direction and can show font in the horizontal direction.Such mode is also convenient for carrying out each deflection angle Statistics.In the present embodiment, the mode of statistics can be that identical deflection angle is returned into one kind, and same angular angle value, positive and negative values are not It with being two different deflection angles, counts by this method, how many kind deflection angle is then divided into how many class.
S220, statistical result is arranged by drop power mode;
Mode according to above-mentioned steps S210 carries out statistics classification to the deflection angle of all target texts, each is identical Deflection angle is that a classification arranges the category according to the quantity of deflection angle.In the present invention, it is preferred to drop the mode of power It is arranged, i.e., the classification more than identical deflection angle quantity is come into front.The specific method of arrangement can be to each classification It is numbered, for example, being 1 by the most number of deflection angle quantity, the number of quantity more than second is 2, and so on.It needs to illustrate , the above numbering, only to facilitate understand for example, numbering and classification processing mode are not limited to Above several, every scheme for using same thought is all included in protection scope of the present invention.
S230, the rotation angle for rotating the Target Photo 500 is generated according to the rank results.
It has been obtained in Target Photo 500 after the Rankine-Hugoniot relations of the deflection angle of all target texts, has been generated according to step S220 There are many ways to rotating the rotation angle of the Target Photo 500, as shown in Figure 10, is generated for one of which and rotate the target The method of the rotation angle of picture 500, includes the following steps:
S231, the deflection angle for being located at first place in the rank results is obtained;
S232, the Target Photo 500 is rotated according to the deflection angle for being located at first place.
In step S220, the deflection angle of all target texts is sorted out, therefore pair for being directly 1 by number The deflection angle answered is set to rotation angle, and preferably deflection angle is defined as with directive angle, as described in step S210, when When deflection angle is positive value, Target Photo 500 is rotated clockwise, when deflection angle is negative value, Target Photo 500 is carried out Rotation counterclockwise.
In the present embodiment, since the quantity of the deflection angle positioned at the first classification is most, therefore will be positioned at the first classification Corresponding deflection angle, which is defined as rotation angle, can be such that word most in Target Photo 500 rotates to most suitable reading direction, in this way It is more convenient to read to target text.
And in another embodiment, the method for generating the rotation angle for rotating the Target Photo 500 is also disclosed, is please referred to Figure 11, step include:
S233, pending control instruction is obtained, the control instruction is used to switch the rotation angle of the Target Photo 500 Degree;
S234, the Target Photo is rotated according to the deflection angle that the control instruction arranges along the rank results successively 500。
The method of such picture rotation is a kind of more complicated rotation of the method for the picture rotation in a kind of upper embodiment Mode can be rotated automatically, can also be to be controlled by dependent instruction, when to be rotated automatically, The corresponding deflection angle of the classification most from deflection angle quantity is that rotation angle carries out first time rotation, is rotated when having executed first time Afterwards, then using the corresponding deflection angle of classification of deflection angle quantity more than second it is rotated as rotation angle, when rotation finishes, then with Deflection angle more than three is that rotation angle is rotated, and so on.
Further, putting in order according to deflection angle quantity, the side that the deflection angle most from quantity is rotated successively Formula can also be manually rotation mode, for example, in one embodiment, system obtains the control for the order for executing rotation for the first time System instruction carries out first time rotation to Target Photo 500, and angle of declaring a war is the most corresponding deflection of classification of deflection angle quantity Angle;When receiving next control instruction, then execute the rotation of Target Photo 500 next time, the angle rotated at this time Degree is the corresponding deflection angle of classification of deflection angle quantity more than second, and so on, after receiving the control instruction stopped rotating, It stops rotating to Target Photo 500.Or after all deflection angles were carried out and are rotated with this, it is automatically stopped Target Photo 500 rotation.
Respective figure 9 when in the target text include multiple baselines direction when, according to the multiple baseline correspond to Multiple deflection angles are generated, the method for the rotation angle that the Target Photo is generated according to the deflection angle includes following step Suddenly, 2 are please referred to Fig.1:
S240, the average angle number of degrees for calculating deflection angle in the Target Photo 500;
S250, the average angle number of degrees are set to rotation angle.
In step s 110, using target text engine openCV or OCR that each target in Target Photo 500 is literary Word all identifies, therefore can obtain the baseline of each target text and the quantity of target text simultaneously, records each Deflection angle between the baseline and reference line of a target text, in the present embodiment, by the inclined of each target text of acquisition It is rotation angle that corner addition, which takes the average angle number of degrees, such method be especially suitable for the baseline of each target text and reference line it Between the little situation of angle difference range, for example, the difference of the deflection angle between the baseline and reference line of all target texts Value using the method averaged, rotates Target Photo 500 when ± 60 °, can effectively improve Target Photo The reading comfort degree of target text on 500.
Further, 3 are please referred to Fig.1 invention additionally discloses a kind of device of picture rotation, including:
Acquisition module 100:For obtaining deflection of the target text in Target Photo 500 relative to preset reference line Angle, gravity direction of the reference line perpendicular to terminal;
Processing module 200:Rotation angle for generating the Target Photo 500 according to the deflection angle;
Execution module 300:For rotating the Target Photo 500 according to the rotation angle.
Acquisition module 100 and execution module 300 are electrically connected with processing module 200 respectively, and the direction of reference line here is A parameter being preset in acquisition module 100, refering to the method for above-mentioned picture rotation, the rotation at least two of the reference line Kind, one is reference line is set as with the edge line of display interface 400, another kind is always using horizontal direction as reference line side To the technique effect that the selection mode of two kinds of reference lines is reached is different, the first direction for being suitable for display interface 400 is not allowed Mutability, or always with 90 degree of occasions for rotational units rotation, second is suitable for arbitrary occasion, and display interface 400 can Arbitrarily to rotate, the rotation of the Target Photo 500 in display display interface 400 is not affected.
Further, the rotation of Target Photo 500 is according to the target text on Target Photo 500 and inclined between reference line Turn to be performed, therefore before deflection angle of the target text in obtaining Target Photo 500 relative to preset reference line, also It needs to obtain the target text in Target Photo 500, therefore the device of the picture rotation of the present invention further includes:
Identification module:The pixel value of target text described in the Target Photo 500 for identification;
Computing module:Between 500 total pixel value of pixel value for calculating the target text and the Target Photo Ratio;
Judgment module:For judging whether the ratio is more than preset first to compare threshold value;When the ratio is more than institute When stating first and comparing threshold value, deflection of the target text obtained in Target Photo 500 relative to preset reference line is triggered Angle.
Target text in identification Target Photo 500 can be identified by target text engine openCV or OCR, be identified Module identifies the target text base direction in target text and current goal picture 500 all in Target Photo 500, knows Not all target texts are conducive to distinguish target text and image content in Target Photo 500, avoid having class in picture It is similar to target text but is not the subsequent processing work of disturbing factor influence of target text again.It is when which is recognized accurately Target text which when be background, then the picture of 500 Chinese of Target Photo can quickly, be accurately calculated by computing module Ratio between element value and 500 total pixel value of the Target Photo, judges ratio threshold value compared with first by judgment module Relationship, first compare threshold value storage judgment module in.When ratio, which is equal to or over first, compares threshold value, then into The rotation processing of row picture is then not necessarily to carry out rotation processing to picture, with section when ratio compares threshold value no more than first Save processor resource.
Further, for obtaining deflection of the target text in the Target Photo 500 relative to preset reference line The acquisition module at angle further includes:
First acquisition module:Baseline for obtaining the target text, the baseline are the horizontally long side of the target text Upward horizontal line;
First computing module:For calculating the angle number of degrees between the baseline and the reference line, the angle number of degrees For the deflection angle of the deflection angle.
When in the target text including multiple base directions, the picture rotation device further includes:
Statistical module:For being counted to the deflection angle using angle value as statistical condition;
Queue generation module:For statistical result to be arranged by drop power mode;
Angle generation module:For generating the rotation angle for rotating the Target Photo 500 according to the rank results.
After generating rotation angle, including two kinds of methods for rotating the Target Photo 500, therefore corresponding two kinds of device knots Structure, the first corresponding picture rotation device of method for rotating the Target Photo 500 include:Second acquisition module, for obtaining It takes and is located at the first deflection angle in the rank results;First execution module:For rotating the target according to the deflection angle Picture 500.It is more that the method that the corresponding Target Photo 500 of such structure rotates is suitable for target text, exists compared with multiple target text Word deflection angle is identical, and the deflection angle of target text differs larger situation.Second of method for rotating the Target Photo 500 The structure of corresponding picture rotation device includes:Third acquisition module:For obtaining pending control instruction, the control refers to Enable the rotation angle for switching the Target Photo 500;Second execution module:For according to the control instruction successively along institute It states the deflection angle arranged in rank results and rotates the Target Photo 500.The corresponding method of such picture rotation device is upper one A kind of more complicated rotation mode of the method for picture rotation in kind embodiment, can be rotated automatically, can also It is to be controlled by dependent instruction, when to be rotated automatically, the corresponding deflection of the classification most from deflection angle quantity Angle is that rotation angle carries out first time rotation, after having executed first time rotation, then with the classification pair of deflection angle quantity more than second The deflection angle answered is that rotation angle is rotated, and is rotated as rotation angle when rotation finishes, then using the deflection angle more than third, And so on.Further, putting in order according to deflection angle quantity, the side that the deflection angle most from quantity is rotated successively Formula can also be manually rotation mode.Specific rotation mode can refer to above-mentioned picture rotation method.
Further, when in the target text including multiple base directions, the picture rotation device also wraps Another structure is included, specifically, including:
Second computing module:The average angle number of degrees for calculating deflection angle in the Target Photo 500;
Angle generation module:For the average angle number of degrees to be set to rotation angle.
In the present invention, using target text engine openCV or OCR by each target text in Target Photo 500 It identifies, therefore the baseline of each target text and the quantity of target text can be obtained simultaneously, record each mesh The deflection angle between the baseline and reference line of word is marked, in the present embodiment, by the deflection angle of each target text of acquisition It is rotation angle that addition, which takes the average angle number of degrees, and such method is especially suitable between the baseline and reference line of each target text Angle differs the little situation of range, for example, the difference of the deflection angle between the baseline and reference line of all target texts exists When ± 60 °, using the method averaged, Target Photo 500 is rotated, can be effectively improved on Target Photo 500 Target text reading comfort degree.
Invention additionally discloses a kind of computer equipment, including memory and processor, calculating is stored in the memory Machine readable instruction, when the computer-readable instruction is executed by the processor so that the processor executes above-mentioned any one The item picture rotation method.
The embodiment of the present invention provides computer equipment basic structure block diagram, please refers to Fig.1 4, which includes logical Cross processor, non-volatile memory medium, memory and the network interface of system bus connection.Wherein, the computer equipment Non-volatile memory medium is stored with operating system, database and computer-readable instruction, and control letter can be stored in database Sequence is ceased, when which is executed by processor, processor may make to realize a kind of picture rotation method.The calculating The processor of machine equipment supports the operation of entire computer equipment for providing calculating and control ability.The computer equipment It can be stored with computer-readable instruction in memory, when which is executed by processor, processor may make to hold A kind of picture rotation method of row.The network interface of the computer equipment is used for and terminal connection communication.Those skilled in the art can To understand, structure is not constituted only with the block diagram of the relevant part-structure of application scheme to this Shen shown in Figure 14 Please the restriction of computer equipment that is applied thereon of scheme, specific computer equipment may include than as shown in the figure more or Less component either combines certain components or is arranged with different components.
Processor is for executing acquisition module 2100 in Figure 14, processing module 2200 and execution module in present embodiment 2300 particular content, memory are stored with the program code and Various types of data executed needed for above-mentioned module.Network interface is used for To the data transmission between user terminal or server.Memory in present embodiment is stored in user behavior exciting bank The program code and data needed for all submodules are executed, server is capable of the program code of invoking server and data execute institute There is the function of submodule
The status information for prompting behavior that computer equipment is sent by receiving associated client, i.e., whether associated terminal It opens prompt and whether user closes the prompt task.By verifying whether above-mentioned task condition is reached, and then eventually to association End sends corresponding preset instructions, so that associated terminal can execute corresponding operation according to the preset instructions, to realize Effective supervision to associated terminal.Meanwhile when prompt message state and preset status command differ, server end control Associated terminal persistently carries out jingle bell, to prevent the prompt task of associated terminal the problem of being terminated automatically after executing a period of time.
The present invention also provides a kind of storage mediums being stored with computer-readable instruction, and the computer-readable instruction is by one When a or multiple processors execute so that one or more processors execute picture rotation method described in any of the above-described embodiment.
One of ordinary skill in the art will appreciate that realizing all or part of flow in above-described embodiment method, being can be with Relevant hardware is instructed to complete by computer program, which can be stored in a computer-readable storage and be situated between In matter, the program is when being executed, it may include such as the flow of the embodiment of above-mentioned each method.Wherein, storage medium above-mentioned can be The non-volatile memory mediums such as magnetic disc, CD, read-only memory (Read-Only Memory, ROM) or random storage note Recall body (Random Access Memory, RAM) etc..
It should be understood that although each step in the flow chart of attached drawing is shown successively according to the instruction of arrow, These steps are not that the inevitable sequence indicated according to arrow executes successively.Unless expressly stating otherwise herein, these steps Execution there is no stringent sequences to limit, can execute in the other order.Moreover, at least one in the flow chart of attached drawing Part steps may include that either these sub-steps of multiple stages or stage are not necessarily in synchronization to multiple sub-steps Completion is executed, but can be executed at different times, execution sequence is also not necessarily to be carried out successively, but can be with other Either the sub-step of other steps or at least part in stage execute step in turn or alternately.
The above is only some embodiments of the present invention, it is noted that for the ordinary skill people of the art For member, various improvements and modifications may be made without departing from the principle of the present invention, these improvements and modifications are also answered It is considered as protection scope of the present invention.

Claims (10)

1. a kind of picture rotation method, which is characterized in that including:
Obtain deflection angle of the baseline relative to preset reference line of the target text in Target Photo, the reference line perpendicular to The gravity direction of terminal;
The rotation angle of the Target Photo is generated according to the deflection angle;
The Target Photo is rotated according to the rotation angle.
2. picture rotation method according to claim 1, which is characterized in that the target obtained in the Target Photo Before the step of deflection angle of the baseline of word relative to preset reference line, further include:
Identify the pixel value of target text described in the Target Photo;
Calculate the ratio between the pixel value of the target text and the total pixel value of the Target Photo;
Judge whether the ratio more than or equal to preset first compares threshold value;When the ratio is greater than or equal to described first When comparing threshold value, deflection angle of the target text obtained in Target Photo relative to preset reference line is triggered.
3. picture rotation method according to claim 1, which is characterized in that the target obtained in the Target Photo The baseline of word includes relative to the method for the deflection angle of preset reference line:
The baseline of the target text is obtained, the baseline is the horizontal line on the horizontally long direction of the target text;
The angle number of degrees between the baseline and the reference line are calculated, the angle number of degrees are the deflection angle of the deflection angle.
4. picture rotation method according to claim 1, which is characterized in that when in the target text include multiple baselines Direction when, corresponded to according to the multiple baseline and generate multiple deflection angles, it is described that the target figure is generated according to the deflection angle The method of the rotation angle of piece includes:
The multiple deflection angle is counted using angle value as statistical condition;
Statistical result is arranged by drop power mode;
The rotation angle for rotating the Target Photo is generated according to the rank results.
5. picture rotation method according to claim 4, which is characterized in that the method packet of the rotation Target Photo It includes:
It obtains and is located at the first deflection angle in the rank results;
It is located at the first deflection angle rotation Target Photo according to described.
6. picture rotation method according to claim 4, which is characterized in that the method packet of the rotation Target Photo It includes:
Pending control instruction is obtained, the control instruction is used to switch the rotation angle of the Target Photo;
The Target Photo is rotated according to the deflection angle that the control instruction arranges along the rank results successively.
7. picture rotation method according to claim 1, which is characterized in that when in the target text include multiple baselines Direction when, corresponded to according to the multiple baseline and generate multiple deflection angles, it is described that the target figure is generated according to the deflection angle The method of the rotation angle of piece includes:
Calculate the average angle number of degrees of multiple deflection angles in the Target Photo;
The average angle number of degrees are set to rotation angle.
8. a kind of picture rotation device, which is characterized in that including:
Acquisition module:For obtaining deflection angle of the baseline of the target text in Target Photo relative to preset reference line, institute State gravity direction of the reference line perpendicular to terminal;
Processing module:Rotation angle for generating the Target Photo according to the deflection angle;
Execution module:For rotating the Target Photo according to the rotation angle.
9. a kind of computer equipment, which is characterized in that including memory and processor, being stored with computer in the memory can Reading instruction, when the computer-readable instruction is executed by the processor so that the processor executes such as claim 1 to 7 Any one of picture rotation method described in claim.
10. a kind of storage medium being stored with computer-readable instruction, which is characterized in that the computer-readable instruction is by one Or multiple processors are when executing so that one or more processors are executed as described in any one of claim 1 to 7 claim The step of picture rotation method.
CN201810391961.8A 2018-04-27 2018-04-27 Picture rotation method, apparatus, computer equipment and storage medium Pending CN108573473A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201810391961.8A CN108573473A (en) 2018-04-27 2018-04-27 Picture rotation method, apparatus, computer equipment and storage medium
PCT/CN2018/102863 WO2019205400A1 (en) 2018-04-27 2018-08-29 Image rotation method and device, computer apparatus, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810391961.8A CN108573473A (en) 2018-04-27 2018-04-27 Picture rotation method, apparatus, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN108573473A true CN108573473A (en) 2018-09-25

Family

ID=63575336

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810391961.8A Pending CN108573473A (en) 2018-04-27 2018-04-27 Picture rotation method, apparatus, computer equipment and storage medium

Country Status (2)

Country Link
CN (1) CN108573473A (en)
WO (1) WO2019205400A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109528315A (en) * 2018-11-12 2019-03-29 南京迈瑞生物医疗电子有限公司 Visual area image control system, method, computer equipment and storage medium
CN110415177A (en) * 2019-07-26 2019-11-05 四川长虹电器股份有限公司 A kind of image rotation sanction drawing method based on Java

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103500332A (en) * 2013-09-06 2014-01-08 优视科技有限公司 Character display method and device in image
CN103714327A (en) * 2013-12-30 2014-04-09 上海合合信息科技发展有限公司 Method and system for correcting image direction
CN104835120A (en) * 2015-04-23 2015-08-12 天津大学 Bended book cover flattening method based on datum line
CN106097254A (en) * 2016-06-07 2016-11-09 天津大学 A kind of scanning document image method for correcting error
CN106447615A (en) * 2016-08-02 2017-02-22 浪潮软件股份有限公司 Tilt correction method for scanning document image
CN106776656A (en) * 2015-11-25 2017-05-31 中兴通讯股份有限公司 Adjust the display methods and device of picture character
CN106778733A (en) * 2015-11-25 2017-05-31 中兴通讯股份有限公司 Adjust the display methods and device of picture character
CN107038440A (en) * 2016-02-04 2017-08-11 株式会社理光 Image tilt calibration apparatus, image processing system and image tilt correction method
WO2017206392A1 (en) * 2016-06-01 2017-12-07 中兴通讯股份有限公司 Image correction method and device, and projector

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101374198A (en) * 2007-08-24 2009-02-25 鸿富锦精密工业(深圳)有限公司 Camera device and automatic frontal method for image thereof
CN103474050B (en) * 2012-06-06 2017-03-15 富泰华工业(深圳)有限公司 Image display and method for displaying image
CN103885611B (en) * 2014-04-22 2018-01-19 锤子科技(北京)股份有限公司 A kind of method and apparatus for adjusting image

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103500332A (en) * 2013-09-06 2014-01-08 优视科技有限公司 Character display method and device in image
CN103714327A (en) * 2013-12-30 2014-04-09 上海合合信息科技发展有限公司 Method and system for correcting image direction
CN104835120A (en) * 2015-04-23 2015-08-12 天津大学 Bended book cover flattening method based on datum line
CN106776656A (en) * 2015-11-25 2017-05-31 中兴通讯股份有限公司 Adjust the display methods and device of picture character
CN106778733A (en) * 2015-11-25 2017-05-31 中兴通讯股份有限公司 Adjust the display methods and device of picture character
CN107038440A (en) * 2016-02-04 2017-08-11 株式会社理光 Image tilt calibration apparatus, image processing system and image tilt correction method
WO2017206392A1 (en) * 2016-06-01 2017-12-07 中兴通讯股份有限公司 Image correction method and device, and projector
CN106097254A (en) * 2016-06-07 2016-11-09 天津大学 A kind of scanning document image method for correcting error
CN106447615A (en) * 2016-08-02 2017-02-22 浪潮软件股份有限公司 Tilt correction method for scanning document image

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109528315A (en) * 2018-11-12 2019-03-29 南京迈瑞生物医疗电子有限公司 Visual area image control system, method, computer equipment and storage medium
CN109528315B (en) * 2018-11-12 2021-12-17 南京迈瑞生物医疗电子有限公司 Surgical field image control system, method, computer device and storage medium
CN110415177A (en) * 2019-07-26 2019-11-05 四川长虹电器股份有限公司 A kind of image rotation sanction drawing method based on Java

Also Published As

Publication number Publication date
WO2019205400A1 (en) 2019-10-31

Similar Documents

Publication Publication Date Title
US10949661B2 (en) Layout-agnostic complex document processing system
US8607331B2 (en) Captcha image authentication method and system
WO2019119966A1 (en) Text image processing method, device, equipment, and storage medium
US20060069734A1 (en) Method and system for organizing and displaying message threads
US20040119740A1 (en) Methods and apparatus for displaying and replying to electronic messages
CN110222694B (en) Image processing method, image processing device, electronic equipment and computer readable medium
PH12015500096B1 (en) Method and mobile terminal for notifying and displaying message
US8792730B2 (en) Classification and standardization of field images associated with a field in a form
CN108319592A (en) A kind of method, apparatus and intelligent terminal of translation
CN111259968A (en) Illegal image recognition method, device, equipment and computer readable storage medium
CN107291677A (en) A kind of PDF document header syntax tree generation method, device, terminal and system
WO2022142551A1 (en) Form processing method and apparatus, and medium and computer device
CN108573473A (en) Picture rotation method, apparatus, computer equipment and storage medium
US20070158403A1 (en) Business card information exchange device and method
JP2022550195A (en) Text recognition method, device, equipment, storage medium and computer program
US10552535B1 (en) System for detecting and correcting broken words
CN109242410A (en) A kind of generation method and device of backlog
US8731284B2 (en) Method and system for detecting image spam
CN108304562A (en) One kind searching topic method, searches topic device and intelligent terminal
CN114428688A (en) Online rapidly-shared table content extracting and processing method
CN113936202A (en) Image security processing method and device, electronic equipment and storage medium
CN109933254A (en) Show method, equipment and the computer storage medium of reading content
CN112528984A (en) Image information extraction method, device, electronic equipment and storage medium
CN109376825A (en) A kind of two-dimensional code generation method and device
CN110059563A (en) A kind of text handling method and device

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20180925

RJ01 Rejection of invention patent application after publication