WO2020124455A1 - 一种优化字体的方法及相关设备 - Google Patents

一种优化字体的方法及相关设备 Download PDF

Info

Publication number
WO2020124455A1
WO2020124455A1 PCT/CN2018/122152 CN2018122152W WO2020124455A1 WO 2020124455 A1 WO2020124455 A1 WO 2020124455A1 CN 2018122152 W CN2018122152 W CN 2018122152W WO 2020124455 A1 WO2020124455 A1 WO 2020124455A1
Authority
WO
WIPO (PCT)
Prior art keywords
font
text
data
feature
image data
Prior art date
Application number
PCT/CN2018/122152
Other languages
English (en)
French (fr)
Inventor
陈岩
Original Assignee
深圳市欢太科技有限公司
Oppo广东移动通信有限公司
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 深圳市欢太科技有限公司, Oppo广东移动通信有限公司 filed Critical 深圳市欢太科技有限公司
Priority to PCT/CN2018/122152 priority Critical patent/WO2020124455A1/zh
Priority to CN201880098687.3A priority patent/CN112840308B/zh
Publication of WO2020124455A1 publication Critical patent/WO2020124455A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0487Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser
    • G06F3/0488Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser using a touch-screen or digitiser, e.g. input of commands through traced gestures

Definitions

  • This application relates to the field of smart devices, and in particular to a method for optimizing fonts and related equipment.
  • the embodiment of the present application discloses a method for optimizing fonts and related equipment, which can score handwriting fonts and optimize handwriting fonts with low scores.
  • an embodiment of the present application discloses a method for optimizing fonts, which is applied to an electronic device.
  • the method includes:
  • an embodiment of the present application discloses an optimized font device.
  • the optimized font device includes:
  • An obtaining unit configured to obtain text data, and preprocess the text data to obtain font data
  • a scoring unit used to input the font data into the trained font scoring model to obtain a font score corresponding to the font data
  • a determining unit configured to determine whether the font score is less than a score threshold, and if the font score is less than the score threshold, determine the target font based on the font data
  • the display unit is configured to obtain characters corresponding to the font data from the target font and display the characters.
  • an embodiment of the present application discloses a mobile terminal, including a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured by the above
  • the processor executes, and the above program includes instructions for performing the steps in the first aspect of the embodiments of the present application.
  • an embodiment of the present application discloses a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program for electronic data exchange, wherein the computer program causes the computer to execute the first embodiment of the present application. Part or all of the steps described in one aspect.
  • an embodiment of the present application discloses a computer program product, wherein the computer program product includes a non-transitory computer-readable storage medium that stores the computer program, and the computer program is operable to cause the computer to execute as implemented in the present application Examples of some or all of the steps described in the first aspect.
  • the computer program product may be a software installation package.
  • the electronic device obtains text data, obtains font data through preprocessing, scores the font data, optimizes the font with a low score according to the target font, and obtains the font data corresponding to the font data Text and display. It can be seen that the electronic device optimizes the low-score handwriting font and then displays the text, thereby improving the aesthetics of the display interface and improving the user experience.
  • FIG. 1 is a schematic diagram of a system structure of a font optimization method disclosed in an embodiment of the present application.
  • FIG. 2 is a schematic flowchart of a method for optimizing fonts disclosed in an embodiment of the present application.
  • FIG. 3 is a schematic flowchart of a method for preprocessing text data disclosed in an embodiment of the present application.
  • FIG. 4 is a schematic flowchart of a method for determining a target font disclosed in an embodiment of the present application.
  • FIG. 5 is a schematic structural diagram of a font optimization apparatus 500 disclosed in an embodiment of the present application.
  • FIG. 6 is a block diagram of a partial structure of a mobile phone related to a mobile terminal disclosed in an embodiment of the present application
  • the mobile terminals involved in the embodiments of the present application may include various handheld devices with wireless communication functions, in-vehicle devices, wearable devices, computing devices, or other processing devices connected to a wireless modem, and various forms of user equipment (user equipment, UE), mobile station (MS), terminal device, etc.
  • UE user equipment
  • MS mobile station
  • terminal device etc.
  • electronic devices the devices mentioned above are collectively referred to as electronic devices.
  • FIG. 1 is a schematic diagram of a system structure of a method for optimizing fonts disclosed in an embodiment of the present application.
  • the mobile terminal 101 communicates with a cloud server 102.
  • the mobile terminal 101 collects text data and preprocesses the text data.
  • Font data send the font data to the cloud server 102, and after receiving the font data, the cloud server 102 uses the font data as input to the font scoring model to calculate the font score corresponding to the font data, and determines whether the font score is less than the score threshold, the cloud server 102 Use fonts with a font score less than the score threshold as input to the feature extraction model to obtain font features, match the font features with the fonts in the font library to determine the target font, and the mobile terminal 101 obtains the font data after receiving the target font sent by the cloud server 102 Corresponding characters, the mobile terminal 101 displays the characters.
  • FIG. 2 is a schematic flowchart of a font optimization method disclosed in an embodiment of the present application.
  • Step 201 Obtain text data, and preprocess the text data to obtain font data.
  • the text data includes: text image data and touch screen handwritten text data, where the text image data is picture data in the electronic device, and the touch handwritten text data is handwritten text data received by the touch screen of the electronic device.
  • the text data is text image data
  • the average value is the inclination of the text image data, and the text image data is rotated according to the average value Correction results in the first text image data.
  • set a search box and a search step perform a full image search on the first text image data from the first pixel of the first text image data, and crop the first text image data to obtain second text image data
  • the first The two-character image data includes: multiple test samples, the second character image data is refined to obtain the refined second character image data, and the refined second character image data is normalized to obtain the normalized
  • the second text image data obtain a matching template, and match the normalized second text image data with the matching template to obtain third text image data.
  • the third text image data is used as the input of the feature extraction model to obtain the text features corresponding to the third text image, determine the feature weight corresponding to the text features, obtain the font library, and use the sample text data in the font library as training Input of the feature extraction model to obtain the sample features corresponding to the sample text data, build a text classifier based on the sample features and train the text classifier to obtain a trained text classifier, and use the text features and feature weights as the trained text classification
  • the input of the device obtains the classification result, and determines the recognition character corresponding to the character feature of the classification result.
  • the character feature, the feature weight and the recognition character constitute font data.
  • Step 202 Input the font data into the trained font scoring model to obtain a font score corresponding to the font data.
  • the trained font scoring model before inputting the font data into the trained font scoring model, construct a font scoring model, obtain several handwriting font training samples, score the handwriting font training samples, and correspond to the handwriting font training samples according to the handwriting font training samples To train the font scoring model, and get the trained font scoring model.
  • the font data is input to the trained font scoring model to obtain a calculation result, and it is determined that the calculation result is a font score corresponding to the font data.
  • Step 203 Determine whether the font score is less than a score threshold, and if the font score is less than the score threshold, determine a target font based on the font data.
  • obtain a score threshold determine whether the font score is less than the score threshold, if the font score is not less than the score threshold, establish a mapping relationship between font data and font score, and store the mapping relationship in the personal font library; if the font score is less than the score Threshold value, the font library is obtained, and a font is selected from the font library as the target font according to the font data.
  • Step 204 Obtain the text corresponding to the font data from the target font and display the text.
  • the text library corresponding to the target font obtains the text corresponding to the font data in the text library corresponding to the target font as the replacement text, replace the text data with the replacement text, and display the text in the display interface Alt text.
  • FIG. 3 is a schematic flowchart of a method for preprocessing text data disclosed in an embodiment of the present application.
  • Step 301 Acquire text data, where the text data includes text image data and detect straight lines in the text image data.
  • the text image data is binarized to obtain binarized text image data, wherein the content of the text image data is divided into foreground information and background information , The foreground information is black, and the background information is white; noise reduction is performed on the binarized text image data.
  • the noise reduction methods include: mean filter, median filter, wavelet denoising, etc., which are not limited here
  • the text image data of noise reduction is obtained, and the text image data is updated according to the text image data of noise reduction.
  • Step 302 Calculate the inclination angle of the straight line, calculate the average value of the inclination angle, and determine the average value as the inclination angle of the text image data.
  • obtain all the straight lines in the text data after the straight line detection step calculate the inclination angle of each line separately, calculate the average of the inclination angles based on all the inclination angles, and determine that the average value is the average inclination angle, based on the average inclination angle Determine the tilt angle and tilt direction of the character image data.
  • Step 303 Rotate and correct the text image data according to the tilt angle to obtain first text image data.
  • the text image data is rotated and corrected according to the tilt angle and the tilt direction of the text image data, that is, the text image data is rotated by the value of the tilt angle in the opposite direction of the tilt direction to obtain the first text image data.
  • Step 304 Set a search box and a search step, search and crop the first text image data to obtain second text image data.
  • set a search box and a search step where the search box is used to search for text in the first text image data, and the search step is used to set the number of pixels that the search box moves each time it searches, according to the search Frame and search step, perform a full image search on the first text image data and crop the text in the first text image data to obtain second text image data.
  • Step 305 Refine the second character image data to obtain refined second character image data, and perform normalization processing on the refined second character image data to obtain normalized second character image data , Performing template matching on the normalized second character image data to obtain third character image data.
  • the second character image is refined to obtain refined second character image data
  • the refinement of the second character image data includes: continuously erasing the edge pixels of the second character image data, so that The two-character image data becomes an image skeleton with the original text topology connection relationship; the refined second-character image data is normalized to obtain the normalized second-character image data, wherein the normalization method includes: Min-max standardization, Z-score standardization, etc. are not limited here; obtain the template, match the normalized second text image data with the template, and obtain third text image data, in which the third text image data is The structure of the template is consistent.
  • Step 306 Use the third text image as an input of a trained feature extraction model to obtain text features corresponding to the third text image, and determine feature weights corresponding to the text features.
  • the third text image data is used as the feature extraction model to obtain the third
  • the feature weights corresponding to the text features are determined according to the feature extraction model.
  • Step 307 Obtain a text library, use the sample text data in the text library as the input of the trained feature extraction model to obtain sample features corresponding to the sample text data, and train a text classifier according to the sample features to obtain training Good text classifier.
  • obtain a text library match the sample text in the text library with the template to obtain sample text data consistent with the structure of the template, and use the sample text data as the input of the trained feature extraction model to obtain the corresponding sample text data
  • the sample feature weights corresponding to the sample features are determined according to the feature extraction model, and a text classifier is constructed and trained based on the sample features and the sample feature weights to obtain a trained text classifier.
  • Step 308 Use the text features and feature weights as input to the trained text classifier to obtain a classification result, and determine that the classification result is the identified text corresponding to the text features, the text features, and the feature weights
  • the font data is formed with the recognized text.
  • the text features and feature weights are used as input to the trained text classifier to obtain the classification results corresponding to the text features, and the classification results are determined to be the recognized text corresponding to the text features.
  • the text features, feature weights, and recognized text constitute font data .
  • FIG. 4 is a schematic flowchart of a method for determining a target font disclosed in an embodiment of the present application.
  • Step 401 Obtain a font library and detect whether the font library contains a set font.
  • the font library obtains the font library, and query the set flag in the font library.
  • the set flag is used to mark the set font. If the font library contains the set flag, the set font is obtained in the font library.
  • the font corresponding to the set mark is the set font, and the set font is determined to be the target font; if the set mark is not included in the font library, it is determined that the set font is not included in the font library.
  • Step 402 If the set font is not included in the font library, determine that the font in the font library is a font to be selected.
  • the font in the font library is obtained, and the font in the font library is determined as the font to be selected.
  • Step 403 Obtain the recognized text from the text library of the font to be selected as the text to be selected.
  • a text library of fonts to be selected is obtained, and the recognized text is matched in each text library of the fonts to be selected, and the text corresponding to the recognized text in the text library of the fonts to be selected is determined as the text to be selected.
  • Step 404 Obtain the feature of the text to be selected as the feature to be selected, determine the weight of the feature to be selected corresponding to the feature to be selected, match the feature of the text with the feature to be selected, and determine The matching feature weight is calculated by calculating the feature weights to be selected.
  • the text to be selected is used as the input of the trained feature extraction model to obtain the feature to be selected corresponding to the text to be selected, the weight of the feature to be selected corresponding to the feature to be selected is determined according to the feature extraction model, and the text feature and the feature to be selected Matching is performed to obtain the first matching degree, and the first matching degree is calculated according to the feature weight and the feature weight to be selected to obtain a calculation result, and the calculation result is determined to be a matching degree between the font data and the font to be selected.
  • Step 405 Determine that the feature to be selected corresponding to the maximum value in the matching degree is a target feature, and determine that the font to be selected corresponding to the target feature is the target font.
  • the feature to be selected corresponding to the maximum value in the matching degree is determined as the target feature, where a higher matching degree indicates that the text feature is more similar to the feature to be selected, the font data is determined to be similar to the font to be selected, and the corresponding feature of the target feature is determined
  • the font to be selected is the target font.
  • FIG. 5 is a schematic structural diagram of an apparatus 500 for optimizing fonts disclosed in an embodiment of the present application.
  • the obtaining unit 501 is configured to obtain text data and preprocess the text data to obtain font data;
  • the scoring unit 502 is used to input the font data into the trained font scoring model to obtain the font score corresponding to the font data;
  • the determining unit 503 is configured to determine whether the font score is less than a score threshold, and if the font score is less than the score threshold, determine the target font according to the font data;
  • the display unit 504 is configured to obtain characters corresponding to the font data from the target font and display the characters.
  • the obtaining unit 501 is specifically configured to obtain text data.
  • the text data includes text image data and touch screen handwritten text data.
  • the text image data is the image data in the electronic device
  • the scoring unit 502 is specifically used to: input the font data to the trained font Before the font scoring model, build a font scoring model, obtain several handwriting font training samples, score the handwriting font training samples, train the font scoring model according to the scores corresponding to the handwriting font training samples and the handwriting font training samples, and obtain the trained font scoring model , Input the font data into the trained font scoring model to obtain the calculation result, and determine the calculation result as the font score corresponding to the font data.
  • the determining unit 503 is specifically used to: obtain a score threshold To determine whether the font score is less than the score threshold, if the font score is not less than the score threshold, establish a mapping relationship between font data and font score, and store the mapping relationship in the personal font library; if the font score is less than the score threshold, obtain the font library, Query the setting flag in the font library.
  • the setting flag is used to mark the setting font. If the font library contains the setting flag, the font library contains the setting font. Make sure that the font corresponding to the setting flag is the setting font.
  • the fonts in the font library are the fonts to be selected. Obtain the text library of the fonts to be selected. Match the recognized text in each font library of the selected fonts. Determine that the text corresponding to the recognized text in the font library of the selected fonts is to be selected.
  • Select text use the text to be selected as the input of the trained feature extraction model, obtain the feature to be selected corresponding to the text to be selected, determine the weight of the feature to be selected corresponding to the feature to be selected according to the feature extraction model, and then compare the text feature with the feature to be selected
  • the first matching degree is obtained by matching, and the first matching degree is calculated according to the feature weight and the feature weight to be selected, and the calculation result is obtained.
  • the calculation result is determined to be the matching degree between the font data and the font to be selected, and the maximum value of the matching degree is determined.
  • the feature to be selected is the target feature, where a higher matching degree indicates that the text feature is more similar to the feature to be selected, the font data is determined to be similar to the font to be selected, and the font to be selected corresponding to the target feature is determined to be the target font.
  • the determining unit 503 is specifically used to:
  • the set font is not included in the library.
  • the font in the font library is the font to be selected, the frequency of use corresponding to the font to be selected is determined, and the font to be selected corresponding to the maximum frequency of use in the font library is determined as the target font.
  • the display unit 504 is specifically configured to: after determining the target font, acquire a text library corresponding to the target font, Obtain the text corresponding to the font data as the replacement text in the text library corresponding to the target font, replace the text data with the replacement text, and display the replacement text on the display interface.
  • the display unit 504 is specifically configured to: acquire the font of the font library and acquire the personalized font Font of the library; an enlarged floating layer is displayed on the interface of the text, the enlarged floating layer includes: the font of the font library, the font of the personalized font library
  • FIG. 6 is a block diagram of a partial structure of a mobile phone related to a mobile terminal disclosed in an embodiment of the present application.
  • the mobile phone includes: a radio frequency (Radio Frequency) circuit 910, a memory 920, an input and output unit 930, a sensor 950, an audio collector 960, a wireless fidelity (WiFi) module 970, an application processor AP980, Power supply 990 and other components.
  • a radio frequency (Radio Frequency) circuit 910 the structure of the mobile phone shown in FIG. 6 does not constitute a limitation on the mobile phone, and may include more or fewer components than those illustrated, or combine certain components, or different component arrangements, such as the
  • the radio frequency circuit 910 may be connected to multiple antennas.
  • the input and output unit 930 may be used to receive inputted numeric or character information, and generate key signal input related to user settings and function control of the mobile phone.
  • the input and output unit 930 may include a touch screen 933 and other input devices 932.
  • the input and output unit 930 may also include other input devices 932.
  • other input devices 932 may include, but are not limited to, one or more of physical buttons, function keys (such as volume control buttons, switch buttons, etc.), trackball, mouse, joystick, etc. among them,
  • the radio frequency circuit 910 is used to receive the connection request of the wearable device
  • the AP980 is used to establish a connection with the wearable device according to the connection request.
  • the AP980 is the control center of the mobile phone. It uses various interfaces and lines to connect the various parts of the entire mobile phone. It runs or executes the software programs and/or modules stored in the memory 920, and calls the data stored in the memory 920. Various functions and processing data to monitor the mobile phone as a whole.
  • the AP980 may include one or more processing units; optionally, the AP980 may integrate an application processor and a modem processor, where the application processor mainly processes the operating system, user interface, and application programs, etc.
  • the modulation processor mainly handles wireless communication. It can be understood that the foregoing modem processor may not be integrated into the AP980.
  • the memory 920 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices.
  • a non-volatile memory such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices.
  • the RF circuit 910 can be used for information reception and transmission.
  • the RF circuit 910 includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (Low Noise Amplifier, LNA), a duplexer, and the like.
  • the RF circuit 910 can also communicate with other devices via a wireless communication network.
  • the above wireless communication can use any communication standard or protocol, including but not limited to global mobile communication system, general packet radio service, code division multiple access, broadband code division multiple access, long-term evolution, new air interface, e-mail, short message service, etc. .
  • the mobile phone may further include at least one sensor 950, such as an ultrasonic sensor, an angle sensor, a light sensor, a motion sensor, and other sensors.
  • the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the touch display according to the brightness of the ambient light, and the proximity sensor may turn off the touch display when the mobile phone moves to the ear And/or backlight.
  • the accelerometer sensor can detect the magnitude of acceleration in various directions (generally three axes), and can detect the magnitude and direction of gravity when at rest, and can be used to identify mobile phone gesture applications (such as horizontal and vertical screen switching, related Games, magnetometer attitude calibration), vibration recognition related functions (such as pedometers, taps), etc.
  • other sensors such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc. can be configured here. Repeat.
  • the audio collector 960, the speaker 961, and the microphone 962 can provide an audio interface between the user and the mobile phone.
  • the audio collector 960 can transmit the converted electrical signal of the received audio data to the speaker 961, which converts the speaker 961 into a sound signal to play; on the other hand, the microphone 962 converts the collected sound signal into an electrical signal, which is collected by the audio
  • the receiver 960 converts it into audio data after receiving it, and then processes the audio data to play with the AP 980, and then sends it to another mobile phone via the RF circuit 910, or plays the audio data to the memory 920 for further processing.
  • WiFi is a short-distance wireless transmission technology.
  • the mobile phone can help users send and receive emails, browse web pages, and access streaming media through the WiFi module 970. It provides users with wireless broadband Internet access.
  • FIG. 6 shows the WiFi module 970, it can be understood that it is not a necessary component of the mobile phone, and it can be omitted without changing the scope of the essence of the application as needed.
  • the mobile phone also includes a power supply 990 (such as a battery) that supplies power to various components.
  • a power supply 990 (such as a battery) that supplies power to various components.
  • the power supply can be logically connected to the AP980 through a power management system, so as to realize functions such as charging, discharging, and power management through the power management system.
  • the mobile phone may also include a camera, a Bluetooth module, a fill light device, a light sensor, etc., which will not be repeated here.
  • An embodiment of the present application further provides a computer storage medium, wherein the computer storage medium stores a computer program for electronic data exchange, which causes the computer to execute any method for optimizing fonts as described in the above method embodiments Part or all steps.
  • An embodiment of the present application further provides a computer program product, the computer program product includes a non-transitory computer-readable storage medium storing a computer program, the computer program is operable to cause the computer to execute as described in the above method embodiments Part or all of any method of optimizing fonts.
  • the disclosed device may be implemented in other ways.
  • the device embodiments described above are only schematic.
  • the division of the unit is only a logical function division.
  • there may be another division manner for example, multiple units or components may be combined or may Integration into another system, or some features can be ignored, or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the above integrated unit may be implemented in the form of hardware or software program modules.

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Controls And Circuits For Display Device (AREA)

