WO2019205400A1 - 图片旋转方法、装置、计算机设备及存储介质 - Google Patents

图片旋转方法、装置、计算机设备及存储介质 Download PDF

Info

Publication number
WO2019205400A1
WO2019205400A1 PCT/CN2018/102863 CN2018102863W WO2019205400A1 WO 2019205400 A1 WO2019205400 A1 WO 2019205400A1 CN 2018102863 W CN2018102863 W CN 2018102863W WO 2019205400 A1 WO2019205400 A1 WO 2019205400A1
Authority
WO
WIPO (PCT)
Prior art keywords
target
angle
picture
baseline
deflection
Prior art date
Application number
PCT/CN2018/102863
Other languages
English (en)
French (fr)
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 平安科技(深圳)有限公司
Publication of WO2019205400A1 publication Critical patent/WO2019205400A1/zh

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

Definitions

  • the present application relates to the field of picture display technology, and in particular, the present application relates to a picture rotation method, device, computer device and storage medium.
  • the inventor realized that due to the problem of the photographing angle, the related target text information cannot be read well from the photograph, or the information of the photograph content is inconvenient due to the problem of the photographing angle, for example, the angle of the display screen needs to be constantly changed. It is very inconvenient to read the information content in the photo and when the display is fixed.
  • the inventor of the present application found in the research that the method for rotating a picture in the prior art is to rotate according to the angle of the extension of the target text in the picture with respect to the horizontal plane of the display interface, which is only applicable to the target text in the picture.
  • the unified direction is inclined, when the plurality of target characters are in different angle directions, the rotation angle cannot be recognized, and the application scenario is single.
  • the purpose of the present application is to solve at least one of the above technical defects, in particular, to solve the problem that the target text in the picture is not displayed at the same angle, which is inconvenient to read.
  • the present application provides a picture rotation method, including: acquiring a deflection angle of a baseline of a target text in a target picture with respect to a preset reference line, the reference line being perpendicular to a gravity direction of the terminal; A deflection angle generates a rotation angle of the target picture; and the target picture is rotated according to the rotation angle.
  • the present application further discloses a picture rotation device, comprising: an acquisition module: configured to acquire a deflection angle of a target text in a target picture with respect to a preset reference line, the reference line is perpendicular to a gravity direction of the terminal; and the processing module: Generating a rotation angle of the target picture according to the deflection angle;
  • Execution module for rotating the target picture according to the rotation angle.
  • the present application also discloses a computer device comprising a memory and a processor, the memory storing computer readable instructions, the computer readable instructions being executed by the processor, causing the processor to perform a picture rotation a method of: obtaining a deflection angle of a baseline of a target text in a target picture with respect to a preset reference line, the reference line being perpendicular to a gravity direction of the terminal; generating a rotation angle of the target image according to the deflection angle Rotating the target picture according to the rotation angle.
  • the present application also discloses a non-volatile storage medium storing computer readable instructions that, when executed by one or more processors, cause one or more processors to perform a picture rotation method a step of: obtaining a deflection angle of a baseline of the target text in the target image with respect to a preset reference line, the reference line being perpendicular to a gravity direction of the terminal; generating a rotation angle of the target image according to the deflection angle; The rotation angle rotates the target picture.
  • the beneficial effects of the present application are: the method and apparatus for rotating a picture disclosed in the present application, by acquiring the deflection angle of the target text in the target picture with respect to the reference line, thereby acquiring the rotation angle of the target picture, rotating the target picture, and making the target
  • the target text in the image is displayed in front of the user in an optimal reading manner, which makes the user more convenient to read and improve the customer experience.
  • FIG. 1 is a flow chart of a method for rotating a picture of the present application
  • FIG. 2 is a flowchart of a method for acquiring target text in a target picture in the present application
  • FIG. 3 is a flowchart of a method for acquiring a deflection angle of a target text in a target picture with respect to a preset reference line according to the present application;
  • FIG. 4 is a schematic diagram of a display interface of the present application.
  • Figure 5 is a schematic view showing the interface of the present application when placed at an angle
  • FIG. 6 is a schematic diagram of rotation of a target picture of the present application with a horizontal line as a reference line;
  • FIG. 7 is a schematic diagram showing an extension direction of a target text baseline on a target picture of the present application.
  • Figure 8 is a schematic view showing the deflection angle of the target text of different baselines of the present application.
  • FIG. 9 is a flow chart of a processing manner in a first embodiment of generating a rotation angle of a target text differently at a baseline according to the present application;
  • FIG. 10 is a flowchart of a method for generating a rotation angle of the target picture according to the present application
  • FIG. 11 is a flowchart of a method for generating a second embodiment of a rotation angle of the target picture according to the present application.
  • FIG. 12 is a flow chart of a processing manner in a second embodiment of generating a rotation angle of a target text differently at a baseline according to the present application;
  • Figure 13 is a block diagram showing the connection of the device for rotating the picture of the present application.
  • Figure 14 is a block diagram showing the basic structure of a computer device of the present application.
  • terminal and terminal device used herein include both a wireless signal receiver device, a device having only a wireless signal receiver without a transmitting capability, and a receiving and transmitting hardware.
  • Such devices may include cellular or other communication devices having a single line display or a multi-line display or a cellular or other communication device without a multi-line display; PCS (Personal Communications Service), which may combine voice, data Processing, fax, and/or data communication capabilities; PDA (Personal Digital Assistant), which can include radio frequency receivers, pagers, Internet/Intranet access, web browsers, notepads, calendars, and/or GPS (Global Positioning System (Global Positioning System) receiver; conventional laptop and/or palmtop computer or other device having a conventional laptop and/or palmtop computer or other device that includes and/or includes a radio frequency receiver.
  • PCS Personal Communications Service
  • PDA Personal Digital Assistant
  • terminal may be portable, transportable, installed in a vehicle (aviation, sea and/or land), or adapted and/or configured to operate locally, and/or Run in any other location on the Earth and/or space in a distributed form.
  • the "terminal” and “terminal device” used herein may also be a communication terminal, an internet terminal, a music/video playing terminal, and may be, for example, a PDA, a MID (Mobile Internet Device), and/or have a music/video playback.
  • Functional mobile phones can also be smart TVs, set-top boxes and other devices.
  • the present application provides a method for rotating a picture, as shown in FIG. 1 , including the following steps:
  • the target image 500 is a picture that needs to be rotated, and the target text is a text in the target picture 500.
  • the target text may be a single character or multiple characters, and the application of the present application
  • the scene mainly lies in that in the display interface 400, the picture is rotated according to the deflection angle between the baseline of the target text in the target picture and the reference line, so that the target text is presented at a more suitable reading angle.
  • the rotation of the target picture 500 is performed according to the deflection between the target text and the reference line on the target picture 500, so before the deflection angle of the target text in the target picture 500 is acquired with respect to the preset reference line, The target text in the target picture 500 needs to be obtained.
  • a method for acquiring target text in a target picture 500 is provided. Referring to FIG. 2, the method includes:
  • the target text in the recognition target picture 500 can be identified by the target text engine openCV or OCR. Taking the OCR recognition as an example, the method for identifying the target text in the target picture 500 includes:
  • the target image containing the target text is processed for subsequent feature extraction and learning.
  • the main purpose of this process is to reduce the useless information in the target picture 500 for subsequent processing.
  • this step there are generally sub-steps of grayscale, noise reduction, binarization, character segmentation, and normalization.
  • the grayscale step is performed when the target picture 500 is a color picture. After binarization, there are only two colors left in the image, black and white, one of which is the background of the image, and the other is the target text to be recognized. Noise reduction of the target text for better target word processing.
  • Character segmentation divides the target text in the image into a single target text to identify a single target text.
  • the pixel value of the target text in the target image 500 can be calculated.
  • the pixel value is a value given by the computer when the original image is digitized, and represents the average luminance information of a small square of the original, or the average reflected (transmission) density information of the small square.
  • the total pixel value of the target image 500 is calculated, and the ratio of the pixel value of the target text in the target image 500 to the total pixel value is counted.
  • the purpose of calculating the ratio of the pixel value of the target character in the target picture 500 to the total pixel value is to determine whether it is necessary to perform the picture rotation. When there is no target text in the target picture 500, or the target text is small enough to affect the reading, there is no need to rotate the picture. However, when the target picture 500 has a large number of target characters, and the irregularly displayed target picture 500 brings a certain reading difficulty to the user, the target picture 500 is rotated.
  • the specific determination method is: determining whether the ratio of the pixel value of the target text in the target picture 500 to the total pixel value exceeds a preset first comparison threshold, and acquiring the ratio when the ratio exceeds the first comparison threshold.
  • the first comparison threshold is a reference value input in advance, and the reference value can be any value, and can be set according to the language read by the user. Because different languages have different composition of the target text, the corresponding pixel value ratio will not be Similarly, for example, the proportion of a single English letter is usually less than that of a single Chinese character. Therefore, in the case where the target picture 500 with English is usually used to display the target picture 500 with English, the first comparison threshold set in the system is smaller than that used for the presentation band. There is a first comparison threshold for the target picture 500 in Chinese. In the present application, the target image 500, which is often used to display Chinese, is taken as an example.
  • the first comparison threshold is set to 10%.
  • the step of acquiring the deflection angle of the target text in the target picture 500 with respect to the preset reference line is performed to perform the rotation of the target picture 500.
  • the method for acquiring the deflection angle of the baseline of the target text in the target picture 500 with respect to the preset reference line includes step S140 and step S150.
  • the preset reference line refers to a standard line for determining the tilt direction of the target text.
  • the reference line may have the following two modes.
  • the first reference line refers to the edge of the display interface 400.
  • the line is set as a reference line.
  • the display interface 400 generally has two sets of parallel edge lines. Referring to FIG. 4, the display interface 400 includes an edge line A and an edge line B. The edge line A and the edge line B are perpendicular. The edge line A1 is parallel to the edge line A2, and the edge line B1 is parallel to the edge line B2. As shown in FIG. 4, the reference line is A1. When the display interface 400 is rotated by 180 degrees, the reference line is the edge line A2.
  • the reference line when rotated clockwise by 90 degrees, the reference line is the edge line B2, and when rotated 90 degrees counterclockwise, the reference line is the edge line B1, according to the position of the display interface 400, Set different reference lines for the user to read.
  • the selection of the reference line in the present application may be another way, that is, the reference line is always in the horizontal direction.
  • the horizontal direction monitored by the gyroscope in the display device is always used.
  • the reference line is a horizontal line.
  • the line shown by "C" in the figure is a reference line.
  • the target text on the target picture 500 is rotated and displayed with the horizontal line as a reference line, as shown in FIG. 6, the rotation of the target picture 500 with the horizontal line as a reference line.
  • the first way is to use the edge line of the display interface 400 as a reference line.
  • the reading effect is best only when the display interface 400 is displayed in the horizontal and vertical directions, but when the display interface 400 is When the other angles are displayed, the target text is displayed along the edge line of the display interface 400, and the reading effect is not good, and the second method always uses the horizontal line as the reference line, and the target image can be guaranteed regardless of the rotation of the display interface 400.
  • the angle of 500 rotation is the best angle to read.
  • the method includes:
  • Baseline is a concept of font design and typesetting, which is derived from the position of the bottom of the main body of the western alphabet.
  • the baseline is the horizontal line in the horizontal direction of the text; the Chinese characters are square in square
  • the frame is positioned as a reference. The stroke is centered within the word width and is filled with a box. Therefore, a baseline can be analyzed. Referring to Figure 7, the line indicated by "D" is the direction in which the baseline extends.
  • the angle represented by " ⁇ " is the number of angles between the baseline of the target text and the reference line, that is, the deflection angle.
  • the number of angles between the baseline of the target text and the reference line, that is, the deflection angle.
  • the target text in the target picture 500 has a baseline at all. In the direction, in this way, only the baseline of the target text of a certain row or the deflection angle between the baseline of a certain word and the reference line is calculated, and the rotation angle of the target image 500 can be obtained.
  • the target image is assumed. 500 rotates clockwise to the positive direction and counterclockwise to the negative direction. The clockwise rotation is “+ ⁇ ”, and the counterclockwise rotation is “- ⁇ ”. The rotation angle is obtained. simple.
  • the target text in the target picture 500 includes a plurality of baseline directions. As shown in FIG. 8, each target text in the target picture 500 has a different baseline, and the target text has different deflections. The angle, simply obtaining the deflection angle between the baseline of one of the target characters and the reference line, cannot obtain the rotation angle of the target picture 500, so further processing is required.
  • the target text includes a plurality of baseline directions
  • a plurality of deflection angles are generated according to the plurality of baseline correspondences
  • the method for generating a rotation angle of the target image according to the deflection angle includes the following steps. , see Figure 9:
  • each target text in the target picture 500 is recognized by using the target text engine openCV or OCR, the baseline of each target text can be obtained at the same time, and the baseline and the reference line of each target text are recorded.
  • the deflection angle between and is counted.
  • the deflection angle is preferably an angle with a direction. For example, when the horizontal line is the horizontal axis X and the numerical line is the coordinate of the vertical axis Y, the deflection angle is in the first and fourth quadrants, and the target image is The 500 can be rotated in a clockwise direction, and when the deflection angle is in the second and third quadrants, is defined as a negative value, indicating that the target picture 500 is rotated counterclockwise to achieve the best reading direction.
  • the deflection angles of these words are ⁇ 1, ⁇ 2, ⁇ 3, and ⁇ 4, respectively. It can be seen from the figure that ⁇ 1 and ⁇ 2 are located in the first quadrant, so Positive value, clockwise rotation can display the font in the horizontal direction, and ⁇ 3, ⁇ 4 are in the fourth quadrant, so it is negative, and rotating in the counterclockwise direction can display the font in the horizontal direction. In this way, it is also convenient to count each deflection angle.
  • the statistical method may be to classify the same deflection angle into one class, the same angle value, and the positive and negative values are different for two different deflection angles. In this way, how many kinds of deflection angles are divided into How many classes.
  • the deflection angles of all the target characters are statistically classified according to the manner of the above step S210, and each of the same deflection angles is a category, and the categories are arranged according to the number of deflection angles.
  • the specific method of arranging may be to number each category, for example, the number with the largest number of deflection angles is 1, the number with the second largest number is 2, and so on. It should be noted that the above numbering manner is only for the sake of easy understanding.
  • the numbering mode and the class processing method are not limited to the above, and any solution adopting the same idea is included in the protection scope of the present application.
  • step S220 After the arrangement relationship of the deflection angles of all the target characters in the target picture 500 is obtained according to step S220, there are various methods for generating the rotation angle of the target picture 500. As shown in FIG. 10, one of the rotation centers is generated.
  • the method for describing the rotation angle of the target picture 500 includes the following steps:
  • step S220 the deflection angles of all the target characters have been classified, so that the corresponding deflection angle numbered 1 is directly determined as the rotation angle, and the deflection angle is preferably defined as the angle with the direction, as in step S210.
  • the deflection angle is a positive value
  • the target picture 500 is rotated clockwise
  • the deflection angle is a negative value
  • the deflection angle corresponding to the category located in the first position is the largest, defining the deflection angle corresponding to the category located in the first position as the rotation angle enables the most words in the target picture 500 to be rotated to the optimum reading direction.
  • the target text is easier to read.
  • a method for generating a rotation angle of rotating the target picture 500 is also disclosed. Referring to FIG. 11, the steps include:
  • the method of rotating the picture is a more complicated rotation mode of the method for rotating the picture in the previous embodiment, which may be automatically rotated or controlled by related instructions, when it is automatically rotated.
  • the first rotation is performed from the deflection angle corresponding to the category having the largest number of deflection angles, and after the first rotation is performed, the deflection angle corresponding to the second largest number of deflection angles is rotated as the rotation angle.
  • the rotation is performed with the third more deflection angle as the rotation angle, and so on.
  • the manner of sequentially rotating from the most-deflected deflection angle may also be a manual rotation manner.
  • the system first acquires control of a command to perform rotation.
  • the instruction performs the first rotation of the target image 500, and the warfare angle is the deflection angle corresponding to the category with the largest number of deflection angles; when the next control command is received, the next rotation of the target image 500 is performed, and the rotation is performed at this time.
  • the angle of the deflection angle corresponding to the second largest number of deflection angles, and so on stops the rotation of the target picture 500 after receiving the control command to stop the rotation. Or, when all the deflection angles have been performed with this rotation, the rotation of the target picture 500 is automatically stopped.
  • each target text in the target picture 500 is identified by using the target text engine openCV or OCR, so that the baseline of each target text and the number of target words can be obtained simultaneously, and each target text is recorded.
  • the deflection angle of each target text obtained is added to the average clamping angle as the rotation angle.
  • This method is especially suitable for the baseline and reference lines of each target text.
  • the target image 500 is performed by averaging. The rotation can effectively improve the reading comfort of the target text on the target picture 500.
  • the present application also discloses a device for rotating a picture. Referring to FIG. 13, the method includes:
  • the obtaining module 100 is configured to acquire a deflection angle of the target text in the target picture 500 with respect to a preset reference line, where the reference line is perpendicular to a gravity direction of the terminal;
  • the processing module 200 is configured to generate a rotation angle of the target picture 500 according to the deflection angle;
  • the execution module 300 is configured to rotate the target picture 500 according to the rotation angle.
  • the obtaining module 100 and the executing module 300 are respectively electrically connected to the processing module 200.
  • the direction of the reference line here is a parameter preset in the acquiring module 100.
  • the reference line has at least two rotations. One is that the edge line of the display interface 400 is set as a reference line, and the other is that the horizontal direction is always the reference line direction, and the technical effects achieved by the selection methods of the two reference lines are different, and the first one is suitable for display.
  • the direction of the interface 400 is not easy to change, or the rotation of the target picture 500 in the display interface 400 is not affected. .
  • the device for rotating the picture of the present application further includes:
  • An identification module configured to identify a pixel value of the target text in the target picture 500;
  • a calculation module configured to calculate a ratio between a pixel value of the target text and a total pixel value of the target image 500;
  • a judging module configured to determine whether the ratio exceeds a preset first comparison threshold; when the ratio exceeds the first comparison threshold, triggering target text in the acquisition target image 500 relative to a preset reference line Deflection angle.
  • the target text in the recognition target image 500 can be identified by the target text engine openCV or OCR.
  • the recognition module identifies all target texts in the target image 500 and the target text baseline direction in the current target image 500, and identifies all target texts, which is beneficial to
  • the target text and the image content in the target image 500 are distinguished, and the interference factors that are similar to the target text but not the target text are prevented from affecting the subsequent processing work.
  • the calculation module can quickly and accurately calculate the ratio between the pixel value of the target image 500 Chinese and the total pixel value of the target image 500, and the judgment module
  • the relationship between the ratio and the first comparison threshold is determined, and the first comparison threshold is stored in the determination module. When the ratio is equal to or exceeds the first comparison threshold, the rotation processing of the image is performed. When the ratio is not greater than the first comparison threshold, the rotation of the image is not required to save processor resources.
  • the acquiring module for acquiring the deflection angle of the target text in the target picture 500 with respect to the preset reference line further includes:
  • a first acquiring module configured to acquire a baseline of the target text, where the baseline is a horizontal line in a horizontal direction of the target text;
  • the first calculating module is configured to calculate a clamping angle between the baseline and the reference line, and the clamping angle number is a deflection angle of the deflection angle.
  • the image rotation device further includes:
  • the statistics module is configured to perform statistics on the deflection angle according to statistical conditions of the angle value
  • Queue generation module used to arrange statistical results in a reduced power manner
  • An angle generating module configured to generate a rotation angle of the target image 500 according to the arrangement result.
  • the method includes two methods for rotating the target image 500. Therefore, the image rotation device corresponding to the first method for rotating the target image 500 includes: a second acquisition module, configured to: Obtaining a deflection angle of the first position in the ranking result; a first execution module: for rotating the target picture 500 according to the deflection angle.
  • the method of rotating the target picture 500 corresponding to such a structure is suitable for a case where there are many target characters, and there are many cases where the target character deflection angle is the same, and the deflection angles of the target characters are largely different.
  • the second image acquisition device corresponding to the method for rotating the target image 500 includes: a third acquisition module: configured to acquire a control instruction to be executed, where the control instruction is used to switch a rotation angle of the target image 500; a second execution module: configured to rotate the target picture 500 along a deflection angle arranged in the arrangement result according to the control instruction.
  • the corresponding method of the picture rotation device is a more complicated rotation mode of the method for rotating the picture in the previous embodiment, which may be automatically rotated or controlled by related instructions, when it is automatically rotated.
  • the deflection angle corresponding to the category with the largest number of deflection angles is the first rotation of the rotation angle, after the first rotation is performed, the deflection angle corresponding to the second largest number of deflection angles is used as the rotation angle.
  • Rotate when the rotation is completed, rotate with the third more deflection angle as the rotation angle, and so on.
  • the manner of sequentially rotating from the maximum number of deflection angles may also be a manual rotation mode.
  • the specific rotation method refer to the above picture rotation method.
  • the image rotation device further includes another structure, specifically, including:
  • a second calculation module configured to calculate an average number of clamping angles of the deflection angles in the target picture 500;
  • Angle generation module used to set the average clamp angle to a rotation angle.
  • each target text in the target image 500 is identified by using the target text engine openCV or OCR, so that the baseline of each target text and the number of target texts can be obtained simultaneously, and the baseline of each target text is recorded.
  • the deflection angle of each target text obtained is added to the average clamping angle as the rotation angle. This method is especially suitable for the baseline and reference lines of each target text.
  • the target image 500 is rotated by averaging. It can effectively improve the reading comfort of the target text on the target picture 500.
  • the present application also discloses a computer device comprising a memory and a processor, wherein the memory stores computer readable instructions that, when executed by the processor, cause the processor to perform any of the above The picture rotation method.
  • the computer device includes a processor, a non-volatile storage medium, a memory, and a network interface connected through a system bus.
  • the non-volatile storage medium of the computer device stores an operating system, a database, and computer readable instructions.
  • the database may store a sequence of control information.
  • the processor may implement a processor. Picture rotation method.
  • the processor of the computer device is used to provide computing and control capabilities to support the operation of the entire computer device.
  • Computer readable instructions may be stored in the memory of the computer device, the computer readable instructions being executable by the processor to cause the processor to perform a picture rotation method.
  • the network interface of the computer device is used to communicate with the terminal connection. It will be understood by those skilled in the art that the structure shown in FIG. 14 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation of the computer device to which the solution of the present application is applied.
  • the specific computer device may It includes more or fewer components than those shown in the figures, or some components are combined, or have different component arrangements.
  • the processor is configured to execute the specific content of the obtaining module 2100, the processing module 2200, and the executing module 2300 in FIG. 14, and the memory stores the program code and various types of data required to execute the above module.
  • the network interface is used for data transfer between the user terminal or the server.
  • the memory in this embodiment stores the program code and data required for executing all the sub-modules in the user behavior excitation device, and the server can call the program code of the server and the data to execute the functions of all the sub-modules.
  • the computer device receives the status information of the prompting behavior sent by the associated client, that is, whether the associated terminal opens the prompt and whether the user closes the prompting task. By verifying whether the foregoing task condition is met, the corresponding preset instruction is sent to the associated terminal, so that the associated terminal can perform a corresponding operation according to the preset instruction, thereby implementing effective supervision of the associated terminal. Meanwhile, when the state of the prompt information is different from the preset state command, the server end controls the associated terminal to continue to ring to prevent the prompting task of the associated terminal from automatically terminating after being executed for a period of time.
  • the application further provides a storage medium storing computer readable instructions, when executed by one or more processors, causing one or more processors to perform the picture rotation method of any of the above embodiments .
  • the foregoing storage medium may be a magnetic disk, an optical disk, or a read-only storage memory (Read-Only) Non-volatile storage media such as Memory, ROM), or random storage memory (Random Access Memory, RAM), etc.

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

