A method for recognizing handwritten strokes and an electronic device
By identifying the positional relationship and writing order of strokes, and using rectangular boxes to determine the stroke belonging, the accuracy of stroke selection in handwritten notes is solved, and the effect of accurate selection and column identification is achieved.
Patent Information
- Application Number
- CN202410875199.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-29
- Publication Date
- 2025-07-18
- Estimated Expiration
- 2044-06-29
AI Technical Summary
When users write notes by hand, it is difficult to accurately select the notes in the prior art, especially when the characters are close or the strokes are crossed, and it is easy to select multiple or missed when selecting patterns, and it is difficult to correctly identify the columns.
By identifying the positional relationship and writing order of strokes, use rectangular boxes to determine the strokes, combine the writing order of strokes and the positional relationship of rectangular boxes, accurately group strokes to ensure that there are no missed selection, multiple selection or column division errors when users select strokes.
It realizes accurate selection of strokes when users write notes, avoids multiple selection, missed selection and column division errors, and improves the accuracy and efficiency of selection.
Smart Images

Figure CN118887688B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of electronic devices, and more specifically, to a method for recognizing handwritten strokes and an electronic device. Background Art
[0002] With the progress of technology, more and more users will use electronic devices to handwrite notes in scenarios such as meetings and classes. When taking notes, users often need to select note content for operations such as deletion, movement, and copying, where the note content can include text and patterns. Currently, when users select note content, there are problems such as the following: 1. When the distance between two characters is relatively close or there are stroke intersections, it may not be possible to select characters one by one; 2. When selecting a pattern, there may be overselection or underselection of strokes; 3. When users record notes in a columnar format, it may not be possible to correctly recognize the columns, resulting in a disorder in the selection order when selecting note content. Based on this, how to quickly and accurately analyze notes so that users can accurately select the desired note content has become a technical problem to be solved urgently. Summary of the Invention
[0003] This application provides a method for recognizing handwritten strokes and an electronic device, which can quickly and accurately analyze strokes so that users can accurately select the desired strokes when selecting strokes.
[0004] In a first aspect, a method for recognizing handwritten strokes is provided. The method includes: displaying first content, where the first content includes multiple strokes; grouping the multiple strokes according to the positional relationship of the multiple strokes and the writing order of the multiple strokes.
[0005] In the embodiments of this application, strokes can be grouped according to the positional relationship between strokes and the writing order of strokes. Strokes belonging to the same stroke group can be strokes of the same pattern, or strokes of the same character, or strokes in the same column, so that when users select text and patterns, there will be no problems of underselection, overselection, inability to select a single character, or column error.
[0006] In combination with the first aspect, in some implementation manners of the first aspect, the first content includes a first character and a second character. The grouping of the multiple strokes according to the positional relationship of the multiple strokes and the writing order of the multiple strokes includes: when there is a first overlapping area between a first rectangular box corresponding to the first character and a second rectangular box corresponding to the second character, determining the attribution of the one or more strokes in the first overlapping area according to the writing order of the strokes of the first character and the second character and the positional relationship between the one or more strokes and the first rectangular box and the second rectangular box.
[0007] In combination with the first aspect, in some implementations of the first aspect, determining the attribution of the one or more strokes according to the writing order of the strokes of the first text and the second text and the positional relationship between one or more strokes in the first overlapping region and the first rectangular frame and the second rectangular frame includes: determining the coordinates of the first rectangular frame, the second rectangular frame, and the one or more strokes according to the positional relationship between the first text and the second text; determining the attribution of the one or more strokes according to the distance relationship between the coordinates of the first rectangular frame, the second rectangular frame, and the one or more strokes and the writing order of the strokes of the first text and the second text.
[0008] In the embodiments of the present application, the attribution of the strokes in the overlapping region can be determined according to the writing order of the text and the positional relationship between the strokes in the overlapping region and the text, so that when the user selects text, even if adjacent texts are close or there are overlapping strokes, a single text can be selected.
[0009] In combination with the first aspect, in some implementations of the first aspect, the first text and the second text are distributed left and right, the first text is on the left side of the second text, and the one or more strokes include a first stroke. Determining the coordinates of the first rectangular frame, the second rectangular frame, and the one or more strokes according to the positional relationship between the first text and the second text includes: determining the first central abscissa of the first rectangular frame, the second central abscissa of the second rectangular frame, and the first average abscissa of the first stroke.
[0010] In combination with the first aspect, in some implementations of the first aspect, determining the attribution of the one or more strokes according to the distance relationship between the coordinates of the first rectangular frame, the second rectangular frame, and the one or more strokes and the writing order of the strokes of the first text and the second text includes: when the distance between the first average abscissa and the first central abscissa is greater than the distance between the first average abscissa and the second central abscissa, determining that the first stroke belongs to the second text; or when the distance between the first average abscissa and the first central abscissa is less than the distance between the first average abscissa and the second central abscissa, and the previous stroke of the first stroke belongs to the second text, determining that the first stroke belongs to the second text; or when the distance between the first average abscissa and the first central abscissa is less than the distance between the first average abscissa and the second central abscissa, and the previous stroke of the first stroke does not belong to the second text, determining that the first stroke belongs to the first text.
[0011] In combination with the first aspect, in some implementations of the first aspect, the first character and the second character are arranged horizontally, with the first character on the left side of the second character. The horizontal length of the first rectangle and / or the second rectangle is greater than a first threshold. The one or more strokes include a first stroke. Determining the coordinates of the first rectangle, the second rectangle, and the one or more strokes according to the positional relationship between the first character and the second character includes: determining the abscissa of the right border of the first rectangle, the abscissa of the left border of the second rectangle, and the first average abscissa of the first stroke.
[0012] In combination with the first aspect, in some implementations of the first aspect, determining the attribution of the one or more strokes according to the distance relationship between the coordinates of the first rectangle, the second rectangle, and the one or more strokes and the writing order of the strokes of the first character and the second character includes: when the distance between the first average abscissa and the abscissa of the right border of the first rectangle is greater than the distance between the first average abscissa and the abscissa of the left border of the second rectangle, determining that the first stroke belongs to the second character; or when the distance between the first average abscissa and the abscissa of the right border of the first rectangle is less than the distance between the first average abscissa and the abscissa of the left border of the second rectangle, and the previous stroke of the first stroke belongs to the second character, determining that the first stroke belongs to the second character; or when the distance between the first average abscissa and the abscissa of the right border of the first rectangle is less than the distance between the first average abscissa and the abscissa of the left border of the second rectangle, and the previous stroke of the first stroke does not belong to the second character, determining that the first stroke belongs to the first character.
[0013] In combination with the first aspect, in some implementations of the first aspect, the first character and the second character are arranged vertically, with the first character on the upper side of the second character. The one or more strokes include a first stroke. Determining the coordinates of the first rectangle, the second rectangle, and the one or more strokes according to the positional relationship between the first character and the second character includes: determining the first central ordinate of the first rectangle, the second central ordinate of the second rectangle, and the first average ordinate of the first stroke.
[0014] In combination with the first aspect, in some implementations of the first aspect, determining the attribution of the one or more strokes according to the distance relationship between the coordinates of the first rectangular box, the second rectangular box, and the one or more strokes, and the writing order of the strokes of the first text and the second text includes: when the distance between the first average ordinate and the first central ordinate is greater than the distance between the first average ordinate and the second central ordinate, determining that the first stroke belongs to the second text; or when the distance between the first average ordinate and the first central ordinate is less than the distance between the first average ordinate and the second central ordinate, and the previous stroke of the first stroke belongs to the second text, determining that the first stroke belongs to the second text; or when the distance between the first average ordinate and the first central ordinate is less than the distance between the first average ordinate and the second central ordinate, and the previous stroke of the first stroke does not belong to the second text, determining that the first stroke belongs to the first text.
[0015] In combination with the first aspect, in some implementations of the first aspect, the first text and the second text are diagonally distributed, the first text is located below or above the left of the second text, the one or more strokes include a first stroke, and determining the coordinates of the first rectangular box, the second rectangular box, and the one or more strokes according to the positional relationship between the first text and the second text includes: determining the first central coordinate of the first rectangular box, the second central coordinate of the second rectangular box, and the first average coordinate of the first stroke.
[0016] In combination with the first aspect, in some implementations of the first aspect, determining the attribution of the one or more strokes according to the distance relationship between the coordinates of the first rectangular box, the second rectangular box, and the one or more strokes, and the writing order of the strokes of the first text and the second text includes: when the distance between the first average coordinate and the first central coordinate is greater than the distance between the first average coordinate and the second central coordinate, determining that the first stroke belongs to the second text; or when the distance between the first average coordinate and the first central coordinate is less than the distance between the first average coordinate and the second central coordinate, and the previous stroke of the first stroke belongs to the second text, determining that the first stroke belongs to the second text; or when the distance between the first average coordinate and the first central coordinate is less than the distance between the first average coordinate and the second central coordinate, and the previous stroke of the first stroke does not belong to the second text, determining that the first stroke belongs to the first text.
[0017] In combination with the first aspect, in certain implementations of the first aspect, the first content includes one or more patterns, and the method further includes: identifying N strokes corresponding to the one or more patterns, where N≥2 and N is an integer; and grouping the N strokes according to the positional relationship and writing order of the multiple strokes, including: dividing the N strokes into M stroke groups according to the positional relationship between the N strokes, where the distance between the strokes in any two of the M stroke groups is greater than a second threshold, N≥M≥1 and M is an integer.
[0018] In the embodiments of the present application, the electronic device can divide the strokes of a pattern into different stroke groups according to the distance relationship between the pattern strokes, so that when the user selects a pattern, the complete pattern can be quickly selected.
[0019] In combination with the first aspect, in certain implementations of the first aspect, the method further includes: dividing the first stroke group into Q stroke groups according to the writing intervals of P strokes, where the M stroke groups include the first stroke group, the first stroke group includes the P strokes, and the writing interval between two adjacent stroke groups in the Q stroke groups is greater than a third threshold, Q≥1 and Q is an integer.
[0020] In the embodiments of the present application, the electronic device can first group the strokes of a pattern according to the distance relationship between the strokes, so that the strokes with a relatively close distance can belong to the same stroke group, and then can divide a stroke group into multiple new stroke groups according to the writing intervals of the strokes in a stroke group, refining the granularity of the grouping and avoiding the problem of multiple selection of strokes when the user selects a pattern.
[0021] In combination with the first aspect, in certain implementations of the first aspect, the method further includes: aggregating the Q stroke groups into W stroke groups according to the writing intervals of the Q stroke groups and the distance relationship between the Q stroke groups, where the writing interval between two adjacent stroke groups in the multiple stroke groups aggregated into the same stroke group in the Q stroke groups is less than or equal to a fourth threshold and the distance is less than or equal to a fifth threshold, Q≥W≥1 and P is an integer.
[0022] In the embodiments of the present application, the electronic device can first group the strokes of a pattern according to the distance relationship between the strokes, so that the strokes with a relatively close distance can belong to the same stroke group, and then can divide a stroke group into multiple new stroke groups according to the writing intervals of the strokes in a stroke group, and then aggregate the stroke groups according to the writing intervals and distance relationships between the stroke groups, avoiding the problem of missed selection of strokes when the user selects a pattern.
[0023] In combination with the first aspect, in some implementations of the first aspect, the distance between any two stroke groups among the Q stroke groups is greater than a sixth threshold, and the sixth threshold is less than the second threshold.
[0024] In combination with the first aspect, in some implementations of the first aspect, the writing interval is the time interval corresponding to two adjacent strokes in the writing order.
[0025] In combination with the first aspect, in some implementations of the first aspect, the method further includes: identifying fields and / or patterns in the first content, and grouping the multiple strokes according to the positional relationship and the writing order of the multiple strokes, including: dividing the first content into one or more region blocks according to the positional relationship and the writing order of the field and / or the pattern; and obtaining one or more columns by column-dividing the first content according to the positional relationship of the one or more region blocks.
[0026] In the embodiments of the present application, the electronic device can divide the content into one or more region blocks, and the strokes of the fields and / or patterns in each region block satisfy the writing order from left to right and from top to bottom. Then, the content is column-divided according to the positional relationship between the region blocks, which improves the success rate of column division and ensures that the user can select the content column by column in the manner from left to right and from top to bottom.
[0027] In combination with the first aspect, in some implementations of the first aspect, the method further includes: sorting the region blocks in the first column according to the positional relationship between the region blocks in the first column. Among them, the one or more classifications include the first column.
[0028] In combination with the first aspect, in some implementations of the first aspect, the method further includes: sorting the fields and / or patterns in the first region block according to the positional relationship of the fields and / or patterns in the first region block. Among them, the one or more region blocks include the first region block.
[0029] In combination with the first aspect, in some implementations of the first aspect, the fields and / or patterns in the first region block satisfy the order from top to bottom and / or from left to right.
[0030] In a second aspect, a method for recognizing handwritten strokes is provided. The method includes: displaying a first content, where the first content includes a first text and a second text; when there is a first overlapping region between a first rectangular frame corresponding to the first text and a second rectangular frame corresponding to the second text, determining the attribution of one or more strokes according to the writing order of the strokes of the first text and the second text and the positional relationship between one or more strokes in the first overlapping region and the first rectangular frame and the second rectangular frame.
[0031] In a third aspect, a method for recognizing handwritten strokes is provided. The method includes: recognizing N strokes corresponding to one or more patterns in a first content; dividing the N strokes into M stroke groups according to the distance relationships among the N strokes; dividing the M stroke groups into Q stroke groups according to the writing intervals of the N strokes; and aggregating the Q stroke groups into P stroke groups according to the writing intervals and distance relationships of the Q stroke groups.
[0032] In a fourth aspect, a method for recognizing handwritten strokes is provided. The method includes: recognizing fields and / or patterns in a first stroke content; dividing the first stroke content into multiple region blocks according to the positional relationships and writing orders of the fields and / or patterns; and performing column division on the first stroke content according to the positional relationships of the multiple region blocks.
[0033] In a fifth aspect, an electronic device is provided. The electronic device includes one or more processors; one or more memories; and the one or more memories store one or more computer programs, and the one or more computer programs include instructions that, when executed by the one or more processors, cause the above aspects or any possible implementation manner of the above aspects to be executed.
[0034] In a sixth aspect, a computer-readable storage medium is provided. The computer-readable storage medium includes a computer program or instructions that, when running on a computer, cause the first aspect and any possible implementation method of the first aspect to be executed.
[0035] In a seventh aspect, a computer program product is provided. The computer program product includes a computer program or instructions that, when running on a computer, cause the first aspect and any possible implementation method of the first aspect to be executed.
[0036] In an eighth aspect, a computer program is provided. When it runs on a computer, it causes the method in the first aspect and any possible implementation manner thereof to be executed.
[0037] In a ninth aspect, an electronic device according to an embodiment of the present application is provided. The electronic device includes modules / units for executing the methods of the above aspects or any possible design of the above aspects; these modules / units can be implemented by hardware or by hardware executing corresponding software.
[0038] Among them, for the beneficial effects of the second aspect to the ninth aspect, please refer to the beneficial effects of the first aspect, and no repeated description will be given. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 is a schematic structural diagram of the electronic device provided by an embodiment of the present application.
[0040] Figure 2 It is a software structure block diagram of the electronic device provided by the embodiment of the present application.
[0041] Figure 3 It is a group of GUIs provided by the embodiment of the present application.
[0042] Figure 4 It is a schematic flowchart of a method for recognizing handwritten strokes provided by the embodiment of the present application.
[0043] Figure 5 It is a group of GUIs provided by the embodiment of the present application.
[0044] Figure 6 It is a schematic flowchart of a method for recognizing handwritten strokes provided by the embodiment of the present application.
[0045] Figure 7 It is a schematic diagram of the positional relationship of adjacent characters provided by the embodiment of the present application.
[0046] Figure 8 It is a schematic diagram for determining stroke coordinates provided by the embodiment of the present application.
[0047] Figure 9 It is a schematic flowchart of a method for recognizing handwritten strokes provided by the embodiment of the present application.
[0048] Figure 10 It is a group of GUIs provided by the embodiment of the present application.
[0049] Figure 11 It is a schematic flowchart of a method for recognizing handwritten strokes provided by the embodiment of the present application.
[0050] Figure 12 It is a group of GUIs provided by the embodiment of the present application.
[0051] Figure 13 It is a schematic flowchart of a method for recognizing handwritten strokes provided by the embodiment of the present application.
[0052] Figure 14 It is a group of GUIs provided by the embodiment of the present application.
[0053] Figure 15 It is a schematic flowchart of a method for dividing stroke groups provided by the embodiment of the present application.
[0054] Figure 16 It is a schematic diagram of stroke groups provided by the embodiment of the present application.
[0055] Figure 17 It is a schematic flowchart of a method for dividing stroke groups provided by the embodiment of the present application.
[0056] Figure 18 It is a schematic flowchart of a method for dividing stroke groups provided by an embodiment of the present application.
[0057] Figure 19 It is a schematic diagram of dividing stroke groups provided by an embodiment of the present application.
[0058] Figure 20 It is a schematic flowchart of a method for aggregating stroke groups provided by an embodiment of the present application.
[0059] Figure 21 It is a schematic diagram of aggregating stroke groups provided by an embodiment of the present application.
[0060] Figure 22 It is a schematic diagram of dividing content into columns provided by an embodiment of the present application.
[0061] Figure 23 It is a schematic flowchart of a method for dividing region blocks provided by an embodiment of the present application.
[0062] Figure 24 It is a schematic diagram of the positional relationship between fields and / or patterns provided by an embodiment of the present application.
[0063] Figure 25 It is a schematic flowchart of a method for dividing content into columns according to the positional relationship of region blocks provided by an embodiment of the present application.
[0064] Figure 26 It is a schematic flowchart of a method for recognizing handwritten strokes provided by an embodiment of the present application.
[0065] Figure 27 It is a schematic flowchart of a method for recognizing handwritten strokes provided by an embodiment of the present application.
[0066] Figure 28 It is a schematic flowchart of a method for recognizing handwritten strokes provided by an embodiment of the present application.
[0067] Figure 29 It is a schematic diagram of the composition of an electronic device provided by an embodiment of the present application. Detailed implementation manners
[0068] Next, the technical solutions in the embodiments of the present application will be described in conjunction with the accompanying drawings.
[0069] The terms used in the following embodiments are only for the purpose of describing specific embodiments and are not intended to limit the present application. As used in the specification and appended claims of the present application, the singular forms "a", "an", "the", "above-mentioned", "said", "this" are also intended to include forms such as "one or more", unless the context clearly indicates otherwise. It should also be understood that in the following embodiments of the present application, "at least one", "one or more" means one, two or more than two. The term "and / or" is used to describe the relationship between associated objects and indicates that three relationships can exist; for example, A and / or B can mean: A exists alone, A and B exist simultaneously, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the associated objects before and after are in an "or" relationship.
[0070] References in this specification to "one embodiment" or "some embodiments" or the like mean that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the present application. Thus, the phrases "in one embodiment", "in some embodiments", "in other some embodiments", "in still other embodiments", etc. that appear in different places in this specification are not necessarily all referring to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in another way. The terms "comprising", "including", "having" and their variants all mean "including but not limited to", unless otherwise specifically emphasized in another way.
[0071] Embodiments of an electronic device, a user interface for such an electronic device, and for using such an electronic device are described below. In some embodiments, the electronic device may be a portable electronic device that also includes other functions such as a personal digital assistant and / or music player functions, such as a mobile phone, a tablet computer, a wearable electronic device with wireless communication functions (such as a smart watch), etc. Exemplary embodiments of the portable electronic device include, but are not limited to, those equipped with or other operating systems. The above-mentioned portable electronic device may also be other portable electronic devices, such as a laptop computer. It should also be understood that in other some embodiments, the above-mentioned electronic device may not be a portable electronic device, but a desktop computer.
[0072] Exemplarily, Figure 1The structural schematic diagram of the electronic device 100 is shown. The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone interface 170D, a sensor module 180, a key 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. Among them, the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0073] It can be understood that the structure schematically shown in the embodiments of this application does not constitute a specific limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may include more or fewer components than those shown in the figure, or combine certain components, or split certain components, or have different component arrangements. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0074] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units may be independent devices or integrated in one or more processors.
[0075] Among them, the controller may be the nerve center and command center of the electronic device 100. The controller may generate operation control signals according to the instruction operation code and timing signals to complete the control of fetching instructions and executing instructions.
[0076] A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory may hold the instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to use the instruction or data again, it can directly call it from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0077] In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0078] The wireless communication function of the electronic device 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modulation and demodulation processor, and the baseband processor, etc.
[0079] The antenna 1 and the antenna 2 are used for transmitting and receiving electromagnetic wave signals. Each antenna in the electronic device 100 can be used to cover a single or multiple communication bands. Different antennas can also be multiplexed to improve the utilization rate of the antennas. For example: the antenna 1 can be multiplexed as the diversity antenna of the wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0080] The mobile communication module 150 may provide solutions for wireless communications such as 2G / 3G / 4G / 5G applied to the electronic device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 may receive electromagnetic waves through the antenna 1, filter and amplify the received electromagnetic waves, and then transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 may also amplify the signal modulated by the modulation and demodulation processor and convert it into electromagnetic waves through the antenna 1 for radiation. In some embodiments, at least some functional modules of the mobile communication module 150 may be provided in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 may be provided in the same device.
[0081] The modulation and demodulation processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. Subsequently, the demodulator transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After being processed by the baseband processor, the low-frequency baseband signal is transmitted to the application processor. The application processor outputs a sound signal through an audio device (not limited to the speaker 170A, receiver 170B, etc.), or displays an image or video through the display screen 194. In some embodiments, the modulation and demodulation processor may be an independent device. In other embodiments, the modulation and demodulation processor may be independent of the processor 110 and provided in the same device as the mobile communication module 150 or other functional modules.
[0082] The wireless communication module 160 may provide solutions for wireless communications applied to the electronic device 100, including wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite systems (GNSSs), frequency modulation (FM), near field communication (NFC), infrared (IR), etc. The wireless communication module 160 may be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, performs frequency modulation and filtering processing on the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 may also receive signals to be sent from the processor 110, perform frequency modulation and amplification on them, and convert them into electromagnetic waves through the antenna 2 for radiation.
[0083] In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, such that electronic device 100 can communicate with a network and other devices through wireless communication technologies. The wireless communication technologies may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-CDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology, etc. The GNSS may include global positioning system (GPS), global navigation satellite system (GLONASS), beidou navigation satellite system (BDS), quasi-zenith satellite system (QZSS), and / or satellite based augmentation systems (SBAS).
[0084] Electronic device 100 implements a display function through a GPU, display screen 194, and an application processor, etc. The GPU is a microprocessor for image processing, and is connected to display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or change display information.
[0085] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a Miniled, a MicroLed, a Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include one or N display screens 194, where N is a positive integer greater than 1.
[0086] The electronic device 100 can implement the shooting function through the ISP, the camera 193, the video codec, the GPU, the display screen 194, and the application processor, etc.
[0087] The ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, and the light passes through the lens and is transmitted to the camera sensor. The optical signal is converted into an electrical signal, and the camera sensor transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye. The ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. The ISP can also optimize parameters such as the exposure and color temperature of the shooting scene. In some embodiments, the ISP can be set in the camera 193.
[0088] The camera 193 is used to capture static images or videos. An object generates an optical image through the lens and projects it onto the sensor. The sensor can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The sensor converts the optical signal into an electrical signal, and then transmits the electrical signal to the ISP to convert it into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV, etc. format. In some embodiments, the electronic device 100 may include one or N cameras 193, where N is a positive integer greater than 1.
[0089] The digital signal processor is used to process digital signals. In addition to processing digital image signals, it can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy, etc.
[0090] The video codec is used to compress or decompress digital videos. The electronic device 100 can support one or more video codecs. In this way, the electronic device 100 can play or record videos in multiple encoding formats, such as: Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
[0091] The NPU is a neural-network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission pattern between human brain neurons, it can quickly process input information and can also continuously self-learn. Through the NPU, applications such as intelligent cognition of the electronic device 100 can be realized, such as: image recognition, face recognition, speech recognition, text understanding, etc.
[0092] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement the data storage function. For example, files such as music and videos are saved in the external memory card.
[0093] The internal memory 121 can be used to store computer-executable program code, and the executable program code includes instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 can include a program storage area and a data storage area. Among them, the program storage area can store the operating system, application programs required for at least one function (such as the sound playback function, image playback function, etc.). The data storage area can store the data created during the use of the electronic device 100 (such as audio data, phone book, etc.). In addition, the internal memory 121 can include high-speed random access memory and can also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.
[0094] The electronic device 100 can implement audio functions through the audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, and the application processor, etc. Such as music playback, recording, etc.
[0095] The audio module 170 is used to convert digital audio information into an analog audio signal for output, and is also used to convert an analog audio input into a digital audio signal. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be disposed in the processor 110, or some functional modules of the audio module 170 can be disposed in the processor 110.
[0096] The speaker 170A, also known as the "loudspeaker", is used to convert an audio electrical signal into a sound signal. The electronic device 100 can listen to music or hands-free calls through the speaker 170A.
[0097] The receiver 170B, also known as the "earpiece", is used to convert an audio electrical signal into a sound signal. When the electronic device 100 answers a call or a voice message, the voice can be listened to by holding the receiver 170B close to the ear.
[0098] The microphone 170C, also known as the "microphone" or "transmitter", is used to convert a sound signal into an electrical signal. When making a call or sending a voice message, the user can speak with the mouth close to the microphone 170C to input the sound signal into the microphone 170C. The electronic device 100 can be provided with at least one microphone 170C. In some other embodiments, the electronic device 100 can be provided with two microphones 170C, which can not only collect sound signals but also implement a noise reduction function. In some other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C, which can collect sound signals, reduce noise, identify the sound source, and implement functions such as directional recording.
[0099] The pressure sensor 180A is used to sense a pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be disposed on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. The capacitive pressure sensor can include at least two parallel plates with conductive materials. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure according to the change in capacitance. When a touch operation acts on the display screen 194, the electronic device 100 detects the intensity of the touch operation according to the pressure sensor 180A. The electronic device 100 can also calculate the position of the touch according to the detection signal of the pressure sensor 180A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities can correspond to different operation instructions. For example, when a touch operation with a touch operation intensity greater than or equal to a first pressure threshold acts on the alarm application icon, the instruction to create a new alarm is executed.
[0100] The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to implement fingerprint unlocking, access to application locks, fingerprint photography, fingerprint answering of incoming calls, etc. For example, when the mobile phone detects a touch operation of the user on the lock screen interface, the mobile phone can collect the fingerprint information of the user through the fingerprint sensor 180H, and match the collected fingerprint information with the fingerprint information preset in the mobile phone. If the match is successful, the mobile phone can enter the non-lock screen interface from the lock screen interface.
[0101] The touch sensor 180K, also known as the "touch panel". The touch sensor 180K can be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also known as a "touch screen". The touch sensor 180K is used to detect touch operations acting thereon or nearby. The touch sensor can transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In some other embodiments, the touch sensor 180K can also be disposed on the surface of the electronic device 100, at a different position from the display screen 194.
[0102] Figure 2 It is a software structure block diagram of the electronic device 100 according to an embodiment of the present application. The layered architecture divides the software into several layers, and each layer has a clear role and division of labor. Communication between layers is through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom are the application layer, the application framework layer, the Android runtime, and the system library, and the kernel layer. The application layer can include a series of application packages.
[0103] Such as Figure 2 shown, the application layer can include a camera, settings, third-party applications, etc. Among them, the third-party applications can include a gallery, a calendar, a call, a map, a navigation, a WLAN, a Bluetooth, music, a video, a short message, etc.
[0104] The application framework layer provides application programming interfaces (APIs) and programming frameworks for the applications in the application layer. The application framework layer can include some predefined functions.
[0105] Such as Figure 2 shown, the application framework layer can include a window manager, a content provider, a view system, a telephone manager, a resource manager, a notification manager, etc.
[0106] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc. The content provider is used to store and obtain data, and make this data accessible to application programs. The data may include videos, images, audio, incoming and outgoing calls, browsing history and bookmarks, phone books, etc.
[0107] The view system includes visual controls, such as controls for displaying text, controls for displaying pictures, etc., such as the indication information for prompting the virtual shutter key in the embodiments of the present application. The view system can be used to build application programs. The display interface can be composed of one or more views. For example, a display interface including a short message notification icon may include a view for displaying text and a view for displaying pictures.
[0108] The phone manager is used to provide the communication function of the electronic device 100. For example, the management of call states (including answering, hanging up, etc.).
[0109] The resource manager provides various resources for application programs, such as localized strings, icons, pictures, layout files, video files, etc.
[0110] The notification manager enables application programs to display notification information in the status bar. It can be used to convey notification-type messages, which can automatically disappear after a short stay without user interaction. For example, the notification manager is used to notify the completion of a download, message reminder, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as the notification of a background-running application program, and can also be a notification that appears on the screen in the form of a dialogue window. For example, prompting text information in the status bar, emitting a prompt tone, vibrating the electronic device, flashing the indicator light, etc.
[0111] Android runtime includes a core library and a virtual machine. Android runtime is responsible for the scheduling and management of the Android system.
[0112] The core library consists of two parts: one part is the functional functions that need to be called by the Java language, and the other part is the core library of Android.
[0113] The application layer and the application framework layer run in the virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.
[0114] The system library may include multiple functional modules. For example: a surface manager, media libraries, a 3D graphics processing library (such as OpenGL ES), a 2D graphics engine (such as SGL), etc.
[0115] The surface manager is used to manage the display subsystem and provides the fusion of 2D and 3D layers for multiple applications.
[0116] The media libraries support the playback and recording of multiple common audio and video formats, as well as static image files, etc. The media libraries can support multiple audio and video coding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
[0117] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis, and layer processing, etc.
[0118] The 2D graphics engine is a drawing engine for 2D drawing.
[0119] In addition, the system library may also include a status monitoring service module, etc., such as a physical state recognition module for analyzing and recognizing user gestures; a sensor service module for monitoring sensor data uploaded by various sensors in the hardware layer to determine the physical state of the electronic device 100.
[0120] The kernel layer is the layer between the hardware and the software. The kernel layer at least includes a display driver, a camera driver, an audio driver, and a sensor driver.
[0121] The hardware layer may include various sensors, such as Figure 1 the various sensors introduced in, the acceleration sensor, the gyroscope sensor, the touch sensor, etc. involved in the embodiments of the present application.
[0122] It should be noted that Figure 2 only one way of dividing the system framework is taken as an example, and it should not be understood as a specific limitation on the embodiments of the present application. In the embodiments of the present application, when the operating systems carried by the electronic devices are different, for different operating systems, there may be different frameworks. It can be understood that when different frameworks are adopted, the division methods of each layer of the framework, the specific naming, and which layer the above-mentioned various modules are specifically located in may be different.
[0123] With the progress of technology, more and more users will use electronic devices to handwrite records in scenarios such as meetings and classes. Taking note-taking as an example, when users take notes, they often need to select note content for operations such as deletion, movement, and copying, where the note content may include text and patterns. Currently, when users select note content, there are many problems. The following is combined withFigure 3 Provide explanation.
[0124] Figure 3 A set of graphical user interfaces (GUIs) are shown.
[0125] like Figure 3 As shown in (a) and (b) in the figure, the content of the note displayed by the electronic device is: "Huawei Notes", in which the two characters "笔" and "记" are close to each other. When the electronic device detects that the user selects the operation of "笔", because the two characters "笔" and "记" are close to each other, the electronic device will also select the radical "讠" of "记" when selecting "笔", that is, the following is displayed: Figure 3 GUI shown in (b) in .
[0126] like Figure 3 As shown in (c) and (d) in the figure, the note content displayed by the electronic device is: "Inspiration Collection", in which the strokes of the two characters "灵" and "感" overlap. When the electronic device detects that the user selects "灵", due to the overlap of the strokes of the two characters "灵" and "感", the electronic device may not be able to select "灵" alone, but will directly select the two characters "灵" and "感", that is, the display is as follows Figure 3 GUI shown in (d).
[0127] like Figure 3 As shown in (e) and (f) of FIG. 1 , the note content displayed by the electronic device is a pattern. When the electronic device detects that the user selects the pattern and moves the pattern, the electronic device may miss the strokes originally belonging to the pattern, that is, displaying the following Figure 3 GUI shown in (f) in .
[0128] like Figure 3 As shown in (g) and (h) in FIG. 1 , the note content displayed by the electronic device includes two columns of text. In this case, the electronic device may not be able to recognize that the note content includes two columns of text. Therefore, in this case, the user cannot select only one column of text, and can only select the text in the note content line by line. That is, the electronic device can display the following Figure 3 GUI shown in (h).
[0129] In summary, when users select note content, there are problems such as the following: 1. When the distance between two characters is relatively close or there are stroke intersections, it may not be possible to select characters one by one; 2. When selecting a pattern, there may be overselection or underselection of strokes; 3. When users record notes in a columnar format, the columnar format may not be correctly recognized, resulting in a disorder in the selection order when selecting note content. Based on this, the embodiments of the present application provide an analysis method for handwritten notes, which can quickly and accurately analyze notes so that users can accurately select the desired note content.
[0130] Figure 4 FIG. shows a schematic flowchart of a method for recognizing handwritten strokes provided by an embodiment of the present application. This method can be executed by an electronic device or by components of an electronic device (such as a processor, a chip system, etc.). In the following, an example will be given with the execution entity being an electronic device, as Figure 4 shown, the method includes:
[0131] S410, display content #1.
[0132] Among them, the content #1 may include text. In the embodiments of the present application, the text type in the content #1 is not specifically limited. For example, the text type in the content #1 includes but is not limited to Chinese, English, etc.
[0133] In some embodiments, the content #1 may be the content corresponding to the note being recorded by the user.
[0134] In some embodiments, the content #1 may be the content corresponding to the note that has been stored.
[0135] In some embodiments, the content #1 may be the content sent by other electronic devices.
[0136] S420, recognize the text included in the content #1.
[0137] The electronic device can recognize the text in the content #1 through technologies such as optical character recognition (OCR).
[0138] In some embodiments, the content #1 includes text #1 and text #2, and text #1 and text #2 are adjacent. The distance between the text #1 and text #2 is less than or equal to a threshold #1, or there is a stroke intersection between the text #1 and text #2.
[0139] It should be noted that when there is a stroke intersection between the text #1 and text #2, the distance between the text #1 and text #2 is 0. Therefore, it can also be understood that the distance between the text #1 and text #2 is less than the threshold #1.
[0140] For example, Figure 5 shows a set of GUIs provided by an embodiment of the present application, and the content #1 displayed on the electronic device is as Figure 5 shown in (a) of. The electronic device can recognize that the content #1 includes two characters, namely "ling" and "gan".
[0141] S430. Determine the overlapping area #1 according to the rectangular frame #1 corresponding to the character #1 and the rectangular frame #2 corresponding to the character #2.
[0142] When the electronic device recognizes the characters in the content #1, it can use rectangular frames to enclose the recognized characters. If the distance between two adjacent characters is relatively close or there are overlapping strokes, there will be an overlapping area between the rectangular frames corresponding to the two adjacent characters. Therefore, the electronic device can determine the overlapping area #1 according to the rectangular frame #1 corresponding to the character #1 and the rectangular frame #2 corresponding to the character #2. In other words, each character in the content #1 can correspond to a rectangular frame, and the rectangular frames of adjacent characters may overlap. For example, as Figure 5 shown in (a) of, there are overlapping strokes between "ling" and "gan", so there is an overlapping area between the rectangular frames corresponding to "ling" and "gan".
[0143] In some embodiments, the overlapping area #1 includes one or more strokes. The one or more strokes can be complete strokes or parts of a stroke.
[0144] It can be understood that for the non-overlapping area, the strokes included in the non-overlapping area belong to the character corresponding to the non-overlapping area. For the overlapping area, the electronic device needs to determine the attribution of the strokes included in the overlapping area, which will be introduced in detail below.
[0145] S440. Determine the strokes in the character and the writing order of the strokes.
[0146] The electronic device records the sequence of trajectory points of the strokes in the content. The sequence of trajectory points includes the information of the start point of the trajectory, the information of the end point of the trajectory and the writing order. Therefore, the electronic device can determine the trajectory points and the writing order of each stroke in the character according to the sequence of trajectory points, that is, determine each stroke and the writing order of the stroke.
[0147] In some embodiments, the electronic device can determine the trajectory points and the writing order of the strokes of all the characters in the content #1.
[0148] For example, the electronic device can determine the trajectory points and the writing order of each stroke in "ling" and "gan".
[0149] In some embodiments, the electronic device can determine the trajectory points and the writing order of the strokes corresponding to the overlapping area.
[0150] For example, asFigure 5 As shown in (a) in
[0151] It should be noted that, in some embodiments, the strokes in the overlapping region may be a part of a stroke. The electronic device determining the trajectory points and writing order of the strokes corresponding to the overlapping region can be understood as the electronic device determining the trajectory points and writing order of the complete strokes corresponding to the strokes in the overlapping region.
[0152] For example, as Figure 5 shown in (a) in
[0153] S450. Determine the attribution of one or more strokes in the overlapping region according to the writing order of the strokes of text #1 and text #2 and the positional relationship between one or more strokes in the overlapping region and rectangle frame #1 and rectangle frame #2.
[0154] It can be understood that the strokes in the overlapping region that belong to text #1 should be closer to rectangle frame #1. Similarly, the strokes in the overlapping region that belong to text #2 should be closer to rectangle frame #2.
[0155] It can also be understood that, in some scenarios, due to the user's writing, the strokes in the overlapping region that belong to text #2 may also be closer to rectangle frame #1. In such a scenario, it can also be determined whether the previous stroke of this stroke has a previous stroke. When the previous stroke belongs to text #2, it indicates that this stroke also belongs to text #2.
[0156] In summary, the electronic device can determine the attribution of one or more strokes in the overlapping region according to the writing order of the strokes of text #1 and text #2 and the positional relationship between one or more strokes in the overlapping region and rectangle frame #1 and rectangle frame #2.
[0157] In some embodiments, text #1 and text #2 are distributed left and right, with text #1 on the left of text #2. One or more strokes in this overlapping region include stroke #1. As Figure 6 shown, S450. Determining the attribution of one or more strokes in the overlapping region according to the writing order of the strokes of text #1 and text #2 and the positional relationship between one or more strokes in the overlapping region and rectangle frame #1 and rectangle frame #2 includes:
[0158] S451. Determine the central abscissa #1 of rectangle frame #1 and the central abscissa #2 of rectangle frame #2.
[0159] After the electronic device recognizes text #1 and text #2, it can use rectangle box #1 and rectangle box #2 to enclose text #1 and text #2 respectively. On the basis of determining rectangle box #1 and rectangle box #2, the center abscissa #1 of rectangle box #1 and the center abscissa #2 of rectangle box #2 can be further determined. The center abscissa #1 of rectangle box #1 can be understood as the abscissa corresponding to the center point of rectangle box #1, denoted as x1. The center abscissa #2 of rectangle box #2 can be understood as the abscissa corresponding to the center point of rectangle box #2, denoted as x2.
[0160] In the embodiments of the present application, the positional relationship between two adjacent texts includes left - right distribution, up - down distribution, and diagonal distribution. For example, Figure 7 as shown in (a) of Figure 7 , when the central angle of the rectangle boxes corresponding to two adjacent texts is less than angle threshold #1 (for example, angle threshold #1 is 30°), the two texts are in left - right distribution. As Figure 7 shown in (b) of
[0161] S452, determine the average abscissa #1 of stroke #1.
[0162] When the electronic device determines that stroke #1 is a stroke in the overlapping area, it can determine the average abscissa #1 of stroke #1. The average abscissa #1 of stroke #1 can be understood as the abscissa corresponding to the center of gravity of stroke #1.
[0163] In the embodiments of the present application, the method for determining the average abscissa #1 of stroke #1 is not specifically limited. Here, an exemplary possible implementation method is introduced below.
[0164] A possible implementation method is that the electronic device can rasterize stroke #1 into an image, and the electronic device can determine the center of gravity of this image as the center of gravity of stroke #1, denoted as x. The following is introduced in combination with Figure 8 this.
[0165] For example, Figure 8 as shown, the electronic device can initialize a vertical projection array h that is all 0 within the range of the maximum abscissa of stroke #1. The electronic device traverses all points of stroke #1, calculates the range of the abscissa spanned by any two points, and adds 1 to the elements in the corresponding array between these two points. If the abscissas of these two points are the same, then add the difference in their ordinates. Figure 8Taking p0 and p1 as examples, the abscissa range is x0 and x1, and the values of h[x0] to h[x1] corresponding in the array are all incremented by 1. If x0 = x1, the absolute value of y0 - y1 is added to h[x0] in the array. By the above method, the values of the elements in the array h can be determined, and then the abscissa of stroke #1 can be determined according to formula (1).
[0166]
[0167] where x is the abscissa of stroke #1, i is the abscissa of the i-th element in the array h, and h i is the value of the i-th element in the array h.
[0168] S453, whether the distance between the average abscissa #1 and the central abscissa #1 is greater than the distance between the average abscissa #1 and the central abscissa #2.
[0169] The electronic device can determine the distance between the average abscissa #1 and the central abscissa #1 and the distance between the average abscissa #1 and the central abscissa #2. When it is determined that the distance between the average abscissa #1 and the central abscissa #1 is greater than the distance between the average abscissa #1 and the central abscissa #2, step S454 can be executed. When it is determined that the distance between the average abscissa #1 and the central abscissa #1 is less than the distance between the average abscissa #1 and the central abscissa #2, step S455 can be executed.
[0170] In the embodiments of the present application, the parameters characterizing the distances between the average abscissa #1 and the central abscissa #1 and the central abscissa #2 are not specifically limited, and any parameter capable of characterizing the gap can be used to characterize the distances between the average abscissa #1 and the central abscissa #1 and the central abscissa #2.
[0171] For example, the distance between the average abscissa #1 and the central abscissa #1 is x - x1, and the distance between the average abscissa #1 and the central abscissa #2 is x2 - x.
[0172] For another example, the distance between the average abscissa #1 and the central abscissa #1 is (x - x1) 2 , and the distance between the average abscissa #1 and the central abscissa #2 is (x2 - x) 2 .
[0173] For another example, the distance between the average abscissa #1 and the central abscissa #1 is |x1 - x|, and the distance between the average abscissa #1 and the central abscissa #2 is |x2 - x|.
[0174] S454, determine that stroke #1 belongs to character #2.
[0175] When the distance between the average abscissa #1 and the central abscissa #1 is greater than the distance between the average abscissa #1 and the central abscissa #2, it indicates that the stroke #1 is closer to the rectangle #2. As described above, the strokes belonging to the text #2 in the overlapping area should be closer to the rectangle #2. Therefore, it can be determined that the stroke #1 belongs to the text #2.
[0176] S455, whether the previous stroke of the stroke #1 belongs to the text #2.
[0177] As described above, the strokes belonging to the text #2 in the overlapping area may also be closer to the rectangle #1. In this scenario, it is also possible to determine whether the previous stroke of the stroke #1 belongs to the text #2. When it is determined that the previous stroke of the stroke #1 belongs to the text #2, step S454 can be executed. When it is determined that the previous stroke of the stroke #1 does not belong to the text #2, step S456 can be executed.
[0178] S456, determine that the stroke #1 belongs to the text #1.
[0179] When the distance between the average abscissa #1 and the central abscissa #1 is less than the distance between the average abscissa #1 and the central abscissa #2, it indicates that the stroke #1 is closer to the rectangle #1, and the previous stroke of the stroke #1 does not belong to the text #2. Therefore, it can be determined that the stroke #1 belongs to the text #1.
[0180] For example, as Figure 5 shown in (b), the electronic device can determine the central abscissa #1 of the rectangle #1 corresponding to "ling", and determine the central abscissa #2 of the rectangle #2 corresponding to "gan". The rectangle #1 and the rectangle #2 have an overlapping area, and the overlapping area includes stroke 1, stroke 2, and stroke 3. The electronic device can respectively determine the average abscissa corresponding to stroke 1, the average abscissa corresponding to stroke 2, and the average abscissa corresponding to stroke 3. The distance between the average abscissa corresponding to stroke 1 and the central abscissa #1 is less than the distance to the central abscissa #2, and the previous stroke of stroke 1 does not belong to "gan", then the electronic device can determine that stroke 1 belongs to "ling". The distance between the average abscissa corresponding to stroke 2 and the central abscissa #1 is greater than the distance to the central abscissa #2, then the electronic device can determine that stroke 2 belongs to "gan". The distance between the average abscissa corresponding to stroke 3 and the central abscissa #1 is less than the distance to the central abscissa #2, but the previous stroke of stroke 3 is stroke 2, and this stroke 2 belongs to "gan", then the electronic device can determine that stroke 3 belongs to "gan".
[0181] In some embodiments, the text #1 and the text #2 are distributed left and right, the text #1 is on the left side of the text #2, and one or more strokes of the overlapping area include the stroke #1, where the horizontal length of the rectangle #1 corresponding to the text #1 and / or the rectangle #2 corresponding to the text #2 is greater than the threshold #2, asFigure 9 As shown in Figure 9 , for S450, determining the attribution of one or more strokes in the overlapping area according to the writing order of the strokes of Text #1 and Text #2 and the positional relationship between one or more strokes in the overlapping area and Rectangle Frame #1 and Rectangle Frame #2 includes:
[0182] S457, determining the abscissa #1 of the right border of Rectangle Frame #1 and the abscissa #2 of the left border of Rectangle Frame #2.
[0183] After the electronic device recognizes Text #1 and Text #2, it can use Rectangle Frame #1 and Rectangle Frame #2 to enclose Text #1 and Text #2 respectively. On the basis of determining Rectangle Frame #1 and Rectangle Frame #2, since the horizontal length of Rectangle Frame #1 and / or Rectangle Frame #2 is greater than Threshold #2, if the center abscissa is still used as the comparison benchmark, the result may be biased towards the text corresponding to the rectangle frame with a shorter horizontal length. Therefore, the electronic device can determine the abscissa #1 of the right border of Rectangle Frame #1 and the abscissa #2 of the left border of Rectangle Frame #2. The abscissa #1 of the right border of Rectangle Frame #1 can be understood as the abscissa corresponding to the right border of Rectangle Frame #1, denoted as x1. The abscissa #2 of the left border of Rectangle Frame #2 can be understood as the abscissa corresponding to the left border of Rectangle Frame #2, denoted as x2.
[0184] S458, determining the average abscissa #1 of Stroke #1.
[0185] It should be understood that for the description of step S458, reference can be made to the above text. For the sake of brevity, it will not be elaborated here.
[0186] S459, whether the distance between the average abscissa #1 and the abscissa #1 of the right border of Rectangle Frame #1 is greater than the distance between the average abscissa #1 and the abscissa #2 of the left border of Rectangle Frame #2.
[0187] The electronic device can determine the distance between the average abscissa #1 and the abscissa #1 of the right border of Rectangle Frame #1 and the distance between the average abscissa #1 and the abscissa #2 of the left border of Rectangle Frame #2. When it is determined that the distance between the average abscissa #1 and the abscissa #1 of the right border of Rectangle Frame #1 is greater than the distance between the average abscissa #1 and the abscissa #2 of the left border of Rectangle Frame #2, step S4510 can be executed. When it is determined that the distance between the average abscissa #1 and the abscissa #1 of the right border of Rectangle Frame #1 is less than the distance between the average abscissa #1 and the abscissa #2 of the left border of Rectangle Frame #2, step S4511 can be executed.
[0188] S4510, determining that Stroke #1 belongs to Text #2.
[0189] When the distance between the average horizontal coordinate #1 and the horizontal coordinate #1 of the right border of rectangular box #1 is greater than the distance between the average horizontal coordinate #1 and the horizontal coordinate #2 of the left border of rectangular box #2, it indicates that stroke #1 is closer to rectangular box #2. As described above, the stroke belonging to character #2 in the overlapping area should be closer to rectangular box #2. Therefore, it can be determined that stroke #1 belongs to character #2.
[0190] S4511, whether the preceding stroke of stroke #1 belongs to character #2.
[0191] It should be understood that the description of step S4511 can be found above, and for the sake of brevity, it will not be repeated here. When it is determined that the preceding stroke of stroke #1 belongs to character #2, step S4510 can be executed, and when it is determined that the preceding stroke of stroke #1 does not belong to character #2, step S4512 can be executed.
[0192] S4512, determine whether stroke #1 belongs to character #1.
[0193] When the distance between the average horizontal coordinate #1 and the horizontal coordinate #1 of the right border of rectangular box #1 is smaller than the distance between the average horizontal coordinate #1 and the horizontal coordinate #2 of the left border of rectangular box #2, it indicates that stroke #1 is closer to rectangular box #1, and the preceding stroke of stroke #1 does not belong to character #2. Therefore, it can be determined that stroke #1 belongs to character #1.
[0194] For example, Figure 10 As shown in , the electronic device can recognize that the characters include "互" and "jiao". Since the character type of "jiao" is English, the horizontal length of the corresponding rectangular box is greater than the threshold value #2, so the electronic device can determine the horizontal coordinate #1 of the right side frame of the rectangular box #1 corresponding to "互", and determine the horizontal coordinate #2 of the left side frame of the rectangular box #2 corresponding to "jiao". Rectangular box #1 and rectangular box #2 have an overlapping area, and the overlapping area includes stroke 1, stroke 2 and stroke 3. The electronic device can respectively determine the average horizontal coordinate corresponding to stroke 1, the average horizontal coordinate corresponding to stroke 2, and the average horizontal coordinate corresponding to stroke 3. If the distance between the average horizontal coordinate corresponding to stroke 1 and the horizontal coordinate #1 of the right frame of rectangular box #1 is greater than the distance between the average horizontal coordinate corresponding to stroke 1 and the horizontal coordinate #2 of the left frame of rectangular box #2, the electronic device can determine that stroke 1 belongs to "jiao". If the distance between the average horizontal coordinate corresponding to stroke 2 and the horizontal coordinate #1 of the right frame of rectangular box #1 is greater than the distance between the average horizontal coordinate corresponding to stroke 2 and the horizontal coordinate #2 of the left frame of rectangular box #2, the electronic device can determine that stroke 2 belongs to "jiao". The distance between the average horizontal coordinate corresponding to stroke 3 and the horizontal coordinate #1 of the right border of rectangular box #1 is smaller than the distance between the average horizontal coordinate corresponding to stroke 3 and the horizontal coordinate #2 of the left border of rectangular box #2, but the preceding stroke of stroke 3 belongs to "互", then the electronic device can determine that stroke 3 belongs to "互".
[0195] In some embodiments, text #1 and text #2 are vertically distributed, with text #1 above text #2, and one or more strokes of the overlapping area include stroke #1, as Figure 11 shown, S450, determining the attribution of one or more strokes of the overlapping area according to the writing order of the strokes of text #1 and text #2 and the positional relationship between one or more strokes of the overlapping area and rectangle frame #1 and rectangle frame #2, includes:
[0196] S4513, determining the center ordinate #1 of rectangle frame #1 and the center ordinate #2 of rectangle frame #2.
[0197] After the electronic device recognizes text #1 and text #2, rectangle frame #1 and rectangle frame #2 can be used to enclose text #1 and text #2 respectively. On the basis of determining rectangle frame #1 and rectangle frame #2, since text #1 and text #2 are vertically distributed, the electronic device can further determine the center ordinate #1 of rectangle frame #1 and the center ordinate #2 of rectangle frame #2. The center ordinate #1 of rectangle frame #1 can be understood as the ordinate corresponding to the center point of rectangle frame #1, denoted as y1. The center ordinate #2 of rectangle frame #2 can be understood as the ordinate corresponding to the center point of rectangle frame #2, denoted as y2.
[0198] S4514, determining the average ordinate #1 of stroke #1.
[0199] When the electronic device determines that stroke #1 is a stroke in the overlapping area, it can determine the average ordinate #1 of stroke #1. The average ordinate #1 of stroke #1 can be understood as the ordinate corresponding to the center of gravity of stroke #1.
[0200] It should be understood that the description of determining the average ordinate #1 of stroke #1 can refer to the description of determining the average abscissa #1 of stroke #1. For the sake of brevity, it will not be elaborated here. The average ordinate of stroke #1 can be denoted as y.
[0201] S4515, whether the distance between the average ordinate #1 and the center ordinate #1 is greater than the distance between the average ordinate #1 and the center ordinate #2.
[0202] The electronic device can determine the distance between the average ordinate #1 and the center ordinate #1 and the distance between the average ordinate #1 and the center ordinate #2. When it is determined that the distance between the average ordinate #1 and the center ordinate #1 is greater than the distance between the average ordinate #1 and the center ordinate #2, step S4516 can be executed. When it is determined that the distance between the average ordinate #1 and the center ordinate #1 is less than the distance between the average ordinate #1 and the center ordinate #2, step S4517 can be executed.
[0203] S4516, determining that stroke #1 belongs to text #2.
[0204] When the distance between the average vertical coordinate #1 and the center vertical coordinate #1 is greater than the distance between the average vertical coordinate #1 and the center vertical coordinate #2, it indicates that the stroke #1 is closer to the rectangular box #2. As described above, the strokes in the overlapping area belonging to the character #2 should be closer to the rectangular box #2. Therefore, it can be determined that the stroke #1 belongs to the character #2.
[0205] S4517, whether the preceding stroke of stroke #1 belongs to character #2.
[0206] As described above, the strokes in the overlapping area belonging to character #2 may also be closer to rectangular frame #1. In this scenario, it is also possible to determine whether the preceding stroke of stroke #1 belongs to character #2. When it is determined that the preceding stroke of stroke #1 belongs to character #2, step S454 can be executed. When it is determined that the preceding stroke of stroke #1 does not belong to character #2, step S456 can be executed.
[0207] S4518, determine that stroke #1 belongs to character #1.
[0208] When the distance between the average vertical coordinate #1 and the center vertical coordinate #1 is smaller than the distance between the average vertical coordinate #1 and the center vertical coordinate #2, it indicates that the stroke #1 is closer to the rectangular frame #1, and the preceding stroke of the stroke #1 does not belong to the character #2. Therefore, it can be determined that the stroke #1 belongs to the character #1.
[0209] For example, Figure 12 As shown, the electronic device can determine the center vertical coordinate #1 of the rectangular box #1 corresponding to "yan", and determine the center vertical coordinate #2 of the rectangular box #2 corresponding to "ni". Rectangular box #1 and rectangular box #2 have an overlapping area, and the overlapping area includes stroke 1 and stroke 2. The electronic device can determine the average vertical coordinate corresponding to stroke 1 and the average vertical coordinate corresponding to stroke 2, respectively. If the distance between the average vertical coordinate corresponding to stroke 1 and the center vertical coordinate #1 is greater than the distance between the average vertical coordinate corresponding to stroke 1 and the center vertical coordinate #2, the electronic device can determine that stroke 1 belongs to "ni". If the distance between the average vertical coordinate corresponding to stroke 2 and the center vertical coordinate #1 is greater than the distance between the average vertical coordinate corresponding to stroke 2 and the center vertical coordinate #2, the electronic device can determine that stroke 2 belongs to "ni".
[0210] In some embodiments, character #1 and character #2 are diagonally distributed, character #1 is on the upper left or lower left side of character #2, and one or more strokes in the overlapping area include stroke #1, such as Figure 13 As shown, S450, according to the writing order of the strokes of the character #1 and the character #2 and the positional relationship between the one or more strokes in the overlapping area and the rectangular frame #1 and the rectangular frame #2, determines the ownership of the one or more strokes in the overlapping area, including:
[0211] S4519, determine the center coordinate #1 of rectangle #1 and the center coordinate #2 of rectangle #2.
[0212] After the electronic device recognizes text #1 and text #2, it can use rectangle #1 and rectangle #2 to enclose text #1 and text #2 respectively. Based on the determination of rectangle #1 and rectangle #2, since text #1 and text #2 are diagonally distributed, the electronic device can further determine the center coordinate #1 of rectangle #1 and the center coordinate #2 of rectangle #2. The center coordinate #1 of rectangle #1 can be understood as the coordinate corresponding to the center point of rectangle #1, denoted as (x1, y1). The center coordinate #2 of rectangle #2 can be understood as the coordinate corresponding to the center point of rectangle #2, denoted as (x2, y2).
[0213] S4520, determine the average coordinate #1 of stroke #1.
[0214] When the electronic device determines that stroke #1 is a stroke in the overlapping area, it can determine the average coordinate #1 of stroke #1. The average coordinate #1 of stroke #1 can be understood as the coordinate corresponding to the center of gravity of stroke #1, denoted as (x, y).
[0215] S4521, whether the distance between the average coordinate #1 and the center coordinate #1 is greater than the distance between the average coordinate #1 and the center coordinate #2.
[0216] The electronic device can determine the distance between the average coordinate #1 and the center coordinate #1 and the distance between the average coordinate #1 and the center coordinate #2. When it is determined that the distance between the average coordinate #1 and the center coordinate #1 is greater than the distance between the average coordinate #1 and the center coordinate #2, step S4522 can be executed. When it is determined that the distance between the average coordinate #1 and the center coordinate #1 is less than the distance between the average coordinate #1 and the center coordinate #2, step S4523 can be executed.
[0217] S4522, determine that stroke #1 belongs to text #2.
[0218] When the distance between the average coordinate #1 and the center coordinate #1 is greater than the distance between the average coordinate #1 and the center coordinate #2, it indicates that this stroke #1 is closer to rectangle #2. As described above, the strokes belonging to text #2 in the overlapping area should be closer to rectangle #2. Therefore, it can be determined that stroke #1 belongs to text #2.
[0219] S4523, whether the previous stroke of stroke #1 belongs to text #2.
[0220] As described above, the strokes belonging to character #2 in the overlapping region may also be closer to rectangle #1. In such a scenario, it is also possible to determine whether the previous stroke of stroke #1 belongs to character #2. When it is determined that the previous stroke of stroke #1 belongs to character #2, step S4522 can be executed. When it is determined that the previous stroke of stroke #1 does not belong to character #2, step S4524 can be executed.
[0221] S4524. Determine that stroke #1 belongs to character #1.
[0222] When the distance between average coordinate #1 and center coordinate #1 is less than the distance between average coordinate #1 and center coordinate #2, it indicates that this stroke #1 is closer to rectangle #1, and the previous stroke of stroke #1 does not belong to character #2. Therefore, it can be determined that stroke #1 belongs to character #1.
[0223] For example, as Figure 14 shown, the electronic device can determine the center coordinate #1 of rectangle #1 corresponding to "ji" and the center coordinate #2 of rectangle #2 corresponding to "bu". Rectangle #1 and rectangle #2 have an overlapping region, and this overlapping region includes stroke 1. The electronic device can respectively determine the average coordinate corresponding to stroke 1. If the distance between the average coordinate corresponding to stroke 1 and center coordinate #1 is greater than the distance from the center coordinate #2, then the electronic device can determine that stroke 1 belongs to "bu".
[0224] Based on the description above regarding Figures 4 - 14 the electronic device can determine the coordinates of the rectangle corresponding to character #1, the rectangle corresponding to character #2, and the strokes in the overlapping region according to the positional relationship between character #1 and character #2.
[0225] For example, when character #1 and character #2 are distributed horizontally side by side, the electronic device can determine the center abscissa of the rectangle corresponding to character #1 and the rectangle corresponding to character #2, and determine the average abscissa of the strokes in the overlapping region.
[0226] For another example, when character #1 and character #2 are distributed horizontally side by side, character #1 is on the left of character #2, and the horizontal length of the rectangle corresponding to character #1 and / or the rectangle corresponding to character #2 is greater than threshold #2, the electronic device can determine the abscissa of the right border of the rectangle corresponding to character #1, the abscissa of the left border of the rectangle corresponding to character #2, and determine the average abscissa of the strokes in the overlapping region.
[0227] For another example, when character #1 and character #2 are distributed vertically one above the other, the electronic device can determine the center ordinate of the rectangle corresponding to character #1 and the rectangle corresponding to character #2, and determine the average ordinate of the strokes in the overlapping region.
[0228] For another example, text #1 and text #2 are diagonally distributed. The electronic device can determine the center coordinates of the rectangular box corresponding to text #1 and the rectangular box corresponding to text #2, and determine the average coordinates of the strokes in the overlapping area.
[0229] After the electronic device determines the coordinates of the rectangular box corresponding to text #1, the rectangular box corresponding to text #2, and the strokes in the overlapping area, it can determine the attribution of the strokes in the overlapping area according to the distance relationship between the coordinates of the rectangular box corresponding to text #1, the rectangular box corresponding to text #2, and the strokes in the overlapping area, and the writing attributes of text #1 and text #2. For specific descriptions, please refer to the above text.
[0230] In some embodiments, content #1 further includes one or more patterns, such as Figure 4 shown, and the method further includes:
[0231] S460, identifying N strokes corresponding to one or more patterns.
[0232] When the electronic device identifies content #1, it can divide the strokes into strokes belonging to text and strokes belonging to patterns. Therefore, when content #1 includes one or more patterns, the electronic device can identify N strokes belonging to the one or more patterns, where N≥2 and N is an integer.
[0233] In the embodiments of the present application, the method for the electronic device to identify the stroke type is not specifically limited. For example, a graphical neural network (GNN) can be trained. The electronic device can input content #1 into the GNN, and thus can identify the categories of each stroke in content #1.
[0234] S470, dividing the N strokes into M stroke groups according to the positional relationship of the N strokes.
[0235] After the electronic device identifies the N strokes, it can divide the N strokes into M stroke groups according to the positional relationship between the N strokes, where N≥M≥1 and M is an integer. A stroke group can be understood as a set composed of strokes corresponding to the same pattern.
[0236] It should be noted that when M≥2, the distance between the strokes in any two of the M groups is greater than or equal to threshold #3. The method for dividing groups according to the distance relationship of strokes will be introduced below.
[0237] Figure 15FIG. 0 shows a schematic flowchart of a method for dividing stroke groups provided by an embodiment of the present application. This method can be executed by an electronic device or by components of the electronic device (such as a processor, a chip system, etc.). In the following, the execution entity is taken as an electronic device for introduction. In this embodiment, the electronic device can aggregate multiple strokes into a stroke group according to the spatial distance between the strokes, as Figure 14 shown, the method includes:
[0238] S1510, create a new stroke group.
[0239] Among them, the electronic device initializes the stroke group in step S1510, that is, there are no strokes in the newly created stroke group.
[0240] S1520, take out the ungrouped stroke s i .
[0241] Since the electronic device can recognize the strokes of the pattern, it can take out the ungrouped stroke s i to group the stroke s i .
[0242] S1530, determine a first-level new stroke group.
[0243] The electronic device can use the stroke s i as an element in the first-level new stroke group.
[0244] S1540, store it in the current group.
[0245] When the electronic device determines that a new element has been added to the first-level new stroke group, it can add the newly added element to the current stroke group.
[0246] S1550, search for strokes whose distance from s i is less than or equal to threshold #3.
[0247] S1560, determine a second-level new stroke group according to the search result.
[0248] After the electronic device takes out the stroke s i in the first-level new stroke group, it can search for strokes whose distance from this stroke s i is less than threshold #3, and determine this stroke s i and the strokes whose distance from this stroke is less than threshold #3 as the second-level new stroke group.
[0249] It can be understood that when there are no strokes whose distance from the stroke s i is less than threshold #3, the second-level new stroke group can be an empty set.
[0250] S1570, Whether there are strokes in the secondary new stroke grouping.
[0251] When the electronic device determines that there are strokes in the secondary new stroke grouping, it can execute step S1580. When it determines that there are no strokes in the secondary new stroke grouping, it can execute step S1510 again.
[0252] S1580, Determine the secondary new stroke grouping as a new primary new stroke grouping.
[0253] When the electronic device determines that there are strokes in the secondary new stroke grouping, it can determine this secondary new stroke grouping as a new primary new stroke grouping, then store the strokes in the new primary new stroke grouping into the current stroke grouping, and loop to execute step S1540 - step S1560.
[0254] It can be understood that since the new strokes are added to the replaced primary new stroke group, the electronic device can continue to search for strokes whose distance from the newly added strokes is less than threshold #3 to finally determine a stroke grouping. In other words, the method for dividing stroke groups provided in the embodiments of the present application can be understood as a depth search algorithm, that is, first determine a stroke as the root node, then search for strokes whose distance from the root node is less than threshold #3 as the first-level child nodes, and then search for strokes whose distance from the first-level child nodes is less than threshold #3 as the second-level child nodes, and so on. The electronic device can establish a tree-like relationship graph, and the strokes associated with this tree-like relationship graph are the strokes in the same stroke grouping. The following is combined with Figure 16 for introduction.
[0255] Figure 16 Shows the stroke grouping schematic diagram provided by the embodiments of the present application.
[0256] Such as Figure 16As shown in (a) and (b) thereof, the electronic device recognizes that the strokes of the pattern include Stroke 1 - Stroke 13. After the electronic device recognizes the above strokes, the electronic device can create Stroke Group #1. The electronic device can determine that Stroke 1 is an element in the newly created Stroke Group #1 and use Stroke 1 as the root node. The strokes whose distances from Stroke #1 searched by the electronic device are less than Threshold #3 are Stroke 2, Stroke 3, Stroke 4, and Stroke 5. Thus, the electronic device can add Stroke 2, Stroke 3, Stroke 4, and Stroke 5 to the newly created Stroke Group #1 and use Stroke 2, Stroke 3, Stroke 4, and Stroke 5 as the first-level child nodes. Since Stroke 2, Stroke 3, Stroke 4, and Stroke 5 are newly added, the electronic device can continue to search for strokes whose distances from Stroke 2, Stroke 3, Stroke 4, and Stroke 5 are less than Threshold #3. In this search, Stroke 6 can be newly added and used as the second-level child node. Similarly, the electronic device can continue to search for strokes whose distances from Stroke #6 are less than Threshold #3. In this search, Stroke 7 can be newly added and used as the third-level child node. Similarly, the electronic device can continue to search for strokes whose distances from Stroke #7 are less than Threshold #3. In this search, Stroke 8 can be newly added and used as the fourth-level child node. Similarly, the electronic device can continue to search for strokes whose distances from Stroke #8 are less than Threshold #3. Since no new strokes whose distances from Stroke #8 are less than Threshold #3 are searched, this search can be ended, and then it can be determined that Stroke 1 - Stroke 8 are a stroke group. The tree relationship diagram formed by Stroke 1 - Stroke 8 is as shown in Figure 16 shown in (b) thereof.
[0257] Similarly, the electronic device can determine that Stroke 9 - Stroke 13 are a stroke group. The tree relationship diagram formed by Stroke 9 - Stroke 13 is as shown in Figure 16 shown in (c) thereof.
[0258] In the embodiment of the present application, the strokes in a stroke group can be understood as the strokes belonging to the same pattern. The electronic device can quickly determine the strokes included in a pattern by dividing the stroke group.
[0259] In some embodiments, as shown in Figure 17 S1550, search for strokes whose distances from s i are less than Threshold #3, including:
[0260] S1551, determine the sliding window w i according to stroke s i and Threshold #3.
[0261] The electronic device can expand a distance of Threshold #3 outward with the rectangular frame corresponding to stroke s i as the reference and determine the expanded rectangular frame as the sliding window w i .
[0262] S1552. Determine a stroke set according to a sliding window w i Determine the stroke set.
[0263] The electronic device may determine the strokes covered by the sliding window w i as elements in the stroke set. The stroke set may include one or more strokes.
[0264] It should be noted that the strokes covered by the sliding window w i may include the strokes completely covered by the sliding window w i and may also include the strokes partially covered by the sliding window w i The strokes partially covered by the sliding window w
[0265] S1553. Calculate the distance d i j between the stroke s i in the stroke set and the stroke s i j .
[0266] S1554. Determine whether d i j is less than or equal to a threshold #3.
[0267] The electronic device may sequentially calculate the distances between the strokes in the stroke set and the stroke s i and determine whether the distance is less than or equal to the threshold #3. When it is determined that the distance is less than or equal to the threshold #3, step S1555 is executed.
[0268] S1555. Store the stroke s i j into a secondary new stroke grouping.
[0269] The electronic device may sequentially calculate the distances between all the strokes in the stroke set and the stroke s i and store the strokes in the stroke set whose distances from the stroke s i are less than the threshold #3 into a secondary new stroke grouping.
[0270] It can be understood that in the embodiments of the present application, one or more strokes with relatively close distances to the stroke s i may be quickly screened out through the sliding window first, and then the distances between the stroke s i and the one or more strokes are calculated, so that a stroke grouping can be quickly determined.
[0271] As can be seen from the above description, in some embodiments, the distances between the strokes in any two of the M stroke groupings are greater than the threshold #3.
[0272] In the embodiments of the present application, the electronic device may divide the strokes into different stroke groups according to the distance relationship between the pattern strokes, so that when the user selects a pattern, the complete pattern can be quickly selected.
[0273] In some embodiments, after the electronic device divides N strokes into M stroke groups, it may further disassemble a stroke group into multiple stroke groups according to the writing interval between the strokes. For example, Figure 4 as shown, the method further includes:
[0274] S480, dividing the first stroke group into Q stroke groups according to the writing intervals of P strokes.
[0275] The electronic device may divide N strokes into M stroke groups. The M stroke groups include a first stroke group, and the first stroke group includes P strokes. The electronic device may further divide the P-stroke group into Q stroke groups according to the writing intervals of the P strokes, where Q≥1 and Q is an integer.
[0276] The writing interval of the strokes in the embodiments of the present application refers to the time interval between two adjacent strokes in the writing order. The writing interval of the strokes may also be referred to as the writing time interval of the strokes. The following description will use the writing interval.
[0277] For example, stroke #1 and stroke #2 are adjacent strokes in the writing order, that is, the user first writes stroke #1 and then writes stroke #2. Then the writing interval between stroke #1 and stroke #2 refers to the difference between the time when writing stroke #2 starts and the time when writing stroke #1 ends.
[0278] The method of dividing groups according to the writing intervals of the strokes will be introduced below.
[0279] Figure 18 FIG. shows a schematic flowchart of the method for dividing stroke groups provided by the embodiments of the present application. This method may be executed by an electronic device or by components of the electronic device (such as a processor, a chip system, etc.). The following description will take the execution entity as an electronic device as an example. For example, Figure 18 as shown, the method includes:
[0280] S1810, sorting the strokes in stroke group #1 in the writing order.
[0281] Among them, stroke group #1 is one of the M stroke groups. The stroke group #1 includes one or more strokes. The electronic device may sort the one or more strokes according to the writing sequence of the one or more strokes.
[0282] S1820, calculating the writing interval between the front and back strokes in stroke group #1.
[0283] After the electronic device sorts the strokes in stroke group #1 according to the writing order, it can calculate the writing interval between two adjacent stroke groups.
[0284] For example, if the strokes in stroke group #1 are sorted in the writing order as stroke #1, stroke #2, stroke #3, and stroke #4, the electronic device can calculate the writing interval between stroke #1 and stroke #2, the writing interval between stroke #2 and stroke #3, and the writing interval between stroke #3 and stroke #4, respectively.
[0285] In the embodiments of this application, the electronic device can calculate the writing interval between strokes through the following several possible implementation manners.
[0286] In one possible implementation manner, each stroke corresponds to a time stamp for recording the time of writing the stroke, and the electronic device can calculate the writing interval between the previous and the next strokes according to the time stamp.
[0287] In one possible implementation manner, the electronic device can assign a time value to each stroke and use this time value as the time of writing the stroke, and the electronic device can calculate the writing interval between the previous and the next strokes according to this time value.
[0288] S1830, determine the writing intervals whose writing intervals are greater than threshold #4.
[0289] It can be understood that when the user draws a pattern, the writing interval between two adjacent strokes in the writing order should be relatively short. If the writing interval between two adjacent strokes in the writing order is relatively long, it indicates that these two adjacent strokes in the writing order may belong to two different patterns. Therefore, the electronic device can calculate one or more writing intervals corresponding to stroke group #1, and the electronic device can find the writing intervals greater than threshold #4 among these one or more writing intervals.
[0290] For example, if the strokes in stroke group #1 are sorted in the writing order as stroke #1, stroke #2, stroke #3, and stroke #4, the writing interval between stroke #1 and stroke #2 calculated by the electronic device is writing interval #1, the writing interval between stroke #2 and stroke #3 is writing interval #2, and the writing interval between stroke #3 and stroke #4 is writing interval #3. Among them, writing interval #1 and writing interval #3 are less than or equal to threshold #4, and writing interval #2 is greater than threshold #4.
[0291] S1840, divide stroke group #1 into multiple stroke clusters according to the writing intervals whose writing intervals are greater than threshold #4.
[0292] After the electronic device determines that the writing interval is greater than the threshold #4, the writing interval greater than the threshold #4 can be used as a dividing point to divide the stroke group #1, so as to divide the stroke group #1 into multiple stroke clusters, and each stroke cluster in the multiple stroke clusters can include one or more strokes.
[0293] For example, the strokes in the stroke group #1 are sorted in the order of writing as stroke #1, stroke #2, stroke #3, and stroke #4. The writing interval between stroke #1 and stroke #2 calculated by the electronic device is writing interval #1, the writing interval between stroke #2 and stroke #3 is writing interval #2, and the writing interval between stroke #3 and stroke #4 is writing interval #3. Among them, the writing interval #1 and the writing interval #3 are less than or equal to the threshold #4, and the writing interval #2 is greater than the threshold #4. The electronic device can use the writing interval #2 as a dividing point to divide the stroke group #1, where stroke #1 and stroke #2 are stroke cluster #1, and stroke #3 and stroke #4 are stroke cluster #2.
[0294] In some embodiments, after the electronic device executes step S1840, it can execute step S1850, or it can also execute step S1860.
[0295] S1850, determine that the multiple stroke clusters are new stroke groups.
[0296] The electronic device can split the stroke group #1 into multiple stroke clusters and use the multiple stroke clusters as new stroke groups. In other words, the electronic device can divide the stroke group #1 into multiple stroke groups according to the writing intervals of the strokes in the stroke group #1.
[0297] S1860, calculate the distance between stroke cluster c i and other stroke clusters.
[0298] After the electronic device divides the stroke group #1 into multiple stroke clusters, it can calculate the distance between stroke cluster c i and other stroke clusters.
[0299] For example, if the electronic device divides the stroke group #1 into stroke cluster #1, stroke cluster #2, and stroke cluster #3, the electronic device can calculate the distance between stroke cluster #1 and stroke cluster #2 respectively, and calculate the distance between stroke cluster #1 and stroke cluster #3.
[0300] In some embodiments, the distance between stroke clusters can be the shortest distance between stroke clusters, that is, the distance corresponding to the strokes with the closest distance in the two stroke clusters.
[0301] S1870, whether the minimum value of the distance between stroke cluster c i and other stroke clusters is greater than the threshold #5.
[0302] When the electronic device determines that the minimum value of the distances between the stroke cluster c i and other stroke clusters is greater than threshold #5, step S1780 can be executed. When it is determined that the minimum value of the distances between the stroke cluster c i and other stroke clusters is less than or equal to threshold #5, i can be incremented by 1 and step S1760 can be executed again, that is, calculate the distances between the stroke cluster c i+1 and other stroke clusters.
[0303] In some embodiments, threshold #5 is less than threshold #3.
[0304] S1880, whether there are any stroke clusters other than the stroke cluster c i in the stroke grouping #1.
[0305] When the electronic device determines that the minimum value of the distances between the stroke cluster c i and other stroke clusters is greater than threshold #5, it can also determine whether there are any stroke clusters other than the stroke cluster c i in the stroke grouping #1. When it is determined whether there are any stroke clusters other than the stroke cluster c i in the stroke grouping #1, step S1790 can be executed.
[0306] S1890, determine that the stroke cluster c i is a new stroke grouping.
[0307] When the electronic device determines that the minimum value of the distances between the stroke cluster c i and other stroke clusters is greater than threshold #5 and there are other stroke clusters in the stroke grouping #1, the stroke cluster c i can be removed from the stroke grouping #1 and determined as a new stroke grouping.
[0308] In summary, the electronic device can divide the first grouping in the M stroke groupings into Q stroke groups according to the Figure 17 method shown.
[0309] Figure 19 shows a schematic diagram of dividing stroke groupings provided by an embodiment of the present application.
[0310] As Figure 19As shown, the content displayed on the electronic device includes Pattern #1 and Pattern #2. Since Pattern #1 and Pattern #2 are relatively close, when the electronic device divides the strokes into groups according to the distance relationship between the strokes of Pattern #1 and Pattern #2, the strokes of Pattern #1 and Pattern #2 can be divided into the same stroke group, denoted as Stroke Group #1. Pattern #1 includes Stroke 1, Stroke 2, Stroke 3, and Stroke 4, and Pattern #2 includes Stroke 5 and Stroke 6. The electronic device can sort the above strokes in the order of writing, and the obtained sorting result is Stroke 5, Stroke 6, Stroke 1, Stroke 2, Stroke 3, Stroke 4. The electronic device can calculate the writing interval between Stroke 5 and Stroke 6, the writing interval between Stroke 6 and Stroke 1, the writing interval between Stroke 1 and Stroke 2, the writing interval between Stroke 2 and Stroke 3, and the writing interval between Stroke 3 and Stroke 4 respectively.
[0311] When the electronic device determines that the writing interval between Stroke 6 and Stroke 1 is greater than Threshold #4, it can divide Stroke Group #1 into Stroke Cluster #1 and Stroke Cluster #2, and then use Stroke Cluster #1 and Stroke Cluster #2 as new stroke groups, that is, divide Stroke Group #1 into two new stroke groups. Among them, Stroke Cluster #1 includes Stroke 5 and Stroke 6, and Stroke Cluster #2 includes Stroke 1, Stroke 2, Stroke 3, and Stroke 4.
[0312] When the electronic device determines that the writing interval between Stroke 6 and Stroke 1 is greater than Threshold #4, it can also divide Stroke Group #1 into Stroke Cluster #1 and Stroke Cluster #2, and then calculate the distance between Stroke Cluster #1 and Stroke Cluster #2. When it determines that the distance between Stroke Cluster #1 and Stroke Cluster #2 is greater than Threshold #5, it uses Stroke Cluster #1 and Stroke Cluster #2 as new stroke groups.
[0313] It is not difficult to understand that when the electronic device divides stroke groups according to the distance relationship between the strokes of a pattern, the electronic device will Figure 19 Pattern #1 and Pattern #2 in belong to the same stroke group. At this time, if the user only wants to select Pattern #1, the electronic device may synchronously select Pattern #2. Therefore, the electronic device can also divide Stroke Group #1 into two stroke groups according to the writing interval between the strokes, so that Pattern #1 corresponds to one stroke group and Pattern #2 corresponds to another stroke group. At this time, if the user only wants to select Pattern #1, since Pattern #1 and Pattern #2 belong to different stroke groups, the electronic device will not synchronously select Pattern #2.
[0314] From the above description, it can be seen that in some embodiments, the writing interval between two adjacent stroke groups in the Q stroke groups is greater than Threshold #4.
[0315] It should be noted that the writing interval of the stroke groups in the embodiments of the present application refers to the time interval between two adjacent stroke groups in the writing order.
[0316] For example, stroke group #1 and stroke group #2 are stroke groups adjacent in writing order. If the user first writes stroke group #1 and then writes stroke group #2, the writing interval between stroke group #1 and stroke group #2 refers to the difference between the time of starting to write stroke group #2 and the time of ending to write stroke group #1.
[0317] In some embodiments, the distance between any two of the Q stroke groups can be greater than, and can also be greater than threshold #5.
[0318] In the embodiments of the present application, the electronic device can first group the strokes of the pattern according to the distance relationship between the strokes, so that the strokes with a relatively close distance can be attributed to the same stroke group. Then, the electronic device can also divide a stroke group into multiple new stroke groups according to the writing interval of the strokes in a stroke group, which refines the granularity of the grouping and avoids the problem of multiple selected strokes when the user selects a pattern.
[0319] In some embodiments, after the electronic device divides M strokes into Q stroke groups, it can also aggregate multiple stroke groups into one stroke group according to the writing interval between the stroke groups, as Figure 4 shown. The method further includes:
[0320] S490, aggregating the Q stroke groups into W stroke groups according to the writing interval of the Q stroke groups and the distance relationship of the Q stroke groups.
[0321] The electronic device can first divide the first stroke group into Q stroke groups, and then can aggregate the Q stroke groups into W stroke groups according to the writing interval of the Q stroke groups and the distance relationship of the Q stroke groups, where Q≥W≥1 and P is an integer.
[0322] Next, a method for dividing groups according to the writing interval of strokes will be introduced.
[0323] Figure 20 FIG. shows a schematic flowchart of a method for aggregating stroke groups provided by an embodiment of the present application. This method can be executed by an electronic device or by components of the electronic device (such as a processor, a chip system, etc.). Hereinafter, an example will be given with the execution subject being an electronic device. As Figure 20 shown, the method includes:
[0324] S2010, sorting the Q stroke groups in the order of writing.
[0325] The electronic device can sort the Q stroke groups in the order of writing, and the sorting result is denoted as {G0, G1,... G Q}.
[0326] In S2020, calculate the writing interval between the two stroke groups before and after.
[0327] After the electronic device sorts the Q stroke groups in the order of writing, it can calculate the writing interval between two adjacent stroke groups.
[0328] When calculating the writing interval between two adjacent stroke groups, the electronic device can determine the start writing time of the latter stroke group, which is recorded as t i+1 start , and determine the end writing time of the previous stroke group, which is recorded as t i end , then the writing interval between the two stroke groups is δi = t i+1 start -t i end . The calculation result of the electronic device can be recorded as {δ0, δ1,... δQ-1}.
[0329] In some embodiments, the writing interval between two stroke groups can be less than 0.
[0330] S2030, whether the minimum writing interval between stroke groups is less than or equal to threshold #6.
[0331] The electronic device can determine whether the minimum value in {δ0, δ1,... δQ-1} is less than or equal to threshold #6. When it is determined that the minimum value is less than or equal to threshold #6, step S2040 can be executed. When it is determined that the minimum value is greater than threshold #6, the aggregation can be stopped.
[0332] S2040, take out G from {G0, G1, …… G Q} i .
[0333] It should be understood that when the electronic device first executes step S1940, i can be equal to 0.
[0334] S2050, take out G from {G i+1 , G i+2 , …… G Q} j and calculate the writing interval between G i and G j .
[0335] It should be understood that when the electronic device first executes step S2050, since i can be equal to 0, then j can be equal to 1.
[0336] It should also be understood that for calculating G i and G jThe description of the writing interval can be found above. For the sake of brevity, it will not be repeated here. G i and G j 's writing interval is denoted as δij.
[0337] S2060, 0 ≤ δij ≤ threshold #6 and G j has not been merged yet.
[0338] When the electronic device determines that the conditions in step S2060 are met, it can execute step S2070. When it determines that the conditions in S2060 are not met, it can set j += 1 and execute step S2050 again.
[0339] S2070, calculate the minimum distance d between G i and G j . ij .
[0340] Among them, calculating the minimum distance d between G i and G j can be understood as calculating the distance between each stroke in G ij and each stroke in G i , and then selecting the minimum distance among them as the minimum distance between G j and G i and G j .
[0341] S2080, whether d ij is less than or equal to threshold #7.
[0342] The electronic device can execute step S2090 when it determines that the minimum distance d between G i and G j is less than or equal to threshold #7. When it determines that the minimum distance d between G ij and G i and G j is greater than threshold #7, it can set j += 1 and execute step S2050 again. ij
[0343] In some embodiments, threshold #7 can be greater than threshold #3.
[0344] S2090, aggregate G i and G j into a group.
[0345] When the electronic device determines that the minimum distance between G i and G j is less than or equal to threshold #7, it can aggregate G i and G j into a stroke group.
[0346] S20100, Gj Whether it is the last stroke grouping.
[0347] When the electronic device determines that G j is {G i+1 , G i+2 , …… G Q} is the last stroke grouping, it can make i += 1 and then execute step S2040. When determining that G j is not {G i+1 , G i+2 , …… G Q} is the last stroke grouping, it can make j += 1 and execute step S2050 again.
[0348] It should be noted that S20100 is not only the step executed after S2090. The electronic device will also execute this step after j + 1 to determine whether it has traversed the stroke groupings in {G i+1 , G i+2 , …… G Q}. When determining that G after j + 1 jj is {G i+1 , G i+2 , …… G Q} is the last stroke grouping, it can make i += 1 and then execute step S2040.
[0349] Figure 21 FIG. shows a schematic diagram of aggregated stroke groupings provided by an embodiment of the present application.
[0350] As Figure 21 shown, the content displayed by the electronic device includes strokes 1 - 9. The electronic device can first divide the above strokes into 3 groups according to the methods shown in Figure 15 and Figure 16 , namely stroke grouping #1, stroke grouping #2, and stroke grouping #3. Among them, stroke grouping #1 includes strokes 1 and 2, stroke grouping #2 includes strokes 3, 4, 5, 6, and 7, and stroke grouping #3 includes strokes 8 and 9. The electronic device can sort stroke grouping #1, stroke grouping #2, and stroke grouping #3 in the order of writing, and the obtained sorting result is stroke grouping #1, stroke grouping #2, and stroke grouping #3. The electronic device calculates the writing interval between stroke grouping #1 and stroke grouping #2 and calculates the writing interval between stroke grouping #2 and stroke grouping #3.
[0351] Assume that the writing interval between stroke grouping #1 and stroke grouping #2 is less than threshold #6, and the writing interval between stroke grouping #2 and stroke grouping #3 is less than threshold #6.
[0352] According to Figure 20In the method shown, the electronic device can first extract stroke group #1 from {stroke group #1, stroke group #2, stroke group #3}, and extract stroke group #2 from {stroke group #2, stroke group #3}. Since the writing interval between stroke group #1 and stroke group #2 is less than threshold #6 and stroke group #2 has not been merged, the minimum distance between stroke group #1 and stroke group #2 can be calculated. Assuming that the minimum distance between stroke group #1 and stroke group #2 is less than threshold #7, the electronic device can aggregate stroke group #1 and stroke group #2.
[0353] Since stroke group #2 is not the last group in {stroke group #2, stroke group #3}, the electronic device can calculate the writing interval between stroke group #1 and stroke group #3. Assuming that the writing interval between stroke group #1 and stroke group #3 is less than threshold #6, the minimum distance between stroke group #1 and stroke group #3 can be calculated. Assuming that the minimum distance between stroke group #1 and stroke group #3 is greater than threshold #7, the electronic device will not aggregate stroke group #1 and stroke group #3 into the same stroke group.
[0354] Since stroke group #3 is the last group in {stroke group #2, stroke group #3}, and the electronic device has determined the writing interval and distance relationship between stroke group #1 and all other stroke groups, the electronic device can continue to determine the next stroke group, that is, the electronic device takes out stroke group #2 from {stroke group #1, stroke group #2, stroke group #3}, and takes out stroke group #3 from {stroke group #3}. Since the writing interval between stroke group #2 and stroke group #3 is less than threshold #6, the electronic device can calculate the minimum distance between stroke group #2 and stroke group #3. Assuming that the minimum distance between stroke group #2 and stroke group #3 is less than threshold #7, the electronic device can aggregate stroke group #2 and stroke group #3.
[0355] Since the electronic device aggregates stroke group #1 and stroke group #2 into the same stroke group, and aggregates stroke group #2 and stroke group #3 into the same stroke group, the electronic device can eventually aggregate stroke group #1, stroke group #2 and stroke group #3 into the same stroke group.
[0356] It is not difficult to understand that when the electronic device divides the strokes into groups according to the distance between the strokes of the pattern and the writing interval of the strokes, the electronic device will Figure 21 The strokes in the Chinese character are divided into three stroke groups, but in reality Figure 21The strokes shown should belong to the same pattern. At this time, if the user wants to select the pattern, the electronic device may miss some strokes in the pattern. Therefore, the electronic device can also aggregate three stroke groups into the same stroke group according to the writing interval and distance relationship between the stroke groups. At this time, if the user wants to select the pattern, since Figure 21 the strokes in
[0357] belong to the same stroke group, the electronic device will not miss the strokes in the pattern.
[0358] Through the above description, in some embodiments, for multiple stroke groups aggregated into the same stroke group among the Q stroke groups, the writing interval between two adjacent stroke groups in the writing order is less than or equal to threshold #6 and the distance is less than or equal to threshold #7.
[0359] In some embodiments, as Figure 4 shown, the method further includes:
[0360] S4100, identifying the fields and / or patterns in content #1.
[0361] In some embodiments, the fields identified by the electronic device can correspond to a line of text.
[0362] In some embodiments, the fields identified by the electronic device can correspond to a paragraph of text.
[0363] In some embodiments, the images identified by the electronic device correspond to a complete pattern.
[0364] The fields and patterns in the embodiments of the present application can correspond to a rectangular frame, and the rectangular frame can enclose the fields and patterns.
[0365] Figure 22 shows a schematic diagram of column-dividing the content provided by the embodiments of the present application.
[0366] Figure 22 As shown in (a) of
[0367] Continuing to refer to Figure 22In (a) of , since the bounding lines and underlines included in Content #1 are associated with the text, when the electronic device recognizes fields and patterns, the bounding lines and underlines can be regarded as part of the fields. In other words, in these embodiments, the fields recognized by the electronic device may include underlines and bounding lines.
[0368] In other embodiments, the electronic device may also regard the bounding lines and underlines as patterns. In other words, in these embodiments, the fields recognized by the electronic device do not include underlines and bounding lines, but regard the underlines and bounding lines as patterns.
[0369] S4110, divide Content #1 into one or more region blocks according to the positional relationship and writing order of the fields and / or patterns.
[0370] In some embodiments, the writing order of the strokes in each region block follows the writing principle of from left to right and then from top to bottom. The following combines Figure 23 to introduce the method for dividing region blocks provided by the embodiments of the present application.
[0371] Figure 23 FIG. shows a schematic flowchart of the method for dividing region blocks provided by the embodiments of the present application. This method can be executed by an electronic device or by components of the electronic device (such as a processor, a chip system, etc.). Hereinafter, the case where the execution entity is an electronic device is taken as an example for introduction. As Figure 23 shown, this method includes:
[0372] S2310, sort the fields and / or patterns according to the writing order of the strokes.
[0373] As described above, the electronic device can recognize the fields and / or patterns in Content #1, and then can sort the fields and / or patterns according to the writing order of the strokes of the fields and / or patterns. The sorting result is recorded as {P1, P2,..., P i}, and each element therein is used to represent a field or a pattern.
[0374] S2320, add P1 to region block D1, and traverse the remaining fields and / or patterns.
[0375] S2330, whether the abscissa of P i overlaps with that of P i-1 and whether P i is located below P i-1
[0376] As described above, each field and pattern corresponds to a rectangular box. The electronic device can judge the abscissa of the rectangular box corresponding to P i and that of the rectangular box corresponding to P i-1 Whether the abscissas of the corresponding rectangular frames overlap, and determine whether P i is below P i-1 When it is determined that P i the abscissa of the corresponding rectangular frame of P i-1 overlaps with the abscissa of the corresponding rectangular frame of P i and P i-1 is below P i the abscissa of the corresponding rectangular frame of P i-1 does not overlap with the abscissa of the corresponding rectangular frame of P and / or P i is not below P i-1 Step S2340 can be executed.
[0377] In the embodiments of the present application, there are three positional relationships between the rectangular frames of fields and / or patterns, namely, abscissa overlap, ordinate overlap, and non-overlap of abscissa and ordinate. As Figure 24 shown in (a) of Figure 24 , the rectangular frame #1 is the rectangular frame corresponding to the field #1, and the rectangular frame #2 is the rectangular frame corresponding to the field #2. Since the abscissas of the rectangular frames #1 and #2 are partially the same, it can be considered that the abscissas of the rectangular frames #1 and #2 overlap. Similarly, as Figure 24 shown in (b) of
[0378] S2340, whether the ordinates of P i and P i-1 overlap and whether P i is to the right of P i-1 .
[0379] It should be understood that for the detailed description of S2340, reference can be made to the description of S2330. For the sake of brevity, it will not be elaborated here.
[0380] When it is determined that P i the ordinate of the corresponding rectangular frame of P i-1 overlaps with the ordinate of the corresponding rectangular frame of P and P i is to the right of P i-1 Step S2350 can be executed. When it is determined that P i the abscissa of the corresponding rectangular frame of P i-1 does not overlap with the abscissa of the corresponding rectangular frame of P and / or P i is not to the right of P i-1 Step S2360 can be executed.
[0381] It should be noted that in some other embodiments of the present application, the execution order of step S2330 and step S2340 can be swapped, that is, step S2340 is executed first. When it is determined that the conditions in step S2340 are met, the electronic device executes step S2350. When it is determined that the conditions in step S2340 are not met, the electronic device executes step S2330. When the electronic device executes step S2330, when it is determined that the conditions in step S2330 are met, the electronic device executes step S2350. When it is determined that the conditions in step S23330 are not met, the electronic device executes step S2360.
[0382] S2350, P i The distance between and P i-1 Is it less than threshold #8?
[0383] The electronic device determines P i The distance between and P i-1 When the distance between is less than threshold #8, step S2370 can be executed. When it is determined that the distance between P i The distance between and P i-1 Is greater than or equal to threshold #8, step S23260 can be executed.
[0384] S2360, add P i To the new region block D j+1 .
[0385] When P i The distance between and P i-1 When the horizontal and vertical coordinates do not overlap, the electronic device can add P i To the new region block D j+1 In.
[0386] S2370, add P i To the region block where P i-1 Is located.
[0387] When P i The distance between and P i-1 When the vertical coordinates overlap and P i Is located to the right of P i-1 Or when P i The distance between and P i-1 When the horizontal coordinates overlap and P i Is located below P i-1 The electronic device can add P i To the region block where P i-1 Is located.
[0388] By Figure 23 The method shown, the electronic device can traverse {P2,..., P i} to determine the region blocks corresponding to each field and pattern. The following is an exemplary description in conjunction with Figure 22 For example. Suppose Figure 22 the writing order of fields 1 - 14, pattern 1, and pattern 2 in
[0389] is field 1, field 2, pattern 1, field 3, field 4, field 5, field 6, field 7, field 8, field 9, pattern 2, field 10, field 11, field 12, field 13, and field 14. The electronic device can add field 1 to region block #1 and then start traversing from field 14.
[0390] Since the abscissas of field 14 and field 13 overlap and field 14 is below field 13, and the distance between them is less than threshold #8, the electronic device can add field 14 to the region block to which field 13 belongs.
[0391] Since the abscissas of field 13 and field 12 overlap and field 13 is below field 12, and the distance between them is less than threshold #8, the electronic device can add field 13 to the region block to which field 12 belongs.
[0392] Since the abscissas of field 12 and field 11 overlap and field 12 is below field 11, and the distance between them is less than threshold #8, the electronic device can add field 12 to the region block to which field 11 belongs.
[0393] Since the abscissas and ordinates of field 10 and pattern 2 do not overlap, the electronic device can determine that field 10 is added to a new region block. And since field 11 has been added to the region block of field 10, field 12 has been added to the region block of field 11, field 13 has been added to the region block of field 12, and field 14 has been added to the region block of field 13, therefore, fields 10 - 14 can belong to the same region block.
[0394] According to the above division method, as shown in (b) of Figure 22 the electronic device can divide the content #1 shown in Figure 21 into 4 region blocks, namely region block #1, region block #2, region block #3, and region block #4. Among them, region block #1 includes field 1, field 2, pattern 1, field 3, field 4, and field 5, region block #2 includes fields 6, 7, 8, and 9, region block #3 includes pattern 2, and region block #4 includes fields 10, 11, 12, 13, and 14.
[0395] It is understandable that the strokes of the fields and / or patterns in each region block satisfy the order from left to right and from top to bottom.
[0396] S4120, perform column division on Content #1 according to the positional relationship of one or more region blocks to obtain one or more columns.
[0397] By executing step S4110, the electronic device can determine to divide Content #1 into one or more region blocks, denoted as {D1, D2,..., D i}}. The electronic device can determine the number of columns of Content #1 and which column each region block belongs to according to the positional relationship of each region block, thereby completing the column division of Content #1, that is, obtaining one or more columns.
[0398] Figure 25 FIG. shows a schematic flowchart of a method for performing column division on content according to the positional relationship of region blocks provided by an embodiment of the present application. This method can be executed by an electronic device or by components of the electronic device (such as a processor, a chip system, etc.). Hereinafter, an example will be given with the execution subject being an electronic device. As Figure 25 shown, the method includes:
[0399] S2510, determine Region Block Set #1.
[0400] After the electronic device divides Content #1 into multiple region blocks, it determines Region Block Set #1.
[0401] S2520, contract the region blocks in Region Block Set #1 in the horizontal direction to generate Region Block Set #2.
[0402] Since the lines may be uneven when the user is writing, the electronic device can contract the region blocks in Region Block Set #1 in the horizontal direction to generate Region Block Set #2.
[0403] For example, as shown in (c) of Figure 21 , after Region Block #1 is contracted in the horizontal direction, Region Block #5 can be generated. After Region Block #2 is contracted in the horizontal direction, Region Block #6 can be generated. After Region Block #3 is contracted in the horizontal direction, Region Block #7 can be generated. After Region Block #4 is contracted in the horizontal direction, Region Block #8 can be generated.
[0404] It should be noted that if the rectangular frames corresponding to the region blocks in Region Block Set #1 can be aligned in the horizontal direction, the electronic device may not execute step S2520 but directly execute step S2530.
[0405] It should also be noted that the horizontal alignment of the rectangular frames corresponding to the region blocks in region block set #1 can be understood as the horizontal alignment of the rectangular frames corresponding to the region blocks within an allowable error range. In other words, the abscissas of the left and right borders of two region blocks in an up-and-down relationship are equal or the difference is within the allowable error range.
[0406] S2530, Calculate the vertical projection of the region blocks in region block set #2 to determine the peak value.
[0407] The electronic device can calculate the vertical projection of the region blocks in region block set #2 and determine the peak value based on the vertical projection result.
[0408] For example, as shown in (d) of Figure 22 , when the electronic device performs vertical projection on region block #5, region block #6, region block #7, and region block #8, in the order from left to right, it first projects region block #6, then projects region block #5 and region block #6, and then projects #5. Therefore, a peak value, namely peak value #1, can be determined. Similarly, the electronic device can also determine peak value #2 and peak value #3.
[0409] S2540, Perform column division on the region blocks according to the positions of the peak values and the region blocks.
[0410] After the electronic device determines the number of peak values, that is, determines the number of columns, it can then perform column division on the region blocks according to the positions of the peak values and the region blocks.
[0411] For example, as shown in (d) of Figure 22 , the electronic device can determine that region block #1 and region block #2 (which can also be referred to as region block #5 and region block #6) belong to the first column, determine that region block #3 (which can also be referred to as region block #7) belongs to the second column, and determine that region block #4 (which can also be referred to as region block #8) belongs to the third column.
[0412] S2550, Sort the region blocks in the first column according to the positional relationship between the region blocks in the first column.
[0413] The electronic device divides content #1 into one or more columns, and one or more of these columns include the first column. Since the first column can include one or more region blocks, the electronic device can sort the region blocks in the first column according to the principles from left to right and from top to bottom. In other words, the electronic device can sort the region blocks according to the up-and-down relationship and left-and-right relationship of the region blocks in the first column.
[0414] For example, as shown in Figure 22As shown in (d) therein, the electronic device determines that the first column includes region block #1 and region block #2, where the position of region block #1 is above that of region block #2. Then, the electronic device can determine the order of region block #1 and region block #2 as: region block #1 - region block #2.
[0415] It can be understood that after the electronic device determines the order of the region blocks in each column, when the user selects the fields and / or patterns in that column, the electronic device can sequentially select the corresponding region blocks according to the determined order of the region blocks.
[0416] In the embodiments of the present application, the electronic device can divide the content into one or more region blocks. The strokes of the fields and / or patterns in each region block satisfy the writing order from left to right and from top to bottom. Then, the content is column-divided according to the positional relationship between the region blocks, which improves the success rate of column division and ensures that the user can select the content column by column in the way from left to right and from top to bottom.
[0417] In some embodiments, the method further includes:
[0418] Determining the order of the fields and / or patterns in the first region block according to the positional relationship of the fields and / or patterns in the first region block.
[0419] The electronic device can divide content #1 into one or more region blocks, and the one or more region blocks include a first region block. The electronic device can also determine the order of the fields and / or patterns in the first region block according to the positional relationship of the fields and / or patterns in the first region block.
[0420] In some embodiments, the order of the fields and / or patterns in the first region block determined by the electronic device satisfies the order from top to bottom and / or from left to right.
[0421] For example, as Figure 22 shown in (d) therein, the electronic device can determine the order of the fields and patterns in region block #1 (or region block #5) as: field 1, field 2, pattern 1, field 3, field 4, and field 5.
[0422] It can be understood that after the electronic device determines the order of the fields and / or patterns in each region block, when the user selects the fields and / or patterns in that content block, the electronic device can sequentially select the corresponding fields and / or patterns according to the determined order of the fields and / or patterns.
[0423] Figure 26 FIG. shows a schematic flowchart of the handwriting stroke recognition method provided by the embodiments of the present application. This method can be executed by an electronic device or by components of the electronic device (such as a processor, a chip system, etc.). Below, the execution subject is taken as an electronic device for introduction. AsFigure 25 As shown, the method includes:
[0424] S2610. Identify N strokes corresponding to one or more patterns.
[0425] S2620. Divide the N strokes into M stroke groups according to the positional relationship of the N strokes.
[0426] S2630. Divide the first stroke group into Q stroke groups according to the writing intervals of P strokes.
[0427] S2640. Aggregate the Q stroke groups into W stroke groups according to the writing intervals and distance relationships of the Q stroke groups.
[0428] It should be understood that for the detailed description of steps S2610 - S2640, reference can be made to the description of steps S460 - S490. For the sake of brevity, it will not be elaborated here.
[0429] In the embodiments of the present application, the electronic device can divide strokes into different stroke groups according to the positional relationship between the pattern strokes, so that when the user selects a pattern, the complete pattern can be quickly selected.
[0430] In addition, the electronic device can also divide a stroke group into multiple new stroke groups according to the writing intervals of the strokes in a stroke group, refining the granularity of the grouping and avoiding the problem of multiple - selected strokes when the user selects a pattern.
[0431] In addition, the electronic device can also aggregate the stroke groups according to the writing intervals and positional relationships between the stroke groups, avoiding the problem of missed - selected strokes when the user selects a pattern.
[0432] Figure 27 Fig. shows a schematic flowchart of the handwritten stroke recognition method provided by the embodiments of the present application. This method can be executed by an electronic device or by components of the electronic device (such as a processor, a chip system, etc.). In the following, the execution entity is taken as an electronic device for introduction. As Figure 27 shown, the method includes:
[0433] S2710. Identify the fields and / or patterns in Content #1.
[0434] S2720. Divide Content #1 into one or more region blocks according to the positional relationship and writing order of the fields and / or patterns.
[0435] S2730. Column - divide Content #1 into one or more columns according to the positional relationship of the one or more region blocks.
[0436] It should be understood that for the detailed description of steps S2710 - S2730, reference can be made to the description of steps S4100 - S4120. For the sake of brevity, it will not be elaborated here.
[0437] In the embodiments of the present application, the electronic device can divide the content into one or more regional blocks. The strokes of the fields and / or patterns in each regional block satisfy the writing order from left to right and from top to bottom. Then, the pen content is columned according to the positional relationship between the regional blocks, which improves the success rate of columning and ensures that the user can select the content column by column in the manner from left to right and from top to bottom.
[0438] Figure 28 FIG. shows a schematic flowchart of a method for recognizing handwritten strokes provided by an embodiment of the present application. This method can be executed by an electronic device or by components of the electronic device (such as a processor, a chip system, etc.). In the following, the case where the execution entity is an electronic device will be taken as an example for introduction, as Figure 28 shown, the method includes:
[0439] S2810, display a first content, where the first content includes a plurality of strokes.
[0440] For example, the first content displayed by the electronic device can be as Figure 5 shown, and the first content includes text.
[0441] For another example, the first content displayed by the electronic device can be as Figure 16 shown, and the first content includes a pattern.
[0442] For another example, the first content displayed by the electronic device can be as Figure 22 shown, and the first content includes a pattern and text.
[0443] S2820, group the plurality of strokes according to the positional relationship and the writing order of the plurality of strokes.
[0444] The electronic device can group the plurality of strokes according to the positional relationship and the writing order of the plurality of strokes in the first content. Among them, the strokes belonging to the same stroke group can be the strokes of the same pattern, or the strokes of the same character, or the strokes in the same column.
[0445] In the embodiments of the present application, the positional relationship includes a distance relationship and an orientation relationship. The distance relationship is used to indicate the distance between strokes (for example, the distance between stroke #1 and stroke #2 is 1 cm), and the orientation relationship is used to indicate the orientation between strokes (for example, stroke #1 is located on the left side of stroke #2).
[0446] In the embodiments of the present application, strokes can be grouped according to the positional relationship between strokes and the writing order of strokes. Strokes belonging to the same stroke group can be strokes of the same pattern, or strokes of the same character, or strokes in the same column, so that when the user selects text and patterns, problems such as missed selection, multiple selection, inability to select a single character, and column division error will not occur.
[0447] In some embodiments, the first content includes a first character and a second character. Grouping multiple strokes according to the positional relationship of multiple strokes and the writing order of multiple strokes includes:
[0448] When there is a first overlapping area between the first rectangular box corresponding to the first character and the second rectangular box corresponding to the second character, determine the attribution of one or more strokes according to the writing order of the strokes of the first character and the second character and the positional relationship between one or more strokes in the first overlapping area and the first rectangular box and the second rectangular box.
[0449] It should be understood that for a detailed description of determining the attribution of the strokes in the overlapping area, reference can be made to the above text. For the sake of brevity, it will not be repeated here.
[0450] In some embodiments, determining the attribution of one or more strokes according to the writing order of the strokes of the first character and the second character and the positional relationship between one or more strokes in the first overlapping area and the first rectangular box and the second rectangular box includes:
[0451] Determine the coordinates of the first rectangular box, the second rectangular box, and one or more strokes according to the positional relationship between the first character and the second character;
[0452] Determine the attribution of one or more strokes according to the distance relationship between the coordinates of the first rectangular box, the second rectangular box, and one or more strokes and the writing order of the strokes of the first character and the second character.
[0453] In some embodiments, the first character and the second character are distributed left and right, with the first character on the left of the second character. One or more strokes include a first stroke. Determining the coordinates of the first rectangular box, the second rectangular box, and one or more strokes according to the positional relationship between the first character and the second character includes:
[0454] Determine the first central abscissa of the first rectangular box, the second central abscissa of the second rectangular box, and the first average abscissa of the first stroke.
[0455] In some embodiments, determining the attribution of one or more strokes according to the distance relationship between the coordinates of the first rectangular box, the second rectangular box, and one or more strokes and the writing order of the strokes of the first character and the second character includes:
[0456] When the distance between the first average abscissa and the first central abscissa is greater than the distance between the first average abscissa and the second central abscissa, it is determined that the first stroke belongs to the second character; or
[0457] When the distance between the first average abscissa and the first central abscissa is less than the distance between the first average abscissa and the second central abscissa, and the previous stroke of the first stroke belongs to the second character, it is determined that the first stroke belongs to the second character; or
[0458] When the distance between the first average abscissa and the first central abscissa is less than the distance between the first average abscissa and the second central abscissa, and the previous stroke of the first stroke does not belong to the second character, it is determined that the first stroke belongs to the first character.
[0459] In some embodiments, the first character and the second character are distributed left and right, the first character is on the left side of the second character, the horizontal length of the first rectangular frame and / or the second rectangular frame is greater than the first threshold, and one or more strokes include the first stroke. Determining the coordinates of the first rectangular frame, the second rectangular frame, and one or more strokes according to the positional relationship between the first character and the second character includes:
[0460] Determine the abscissa of the right border of the first rectangular frame, the abscissa of the left border of the second rectangular frame, and the first average abscissa of the first stroke.
[0461] In some embodiments, determining the attribution of one or more strokes according to the distance relationship between the coordinates of the first rectangular frame, the second rectangular frame, and one or more strokes and the writing order of the strokes of the first character and the second character includes:
[0462] When the distance between the first average abscissa and the abscissa of the right border of the first rectangular frame is greater than the distance between the first average abscissa and the abscissa of the left border of the second rectangular frame, it is determined that the first stroke belongs to the second character; or
[0463] When the distance between the first average abscissa and the abscissa of the right border of the first rectangular frame is less than the distance between the first average abscissa and the abscissa of the left border of the second rectangular frame, and the previous stroke of the first stroke belongs to the second character, it is determined that the first stroke belongs to the second character; or
[0464] When the distance between the first average abscissa and the abscissa of the right border of the first rectangular frame is less than the distance between the first average abscissa and the abscissa of the left border of the second rectangular frame, and the previous stroke of the first stroke does not belong to the second character, it is determined that the first stroke belongs to the first character.
[0465] In some embodiments, the first text and the second text are arranged vertically, with the first text above the second text. One or more strokes include a first stroke. Determining the coordinates of the first rectangle, the second rectangle, and the one or more strokes according to the positional relationship between the first text and the second text includes:
[0466] Determining a first central ordinate of the first rectangle, a second central ordinate of the second rectangle, and a first average ordinate of the first stroke.
[0467] In some embodiments, determining the attribution of one or more strokes according to the distance relationship between the coordinates of the first rectangle, the second rectangle, and the one or more strokes and the writing order of the strokes of the first text and the second text includes:
[0468] When the distance between the first average ordinate and the first central ordinate is greater than the distance between the first average ordinate and the second central ordinate, determining that the first stroke belongs to the second text; or
[0469] When the distance between the first average ordinate and the first central ordinate is less than the distance between the first average ordinate and the second central ordinate, and the previous stroke of the first stroke belongs to the second text, determining that the first stroke belongs to the second text; or
[0470] When the distance between the first average ordinate and the first central ordinate is less than the distance between the first average ordinate and the second central ordinate, and the previous stroke of the first stroke does not belong to the second text, determining that the first stroke belongs to the first text.
[0471] In some embodiments, the first text and the second text are arranged diagonally, with the first text in the lower left or upper left of the second text. One or more strokes include a first stroke. Determining the coordinates of the first rectangle, the second rectangle, and the one or more strokes according to the positional relationship between the first text and the second text includes:
[0472] Determining a first central coordinate of the first rectangle, a second central coordinate of the second rectangle, and a first average coordinate of the first stroke.
[0473] In some embodiments, determining the attribution of one or more strokes according to the distance relationship between the coordinates of the first rectangle, the second rectangle, and the one or more strokes and the writing order of the strokes of the first text and the second text includes:
[0474] When the distance between the first average coordinate and the first central coordinate is greater than the distance between the first average coordinate and the second central coordinate, determining that the first stroke belongs to the second text; or
[0475] When the distance between the first average coordinate and the first center coordinate is less than the distance between the first average coordinate and the second center coordinate, and the preceding stroke of the first stroke belongs to the second character, it is determined that the first stroke belongs to the second character; or
[0476] When the distance between the first average coordinate and the first center coordinate is less than the distance between the first average coordinate and the second center coordinate, and the preceding stroke of the first stroke does not belong to the second character, it is determined that the first stroke belongs to the first character.
[0477] In some embodiments, the first content includes one or more patterns, and the method further includes: identifying N strokes corresponding to the one or more patterns, where N≥2 and N is an integer; grouping the N strokes according to the positional relationship and writing order of the multiple strokes, including: dividing the N strokes into M stroke groups according to the positional relationship between the N strokes, where the distance between any two strokes in the M stroke groups is greater than a second threshold, N≥M≥1 and M is an integer.
[0478] In some embodiments, the method further includes: dividing the first stroke group into Q stroke groups according to the writing intervals of P strokes, where the M stroke groups include the first stroke group, the first stroke group includes P strokes, and the writing intervals between two adjacent stroke groups in the Q stroke groups are greater than a third threshold, Q≥1 and Q is an integer.
[0479] In some embodiments, the method further includes: aggregating the Q stroke groups into W stroke groups according to the writing intervals of the Q stroke groups and the distance relationship between the Q stroke groups, where the writing intervals between two adjacent stroke groups in the multiple stroke groups aggregated into the same stroke group in the Q stroke groups are less than or equal to a fourth threshold and the distance is less than or equal to a fifth threshold, Q≥W≥1 and P is an integer.
[0480] In some embodiments, the distance between any two stroke groups in the Q stroke groups is greater than a sixth threshold, and the sixth threshold is less than the second threshold.
[0481] In some embodiments, the writing interval is the time interval corresponding to two adjacent strokes in the writing order.
[0482] It should be understood that the detailed description of dividing and aggregating stroke groups can be found above. For the sake of brevity, it will not be repeated here.
[0483] In some embodiments, the method further includes: identifying fields and / or patterns in the first content; grouping a plurality of strokes according to the positional relationship and writing order of the plurality of strokes, including: dividing the first content into one or more regional blocks according to the positional relationship and writing order of the fields and / or patterns; and obtaining one or more columns by column-dividing the first content according to the positional relationship of the one or more regional blocks.
[0484] In some embodiments, the method further includes: sorting the regional blocks in the first column according to the positional relationship between the regional blocks in the first column. Wherein, the one or more classifications include the first column.
[0485] In some embodiments, the method further includes: sorting the fields and / or patterns in the first regional block according to the positional relationship of the fields and / or patterns in the first regional block, where the one or more regional blocks include the first regional block.
[0486] In some embodiments, the fields and / or patterns in the first regional block satisfy an order from top to bottom and / or from left to right.
[0487] It should be understood that for the detailed description of dividing regional blocks and column-dividing, reference may be made to the above, and for the sake of brevity, it will not be elaborated here.
[0488] The above has described in detail the method for recognizing handwritten strokes provided in the embodiments of the present application. In each embodiment of the present application, if there is no special description and logical conflict, the terms and / or descriptions among the various embodiments are consistent and can be mutually referred to, and the technical features in different embodiments can be combined to form new embodiments according to their inherent logical relationships.
[0489] The above mainly introduces a method for recognizing handwritten strokes provided in the embodiments of the present application from the perspective of an electronic device. It can be understood that in order for the electronic device to implement the above functions, it includes corresponding hardware structures and / or software modules for executing each function. Those skilled in the art should easily realize that, in combination with the algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed in the way of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.
[0490] In the case of dividing each functional module (or unit) corresponding to each function, Figure 29 FIG. shows a schematic diagram of the composition of an electronic device 2900 provided in an embodiment of the present application, as Figure 29As shown, the electronic device 2900 includes: a display module 2910 and a processing module 2920.
[0491] The display module 2910 is configured to display a first content, and the first content includes a plurality of strokes.
[0492] The processing module 2920 is configured to group the plurality of strokes according to the positional relationship of the plurality of strokes and the writing order of the plurality of strokes.
[0493] In some embodiments, the first content includes a first character and a second character. The processing module 2920 is specifically configured to, when there is a first overlapping area between a first rectangular box corresponding to the first character and a second rectangular box corresponding to the second character, determine the attribution of one or more strokes according to the writing order of the strokes of the first character and the second character and the positional relationship between one or more strokes in the first overlapping area and the first rectangular box and the second rectangular box.
[0494] In some embodiments, the processing module 2920 is specifically configured to determine the coordinates of the first rectangular box, the second rectangular box, and one or more strokes according to the positional relationship between the first character and the second character; and determine the attribution of one or more strokes according to the distance relationship between the coordinates of the first rectangular box, the second rectangular box, and one or more strokes and the writing order of the strokes of the first character and the second character.
[0495] In some embodiments, the first character and the second character are distributed left and right, the first character is on the left of the second character, and one or more strokes include a first stroke. The processing module 2920 is specifically configured to determine a first central abscissa of the first rectangular box, a second central abscissa of the second rectangular box, and a first average abscissa of the first stroke.
[0496] In some embodiments, the processing module 2920 is specifically configured to, when the distance between the first average abscissa and the first central abscissa is greater than the distance between the first average abscissa and the second central abscissa, determine that the first stroke belongs to the second character; or when the distance between the first average abscissa and the first central abscissa is less than the distance between the first average abscissa and the second central abscissa, and the previous stroke of the first stroke belongs to the second character, determine that the first stroke belongs to the second character; or when the distance between the first average abscissa and the first central abscissa is less than the distance between the first average abscissa and the second central abscissa, and the previous stroke of the first stroke does not belong to the second character, determine that the first stroke belongs to the first character.
[0497] In some embodiments, the first text and the second text are distributed horizontally, with the first text on the left side of the text. The horizontal length of the first rectangular box and / or the second rectangular box is greater than the first threshold. One or more strokes include a first stroke. The processing module 2920 is specifically configured to determine the abscissa of the right border of the first rectangular box, the abscissa of the left border of the second rectangular box, and the first average abscissa of the first stroke.
[0498] In some embodiments, the processing module 2920 is specifically configured to determine that the first stroke belongs to the second text when the distance between the first average abscissa and the abscissa of the right border of the first rectangular box is greater than the distance between the first average abscissa and the abscissa of the left border of the second rectangular box; or to determine that the first stroke belongs to the second text when the distance between the first average abscissa and the abscissa of the right border of the first rectangular box is less than the distance between the first average abscissa and the abscissa of the left border of the second rectangular box, and the previous stroke of the first stroke belongs to the second text; or to determine that the first stroke belongs to the first text when the distance between the first average abscissa and the abscissa of the right border of the first rectangular box is less than the distance between the first average abscissa and the abscissa of the left border of the second rectangular box, and the previous stroke of the first stroke does not belong to the second text.
[0499] In some embodiments, the first text and the second text are distributed vertically, with the first text above the second text. One or more strokes include a first stroke. The processing module 2920 is specifically configured to determine the first central ordinate of the first rectangular box, the second central ordinate of the second rectangular box, and the first average ordinate of the first stroke.
[0500] In some embodiments, the processing module 2920 is specifically configured to determine that the first stroke belongs to the second text when the distance between the first average ordinate and the first central ordinate is greater than the distance between the first average ordinate and the second central ordinate; or to determine that the first stroke belongs to the second text when the distance between the first average ordinate and the first central ordinate is less than the distance between the first average ordinate and the second central ordinate, and the previous stroke of the first stroke belongs to the second text; or to determine that the first stroke belongs to the first text when the distance between the first average ordinate and the first central ordinate is less than the distance between the first average ordinate and the second central ordinate, and the previous stroke of the first stroke does not belong to the second text.
[0501] In some embodiments, the first text and the second text are distributed diagonally, with the first text in the lower left or upper left of the second text. One or more strokes include a first stroke. The processing module 2920 is specifically configured to determine the first central coordinate of the first rectangular box, the second central coordinate of the second rectangular box, and the first average coordinate of the first stroke.
[0502] In some embodiments, the processing module 2920 is specifically configured to determine that the first stroke belongs to the second character when the distance between the first average coordinate and the first center coordinate is greater than the distance between the first average coordinate and the second center coordinate; or to determine that the first stroke belongs to the second character when the distance between the first average coordinate and the first center coordinate is less than the distance between the first average coordinate and the second center coordinate, and the previous stroke of the first stroke belongs to the second character; or to determine that the first stroke belongs to the first character when the distance between the first average coordinate and the first center coordinate is less than the distance between the first average coordinate and the second center coordinate, and the previous stroke of the first stroke does not belong to the second character.
[0503] In some embodiments, the first content includes one or more patterns, and the processing module 2920 is further configured to identify N strokes corresponding to the one or more patterns, where N≥2 and N is an integer; the processing module 2920 is specifically configured to divide the N strokes into M stroke groups according to the positional relationship between the N strokes, where the distance between any two strokes in the M stroke groups is greater than a second threshold, and N≥M≥1 and M is an integer.
[0504] In some embodiments, the processing module 2920 is further configured to divide the first stroke group into Q stroke groups according to the writing intervals of P strokes, where the M stroke groups include the first stroke group, the first stroke group includes P strokes, and the writing interval between two adjacent stroke groups in the Q stroke groups in the writing order is greater than a third threshold, and Q≥1 and Q is an integer.
[0505] In some embodiments, the processing module 2920 is further configured to aggregate the Q stroke groups into W stroke groups according to the writing intervals of the Q stroke groups and the distance relationship between the Q stroke groups, where the writing interval between two adjacent stroke groups in the multiple stroke groups aggregated into the same stroke group in the Q stroke groups is less than or equal to a fourth threshold and the distance is less than or equal to a fifth threshold, and Q≥W≥1 and P is an integer.
[0506] In some embodiments, the distance between any two stroke groups in the Q stroke groups is greater than a sixth threshold, and the sixth threshold is less than the second threshold.
[0507] In some embodiments, the writing interval is the time interval corresponding to two adjacent strokes in the writing order.
[0508] In some embodiments, the processing module 2920 is further configured to identify fields and / or patterns in the first content;
[0509] The processing module 2920 is specifically configured to divide the first content into one or more regional blocks according to the positional relationship and writing order of the fields and / or patterns; and perform column division on the first content according to the positional relationship of the one or more regional blocks to obtain one or more columns.
[0510] In some embodiments, the processing module 2920 is further configured to sort the regional blocks in the first column according to the positional relationship between the regional blocks in the first column. Among them, one or more classifications include the first column.
[0511] In some embodiments, the processing module 2920 is further configured to sort the fields and / or patterns in the first regional block according to the positional relationship of the fields and / or patterns in the first regional block. Among them, one or more regional blocks include the first regional block.
[0512] In some embodiments, the fields and / or patterns in the first regional block satisfy the order from top to bottom and / or from left to right.
[0513] The embodiments of the present application provide a computer program product. When the computer program product runs on an electronic device, the electronic device is enabled to execute the technical solutions in the above embodiments. The implementation principle and technical effects are similar to those of the related embodiments of the above method, and will not be elaborated here.
[0514] The embodiments of the present application provide a readable storage medium. The readable storage medium contains instructions. When the instructions run on an electronic device, the electronic device is enabled to execute the technical solutions of the above embodiments. The implementation principle and technical effects are similar, and will not be elaborated here.
[0515] The embodiments of the present application provide a chip. The chip is used to execute instructions. When the chip runs, it executes the technical solutions in the above embodiments. The implementation principle and technical effects are similar, and will not be elaborated here.
[0516] Those of ordinary skill in the art can realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the embodiments of the present application.
[0517] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the systems, devices, and units described above can refer to the corresponding processes in the foregoing method embodiments, and will not be elaborated here.
[0518] In several embodiments provided in the present application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces. The indirect couplings or communication connections of the devices or units can be in electrical, mechanical, or other forms.
[0519] The units described as separate components may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they can be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0520] In addition, in each embodiment of the present application, the functional units can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit.
[0521] If the functions are implemented in the form of software function units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiments of the present application, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the embodiments of the present application. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM), random access memories (RAM), magnetic disks, or optical discs that can store program codes.
[0522] As described above, it is only the specific implementation manners of the embodiments of the present application, but the protection scope of the embodiments of the present application is not limited thereto. Any person skilled in the art within the technical scope disclosed in the embodiments of the present application can easily think of changes or substitutions, which should all be covered by the protection scope of the embodiments of the present application. Therefore, the protection scope of the embodiments of the present application should be subject to the protection scope of the claims.
Claims
1. A method for recognizing handwritten strokes, characterized in that, The method includes: Displaying a first content, where the first content includes a plurality of strokes; Grouping the plurality of strokes according to the positional relationship of the plurality of strokes and the writing order of the plurality of strokes; Wherein, the first content includes a first character and a second character, and the grouping the plurality of strokes according to the positional relationship of the plurality of strokes and the writing order of the plurality of strokes includes: When there is a first overlapping area between a first rectangular box corresponding to the first character and a second rectangular box corresponding to the second character, determining the attribution of one or more strokes in the first overlapping area according to the writing order of the strokes of the first character and the second character and the positional relationship between the one or more strokes and the first rectangular box and the second rectangular box.
2. The method according to claim 1, wherein The determining the attribution of the one or more strokes according to the writing order of the strokes of the first character and the second character and the positional relationship between the one or more strokes in the first overlapping area and the first rectangular box and the second rectangular box includes: Determining the coordinates of the first rectangular box, the second rectangular box, and the one or more strokes according to the positional relationship between the first character and the second character; Determining the attribution of the one or more strokes according to the distance relationship between the coordinates of the first rectangular box, the second rectangular box, and the one or more strokes and the writing order of the strokes of the first character and the second character.
3. The method according to claim 1 or 2, characterized in that The first character and the second character are distributed left and right, with the first character on the left of the second character, and the one or more strokes include a first stroke. The determining the coordinates of the first rectangular box, the second rectangular box, and the one or more strokes according to the positional relationship between the first character and the second character includes: Determining a first central abscissa of the first rectangular box, a second central abscissa of the second rectangular box, and a first average abscissa of the first stroke.
4. The method according to claim 3, characterized in that The determining the attribution of the one or more strokes according to the distance relationship between the coordinates of the first rectangular box, the second rectangular box, and the one or more strokes and the writing order of the strokes of the first character and the second character includes: When the distance between the first average abscissa and the first central abscissa is greater than the distance between the first average abscissa and the second central abscissa, determining that the first stroke belongs to the second character; or When the distance between the first average abscissa and the first central abscissa is less than the distance between the first average abscissa and the second central abscissa, and the previous stroke of the first stroke belongs to the second character, determining that the first stroke belongs to the second character; or When the distance between the first average abscissa and the first central abscissa is less than the distance between the first average abscissa and the second central abscissa, and the previous stroke of the first stroke does not belong to the second character, determining that the first stroke belongs to the first character.
5. The method according to claim 1 or 2, characterized in that, The first character and the second character are arranged horizontally, with the first character on the left side of the second character. The horizontal length of the first rectangular box and / or the second rectangular box is greater than a first threshold. The one or more strokes include a first stroke. Determining the coordinates of the first rectangular box, the second rectangular box, and the one or more strokes according to the positional relationship between the first character and the second character includes: Determining the abscissa of the right border of the first rectangular box, the abscissa of the left border of the second rectangular box, and the first average abscissa of the first stroke.
6. The method according to claim 5, wherein Determining the attribution of the one or more strokes according to the distance relationship between the coordinates of the first rectangular box, the second rectangular box, and the one or more strokes and the writing order of the strokes of the first character and the second character includes: When the distance between the first average abscissa and the abscissa of the right border of the first rectangular box is greater than the distance between the first average abscissa and the abscissa of the left border of the second rectangular box, determining that the first stroke belongs to the second character; or When the distance between the first average abscissa and the abscissa of the right border of the first rectangular box is less than the distance between the first average abscissa and the abscissa of the left border of the second rectangular box, and the previous stroke of the first stroke belongs to the second character, determining that the first stroke belongs to the second character; or When the distance between the first average abscissa and the abscissa of the right border of the first rectangular box is less than the distance between the first average abscissa and the abscissa of the left border of the second rectangular box, and the previous stroke of the first stroke does not belong to the second character, determining that the first stroke belongs to the first character.
7. The method according to claim 1 or 2, characterized in that, The first character and the second character are arranged vertically, with the first character on the upper side of the second character. The one or more strokes include a first stroke. Determining the coordinates of the first rectangular box, the second rectangular box, and the one or more strokes according to the positional relationship between the first character and the second character includes: Determining the first central ordinate of the first rectangular box, the second central ordinate of the second rectangular box, and the first average ordinate of the first stroke.
8. The method according to claim 7, wherein Determining the attribution of the one or more strokes according to the distance relationship between the coordinates of the first rectangular box, the second rectangular box, and the one or more strokes and the writing order of the strokes of the first character and the second character includes: When the distance between the first average ordinate and the first central ordinate is greater than the distance between the first average ordinate and the second central ordinate, determining that the first stroke belongs to the second character; or When the distance between the first average ordinate and the first central ordinate is less than the distance between the first average ordinate and the second central ordinate, and the previous stroke of the first stroke belongs to the second character, determining that the first stroke belongs to the second character; or When the distance between the first average ordinate and the first central ordinate is less than the distance between the first average ordinate and the second central ordinate, and the preceding stroke of the first stroke does not belong to the second character, it is determined that the first stroke belongs to the first character.
9. The method according to claim 1 or 2, characterized in that, The first character and the second character are diagonally distributed, the first character is located below and to the left or above and to the left of the second character, the one or more strokes include a first stroke, and determining the coordinates of the first rectangular frame, the second rectangular frame, and the one or more strokes according to the positional relationship between the first character and the second character includes: Determining the first central coordinate of the first rectangular frame, the second central coordinate of the second rectangular frame, and the first average coordinate of the first stroke.
10. The method according to claim 9, wherein Determining the attribution of the one or more strokes according to the distance relationship between the coordinates of the first rectangular frame, the second rectangular frame, and the one or more strokes and the writing order of the strokes of the first character and the second character includes: When the distance between the first average coordinate and the first central coordinate is greater than the distance between the first average coordinate and the second central coordinate, it is determined that the first stroke belongs to the second character; or When the distance between the first average coordinate and the first central coordinate is less than the distance between the first average coordinate and the second central coordinate, and the preceding stroke of the first stroke belongs to the second character, it is determined that the first stroke belongs to the second character; or When the distance between the first average coordinate and the first central coordinate is less than the distance between the first average coordinate and the second central coordinate, and the preceding stroke of the first stroke does not belong to the second character, it is determined that the first stroke belongs to the first character.
11. The method according to claim 1 or 2, characterized in that, The first content includes one or more patterns, and the method further includes: Identifying N strokes corresponding to the one or more patterns, where N≥2 and N is an integer; Grouping the plurality of strokes according to the positional relationship between the plurality of strokes and the writing order of the plurality of strokes includes: Dividing the N strokes into M stroke groups according to the positional relationship between the N strokes, where the distance between the strokes in any two of the M stroke groups is greater than a second threshold, N≥M≥1 and M is an integer.
12. The method according to claim 11, wherein The method further includes: Dividing the first stroke group into Q stroke groups according to the writing intervals of P strokes, where the M stroke groups include the first stroke group, the first stroke group includes the P strokes, and the writing interval between two adjacent stroke groups in the Q stroke groups is greater than a third threshold, Q≥1 and Q is an integer.
13. The method according to claim 12, wherein The method further includes: Aggregating the Q stroke groups into W stroke groups according to the writing intervals of the Q stroke groups and the distance relationship between the Q stroke groups, where the writing interval between two adjacent stroke groups in the plurality of stroke groups aggregated into the same stroke group in the Q stroke groups is less than or equal to a fourth threshold and the distance is less than or equal to a fifth threshold, Q≥W≥1 and P is an integer.
14. The method according to claim 12 or 13, characterized in that The distance between any two of the Q stroke groups is greater than a sixth threshold, and the sixth threshold is less than the second threshold.
15. The method according to claim 12 or 13, characterized in that The writing interval is the time interval corresponding to two adjacent strokes in the writing order.
16. The method according to claim 1 or 2, characterized in that, The method further includes: Identifying fields and / or patterns in the first content; The grouping of the plurality of strokes according to the positional relationship and the writing order of the plurality of strokes includes: Dividing the first content into one or more regional blocks according to the positional relationship and the writing order of the field and / or the pattern; Performing column division on the first content according to the positional relationship of the one or more regional blocks to obtain one or more columns.
17. The method according to claim 16, wherein The method further includes: Sorting the regional blocks in the first column according to the positional relationship between the regional blocks in the first column, where the one or more classifications include the first column.
18. The method according to claim 16, wherein The method further includes: Sorting the fields and / or patterns in the first regional block according to the positional relationship of the fields and / or patterns in the first regional block, where the one or more regional blocks include the first regional block.
19. The method according to claim 18, wherein The fields and / or patterns in the first regional block satisfy the order from top to bottom and / or from left to right.
20. An electronic device, characterized in that, Including one or more processors; one or more memories; the one or more memories store one or more computer programs, and the one or more computer programs include instructions that, when executed by the one or more processors, cause the method according to any one of claims 1 to 19 to be executed.
21. A computer-readable storage medium, characterized in that, Computer instructions are stored in the computer-readable storage medium, and when the computer instructions run on a computer, the method according to any one of claims 1 to 19 is caused to be executed.
22. A chip, characterized in that, The chip includes a processor and a communication interface, the communication interface is used to receive a signal and transmit the signal to the processor, and the processor processes the signal, causing the method according to any one of claims 1 to 19 to be executed.
23. A computer program product, characterized in that, When the computer program product runs on a computer, the computer is caused to execute the method according to any one of claims 1 to 19.
Citation Information
Patent Citations
Online handwritten character recognition method and device, electronic equipment and storage medium
CN111931710A
Character recognition method and device, readable medium and electronic equipment
CN118057487A
Online handwritten information recognition device and method
JP2004139281A