Abstract

一种优化字体的方法,应用于电子设备,所述方法包括:获取文字数据,对所述文字数据进行预处理得到字体数据(201);将所述字体数据输入到训练好的字体打分模型,得到所述字体数据对应的字体分数(202);判断所述字体分数是否小于分数阈值,若所述字体分数小于所述分数阈值,则依据所述字体数据确定目标字体(203);从所述目标字体中获取与所述字体数据对应的文字,显示所述文字(204)。所述方法通过对评分低手写字体进行优化,提高手机手写字体显示的美观性,具有用户体验度高的优点。

Description

一种优化字体的方法及相关设备 技术领域
本申请涉及智能设备领域,具体涉及一种优化字体的方法及相关设备。
背景技术
随着智能手机等电子设备的普及,手机在现实生活中的应用越来越广泛,在手机字体的设置方面更多的手机用户希望用自己的手写字体作为手机字体,但是,不同的人有不同的手写字体,直接使用手写字体容易导致手机显示界面的美观性降低,用户体验度不高。
发明内容
本申请实施例公开了一种优化字体的方法及相关设备,能够对手写字体进行评分,对评分低的手写字体进行优化。
第一方面,本申请实施例公开了一种优化字体的方法,应用于电子设备,所述方法包括:
获取文字数据,对所述文字数据进行预处理得到字体数据;
将所述字体数据输入到训练好的字体打分模型,得到所述字体数据对应的字体分数;
判断所述字体分数是否小于分数阈值,若所述字体分数小于所述分数阈值,则依据所述字体数据确定目标字体;
从所述目标字体中获取与所述字体数据对应的文字,显示所述文字。
第二方面,本申请实施例公开了一种优化字体设备,所述优化字体设备包括:
获取单元,用于获取文字数据,对所述文字数据进行预处理得到字体数据;
评分单元,用于将所述字体数据输入到训练好的字体打分模型,得到所述字体数据对应的字体分数;
确定单元,用于判断所述字体分数是否小于分数阈值,若所述字体分数小 于所述分数阈值,则依据所述字体数据确定目标字体;
显示单元,用于从所述目标字体中获取与所述字体数据对应的文字,显示所述文字。
第三方面,本申请实施例公开一种移动终端,包括处理器、存储器、通信接口,以及一个或多个程序,其中,上述一个或多个程序被存储在上述存储器中,并且被配置由上述处理器执行,上述程序包括用于执行本申请实施例第一方面中的步骤的指令。
第四方面,本申请实施例公开了一种计算机可读存储介质,其中,上述计算机可读存储介质存储用于电子数据交换的计算机程序,其中,上述计算机程序使得计算机执行如本申请实施例第一方面中所描述的部分或全部步骤。
第五方面,本申请实施例公开了一种计算机程序产品,其中,上述计算机程序产品包括存储了计算机程序的非瞬时性计算机可读存储介质,上述计算机程序可操作来使计算机执行如本申请实施例第一方面中所描述的部分或全部步骤。该计算机程序产品可以为一个软件安装包。
可以看出,本申请实施例中,电子设备获取文字数据,通过预处理得到字体数据,对所述字体数据进行打分,依据目标字体对评分低的字体进行优化,获取与所述字体数据对应的文字并显示。可见,电子设备通过对低分的手写字体进行优化后再显示文字,提升了显示界面的美观性,提高了用户的体验度。
附图说明
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是本申请实施例公开的一种字体优化的方法的系统结构示意图。
图2是本申请实施例公开的一种优化字体的方法的流程示意图。
图3是本申请实施例公开的一种文字数据预处理的方法的流程示意图。
图4是本申请实施例公开的一种确定目标字体的方法的流程示意图。
图5是本申请实施例公开的一种优化字体的装置500的结构示意图。
图6是本申请实施例公开的移动终端相关的手机的部分结构的框图
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
本发明的说明书和权利要求书及所述附图中的术语“第一”、“第二”、“第三”和“第四”等是用于区别不同对象,而不是用于描述特定顺序。此外,术语“包括”和“具有”以及它们任何变形,意图在于覆盖不排他的包含。例如包含了一系列步骤或单元的过程、方法、系统、产品或设备没有限定于已列出的步骤或单元,而是可选地还包括没有列出的步骤或单元,或可选地还包括对于这些过程、方法、产品或设备固有的其它步骤或单元。
在本文中提及“实施例”意味着,结合实施例描述的特定特征、结果或特性可以包含在本发明的至少一个实施例中。在说明书中的各个位置出现该短语并不一定均是指相同的实施例,也不是与其它实施例互斥的独立的或备选的实施例。本领域技术人员显式地和隐式地理解的是,本文所描述的实施例可以与其它实施例相结合。
本申请实施例所涉及到的移动终端可以包括各种具有无线通信功能的手持设备、车载设备、可穿戴设备、计算设备或连接到无线调制解调器的其他处理设备,以及各种形式的用户设备(user equipment,UE),移动台(mobile station,MS),终端设备(terminal device)等等。为方便描述,上面提到的设备统称为电子设备。
下面对本申请实施例进行详细介绍。
请参阅图1,图1是本申请实施例公开的一种优化字体的方法的系统结构示意图,其中移动终端101与云服务器102通信连接,移动终端101采集文字数据,对文字数据进行预处理得到字体数据,将字体数据发送至云服务器102,云服务器102接收到字体数据后,将字体数据作为字体打分模型的输入进行计算得到字体数据对应的字体分数,判断字体分数是否小于分数阈值,云服务器 102将字体分数小于分数阈值的字体作为特征提取模型的输入得到字体特征,将字体特征与字体库中的字体进行匹配确定目标字体,移动终端101接收云服务器102发送的目标字体后获取与字体数据对应的文字,移动终端101显示该文字。
请参阅图2,图2是本申请实施例公开的一种优化字体的方法的流程示意图。
步骤201、获取文字数据,对所述文字数据进行预处理得到字体数据。
可选的,文字数据包括:文字图像数据、触控屏手写文字数据,其中,文字图像数据为电子设备中的图片数据,触控手写文字数据为电子设备的触控屏接收的手写文字数据。
进一步地,若文字数据为文字图像数据,检测文字图像数据中包含的所有直线,其中,检测直线包括:对于文字图像数据边缘的每一个像素点,把可能经过这个像素点的所有直线y=k*x+b,映射到k-b空间上,然后投票,对于与x轴垂直的直线斜率不存在无法通过方程y=k*x+b表示,所以用参数方程r=x*cos(theta)+y*sin(theta)表示,其中r表示经过该点直线到原点的距离,theta表示r与x正轴的夹角,对每个边缘点映射之后,在霍夫空间进行投票,每次有直线方程满足(r,theta)点,此处的像素值加1,得到hough-space图像,对该hough-space图像进行过滤,计算局部极大值,依据局部极大值得到若干直线方程以求得文字图像数据中的所有直线。
进一步地,获取文字图像数据中的所有直线,计算每条直线的倾斜角,计算所有倾斜角的平均值,该平均值为该文字图像数据的倾斜度,依据该平均值对文字图像数据进行旋转校正得到第一文字图像数据。
可选的,设置搜索框与搜索步长,从第一文字图像数据的第一个像素点对第一文字图像数据进行全图搜索,对第一文字图像数据进行裁剪得到第二文字图像数据,其中,第二文字图像数据包含:多个测试样本,对第二文字图像数据进行细化处理得到细化的第二文字图像数据,对细化的第二文字图像数据进行归一化处理得到归一后的第二文字图像数据,获取匹配模板,将归一后的第二文字图像数据与匹配模板进行匹配得到第三文字图像数据。
进一步地,将第三文字图像数据作为特征提取模型的输入,得到第三文字图像对应的文字特征,确定该文字特征对应的特征权重,获取字体库,将字体库中的样本文字数据作为训练好的特征提取模型的输入,得到样本文字数据对应的样本特征,依据样本特征建立文字分类器并对文字分类器进行训练得到训练好的文字分类器,将文字特征与特征权重作为训练好的文字分类器的输入得到分类结果,确定分类结果文字特征对应的识别文字,文字特征、特征权重与识别文字构成字体数据。
步骤202、将所述字体数据输入到训练好的字体打分模型,得到所述字体数据对应的字体分数。
可选的,将所述字体数据输入到训练好的字体打分模型之前,构建字体打分模型,获取若干手写字体训练样本,对手写字体训练样本进行打分,依据手写字体训练样本与手写字体训练样本对应的分数训练字体打分模型,得到训练好的字体打分模型。
进一步地,将字体数据输入到训练好的字体打分模型,得到计算结果,确定计算结果为字体数据对应的字体分数。
步骤203、判断所述字体分数是否小于分数阈值,若所述字体分数小于所述分数阈值,则依据所述字体数据确定目标字体。
可选的,获取分数阈值,判断字体分数是否小于分数阈值,若字体分数不小于分数阈值,建立字体数据与字体分数的映射关系,将该映射关系存储至个性字体库中;若字体分数小于分数阈值,则获取字体库,依据字体数据从字体库中选择一种字体作为目标字体。
步骤204、从所述目标字体中获取与所述字体数据对应的文字,显示所述文字。
可选的,确定目标字体后,获取目标字体对应的文字库,在目标字体对应的文字库中获取与字体数据对应的文字作为替换文字,将文字数据替换为替换文字,在显示界面中显示该替换文字。
请参阅图3,图3是本申请实施例公开的一种文字数据预处理的方法的流程示意图。
步骤301、获取文字数据,所述文字数据包括:文字图像数据,检测所述文字图像数据中的直线。
可选的,在检测所述文字图像数据中的直线之前,先对文字图像数据进行二值化处理得到二值化的文字图像数据,其中,将文字图像数据的内容分为前景信息与背景信息,前景信息为黑色,背景信息为白色;对二值化的文字图像数据进行降噪,其中,降噪的方式包括:均值滤波器、中值滤波器、小波去噪等等,在此不作限定,降噪后得到降噪的文字图像数据,依据降噪的文字图像数据对文字图像数据进行更新。
可选的,获取文字数据,若文字数据为文字图像数据,则对文字数据执行直线检测步骤,得到文字图像数据中包含的全部直线,其中,直线检测步骤包括:对文字图像边缘的每一个像素点,把可能经过这个像素点的所有直线y=k*x+b,映射到k-b空间上,然后投票,对于与x轴垂直的直线斜率不存在无法通过方程y=k*x+b表示,所以用参数方程r=x*cos(theta)+y*sin(theta)表示,其中r表示经过该点直线到原点的距离,theta表示r与x正轴的夹角,对每个边缘点映射之后,在霍夫空间进行投票,每次有直线方程满足(r,theta)点,此处的像素值加1,得到hough-space图像,对该hough-space图像进行过滤,计算局部极大值,依据局部极大值得到若干直线方程以求得文字图像数据中的所有直线;例如,第一像素点的像素值为210,第二像素点的像素值为10,则第一像素点在hough-space图像内的像素值比第二像素点的像素值大,说明经过第一像素点的直线更多。
步骤302、计算所述直线的倾斜角,计算所述倾斜角的平均值,确定所述平均值为所述文字图像数据的倾斜角度。
可选的,获取经过直线检测步骤的文字数据中的所有直线,分别计算每条直线的倾斜角,依据所有倾斜角计算倾斜角的平均值,确定该平均值为平均倾斜角,依据平均倾斜角确定文字图像数据的倾斜角度与倾斜方向。
步骤303、根据所述倾斜角度对所述文字图像数据进行旋转校正后得到第一文字图像数据。
可选的,依据文字图像数据的倾斜角度与倾斜方向,对所述文字图像数据 进行旋转校正即将文字图像数据在倾斜方向的反方向旋转该倾斜角度的值,得到第一文字图像数据。
步骤304、设置搜索框与搜索步长,对所述第一文字图像数据进行搜索裁剪得到第二文字图像数据。
可选的,设置搜索框与搜索步长,其中,搜索框用于对第一文字图像数据中的文字进行搜索,搜索步长用于设定搜索框每一次搜索移动的像素点个数,依据搜索框与搜索步长,对第一文字图像数据进行全图搜索并将第一文字图像数据中的文字裁剪得到第二文字图像数据。
步骤305、对所述第二文字图像数据进行细化得到细化的第二文字图像数据,对所述细化的第二文字图像数据进行归一化处理得到归一后的第二文字图像数据,对所述归一后的第二文字图像数据进行模板匹配得到第三文字图像数据。
可选的,对第二文字图像进行细化,得到细化的第二文字图像数据,其中,对第二文字图像数据进行细化包括:连续擦除第二文字图像数据的边缘像素,使第二文字图像数据成为具有原本文字拓扑连接关系的图像骨架;对细化的第二文字图像数据进行归一化处理,得到归一后的第二文字图像数据,其中,归一化的方法包括:min-max标准化、Z-score标准化等等,在此不作限定;获取模板,将归一后的第二文字图像数据与模板进行匹配,得到第三文字图像数据,其中,第三文字图像数据与该模板的结构一致。
步骤306、将所述第三文字图像作为训练好的特征提取模型的输入,得到所述第三文字图像对应的文字特征,确定所述文字特征对应的特征权重。
可选的,获取训练好的特征提取模型,其中,特征提取模型的方法包括:卷积神经网络运算等等,在此不作限定,将第三文字图像数据作为特征提取模型得输入,得到第三文字图像对应的文字特征,依据特征提取模型确定文字特征对应的特征权重。
步骤307、获取文字库,将所述文字库中的样本文字数据作为所述训练好的特征提取模型的输入得到所述样本文字数据对应的样本特征,依据所述样本特征训练文字分类器得到训练好的文字分类器。
可选的,获取文字库,将文字库中的样本文字与模板进行匹配,得到与模板的结构一致的样本文字数据,将样本文字数据作为训练好的特征提取模型的输入得到样本文字数据对应的样本特征,依据特征提取模型确定样本特征对应的样本特征权重,依据样本特征与样本特征权重构建文字分类器并训练,得到训练好的文字分类器。
步骤308、将所述文字特征与特征权重作为所述训练好的文字分类器的输入得到分类结果,确定所述分类结果为所述文字特征对应的识别文字,所述文字特征、所述特征权重与所述识别文字构成字体数据。
可选的,将文字特征与特征权重作为训练好的文字分类器的输入,得到文字特征对应的分类结果,确定分类结果为文字特征对应的识别文字,文字特征、特征权重与识别文字构成字体数据。
请参阅图4,图4是本申请实施例公开的一种确定目标字体的方法的流程示意图。
步骤401、获取字体库,检测所述字体库中是否包含设定字体。
可选的,获取字体库,在字体库中进行查询设定标记,该设定标记用于对设定字体进行标记,若字体库中包含设定标记,获取字体库中包含设定字体,确定设定标记对应的字体为设定字体,确定设定字体为目标字体;若字体库中不包含设定标记,确定字体库中不包含设定字体。
步骤402、若所述字体库中不包含所述设定字体,则确定所述字体库中的字体为待选字体。
可选的,若确定字体库中不包含设定字体,获取字体库中的字体,确定字体库中的字体为待选字体。
步骤403、从所述待选字体的文字库中获取所述识别文字为待选文字。
可选的,获取待选字体的文字库,在每一个待选字体的文字库中对识别文字进行匹配,确定待选字体的文字库中与识别文字对应的文字为待选文字。
步骤404、获取所述待选文字的特征为待选特征,确定所述待选特征对应的待选特征权重,将所述文字特征与所述待选特征进行匹配,依据所述特征权重与所述待选特征权重计算得到匹配度。
可选的,将待选文字作为训练好的特征提取模型的输入,得到待选文字对应的待选特征,依据特征提取模型确定待选特征对应的待选特征权重,将文字特征与待选特征进行匹配得到第一匹配度,依据特征权重与待选特征权重对第一匹配度进行计算,得到计算结果,确定计算结果为字体数据与待选字体的匹配度。
步骤405、确定所述匹配度中的最大值对应的待选特征为目标特征,确定所述目标特征对应的待选字体为所述目标字体。
可选的,确定匹配度中的最大值对应的待选特征为目标特征,其中,匹配度越高代表文字特征与待选特征越相似,确定字体数据与待选字体相似,确定目标特征对应的待选字体为目标字体。
请参阅图5,图5是本申请实施例公开的一种优化字体的装置500的结构示意图。
获取单元501,用于获取文字数据,对所述文字数据进行预处理得到字体数据;
评分单元502,用于将所述字体数据输入到训练好的字体打分模型,得到所述字体数据对应的字体分数;
确定单元503,用于判断所述字体分数是否小于分数阈值,若所述字体分数小于所述分数阈值,则依据所述字体数据确定目标字体;
显示单元504,用于从所述目标字体中获取与所述字体数据对应的文字,显示所述文字。
在一可能的示例中,用于获取文字数据,对所述文字数据进行预处理得到字体数据,获取单元501具体用于:获取文字数据,文字数据包括:文字图像数据、触控屏手写文字数据,其中,文字图像数据为电子设备中的图片数据,触控手写文字数据为电子设备的触控屏接收的手写文字数据;若文字数据为文字图像数据,检测文字图像数据中包含的所有直线,其中,检测直线包括:对于文字图像数据边缘的每一个像素点,把可能经过这个像素点的所有直线y=k*x+b,映射到k-b空间上,然后投票,对于与x轴垂直的直线斜率不存在无法通过方程y=k*x+b表示,所以用参数方程r=x*cos(theta)+y*sin(theta)表示,其 中r表示经过该点直线到原点的距离,theta表示r与x正轴的夹角,对每个边缘点映射之后,在霍夫空间进行投票,每次有直线方程满足(r,theta)点,此处的像素值加1,得到hough-space图像,对该hough-space图像进行过滤,计算局部极大值,依据局部极大值得到若干直线方程以求得文字图像数据中的所有直线;获取文字图像数据中的所有直线,计算每条直线的倾斜角,计算所有倾斜角的平均值,该平均值为该文字图像数据的倾斜度,依据该平均值对文字图像数据进行旋转校正得到第一文字图像数据;设置搜索框与搜索步长,从第一文字图像数据的第一个像素点对第一文字图像数据进行全图搜索,对第一文字图像数据进行裁剪得到第二文字图像数据,其中,第二文字图像数据包含:多个测试样本,对第二文字图像数据进行细化处理得到细化的第二文字图像数据,对细化的第二文字图像数据进行归一化处理得到归一后的第二文字图像数据,获取匹配模板,将归一后的第二文字图像数据与匹配模板进行匹配得到第三文字图像数据;将第三文字图像数据作为特征提取模型的输入,得到第三文字图像对应的文字特征,确定该文字特征对应的特征权重,获取字体库,将字体库中的样本文字数据作为训练好的特征提取模型的输入,得到样本文字数据对应的样本特征,依据样本特征建立文字分类器并对文字分类器进行训练得到训练好的文字分类器,将文字特征与特征权重作为训练好的文字分类器的输入得到分类结果,确定分类结果文字特征对应的识别文字,文字特征、特征权重与识别文字构成字体数据。
在一可能的示例中,用于将所述字体数据输入到训练好的字体打分模型,得到所述字体数据对应的字体分数,评分单元502具体用于:将所述字体数据输入到训练好的字体打分模型之前,构建字体打分模型,获取若干手写字体训练样本,对手写字体训练样本进行打分,依据手写字体训练样本与手写字体训练样本对应的分数训练字体打分模型,得到训练好的字体打分模型,将字体数据输入到训练好的字体打分模型,得到计算结果,确定计算结果为字体数据对应的字体分数。
在一可能的示例中,用于判断所述字体分数是否小于分数阈值,若所述字体分数小于所述分数阈值,则依据所述字体数据确定目标字体,确定单元503 具体用于:获取分数阈值,判断字体分数是否小于分数阈值,若字体分数不小于分数阈值,建立字体数据与字体分数的映射关系,将该映射关系存储至个性字体库中;若字体分数小于分数阈值,则获取字体库,在字体库中进行查询设定标记,该设定标记用于对设定字体进行标记,若字体库中包含设定标记,获取字体库中包含设定字体,确定设定标记对应的字体为设定字体,确定设定字体为目标字体;若字体库中不包含设定标记,确定字体库中不包含设定字体;若确定字体库中不包含设定字体,获取字体库中的字体,确定字体库中的字体为待选字体,获取待选字体的文字库,在每一个待选字体的文字库中对识别文字进行匹配,确定待选字体的文字库中与识别文字对应的文字为待选文字,将待选文字作为训练好的特征提取模型的输入,得到待选文字对应的待选特征,依据特征提取模型确定待选特征对应的待选特征权重,将文字特征与待选特征进行匹配得到第一匹配度,依据特征权重与待选特征权重对第一匹配度进行计算,得到计算结果,确定计算结果为字体数据与待选字体的匹配度,确定匹配度中的最大值对应的待选特征为目标特征,其中,匹配度越高代表文字特征与待选特征越相似,确定字体数据与待选字体相似,确定目标特征对应的待选字体为目标字体。
在一可能的示例中,用于判断所述字体分数是否小于分数阈值,若所述字体分数小于所述分数阈值,则依据所述字体数据确定目标字体,确定单元503具体用于:若确定字体库中不包含设定字体,获取字体库中的字体为待选字体,获取待选字体对应的使用频率,确定字体库中最大使用频率对应的待选字体为目标字体。
在一可能的示例中,用于从所述目标字体中获取与所述字体数据对应的文字,显示所述文字,显示单元504具体用于:确定目标字体后,获取目标字体对应的文字库,在目标字体对应的文字库中获取与字体数据对应的文字作为替换文字,将文字数据替换为替换文字,在显示界面中显示该替换文字。
在一可能的示例中,用于从所述目标字体中获取与所述字体数据对应的文字,显示所述文字,显示单元504具体用于:获取所述字体库的字体,获取所述个性字体库的字体;在所述文字的界面显示放大浮层,所述放大浮层包括: 所述字体库的字体、所述个性字体库的字体
请参阅图6,图6是本申请实施例公开的移动终端相关的手机的部分结构的框图。参考图6,手机包括:射频(Radio Frequency,RF)电路910、存储器920、输入输出单元930、传感器950、音频采集器960、无线保真(Wireless Fidelity,WiFi)模块970、应用处理器AP980、电源990等部件。本领域技术人员可以理解,图6中示出的手机结构并不构成对手机的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置,例如该射频电路910可以连接多根天线。
下面结合图6对手机的各个构成部件进行具体的介绍:
输入输出单元930可用于接收输入的数字或字符信息,以及产生与手机的用户设置以及功能控制有关的键信号输入。具体地,输入输出单元930可包括触控显示屏933以及其他输入设备932。输入输出单元930还可以包括其他输入设备932。具体地,其他输入设备932可以包括但不限于物理按键、功能键(比如音量控制按键、开关按键等)、轨迹球、鼠标、操作杆等中的一种或多种。其中,
射频电路910,用于接收可穿戴设备的连接请求;
AP980,用于依据所述连接请求建立与可穿戴设备的连接。
AP980是手机的控制中心,利用各种接口和线路连接整个手机的各个部分,通过运行或执行存储在存储器920内的软件程序和/或模块,以及调用存储在存储器920内的数据,执行手机的各种功能和处理数据,从而对手机进行整体监控。可选的,AP980可包括一个或多个处理单元;可选的,AP980可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到AP980中。
此外,存储器920可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。
RF电路910可用于信息的接收和发送。通常,RF电路910包括但不限于天线、至少一个放大器、收发信机、耦合器、低噪声放大器(Low Noise Amplifier, LNA)、双工器等。此外,RF电路910还可以通过无线通信与网络和其他设备通信。上述无线通信可以使用任一通信标准或协议,包括但不限于全球移动通讯系统、通用分组无线服务、码分多址、宽带码分多址、长期演进、新空口、电子邮件、短消息服务等。
手机还可包括至少一种传感器950,比如超声波传感器、角度传感器、光传感器、运动传感器以及其他传感器。具体地,光传感器可包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节触控显示屏的亮度,接近传感器可在手机移动到耳边时,关闭触控显示屏和/或背光。作为运动传感器的一种,加速计传感器可检测各个方向上(一般为三轴)加速度的大小,静止时可检测出重力的大小及方向,可用于识别手机姿态的应用(比如横竖屏切换、相关游戏、磁力计姿态校准)、振动识别相关功能(比如计步器、敲击)等;至于手机还可配置的陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器,在此不再赘述。
音频采集器960、扬声器961,传声器962可提供用户与手机之间的音频接口。音频采集器960可将接收到的音频数据转换后的电信号,传输到扬声器961,由扬声器961转换为声音信号播放;另一方面,传声器962将收集的声音信号转换为电信号,由音频采集器960接收后转换为音频数据,再将音频数据播放AP980处理后,经RF电路910以发送给比如另一手机,或者将音频数据播放至存储器920以便进一步处理。
WiFi属于短距离无线传输技术,手机通过WiFi模块970可以帮助用户收发电子邮件、浏览网页和访问流式媒体等,它为用户提供了无线的宽带互联网访问。虽然图6示出了WiFi模块970,但是可以理解的是,其并不属于手机的必须构成,完全可以根据需要在不改变申请的本质的范围内而省略。
手机还包括给各个部件供电的电源990(比如电池),可选的,电源可以通过电源管理系统与AP980逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。
尽管未示出,手机还可以包括摄像头、蓝牙模块、补光装置、光线传感器等,在此不再赘述。
本申请实施例还提供一种计算机存储介质,其中,该计算机存储介质存储用于电子数据交换的计算机程序,该计算机程序使得计算机执行如上述方法实施例中记载的任何一种优化字体的方法的部分或全部步骤。
本申请实施例还提供一种计算机程序产品,所述计算机程序产品包括存储了计算机程序的非瞬时性计算机可读存储介质,所述计算机程序可操作来使计算机执行如上述方法实施例中记载的任何一种优化字体的方法的部分或全部步骤。
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。
在本申请所提供的几个实施例中,应该理解到,所揭露的装置,可通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件程序模块的形式实现。
以上是本申请实施例的实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本申请实施例原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也视为本申请的保护范围。