一种图片旋转的方法、装置、计算机设备及存储介质,该方法包括:获取目标图片中的目标文字的基线相对于预设的参考线的偏转角,所述参考线垂直于终端的重力方向(S100);根据所述偏转角生成所述目标图片的旋转角度(S200);根据所述旋转角度旋转所述目标图片(S300)。该方法通过获取目标图片中的目标文字相对于参考线的偏转角,从而获取目标图片的旋转角度,旋转所述目标图片,使目标图像中的目标文字以最适阅读的方式展现在用户面前,使用户阅读起来更方便,提高客户体验度。

Description

图片旋转方法、装置、计算机设备及存储介质 技术领域
本申请要求于2018年4月27日提交中国专利局、申请号为201810391961.8,发明名称为“图片旋转方法、装置、计算机设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本申请涉及图片显示技术领域,具体而言,本申请涉及一种图片旋转方法、装置、计算机设备及存储介质。
背景技术
随着科技的发展,拍照和图片显示的功能越来越强大,人们经常通过拍照终端来记录生活中的人和物,以留住或者与他人共享身边的美好瞬间。同时,人们在阅读相关信息的时候,也会采用拍照的方式进行临时记录,以便于后续统一整理和回顾,拍照给人们的生活带来了便捷。
但是发明人意识到由于拍照角度的问题,不能很好地从照片中读取相关目标文字信息,或者由于拍照角度的问题,给照片内容的信息识别造成不便,比如需要不断变换显示屏的角度以对照片内的信息内容进行识别,当显示屏是固定的情况下,阅读起来非常不方便。
本申请创造的发明人在研究中发现,现有技术中的图片旋转的方法,是依据图片中目标文字统一的延伸方向相对于显示界面水平面的夹角进行旋转,其只适用于图片中目标文字是统一方向倾斜的情况,当多个目标文字分别处于不同的夹角方向的情况下,无法进行旋转角度的识别,应用场景单一。
技术问题
本申请的目的旨在至少能解决上述的技术缺陷之一,特别是解决图片中的目标文字不在同一个角度上显示,照成阅读不方便的问题。
技术解决方案
为了达到上述目的,本申请提供一种图片旋转方法,包括:获取目标图片中的目标文字的基线相对于预设的参考线的偏转角,所述参考线垂直于终端的重力方向;根据所述偏转角生成所述目标图片的旋转角度;根据所述旋转角度旋转所述目标图片。
本申请还公开一种图片旋转装置,包括:获取模块:用于获取目标图片中的目标文字相对于预设的参考线的偏转角,所述参考线垂直于终端的重力方向;处理模块:用于根据所述偏转角生成所述目标图片的旋转角度;
执行模块:用于根据所述旋转角度旋转所述目标图片。
本申请还公开一种计算机设备,包括存储器和处理器,所述存储器中存储有计算机可读指令,所述计算机可读指令被所述处理器执行时,使得所述处理器执行一种图片旋转方法的下述步骤:获取目标图片中的目标文字的基线相对于预设的参考线的偏转角,所述参考线垂直于终端的重力方向;根据所述偏转角生成所述目标图片的旋转角度;根据所述旋转角度旋转所述目标图片。
本申请还公开一种存储有计算机可读指令的非易失性存储介质,所述计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行一种图片旋转方法的下述步骤:获取目标图片中的目标文字的基线相对于预设的参考线的偏转角,所述参考线垂直于终端的重力方向;根据所述偏转角生成所述目标图片的旋转角度;根据所述旋转角度旋转所述目标图片。
有益效果
本申请的有益效果是:本申请公开的图片旋转的方法和装置,通过获取目标图片中的目标文字相对于参考线的偏转角,从而获取目标图片的旋转角度,旋转所述目标图片,使目标图像中的目标文字以最适阅读的方式展现在用户面前,使用户阅读起来更方便,提高客户体验度。
附图说明
图1为本申请图片旋转方法流程图;
图2为本申请中获取目标图片中的目标文字的方法的流程图;
图3为本申请获取所述目标图片中的目标文字相对于预设的参考线的偏转角的方法的流程图;
图4为本申请显示界面示意图;
图5为本申请显示界面呈角度摆放时的示意图;
图6为本申请目标图片以水平线为参考线的旋转示意图;
图7为本申请目标图片上的目标文字基线的延伸方向示意图;
图8为本申请不同基线的目标文字的偏转角示意图;
图9为本申请基线不同的目标文字生成旋转角度第一实施例中的处理方式流程图;
图10为本申请生成所述目标图片的旋转角度的第一实施例的方法流程图;
图11为本申请生成所述目标图片的旋转角度的第二实施例的方法流程图;
图12为本申请基线不同的目标文字生成旋转角度第二实施例中的处理方式流程图;
图13为本申请图片旋转的装置的模块连接示意图;以及
图14为本申请计算机设备基本结构框图。
本发明的最佳实施方式
在此处键入本发明的最佳实施方式描述段落。
本发明的实施方式
本技术领域技术人员可以理解,这里所使用的“终端”、“终端设备”既包括无线信号接收器的设备,其仅具备无发射能力的无线信号接收器的设备,又包括接收和发射硬件的设备,其具有能够在双向通信链路上,执行双向通信的接收和发射硬件的设备。这种设备可以包括:蜂窝或其他通信设备,其具有单线路显示器或多线路显示器或没有多线路显示器的蜂窝或其他通信设备;PCS(Personal Communications Service,个人通信系统),其可以组合语音、数据处理、传真和/或数据通信能力;PDA(Personal Digital Assistant,个人数字助理),其可以包括射频接收器、寻呼机、互联网/内联网访问、网络浏览器、记事本、日历和/或GPS(Global Positioning System,全球定位系统)接收器;常规膝上型和/或掌上型计算机或其他设备,其具有和/或包括射频接收器的常规膝上型和/或掌上型计算机或其他设备。这里所使用的“终端”、“终端设备”可以是便携式、可运输、安装在交通工具(航空、海运和/或陆地)中的,或者适合于和/或配置为在本地运行,和/或以分布形式,运行在地球和/或空间的任何其他位置运行。这里所使用的“终端”、“终端设备”还可以是通信终端、上网终端、音乐/视频播放终端,例如可以是PDA、MID(Mobile Internet Device,移动互联网设备)和/或具有音乐/视频播放功能的移动电话,也可以是智能电视、机顶盒等设备。
为了能让目标图片500依据目标文字最适阅读的方式在显示屏界面中显示,本申请提供一种图片旋转的方法,请参阅图1,包括以下步骤:
S100、获取目标图片500中的目标文字相的基线对于预设的参考线的偏转角,所述参考线垂直于终端的重力方向;
所述的目标图片500为需要进行旋转的图片,所述的目标文字,为在目标图片500中的文字,本申请中,目标文字可以是单个文字,也可以是多个文字,本申请的应用场景主要在于在显示界面400中,按照目标图片中的目标文字的基线与参考线之间的偏转角对图片进行旋转,从而使目标文字以更适合阅读的角度呈现出来。
目标图片500旋转是根据目标图片500上的目标文字与参考线之间的偏转来执行的,故在在获取目标图片500中的目标文字的基线相对于预设的参考线的偏转角之前,还需要获取目标图片500中的目标文字。在本申请的一实施例中,提供了一种获取目标图片500中的目标文字的方法,请参阅图2,包括:
S110、识别所述目标图片500中所述目标文字的像素值;
识别目标图片500中的目标文字可以通过目标文字引擎openCV或OCR来识别。以OCR识别为例,识别所述目标图片500中的目标文字的方法包括:
对包含目标文字的目标图像进行处理以便后续进行特征提取、学习。这个过程的主要目的是减少所述目标图片500中的无用信息,以便后面的处理。在这个步骤通常有:灰度化、降噪、二值化、字符切分以及归一化这些子步骤,需要说明的是灰度化的步骤在当目标图片500为彩色图片的时候进行。经过二值化后,图像只剩下两种颜色,即黑和白,其中一个是图像背景,另一个颜色就是要识别的目标文字了。对目标文字进行降噪,以便于更好地进行目标文字处理。字符切分则是将图像中的目标文字分割成单个目标文字,以识别出单个的目标文字。
识别出了单个的目标文字,即可计算出目标图片500中目标文字的像素值。像素值是原稿图像被数字化时由计算机赋予的值,它代表了原稿某一小方块的平均亮度信息,或者说是该小方块的平均反射(透射) 密度信息。采用先将目标文字部分识别出来,再计算目标文字的像素值,能够更精确地得到目标文字的像素值,避免因与目标文字形状或者颜色类似的图像被误认为是目标文字,提高了目标文字像素值的准确性。
S120、计算所述目标文字的像素值与所述目标图片500总像素值之间的比值;
S130、判断所述比值是否大于或等于预设的第一比较阈值;当所述比值大于或等于所述第一比较阈值时,触发所述获取目标图片500中的目标文字相对于预设的参考线的偏转角。
当所有的目标文字都逐个提取出来后,再计算目标图片500的总像素值,同时统计出目标图片500中目标文字的像素值占总像素值的比值。
计算目标图片500中目标文字的像素值占总像素值的比值的目的,是为了判断是否有必要执行图片旋转。当目标图片500中没有目标文字,或者目标文字很少,不足以影响阅读的时候,则没有必要对图片进行旋转。但是,当目标图片500中目标文字较多,不规则显示的目标图片500会给用户带来一定的阅读困难时,才对目标图片500进行旋转处理。
进一步的,具体的判断方法为,判断目标图片500中目标文字的像素值占总像素值的比值是否超过预设的第一比较阈值,当所述比值超过所述第一比较阈值时,才获取目标图片500中的目标文字相对于预设的参考线的偏转角。
这里的第一比较阈值为预先输入的一个参考值,这个参考值可以为任意值,可以根据用户阅读的语种进行设置,因为不同的语言,其目标文字的构成不同,对应的像素值比例会不一样,比如单个英文字母所占的比例通常比单个汉字要少,故对于通常情况下常用于展现带有英文的目标图片500的情况下,系统中设置的第一比较阈值要小于常用于展现带有中文的目标图片500的第一比较阈值。本申请中以常用于展现中文的目标图片500为例,当中文文字占目标图片500的像素比值的10%时,将可能影响正常的阅读,故设置的第一比较阈值为10%,当目标文字的像素值大于或等于总像素值的10%时,则执行获取目标图片500中的目标文字相对于预设的参考线的偏转角这以步骤,以进行目标图片500的旋转。
进一步的,所述获取所述目标图片500中的目标文字的基线相对于预设的参考线的偏转角的方法包括步骤S140和步骤S150。
需要说明的是,预设的参考线是指判断出目标文字的倾斜方向的一条标准线,在本申请中参考线可以有以下两种方式,第一种参考线是指以显示界面400的边缘线设定为参考线,可以理解的是,显示界面400通常有两组平行的边缘线,请参阅图4,显示界面400包括边缘线A和边缘线B,边缘线A与边缘线B为垂直设置,边缘线A1与边缘线A2平行,边缘线B1与边缘线B2平行,如图4所示位置,则参考线为A1,当显示界面400进行180度旋转的时候,参考线为边缘线A2,进一步的,在当前显示界面400的基础上,顺时针旋转90度,则参考线为边缘线B2,当逆时针旋转90 度,参考线为边缘线B1,根据显示界面400所处的位置,设定不同的参考线,以方便用户阅读。
进一步的,本申请中参考线的选择还可以是另一种方式,即参考线始终是水平方向。这样,无论显示界面400旋转至何种角度,始终按照显示设备中的陀螺仪监测到的水平方向为准,请参阅图5,当显示界面400呈角度摆放的时候,参考线则为水平线,图中“C”所示的线条则为参考线,最终,目标图片500上的目标文字以水平线为参考线进行旋转和显示,如图6所示,为目标图片500以水平线为参考线的旋转示意图。这种方式更由于第一中以显示界面400的边缘线为参考线的方式,第一种方式,只有在显示界面400处于水平和垂直方向显示的时候阅读效果最好,但是当显示界面400在其他的角度摆放的时候目标文字随着显示界面400的边缘线显示,阅读效果不佳,而第二种方式的始终以水平线为参考线,则无论显示界面400如何旋转,都能保证目标图片500旋转的角度是最适合阅读的角度。
具体的,以参考线为水平线的方式来说明获取所述目标图片500中的目标文字相对于预设的参考线的偏转角的方法,请参阅图3,包括:
S140、获取所述目标文字的基线,所述基线为所述目标文字横长方向上的水平线;
基线是字体设计与排版的一种概念,源自西文字母的主体底部对其的位置,对于汉字而言,所述基线为所述文字横长方向上的水平线;汉字以一字见方的正方形框架为基准定位,笔画在字宽内居中并充满字框,故可以分析出一条基线,请参阅图7,“D”所指示的线条则为基线的延伸方向。
S150、计算所述基线与所述参考线之间的夹角度数,所述夹角度数为所述偏转角的偏转角。
进一步参阅图7,“θ”表示的角度则为目标文字的基线与参考线之间的夹角度数,也就是偏转角。从图中可以看出,当前情况下,只需要将图片沿顺时针方向旋转“θ”角度,即可将目标图片500上的目标文字如图6所述的状态显示。
S200、根据所述偏转角生成所述目标图片500的旋转角度;
在上述S150步骤的介绍中,通过结合图6和图7说明目标图片500旋转的方式,但是从图中可以看出,在这一实施例中,目标图片500中的目标文字的基线都在一个方向上,这样,只需要计算出某一行的目标文字的基线或者是某一个字的基线与参考线之间的偏转角,即可得到目标图片500的旋转角度,此种情况下,假设目标图片500沿顺时针方向旋转为正向,沿逆时针方向旋转为负向,则顺时针旋转的旋转角度为“+θ”,逆时针旋转的旋转角度为“-θ”,旋转角度的获取方式较为简单。
但是,在另一实施例中,目标图片500中的目标文字包含多种基线方向,如图8所示,目标图片500中每一个目标文字分别具备不同的基线,所述目标文字具有不同的偏转角,单纯只获取其中一个目标文字的基线与参考线之间的偏转角不能够得到目标图片500的旋转角度,故需要进一步的处理。本申请中当所述目标文字中包含多个基线的方向时,根据所述多个基线对应生成多个偏转角,所述根据所述偏转角生成所述目标图片的旋转角度的方法包括以下步骤,请参阅图9:
S210、以角度值为统计条件对所述偏转角进行统计;
由于在步骤S110中,采用目标文字引擎openCV或OCR将目标图片500中的每一个目标文字都识别出来了,故可以同时获得每一个目标文字的基线,记录每一个目标文字的基线与参考线之间的偏转角,并进行统计。偏转角优选为带有方向的角度,比如,当以水平线为横轴X,数值线为纵轴Y组成的坐标为参考坐标时,偏转角位于第一和第四象限为正值,表示目标图片500可以沿顺时针方向旋转,当偏转角位于第二和第三象限的时候,定义为负值,表示目标图片500沿逆时针防线旋转以达到最佳阅读方向。以附图8中“欢度春节”这几个字进行分解,这几个字的偏转角分别为θ1、θ2、θ3和θ4,从图中可以看出θ1、θ2都位于第一象限,故为正值,以顺时针旋转可将字体沿水平方向显示,而θ3、θ4都位于第四象限,故为负值,以逆时针方向旋转可将字体沿水平方向显示。这样的方式,也方便对每一个偏转角进行统计。在本实施例中,统计的方式可以为将相同的偏转角归成一类,相同角度值,正负值不同的为两个不同的偏转角,以此方式统计,有多少种偏转角,则分成多少类。
S220、将统计结果按降幂方式进行排列;
依据上述步骤S210的方式对所有目标文字的偏转角进行统计归类,每一个相同的偏转角为一个类别,根据偏转角的数量,对该类别进行排列。在本申请中,优选降幂的方式进行排列,即将相同的偏转角数量多的类别排在前面。排列的具体方法,可以是对各个类别进行编号,例如,将偏转角数量最多的编号为1,数量第二多的编号为2,以此类推。需要说明的是,以上编号方式,只是为了便于理解的举例说明,编号方式以及类别处理方式不局限于以上几种,凡是采用了相同思路的方案都纳入本申请的保护范围。
S230、根据所述排列结果生成旋转所述目标图片500的旋转角度。
根据步骤S220得出了目标图片500中所有目标文字的偏转角的排列关系后,生成旋转所述目标图片500的旋转角的方法有多种,如图10所示,为其中一种生成旋转所述目标图片500的旋转角的方法,包括以下步骤:
S231、获取所述排列结果中位于首位的偏转角;
S232、根据所述位于首位的偏转角旋转所述目标图片500。
在步骤S220中,已经对所有的目标文字的偏转角进行归类,故直接将编号为1的对应的偏转角定为旋转角度,优选地将偏转角定义为带有方向的角度,如步骤S210中所述,当偏转角为正值时,对目标图片500进行顺时针旋转,当偏转角为负值时,对目标图片500进行逆时针旋转。
在本实施例中,由于位于首位的类别的偏转角的数量最多,故将位于首位的类别对应的偏转角定义为旋转角度能够使目标图片500中最多的字旋转至最适阅读方向,这样对目标文字阅读起来更便捷。
而在另一实施例中,还公开了生成旋转所述目标图片500的旋转角的方法,请参阅图11,其步骤包括:
S233、获取待执行的控制指令,所述控制指令用于切换所述目标图片500的旋转角度;
S234、根据所述控制指令依次沿所述排列结果中排列的偏转角旋转所述目标图片500。
 此种图片旋转的方法为上一种实施例中的图片旋转的方法的更复杂的一种旋转方式,其可以是自动进行旋转,也可以是通过相关指令来控制,当为自动进行旋转的时候,从偏转角数量最多的类别对应的偏转角为旋转角度进行第一次旋转,当执行完第一次旋转后,再以偏转角数量第二多的类别对应的偏转角为旋转角度进行旋转,当旋转完毕,再以第三多的偏转角为旋转角度进行旋转,以此类推。
进一步的,按照偏转角数量的排列顺序,从数量最多的偏转角依次进行旋转的方式还可以是手动的旋转方式,例如,在一种实施例中,系统第一次获取执行旋转的命令的控制指令,对目标图片500进行第一次旋转,宣战角度为偏转角数量最多的类别对应的偏转角;当接收到下一个控制指令的时候,再执行下一次的目标图片500的旋转,此时旋转的角度为偏转角数量第二多的类别对应的偏转角,依次类推,当接收到停止旋转的控制指令后,对目标图片500停止旋转。或者当所有的偏转角都执行过以此旋转后,自动停止目标图片500的旋转。
对应附图9的当所述目标文字中包含多个基线的方向时,根据所述多个基线对应生成多个偏转角,所述根据所述偏转角生成所述目标图片的旋转角度的方法包括以下步骤,请参阅图12:
S240、计算所述目标图片500中偏转角的平均夹角度数;
S250、将所述平均夹角度数设定成旋转角度。
在步骤S110中,采用目标文字引擎openCV或OCR将目标图片500中的每一个目标文字都识别出来了,故可以同时获得每一个目标文字的基线,以及目标文字的数量,记录每一个目标文字的基线与参考线之间的偏转角,在本实施例中,将获得的每一个目标文字的偏转角相加取平均夹角度数为旋转角度,此种方法尤其适合各个目标文字的基线与参考线之间的夹角相差范围不大的情况,例如,所有的目标文字的基线与参考线之间的偏转角的差值在±60°的时候,采用求平均值的方法,对目标图片500进行旋转,能有效提高目标图片500上的目标文字的阅读舒适度。
进一步的,本申请还公开一种图片旋转的装置,请参阅图13,包括:
获取模块100:用于获取目标图片500中的目标文字相对于预设的参考线的偏转角,所述参考线垂直于终端的重力方向;
处理模块200:用于根据所述偏转角生成所述目标图片500的旋转角度;
执行模块300:用于根据所述旋转角度旋转所述目标图片500。
获取模块100和执行模块300分别与处理模块200电连接,这里的参考线的方向为预设在获取模块100内的一个参数,参阅上述的图片旋转的方法,该参考线的旋转至少有两种,一种是以显示界面400的边缘线设定为参考线,另一种是始终以水平方向为参考线方向,两种参考线的选取方式所达到的技术效果不同,第一种适用于显示界面400的方向不容易变,或者始终以90度为旋转单位旋转的场合,第二种则适用于任意场合,显示界面400可以任意旋转,都不影响显示显示界面400中的目标图片500的旋转。
进一步的,目标图片500旋转是根据目标图片500上的目标文字与参考线之间的偏转来执行的,故在在获取目标图片500中的目标文字相对于预设的参考线的偏转角之前,还需要获取目标图片500中的目标文字,故本申请的图片旋转的装置还包括:
识别模块:用于识别所述目标图片500中所述目标文字的像素值;
计算模块:用于计算所述目标文字的像素值与所述目标图片500总像素值之间的比值;
判断模块:用于判断所述比值是否超过预设的第一比较阈值;当所述比值超过所述第一比较阈值时,触发所述获取目标图片500中的目标文字相对于预设的参考线的偏转角。
识别目标图片500中的目标文字可以通过目标文字引擎openCV或OCR来识别,识别模块识别目标图片500中所有的目标文字以及当前目标图片500中的目标文字基线方向,识别所有的目标文字,有利于区分出目标图片500中的目标文字和图片内容,避免图片中有类似于目标文字但是又不是目标文字的干扰因素影响后续的处理工作。当准确识别出哪些是目标文字哪些是背景的时候,则可通过计算模块快速、精准地计算出目标图片500中文的像素值与所述目标图片500总像素值之间的比值,通过判断模块来判断比值与第一比较阈值的关系,第一比较阈值存储的判断模块中。当比值等于或者超过第一比较阈值的时候,则进行图片的旋转处理,当比值不大于第一比较阈值的时候,则无需对图片进行旋转处理,以节省处理器资源。
进一步的,用于获取所述目标图片500中的目标文字相对于预设的参考线的偏转角的获取模块还包括:
第一获取模块:用于获取所述目标文字的基线,所述基线为所述目标文字横长方向上的水平线;
第一计算模块:用于计算所述基线与所述参考线之间的夹角度数,所述夹角度数为所述偏转角的偏转角。
当所述目标文字中包含多个基线方向的时候,所述图片旋转装置还包括:
统计模块:用于以角度值为统计条件对所述偏转角进行统计;
队列生成模块:用于将统计结果按降幂方式进行排列;
角度生成模块:用于根据所述排列结果生成旋转所述目标图片500的旋转角度。
在生成旋转角度之后,包括两种旋转所述目标图片500的方法,故对应两种装置结构,第一种旋转所述目标图片500的方法对应的图片旋转装置包括:第二获取模块,用于获取所述排列结果中位于首位的偏转角;第一执行模块:用于根据所述偏转角旋转所述目标图片500。此种结构对应的目标图片500旋转的方法适用于目标文字较多,存在较多目标文字偏转角相同,且目标文字的偏转角相差较大的情况。第二种旋转所述目标图片500的方法对应的图片旋转装置的结构包括:第三获取模块:用于获取待执行的控制指令,所述控制指令用于切换所述目标图片500的旋转角度;第二执行模块:用于根据所述控制指令依次沿所述排列结果中排列的偏转角旋转所述目标图片500。此种图片旋转装置对应的方法为上一种实施例中的图片旋转的方法的更复杂的一种旋转方式,其可以是自动进行旋转,也可以是通过相关指令来控制,当为自动进行旋转的时候,从偏转角数量最多的类别对应的偏转角为旋转角度进行第一次旋转,当执行完第一次旋转后,再以偏转角数量第二多的类别对应的偏转角为旋转角度进行旋转,当旋转完毕,再以第三多的偏转角为旋转角度进行旋转,以此类推。进一步的,按照偏转角数量的排列顺序,从数量最多的偏转角依次进行旋转的方式还可以是手动的旋转方式。具体旋转方式可参考上述的图片旋转方法。
进一步的,当所述目标文字中包含多个基线方向的时候,所述图片旋转装置还包括另外一种结构,具体的,包括:
第二计算模块:用于计算所述目标图片500中偏转角的平均夹角度数;
角度生成模块:用于将所述平均夹角度数设定成旋转角度。
本申请中,采用目标文字引擎openCV或OCR将目标图片500中的每一个目标文字都识别出来了,故可以同时获得每一个目标文字的基线,以及目标文字的数量,记录每一个目标文字的基线与参考线之间的偏转角,在本实施例中,将获得的每一个目标文字的偏转角相加取平均夹角度数为旋转角度,此种方法尤其适合各个目标文字的基线与参考线之间的夹角相差范围不大的情况,例如,所有的目标文字的基线与参考线之间的偏转角的差值在±60°的时候,采用求平均值的方法,对目标图片500进行旋转,能有效提高目标图片500上的目标文字的阅读舒适度。
本申请还公开一种计算机设备,包括存储器和处理器,所述存储器中存储有计算机可读指令,所述计算机可读指令被所述处理器执行时,使得所述处理器执行上述任意一项所述图片旋转方法。
本申请实施例提供计算机设备基本结构框图,请参阅图14,该计算机设备包括通过系统总线连接的处理器、非易失性存储介质、存储器和网络接口。其中,该计算机设备的非易失性存储介质存储有操作系统、数据库和计算机可读指令,数据库中可存储有控件信息序列,该计算机可读指令被处理器执行时,可使得处理器实现一种图片旋转方法。该计算机设备的处理器用于提供计算和控制能力,支撑整个计算机设备的运行。该计算机设备的存储器中可存储有计算机可读指令,该计算机可读指令被处理器执行时,可使得处理器执行一种图片旋转方法。该计算机设备的网络接口用于与终端连接通信。本领域技术人员可以理解,图14中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。
本实施方式中处理器用于执行图14中获取模块2100、处理模块2200和执行模块2300的具体内容,存储器存储有执行上述模块所需的程序代码和各类数据。网络接口用于向用户终端或服务器之间的数据传输。本实施方式中的存储器存储有用户行为激励装置中执行所有子模块所需的程序代码及数据,服务器能够调用服务器的程序代码及数据执行所有子模块的功能
计算机设备通过接收关联的客户端发送的提示行为的状态信息,即关联终端是否开启提示以及用户是否关闭该提示任务。通过验证上述任务条件是否达成,进而向关联终端发送对应的预设指令,以使关联终端能够根据该预设指令执行相应的操作,从而实现了对关联终端的有效监管。同时,在提示信息状态与预设的状态指令不相同时,服务器端控制关联终端持续进行响铃,以防止关联终端的提示任务在执行一段时间后自动终止的问题。
本申请还提供一种存储有计算机可读指令的存储介质,所述计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行上述任一实施例所述图片旋转方法。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,该计算机程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,前述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)等非易失性存储介质,或随机存储记忆体(Random Access Memory,RAM)等。
工业实用性
在此处键入工业实用性描述段落。
序列表自由内容
在此处键入序列表自由内容描述段落。