Claims (20)

  1. 一种优化字体的方法,其特征在于,所述方法应用于电子设备,所述方法包括:
    获取文字数据,对所述文字数据进行预处理得到字体数据;
    将所述字体数据输入到训练好的字体打分模型,得到所述字体数据对应的字体分数;
    判断所述字体分数是否小于分数阈值,若所述字体分数小于所述分数阈值,则依据所述字体数据确定目标字体;
    从所述目标字体中获取与所述字体数据对应的文字,显示所述文字。
  2. 根据权利要求1所述的方法,其特征在于,所述获取文字数据,对所述文字数据进行预处理得到字体数据包括:
    所述文字数据包括:文字图像数据;
    检测所述文字图像数据中的直线;
    计算所述直线的倾斜角,计算所述倾斜角的平均值,确定所述平均值为所述文字图像数据的倾斜角度;
    根据所述倾斜角度对所述文字图像数据进行旋转校正后得到第一文字图像数据;
    对所述第一文字图像数据执行字符识别步骤得到字体数据。
  3. 根据权利要求2所述的方法,其特征在于,所述对所述第一文字图像数据执行字符识别步骤得到字体数据之前还包括:
    设置搜索框与搜索步长,对所述第一文字图像数据进行搜索裁剪得到第二文字图像数据;
    对所述第二文字图像数据进行细化得到细化的第二文字图像数据,对所述细化的第二文字图像数据进行归一化处理得到归一后的第二文字图像数据,对所述归一后的第二文字图像数据进行模板匹配得到第三文字图像数据;
    将所述第三文字图像数据作为训练好的特征提取模型的输入,得到所述第 三文字图像对应的文字特征,确定所述文字特征对应的特征权重。
  4. 根据权利要求3所述的方法,其特征在于,所述所述第一文字图像数据执行字符识别步骤得到字体数据包括:
    获取文字库,将所述文字库中的样本文字数据作为所述训练好的特征提取模型的输入得到所述样本文字数据对应的样本特征;
    依据所述样本特征训练文字分类器得到训练好的文字分类器;
    将所述文字特征与特征权重作为所述训练好的文字分类器的输入得到分类结果,确定所述分类结果为所述文字特征对应的识别文字;
    所述文字特征、所述特征权重与所述识别文字构成所述字体数据。
  5. 根据权利要求1所述的方法,其特征在于,所述依据所述字体数据确定目标字体包括:
    检测所述字体库中是否包含设定字体;
    若所述字体库中包含设定字体,确定所述目标字体为所述设定字体;
    若所述字体库中不包含所述设定字体,则将所述字体数据与所述字体库进行匹配确定目标字体。
  6. 根据权利要求5所述的方法,其特征在于,所述则将所述字体数据与所述字体库进行匹配确定目标字体包括:
    确定所述字体库中的字体为待选字体;
    从所述待选字体的字体库中获取所述识别文字为待选文字;
    获取所述待选文字的特征为待选特征,确定所述待选特征对应的待选特征权重,将所述文字特征与所述待选特征进行匹配,依据所述特征权重与所述待选特征权重计算得到匹配度;
    确定所述匹配度中的最大值对应的待选特征为目标特征,确定所述目标特征对应待选字体为所述目标字体。
  7. 根据权利要求1所述的方法,其特征在于,所述依据所述字体数据确定目标字体包括:
    获取所述文字库中的字体对应的字体使用频率;
    确定所述字体使用频率的最大值对应的字体为目标字体。
  8. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    若所述字体分数不小于所述分数阈值,建立所述字体数据与所述字体分数的映射关系,将所述映射关系存储至个性字体库中。
  9. 根据权利要求1所述的方法,其特征在于,所述显示所述文字之后还包括:
    获取所述字体库的字体,获取所述个性字体库的字体;
    在所述文字的界面显示放大浮层,所述放大浮层包括:所述字体库的字体、所述个性字体库的字体。
  10. 一种优化字体的设备,其特征在于,包括:
    获取单元,用于获取文字数据,对所述文字数据进行预处理得到字体数据;
    评分单元,用于将所述字体数据输入到训练好的字体打分模型,得到所述字体数据对应的字体分数;
    确定单元,用于判断所述字体分数是否小于分数阈值,若所述字体分数小于所述分数阈值,则依据所述字体数据确定目标字体;
    显示单元,用于从所述目标字体中获取与所述字体数据对应的文字,显示所述文字。
  11. 根据权利要求10所述的设备,其特征在于,所述获取文字数据,对所述文字数据进行预处理得到字体数据方面,所述获取单元用于:
    所述文字数据包括:文字图像数据;检测所述文字图像数据中的直线;计算所述直线的倾斜角,计算所述倾斜角的平均值,确定所述平均值为所述文字 图像数据的倾斜角度;根据所述倾斜角度对所述文字图像数据进行旋转校正后得到第一文字图像数据;对所述第一文字图像数据执行字符识别步骤得到字体数据。
  12. 根据权利要求11所述的设备,其特征在于,所述对所述第一文字图像数据执行字符识别步骤得到字体数据之前方面,所述获取单元用于:
    设置搜索框与搜索步长,对所述第一文字图像数据进行搜索裁剪得到第二文字图像数据;对所述第二文字图像数据进行细化得到细化的第二文字图像数据,对所述细化的第二文字图像数据进行归一化处理得到归一后的第二文字图像数据,对所述归一后的第二文字图像数据进行模板匹配得到第三文字图像数据;将所述第三文字图像作为训练好的特征提取模型的输入,得到所述第三文字图像对应的文字特征,确定所述文字特征对应的特征权重。
  13. 根据权利要求12所述的设备,其特征在于,所述所述第一文字图像数据执行字符识别步骤得到字体数据方面,所述获取单元用于:
    获取文字库,将所述文字库中的样本文字数据作为所述训练好的特征提取模型的输入得到所述样本文字数据对应的样本特征;依据所述样本特征训练文字分类器得到训练好的文字分类器;将所述文字特征与特征权重作为所述训练好的文字分类器的输入得到分类结果,确定所述分类结果为所述文字特征对应的识别文字;所述文字特征、所述特征权重与所述识别文字构成所述字体数据。
  14. 根据权利要求10所述的设备,其特征在于,所述依据所述字体数据确定目标字体方面,所述确定单元用于:
    检测所述字体库中是否包含设定字体;若所述字体库中包含设定字体,确定所述目标字体为所述设定字体;若所述字体库中不包含所述设定字体,则将所述字体数据与所述字体库进行匹配确定目标字体。
  15. 根据权利要求14所述的设备,其特征在于,所述则将所述字体数据与 所述字体库进行匹配确定目标字体方面,所述确定单元用于:
    确定所述字体库中的字体为待选字体;从所述待选字体的字体库中获取所述识别文字为待选文字;获取所述待选文字的特征为待选特征,确定所述待选特征对应的待选特征权重,将所述文字特征与所述待选特征进行匹配,依据所述特征权重与所述待选特征权重计算得到匹配度;确定所述匹配度中的最大值对应的待选特征为目标特征,确定所述目标特征对应待选字体为所述目标字体。
  16. 根据权利要求10所述的设备,其特征在于,所述依据所述字体数据确定目标字体方面,所述确定单元用于:
    获取所述文字库中的字体对应的字体使用频率;确定所述字体使用频率的最大值对应的字体为目标字体。
  17. 根据权利要求10所述的设备,其特征在于,所述确定单元用于:
    若所述字体分数不小于所述分数阈值,建立所述字体数据与所述字体分数的映射关系,将所述映射关系存储至个性字体库中。
  18. 根据权利要求10所述的设备,其特征在于,所述显示所述文字之后方面,所述显示单元用于:
    获取所述字体库的字体,获取所述个性字体库的字体;在所述文字的界面显示放大浮层,所述放大浮层包括:所述字体库的字体、所述个性字体库的字体。
  19. 一种移动终端,其特征在于,包括处理器、存储器、通信接口,以及一个或多个程序,所述一个或多个程序被存储在所述存储器中,并且被配置由所述处理器执行,所述程序包括用于执行如权利要求1-9任一项所述的方法中的步骤的指令。
  20. 一种计算机可读存储介质,其特征在于,存储用于电子数据交换的计 算机程序,其中,所述计算机程序使得计算机执行如权利要求1-9任一项所述的方法。