Claims (20)

  1. 一种图片旋转方法,包括:
    获取目标图片中的目标文字的基线相对于预设的参考线的偏转角,所述参考线垂直于终端的重力方向;
    根据所述偏转角生成所述目标图片的旋转角度;
    根据所述旋转角度旋转所述目标图片。
  2. 根据权利要求1所述的图片旋转方法,所述获取所述目标图片中的目标文字的基线相对于预设的参考线的偏转角的步骤之前,还包括:
    识别所述目标图片中所述目标文字的像素值;
    计算所述目标文字的像素值与所述目标图片总像素值之间的比值;
    判断所述比值是否大于或等于预设的第一比较阈值;当所述比值大于或等于所述第一比较阈值时,触发所述获取目标图片中的目标文字相对于预设的参考线的偏转角。
  3. 根据权利要求1所述的图片旋转方法,所述获取所述目标图片中的目标文字的基线相对于预设的参考线的偏转角的方法包括:
    获取所述目标文字的基线,所述基线为所述目标文字横长方向上的水平线;
    计算所述基线与所述参考线之间的夹角度数,所述夹角度数为所述偏转角的偏转角。
  4. 根据权利要求1所述的图片旋转方法,当所述目标文字中包含多个基线的方向时,根据所述多个基线对应生成多个偏转角,所述根据所述偏转角生成所述目标图片的旋转角度的方法包括:
    以角度值为统计条件对所述多个偏转角进行统计;
    将统计结果按降幂方式进行排列;
    根据排列结果生成旋转所述目标图片的旋转角度。
  5. 根据权利要求4所述的图片旋转方法,所述旋转所述目标图片的方法包括:
    获取所述排列结果中位于首位的偏转角;
    根据所述位于首位的偏转角旋转所述目标图片。
  6. 根据权利要求4所述的图片旋转方法,所述旋转所述目标图片的方法包括:
    获取待执行的控制指令,所述控制指令用于切换所述目标图片的旋转角度;
    根据所述控制指令依次沿所述排列结果中排列的偏转角旋转所述目标图片。
  7. 根据权利要求1所述的图片旋转方法,当所述目标文字中包含多个基线的方向时,根据所述多个基线对应生成多个偏转角,所述根据所述偏转角生成所述目标图片的旋转角度的方法包括:
    计算所述目标图片中多个偏转角的平均夹角度数;
    将所述平均夹角度数设定成旋转角度。
  8. 一种图片旋转装置,包括:
    获取模块:用于获取目标图片中的目标文字的基线相对于预设的参考线的偏转角,所述参考线垂直于终端的重力方向;
    处理模块:用于根据所述偏转角生成所述目标图片的旋转角度;
    执行模块:用于根据所述旋转角度旋转所述目标图片。
  9. 一种计算机设备,包括存储器和处理器,所述存储器中存储有计算机可读指令,所述计算机可读指令被所述处理器执行时,使得所述处理器执行一种图片旋转方法的下述步骤:
    获取目标图片中的目标文字的基线相对于预设的参考线的偏转角,所述参考线垂直于终端的重力方向;
    根据所述偏转角生成所述目标图片的旋转角度;
    根据所述旋转角度旋转所述目标图片。
  10. 根据权利要求9所述的计算机设备,所述获取所述目标图片中的目标文字的基线相对于预设的参考线的偏转角的步骤之前,还包括:
    识别所述目标图片中所述目标文字的像素值;
    计算所述目标文字的像素值与所述目标图片总像素值之间的比值;
    判断所述比值是否大于或等于预设的第一比较阈值;当所述比值大于或等于所述第一比较阈值时,触发所述获取目标图片中的目标文字相对于预设的参考线的偏转角。
  11. 根据权利要求9所述的计算机设备,所述获取所述目标图片中的目标文字的基线相对于预设的参考线的偏转角的方法包括:
    获取所述目标文字的基线,所述基线为所述目标文字横长方向上的水平线;
    计算所述基线与所述参考线之间的夹角度数,所述夹角度数为所述偏转角的偏转角。
  12. 根据权利要求9所述的计算机设备,当所述目标文字中包含多个基线的方向时,根据所述多个基线对应生成多个偏转角,所述根据所述偏转角生成所述目标图片的旋转角度的方法包括:
    以角度值为统计条件对所述多个偏转角进行统计;
    将统计结果按降幂方式进行排列;
    根据排列结果生成旋转所述目标图片的旋转角度。
  13. 根据权利要求12所述的计算机设备,所述旋转所述目标图片的方法包括:
    获取所述排列结果中位于首位的偏转角;
    根据所述位于首位的偏转角旋转所述目标图片。
  14. 一种存储有计算机可读指令的非易失性存储介质,所述计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行一种图片旋转方法的下述步骤:
    获取目标图片中的目标文字的基线相对于预设的参考线的偏转角,所述参考线垂直于终端的重力方向;
    根据所述偏转角生成所述目标图片的旋转角度;
    根据所述旋转角度旋转所述目标图片。
  15. 根据权利要求14所述的非易失性存储介质,所述获取所述目标图片中的目标文字的基线相对于预设的参考线的偏转角的步骤之前,还包括:
    识别所述目标图片中所述目标文字的像素值;
    计算所述目标文字的像素值与所述目标图片总像素值之间的比值;
    判断所述比值是否大于或等于预设的第一比较阈值;当所述比值大于或等于所述第一比较阈值时,触发所述获取目标图片中的目标文字相对于预设的参考线的偏转角。
  16. 根据权利要求14所述的非易失性存储介质,所述获取所述目标图片中的目标文字的基线相对于预设的参考线的偏转角的方法包括:
    获取所述目标文字的基线,所述基线为所述目标文字横长方向上的水平线;
    计算所述基线与所述参考线之间的夹角度数,所述夹角度数为所述偏转角的偏转角。
  17. 根据权利要求14所述的非易失性存储介质,当所述目标文字中包含多个基线的方向时,根据所述多个基线对应生成多个偏转角,所述根据所述偏转角生成所述目标图片的旋转角度的方法包括:
    以角度值为统计条件对所述多个偏转角进行统计;
    将统计结果按降幂方式进行排列;
    根据排列结果生成旋转所述目标图片的旋转角度。
  18. 根据权利要求17所述的非易失性存储介质,所述旋转所述目标图片的方法包括:
    获取所述排列结果中位于首位的偏转角;
    根据所述位于首位的偏转角旋转所述目标图片。
  19. 根据权利要求17所述的非易失性存储介质,所述旋转所述目标图片的方法包括:
    获取待执行的控制指令,所述控制指令用于切换所述目标图片的旋转角度;
    根据所述控制指令依次沿所述排列结果中排列的偏转角旋转所述目标图片。
  20. 根据权利要求14所述的非易失性存储介质,当所述目标文字中包含多个基线的方向时,根据所述多个基线对应生成多个偏转角,所述根据所述偏转角生成所述目标图片的旋转角度的方法包括:
    计算所述目标图片中多个偏转角的平均夹角度数;
    将所述平均夹角度数设定成旋转角度。