PCT/CN2018/122152 2018-12-19 2018-12-19 一种优化字体的方法及相关设备 WO2020124455A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2018/122152 WO2020124455A1 (zh) 2018-12-19 2018-12-19 一种优化字体的方法及相关设备
CN201880098687.3A CN112840308B (zh) 2018-12-19 2018-12-19 一种优化字体的方法及相关设备

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2018/122152 WO2020124455A1 (zh) 2018-12-19 2018-12-19 一种优化字体的方法及相关设备

Publications (1)

Publication Number Publication Date
WO2020124455A1 true WO2020124455A1 (zh) 2020-06-25

Family

ID=71102558

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/122152 WO2020124455A1 (zh) 2018-12-19 2018-12-19 一种优化字体的方法及相关设备

Country Status (2)

Country Link
CN (1) CN112840308B (zh)
WO (1) WO2020124455A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022223431A1 (de) * 2021-04-19 2022-10-27 Technische Universität Darmstadt Verfahren und vorrichtung zur erzeugung von optimierten fonts
CN115620302A (zh) * 2022-11-22 2023-01-17 山东捷瑞数字科技股份有限公司 一种图片字体识别方法、系统、电子设备及存储介质

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101393645A (zh) * 2008-09-12 2009-03-25 浙江大学 一种手写体汉字的计算机生成与美化方法
CN102609735A (zh) * 2012-02-06 2012-07-25 安徽科大讯飞信息科技股份有限公司 一种字符书写规范度评测的方法和装置
CN103136769A (zh) * 2011-12-02 2013-06-05 北京三星通信技术研究有限公司 用户书写风格字体生成的方法和装置
CN103164865A (zh) * 2011-12-12 2013-06-19 北京三星通信技术研究有限公司 一种对手写输入进行美化的方法和装置
US20150055869A1 (en) * 2013-08-26 2015-02-26 Samsung Electronics Co., Ltd. Method and apparatus for providing layout based on handwriting input
CN106778456A (zh) * 2015-11-19 2017-05-31 北京博智科创科技有限公司 一种手写输入的优化方法及装置
CN108228069A (zh) * 2017-12-21 2018-06-29 北京壹人壹本信息科技有限公司 手写字体输入方法、移动终端及装置

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100338618C (zh) * 2004-09-30 2007-09-19 致伸科技股份有限公司 一种倾斜图像自动校正方法
CN102938062B (zh) * 2012-10-16 2015-08-19 山东山大鸥玛软件有限公司 一种基于内容的文档图像倾斜角估计方法
CN107680108B (zh) * 2017-07-28 2019-06-21 平安科技(深圳)有限公司 倾斜图像的倾斜值获取方法、装置、终端及存储介质

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101393645A (zh) * 2008-09-12 2009-03-25 浙江大学 一种手写体汉字的计算机生成与美化方法
CN103136769A (zh) * 2011-12-02 2013-06-05 北京三星通信技术研究有限公司 用户书写风格字体生成的方法和装置
CN103164865A (zh) * 2011-12-12 2013-06-19 北京三星通信技术研究有限公司 一种对手写输入进行美化的方法和装置
CN102609735A (zh) * 2012-02-06 2012-07-25 安徽科大讯飞信息科技股份有限公司 一种字符书写规范度评测的方法和装置
US20150055869A1 (en) * 2013-08-26 2015-02-26 Samsung Electronics Co., Ltd. Method and apparatus for providing layout based on handwriting input
CN106778456A (zh) * 2015-11-19 2017-05-31 北京博智科创科技有限公司 一种手写输入的优化方法及装置
CN108228069A (zh) * 2017-12-21 2018-06-29 北京壹人壹本信息科技有限公司 手写字体输入方法、移动终端及装置

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022223431A1 (de) * 2021-04-19 2022-10-27 Technische Universität Darmstadt Verfahren und vorrichtung zur erzeugung von optimierten fonts
CN115620302A (zh) * 2022-11-22 2023-01-17 山东捷瑞数字科技股份有限公司 一种图片字体识别方法、系统、电子设备及存储介质
CN115620302B (zh) * 2022-11-22 2023-12-01 山东捷瑞数字科技股份有限公司 一种图片字体识别方法、系统、电子设备及存储介质