PCT/CN2018/102863 2018-04-27 2018-08-29 图片旋转方法、装置、计算机设备及存储介质 WO2019205400A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810391961.8 2018-04-27
CN201810391961.8A CN108573473A (zh) 2018-04-27 2018-04-27 图片旋转方法、装置、计算机设备及存储介质

Publications (1)

Publication Number Publication Date
WO2019205400A1 true WO2019205400A1 (zh) 2019-10-31

Family

ID=63575336

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/102863 WO2019205400A1 (zh) 2018-04-27 2018-08-29 图片旋转方法、装置、计算机设备及存储介质

Country Status (2)

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

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109528315B (zh) * 2018-11-12 2021-12-17 南京迈瑞生物医疗电子有限公司 术野图像控制系统、方法、计算机设备及存储介质
CN110415177A (zh) * 2019-07-26 2019-11-05 四川长虹电器股份有限公司 一种基于Java的图像旋转裁图方法

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101374198A (zh) * 2007-08-24 2009-02-25 鸿富锦精密工业(深圳)有限公司 摄像装置及其影像自动正立方法
US20130328936A1 (en) * 2012-06-06 2013-12-12 Hon Hai Precision Industry Co., Ltd. Display apparatus and method for rotating displayed content
CN103885611A (zh) * 2014-04-22 2014-06-25 锤子科技(北京)有限公司 一种调整图像的方法和装置
CN106776656A (zh) * 2015-11-25 2017-05-31 中兴通讯股份有限公司 调整图片文字的显示方法及装置

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103500332B (zh) * 2013-09-06 2017-03-15 优视科技有限公司 图片内文字显示方法及装置
CN103714327B (zh) * 2013-12-30 2017-02-01 上海合合信息科技发展有限公司 一种图像方向校正方法及系统
CN104835120B (zh) * 2015-04-23 2017-07-28 天津大学 一种基于基准线的弯曲书面展平方法
CN106778733A (zh) * 2015-11-25 2017-05-31 中兴通讯股份有限公司 调整图片文字的显示方法及装置
CN107038440B (zh) * 2016-02-04 2020-04-28 株式会社理光 图像倾斜校正装置、图像处理系统以及图像倾斜校正方法
CN107454372B (zh) * 2016-06-01 2021-05-14 中兴通讯股份有限公司 图像校正方法、装置及投影仪
CN106097254B (zh) * 2016-06-07 2019-04-16 天津大学 一种扫描文档图像纠偏方法
CN106447615A (zh) * 2016-08-02 2017-02-22 浪潮软件股份有限公司 一种扫描文档图像的倾斜校正方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101374198A (zh) * 2007-08-24 2009-02-25 鸿富锦精密工业(深圳)有限公司 摄像装置及其影像自动正立方法
US20130328936A1 (en) * 2012-06-06 2013-12-12 Hon Hai Precision Industry Co., Ltd. Display apparatus and method for rotating displayed content
CN103885611A (zh) * 2014-04-22 2014-06-25 锤子科技(北京)有限公司 一种调整图像的方法和装置
CN106776656A (zh) * 2015-11-25 2017-05-31 中兴通讯股份有限公司 调整图片文字的显示方法及装置