Also Published As

Publication number Publication date
CN112840308A (zh) 2021-05-25
CN112840308B (zh) 2024-06-14

Similar Documents

Publication Publication Date Title
US10169639B2 (en) Method for fingerprint template update and terminal device
CN107767333B (zh) 美颜拍照的方法、设备及计算机可存储介质
CN106156711B (zh) 文本行的定位方法及装置
CN109005286B (zh) 一种显示控制方法及折叠屏终端
CN108427873B (zh) 一种生物特征识别方法及移动终端
CN106874906B (zh) 一种图片的二值化方法、装置及终端
CN109977845B (zh) 一种可行驶区域检测方法及车载终端
CN107766403B (zh) 一种相册处理方法、移动终端以及计算机可读存储介质
CN111401463B (zh) 检测结果输出的方法、电子设备及介质
WO2020124455A1 (zh) 一种优化字体的方法及相关设备
CN111753520A (zh) 一种风险预测方法、装置、电子设备及存储介质
WO2024022149A1 (zh) 数据增强方法、装置及电子设备
CN107734049B (zh) 网络资源的下载方法、装置和移动终端
CN108038427B (zh) 一种文字识别方法及移动终端
CN110674294A (zh) 一种相似度确定方法及电子设备
CN111145083B (zh) 一种图像处理方法、电子设备及计算机可读存储介质
CN110046569B (zh) 一种无人驾驶数据处理方法、装置及电子设备
CN110969085B (zh) 脸部特征点定位方法及电子设备
CN113849142B (zh) 图像展示方法、装置、电子设备及计算机可读存储介质
WO2023231217A1 (zh) 目标物体定位方法、装置、可读存储介质及电子设备
CN109618097B (zh) 辅助拍照方法及终端设备
CN111405189B (zh) 拍摄控制方法及电子设备、拍摄设备
CN110738258B (zh) 图像分类方法、装置及终端设备
CN109887045B (zh) 一种图像显示方法及终端设备
CN109168154B (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: 18943545

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 031121)

122 Ep: pct application non-entry in european phase

Ref document number: 18943545

Country of ref document: EP

Kind code of ref document: A1