Also Published As

Publication number Publication date
CN108573473A (zh) 2018-09-25

Similar Documents

Publication Publication Date Title
KR102469295B1 (ko) 깊이를 사용한 비디오 배경 제거
US10902234B2 (en) Image recognition method and apparatus
TWI684886B (zh) 安全問題的生成以及身份驗證的方法及裝置
WO2019119966A1 (zh) 文字图像处理方法、装置、设备及存储介质
CN108647351B (zh) 文本图像的处理方法、装置、存储介质及终端
US20210256598A1 (en) Method, medium, and system for live preview via machine learning models
TW201901527A (zh) 視訊會議裝置與視訊會議管理方法
RU2643464C2 (ru) Способ и устройство для классификации изображений
US11341605B1 (en) Document rectification via homography recovery using machine learning
US20220328019A1 (en) Display terminal adjustment method and display terminal
US9852498B2 (en) Removing artifacts from document images
WO2018184260A1 (zh) 文档图像的校正方法及装置
CN112069977A (zh) 图像处理方法、装置、电子设备及计算机可读介质
US10049268B2 (en) Selective, user-mediated content recognition using mobile devices
US20230252778A1 (en) Formula recognition method and apparatus
WO2019205400A1 (zh) 图片旋转方法、装置、计算机设备及存储介质
WO2023005813A1 (zh) 图像方向调整方法、装置、存储介质及电子设备
US20220270352A1 (en) Methods, apparatuses, devices, storage media and program products for determining performance parameters
CN112532785B (zh) 图像显示方法、装置、电子设备以及存储介质
WO2019214019A1 (zh) 基于卷积神经网络的网络教学方法以及装置
US20190206089A1 (en) Backdrop color detection
WO2023142438A1 (zh) 终端的碎屏识别方法和相关设备
WO2020124454A1 (zh) 字体切换方法及相关产品
WO2019214181A1 (zh) 文档输入的控制方法及装置
CN115035530A (zh) 图像处理方法、图像文本获得方法、装置及电子设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18916578

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 18.12.2020)

122 Ep: pct application non-entry in european phase

Ref document number: 18916578

Country of ref document: EP

Kind code of ref document: A1