CN110458920B - Handwriting erasing method and device - Google Patents

Handwriting erasing method and device Download PDF

Info

Publication number
CN110458920B
CN110458920B CN201810429247.3A CN201810429247A CN110458920B CN 110458920 B CN110458920 B CN 110458920B CN 201810429247 A CN201810429247 A CN 201810429247A CN 110458920 B CN110458920 B CN 110458920B
Authority
CN
China
Prior art keywords
curve
polygon
handwriting
intersection point
point
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810429247.3A
Other languages
Chinese (zh)
Other versions
CN110458920A (en
Inventor
唐曜
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Hikvision Digital Technology Co Ltd
Original Assignee
Hangzhou Hikvision Digital Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Hikvision Digital Technology Co Ltd filed Critical Hangzhou Hikvision Digital Technology Co Ltd
Priority to CN201810429247.3A priority Critical patent/CN110458920B/en
Priority to PCT/CN2019/085045 priority patent/WO2019214489A1/en
Publication of CN110458920A publication Critical patent/CN110458920A/en
Application granted granted Critical
Publication of CN110458920B publication Critical patent/CN110458920B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/80Creating or modifying a manually drawn or painted image using a manual input device, e.g. mouse, light pen, direction keys on keyboard

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Processing Or Creating Images (AREA)
  • Image Generation (AREA)

Abstract

The application provides a handwriting erasing method and a handwriting erasing device, wherein the method comprises the following steps: acquiring an erasing curve which is drawn in an erasing mode and used for erasing a handwriting curve, wherein the handwriting curve is a curve drawn in a drawing pen mode; connecting the starting point and the end point of the erasing curve to obtain a polygon; and determining a partial curve positioned in the polygon from the handwriting curve and erasing. According to the handwriting line erasing method and device, when the handwriting line is erased, any complicated handwriting can be segmented, the handwriting located in the erasing area after the segmentation is erased at one time, the handwriting erasing process can be simplified, the handwriting erasing efficiency is improved, and user experience is improved.

Description

Handwriting erasing method and device
Technical Field
The application relates to the technical field of graphics, in particular to a handwriting erasing method and device.
Background
In computer graphics processing, some drawn handwriting is usually erased in order to correct erroneous handwriting or to process the handwriting.
The existing handwriting erasing methods, such as erasing points on a polyline, erasing polygons, erasing intersection points of regular erasing areas, and the like. However, when the handwriting fold line is erased, any complicated handwriting cannot be segmented, and one-time erasing of multiple complicated handwriting cannot be realized, that is, the handwriting erasing process is complicated, the erasing efficiency is low, and the user experience is affected.
Disclosure of Invention
In view of this, the present application provides a handwriting erasing method and apparatus, which can simplify the handwriting erasing process, improve the handwriting erasing efficiency, and improve the user experience.
Specifically, the method is realized through the following technical scheme:
according to a first aspect of the present application, a method for erasing a handwriting is provided, including:
acquiring an erasing curve which is drawn in an erasing mode and used for erasing a handwriting curve, wherein the handwriting curve is a curve drawn in a drawing pen mode;
connecting the starting point and the end point of the erasing curve to obtain a polygon;
and determining a partial curve positioned in the polygon from the handwriting curve and erasing.
In one embodiment, the determining a partial curve located within the polygon from the handwriting curve includes:
determining the intersection point of the polygon and the handwriting curve;
screening out the segmentation points of the handwriting curve from the determined at least one intersection point;
and determining a partial curve positioned in the polygon in the handwriting curve according to the segmentation point and the position information of the starting point of the handwriting curve.
In one embodiment, the screening out the segmentation point of the handwriting curve from the determined at least one intersection point includes:
determining position information of each intersection point, wherein the position information of each intersection point comprises a first straight line segment from a first specified endpoint to the intersection point along the handwriting curve, a second straight line segment from the intersection point to a second specified endpoint along the handwriting curve, a third straight line segment from a third specified endpoint to the intersection point along the edge of the polygon, and a fourth straight line segment from the intersection point to a fourth specified endpoint along the edge of the polygon; the first designated endpoint and the second designated endpoint are endpoints on the handwriting curve closest to the intersection point, and the third designated endpoint and the fourth designated endpoint are endpoints on the edge of the polygon closest to the intersection point;
determining a first target line of each intersection point according to the first straight line segment and the second straight line segment of each intersection point, and determining a second target line of each intersection point according to the third straight line segment and the fourth straight line segment of each intersection point;
determining a positional relationship between the first target line and the second target line;
determining whether the intersection point is a crossing intersection point or not according to the position relation;
and if the intersection point is determined to be a crossing intersection point, determining the intersection point as a segmentation point of the handwriting curve.
In an embodiment, the determining whether the intersection point is a crossing intersection point according to the position relationship includes:
if the position relation is a first relation for representing that the first target line passes through the second target line, determining the intersection point as a passing intersection point;
if the position relation is a second relation used for representing that the first target line does not cross the second target line, determining that the intersection point is a non-crossing intersection point;
and if the position relation is a third relation used for representing that the first target line and the second target line are overlapped to separate from each other or a fourth relation used for representing that the first target line and the second target line are separated to overlap with each other, determining that the intersection point is a crossing intersection point or a non-crossing intersection point according to a limit thought.
In an embodiment, the determining a partial curve of the handwriting curve located within the polygon according to the segmentation point and the information of the position of the starting point of the handwriting curve includes:
determining whether the starting point of the handwriting curve is positioned inside or outside the polygon according to the position information of the starting point of the handwriting curve;
if the starting point is located in the polygon, determining an odd-numbered curve as a partial curve located in the polygon, wherein the odd-numbered curve is a curve with an odd number obtained by dividing the handwriting curve based on a dividing point;
and if the starting point is positioned outside the polygon, determining an even-numbered curve as a partial curve positioned inside the polygon, wherein the even-numbered curve is a curve with an even number obtained by segmenting the handwriting curve based on a segmentation point.
In an embodiment, the determining whether the starting point of the handwriting curve is located inside or outside the polygon according to the starting point position information of the handwriting curve includes:
determining whether the starting point is located on an edge of the polygon;
if not, judging whether the starting point is positioned inside or outside the polygon by utilizing a winding number WindingNumber algorithm based on the starting point position information of the handwriting curve;
if so, moving a simulation point along the handwriting curve from the starting point, and when the simulation point leaves the edge line of the polygon for the first time, if the simulation point is currently located in the polygon, determining that the starting point is located outside the polygon; otherwise, determining that the starting point is located within the polygon.
According to a second aspect of the present application, there is provided a handwriting erasing apparatus comprising:
the erasing curve acquiring module is used for acquiring an erasing curve which is drawn in an erasing mode and used for erasing a handwriting curve, and the handwriting curve is drawn in a pen drawing mode;
the polygon obtaining module is used for connecting the starting point and the end point of the erasing curve to obtain a polygon;
and the handwriting curve erasing module is used for determining a partial curve positioned in the polygon from the handwriting curve and erasing the partial curve.
In one embodiment, the handwriting curve erasing module includes:
the handwriting intersection point determining unit is used for determining the intersection point of the polygon and the handwriting curve;
the segmentation point determining unit is used for screening out segmentation points of the handwriting curve from the determined at least one intersection point;
and the partial curve determining unit is used for determining a partial curve positioned in the polygon in the handwriting curve according to the segmentation point and the position information of the initial point of the handwriting curve.
In an embodiment, the segmentation point determination unit is configured to:
determining position information of each intersection point, wherein the position information of each intersection point comprises a first straight line segment from a first specified endpoint to the intersection point along the handwriting curve, a second straight line segment from the intersection point to a second specified endpoint along the handwriting curve, a third straight line segment from a third specified endpoint to the intersection point along the edge of the polygon, and a fourth straight line segment from the intersection point to a fourth specified endpoint along the edge of the polygon; the first designated endpoint and the second designated endpoint are endpoints on the handwriting curve closest to the intersection point, and the third designated endpoint and the fourth designated endpoint are endpoints on the edge of the polygon closest to the intersection point;
determining a first target line of each intersection point according to the first straight line segment and the second straight line segment of each intersection point, and determining a second target line of each intersection point according to the third straight line segment and the fourth straight line segment of each intersection point;
determining a positional relationship between the first target line and the second target line;
determining whether the intersection point is a crossing intersection point or not according to the position relation;
and when the intersection point is determined to be a crossing intersection point, determining the intersection point as a segmentation point of the handwriting curve.
In an embodiment, the segmentation point determination unit is further configured to:
if the position relation is a first relation for representing that the first target line passes through the second target line, determining the intersection point as a passing intersection point;
if the position relation is a second relation used for representing that the first target line does not cross the second target line, determining that the intersection point is a non-crossing intersection point;
and if the position relation is a third relation used for representing that the first target line and the second target line are overlapped to separate from each other or a fourth relation used for representing that the first target line and the second target line are separated to overlap with each other, determining that the intersection point is a crossing intersection point or a non-crossing intersection point according to a limit thought.
In an embodiment, the partial curve determination unit is further configured to:
determining whether the starting point of the handwriting curve is positioned inside or outside the polygon according to the position information of the starting point of the handwriting curve;
when the starting point is positioned in the polygon, determining an odd-numbered curve as a partial curve positioned in the polygon, wherein the odd-numbered curve is a curve with an odd number obtained by dividing the handwriting curve based on a dividing point;
and when the starting point is positioned outside the polygon, determining an even-numbered curve as a partial curve positioned inside the polygon, wherein the even-numbered curve is a curve with an even number obtained by segmenting the handwriting curve based on a segmentation point.
In an embodiment, the partial curve determination unit is further configured to:
determining whether the starting point is located on an edge of the polygon;
if not, judging whether the starting point is positioned inside or outside the polygon by utilizing a winding number WindingNumber algorithm based on the starting point position information of the handwriting curve;
if so, moving a simulation point along the handwriting curve from the starting point, and when the simulation point leaves the edge line of the polygon for the first time, if the simulation point is currently located in the polygon, determining that the starting point is located outside the polygon; otherwise, determining that the starting point is located within the polygon.
According to a third aspect of the present application, there is provided an electronic device comprising:
a processor;
a memory configured to store processor-executable instructions;
wherein the processor is configured to perform any of the handwriting erasing methods described above.
According to a fourth aspect of the present application, a computer-readable storage medium is proposed, on which a computer program is stored, which program, when being processed by a processor, implements any of the handwriting erasing methods described above.
The handwriting erasing method and the handwriting erasing device are used for erasing the handwriting curve by obtaining the erasing curve drawn in the erasing mode, connecting the starting point and the end point of the erasing curve to obtain a polygon, and further determining the position of the partial curve in the polygon in the handwriting curve and erasing, and can realize the segmentation of any complicated handwriting when the handwriting folding line is erased, and can erase the handwriting in the erasing area at one time after the segmentation, so that the handwriting erasing process can be simplified, the handwriting erasing efficiency is improved, and the user experience can be improved.
Drawings
FIG. 1A is a flow chart illustrating a method for handwriting erasure according to an exemplary embodiment of the present application;
FIG. 1B is a diagram illustrating an effect of a method for erasing pen-based data according to an exemplary embodiment of the present application;
FIG. 2A is a flow chart illustrating how to determine a partial curve located within the polygon from the handwriting curve according to an exemplary embodiment of the present application;
FIG. 2B is a flow chart illustrating how the intersection of the polygon with the handwriting curve is determined in accordance with an exemplary embodiment of the present application;
FIG. 3 is a flow chart illustrating how to screen out the segmentation points of the handwriting curve from the determined at least one intersection point according to an exemplary embodiment of the present application;
FIG. 4A is a flow chart illustrating a determination of whether the intersection is a crossing intersection based on the positional relationship according to an exemplary embodiment of the present application;
FIG. 4B is a diagram illustrating a position relationship between a polyline of a handwriting curve and an edge of a polygon associated with an intersection point according to an exemplary embodiment of the present application;
FIG. 4C is a schematic diagram illustrating a positional relationship between a polyline of a handwriting curve and an edge of a polygon associated with an intersection point according to yet another exemplary embodiment of the present application;
FIG. 5A is a flowchart illustrating how to determine a partial curve of the handwriting curve located within the polygon according to the segmentation points and the information of the positions of the starting points of the handwriting curve according to an exemplary embodiment of the present application;
FIG. 5B is a diagram illustrating a segmentation of a handwriting curve according to the segmentation points and the position information of the starting points of the handwriting curve according to an exemplary embodiment of the present application;
FIG. 6 is a flowchart illustrating how to determine whether the starting point of the handwriting curve is inside or outside the polygon according to the position information of the starting point of the handwriting curve;
FIG. 7 is a block diagram of a pen erasing apparatus according to an exemplary embodiment of the present application;
FIG. 8 is a block diagram of a pen erasing apparatus according to another exemplary embodiment of the present application;
fig. 9 is a block diagram illustrating an electronic device according to an exemplary embodiment of the present application.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this application and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It is to be understood that although the terms first, second, third, etc. may be used herein to describe various information, such information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the present application. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
The existing handwriting erasing methods, such as erasing points on a polygonal line, erasing polygons, erasing intersection points of regular erasing areas, and the like, cannot realize the segmentation of any complicated handwriting and cannot realize the one-time erasing of a plurality of complicated handwriting when the polygonal line of the handwriting is erased, and the handwriting erasing methods usually delete existing line segments or split at end points, which are not flexible enough to accurately erase according to the intention of a user, thereby consuming a lot of time and improving the space complexity of the algorithm, but the embodiment can erase the curve of the handwriting by drawing the erasing curve on the curve of the handwriting to segment the curve of the polygon formed according to the erasing curve, thereby realizing the one-time erasing of the curve of the handwriting located inside the polygon, and reducing the space complexity of the algorithm, the accuracy of handwriting erasing is improved, and therefore the continuity of an erasing mode is greatly improved.
FIG. 1A is a flow chart illustrating a method for handwriting erasure according to an exemplary embodiment of the present application; FIG. 1B is a diagram illustrating an effect of a method for erasing pen-based data according to an exemplary embodiment of the present application; the embodiment can be used for terminal equipment such as smart phones, tablet computers, PCs, PDAs (Personal Digital assistants), wearable equipment and the like. As shown in fig. 1A, the method includes steps S101-S103:
s101: and acquiring an erasing curve which is drawn in the erasing mode and used for erasing the handwriting curve, wherein the handwriting curve is a curve drawn in the pen drawing mode.
In one embodiment, the writing interface of the terminal device can have a pen drawing mode and an erasing mode.
In the pen drawing mode, a user can draw a continuous curve with any length on a writing interface of the terminal device through a writing tool (such as a stylus, a finger or a mouse), and the curve is a handwriting curve which can be self-intersected. After the user draws the handwriting curve, the handwriting curve can be displayed on the writing interface, and the handwriting curve can be described as a set of a series of points, which is recorded as Vector < Point > Path (representing an array formed by the points of the handwriting curve). It is worth noting that the curves in the embodiments of the present invention (including handwriting curves and erasure curves) are all non-smooth broken lines in the underlying implementation, but appear visually as a single curve due to the large number of points.
In an embodiment, after the user draws one or more curves based on the above process, the writing interface may be switched from the pen drawing mode to the erasing mode, and then a curve may be drawn on the writing interface at will by using the writing tool, the curve is the erasing curve, and it may also be self-intersecting. After the user has drawn the erase curve, the erase curve may be displayed on the writing interface, and the erase curve may be described as a set of a series of points, which is denoted as Vector < Point > erase path (which represents an array formed by the points of the erase curve).
S102: and connecting the starting point and the end point of the erasing curve to obtain a polygon.
In an embodiment, during the drawing process of the erasure curve, the terminal device may connect the starting point (i.e. the pen-down point of the user) and the end point (i.e. the current point of movement) of the erasure curve with a line segment, so that the erasure curve is closed to form a polygon.
S103: and determining a partial curve positioned in the polygon from the handwriting curve and erasing.
In one embodiment, since the erasure curve is connected end to form a polygon, the edge of the polygon can divide the handwriting curve on the writing interface into two curves according to the parity determination criteria of the polygon: one is a partial curve located within the polygon (i.e., the erased area); and the second is a partial curve outside the polygon.
Wherein, the odd-even judgment criterion of the polygon is as follows: a ray is led to any direction (for example, to the left) from a point to be judged, the number of intersection points of the ray and the side line of the polygon is calculated, and if the number of the intersection points is an even number (including 0), the point is out of the polygon; if the number of the fruit intersection points is odd, the points are in the polygon.
In one embodiment, when the partial curve located inside the polygon in the handwriting curve is determined, the partial curve located inside the polygon may be deleted, and the partial curve located outside the polygon may be displayed.
Visually, the part of the handwriting curve located inside the erasing area (polygon) disappears, and the part located outside the erasing area is preserved. As shown in FIG. 1B, after the handwriting curve A-B-C-D-E is divided into AA ', A' B ', B' BCC ', C' DD ', and D' E by the polygon P1-P2-P3-P4-P5, A 'B' and C 'DD' are within the polygon and will be deleted once, and the final erasing result is: AA ', B' BCC ', D' E.
As can be seen from the above description, in the embodiment, the erasing curve for erasing the handwriting curve drawn in the erasing mode is obtained, the starting point and the end point of the erasing curve are connected to obtain the polygon, and then the partial curve located in the polygon is determined and erased from the handwriting curve.
FIG. 2A is a flow chart illustrating how to determine a partial curve located within the polygon from the handwriting curve according to an exemplary embodiment of the present application; on the basis of the above embodiments, the present embodiment exemplifies how to determine the partial curve located within the polygon from the handwriting curve. As shown in fig. 2A, the determining a partial curve located inside the polygon from the handwriting curve in step S103 may include the following steps S201 to S203:
s201: and determining the intersection point of the polygon and the handwriting curve.
In one embodiment, the purpose of drawing the erase curve is to divide a complete handwriting curve into a plurality of line segments, and the division points of the line segments are located at the intersection positions of the boundaries of the polygon formed by the handwriting curve and the erase curve.
In an embodiment, the method for determining the intersection point of the polygon and the handwriting curve may be selected by a developer according to actual service needs, for example, using a segment tree SegmentTree algorithm or a scan line SweepLine algorithm, which is not limited in this embodiment.
In one embodiment, the above-mentioned manner of determining the intersection point of the polygon and the handwriting curve can be referred to the embodiment shown in fig. 2B, which will not be described in detail.
S202: and screening out the segmentation points of the handwriting curve from the determined at least one intersection point.
In one embodiment, after a plurality of intersection points of the polygon of the erasing curve and the handwriting curve are determined, a segmentation point for segmenting the handwriting curve can be screened out from the intersection points.
It should be noted that not all the intersection points are the dividing points, because the intersection points include crossing intersection points (intersection points formed by the handwriting curves crossing the polygon edges) and non-crossing intersection points (intersection points formed by the handwriting curves not crossing the polygon edges), and therefore the intersection points of the polygon and the handwriting curves can be determined first, and on the basis of the intersection points, the crossing intersection points are determined as the dividing points.
In one embodiment, the manner of screening out the segmentation point of the handwriting curve from the determined at least one intersection point may be referred to the following embodiment shown in fig. 3, which will not be described in detail herein.
S203: and determining a partial curve positioned in the polygon in the handwriting curve according to the segmentation point and the position information of the starting point of the handwriting curve.
In an embodiment, after the segmentation point of the handwriting curve is determined, the position relationship of the starting point of the handwriting curve relative to the polygon may be determined according to the position information of the starting point of the handwriting curve (e.g., the coordinates of the starting point of the handwriting curve), and then the partial curve in the handwriting curve located within the polygon may be determined according to the odd-even decision criterion of the polygon.
As can be seen from the above description, in this embodiment, by determining intersection points of the polygon and the handwriting curve, and screening a dividing point of the handwriting curve from at least one determined intersection point, and then determining a partial curve located within the polygon in the handwriting curve according to the dividing point and the initial point position information of the handwriting curve, it is possible to accurately determine a partial curve located within the polygon from the handwriting curve, and further realize subsequent division of any complicated handwriting, and perform one-time erasing on the handwriting located in an erasing area after division, which can simplify a handwriting erasing process, improve the efficiency of handwriting erasing, and improve user experience.
FIG. 2B is a flow chart illustrating how the intersection of the polygon with the handwriting curve is determined in accordance with an exemplary embodiment of the present application; on the basis of the above embodiments, the present embodiment exemplifies how to determine the intersection point of the polygon and the handwriting curve. As shown in FIG. 2B, the determining the intersection point of the polygon and the handwriting curve in the above step S201 may include the following steps S211-S212:
s211: and constructing a segment tree segmentTree by taking the edge of the polygon as an element.
In an embodiment, after obtaining the Vector < Point > Path corresponding to the handwriting curve and the Vector < Point > erasure Path corresponding to the polygon, the segment tree SegmentTree may be constructed according to each edge of the polygon as an element.
It should be noted that, reference may be made to related technologies for the construction method of the segment tree SegmentTree, and this embodiment is not particularly limited thereto.
S212: and determining at least one intersection point of the polygon and the handwriting curve by using the segmentTree.
In an embodiment, after the SegmentTree is constructed, the intersection point of the polygon and the handwriting curve can be calculated by using the constructed SegmentTree.
It should be noted that, in practical implementation, a block of erasing area may be used to erase multiple scripts simultaneously, so that the line segment tree constructed by using the edges of the polygon as elements may be reused until all intersection points of the polygon and the handwriting curve are calculated.
As can be seen from the above description, in this embodiment, a segment tree SegmentTree is constructed by using the edge of the polygon as an element, and at least one intersection point of the polygon and the handwriting curve is determined by using the SegmentTree, so that the intersection point of the polygon and the handwriting curve can be accurately determined.
FIG. 3 is a flow chart illustrating how to screen out the segmentation points of the handwriting curve from the determined at least one intersection point according to an exemplary embodiment of the present application; on the basis of the above embodiments, the present embodiment exemplifies how to screen the segmentation point of the handwriting curve from the determined at least one intersection point. As shown in FIG. 3, the step S202 of screening out the segmentation points of the handwriting curve from the determined at least one intersection point may include the following steps S301-S305:
s301: position information for each of the intersections is determined.
The position information of the intersection point comprises a first straight line segment from a first designated endpoint to the intersection point along the handwriting curve (such as a prefix line segment of the handwriting curve associated with the intersection point), a second straight line segment from the intersection point along the handwriting curve to a second designated endpoint (such as a suffix line segment of the handwriting curve associated with the intersection point), a third straight line segment from a third designated endpoint to the intersection point along the polygon edge (such as a prefix edge of the polygon associated with the intersection point), and a fourth straight line segment from the intersection point along the polygon edge to a fourth designated endpoint (such as a suffix edge of the polygon associated with the intersection point).
It should be noted that the first specified endpoint and the second specified endpoint are endpoints on the handwriting curve closest to the intersection point, and the third specified endpoint and the fourth specified endpoint are endpoints on the edge of the polygon closest to the intersection point.
For example, if a broken line of the handwriting curve is divided into two segments by the intersection, the segment drawn first of the two segments may be referred to as a prefix segment (i.e., the segment with the intersection as the end point) and the segment drawn later may be referred to as a suffix segment (i.e., the segment with the intersection as the start point) according to the drawing order of the handwriting curve.
Similarly, if one edge of the polygon is divided into two line segments by the intersection, the line segment drawn first of the two line segments may be referred to as a prefix edge (i.e., an edge whose end point is the intersection), and the line segment drawn later may be referred to as a suffix edge (i.e., an edge whose starting point is the intersection), in the drawing order of the edge lines.
In an embodiment, the calculating of the position information of the intersection point may include calculating the position information parameter of each intersection point after determining each intersection point, where the parameter includes: an index of a prefix line segment associated with the intersection (e.g., a number of the prefix line segment), a position metric of the intersection on the prefix line segment, an index of a suffix line segment associated with the intersection (e.g., a number of the suffix line segment), a position metric of the suffix line segment associated with the intersection, an index of a prefix edge associated with the intersection (e.g., a number of the prefix edge), a position metric of the intersection on the prefix edge, an index of a suffix edge associated with the intersection (e.g., a number of the suffix edge), a position metric of the intersection on the suffix edge, and a coordinate of the intersection (e.g., x, y).
It should be noted that, in an actual implementation, a developer may select part or all of the location information according to specific needs, and this embodiment does not limit this.
S302: and determining a first target line of each intersection point according to the first straight line segment and the second straight line segment of each intersection point, and determining a second target line of each intersection point according to the third straight line segment and the fourth straight line segment of each intersection point.
In one embodiment, after determining the first straight line segment and the second straight line segment, and the third straight line segment and the fourth straight line segment of each intersection point, a first target line of the intersection point (hereinafter, referred to as a broken line of the handwriting curve) may be determined according to the first straight line segment and the second straight line segment; and determining a second target line (hereinafter, referred to as a polygon edge) of each intersection point according to the third straight line segment and the fourth straight line segment of the intersection point.
S303: determining a positional relationship between the first target line and the second target line.
In one embodiment, after determining the first target line and the second target line for each intersection point, the positional relationship between the first target line and the second target line may be determined.
In one implementation, the position relationship may include a crossing through relationship, a non-crossing node _ through relationship, a coincidence to a leaving core _ leave relationship, or a separation to a coincidence away core _ core relationship, wherein the crossing through relationship is used to represent that the first target line crosses the second target line; the non-crossing not _ through relation is used for representing a second relation that the first target line does not cross the second target line; the coincidence-to-departure coincide _ leave relation is used for representing that the first target line and the second target line are coincided to depart; the split-to-coincident away _ coincide relationship is used to characterize the first target line and the second target line from split to coincident.
S304: and determining whether the intersection point is a crossing intersection point or not according to the position relation.
And the crossing intersection point is used for representing that the broken line where the intersection point is located crosses the side line of the polygon.
In an embodiment, after determining a position relationship between the first target line and the second target line associated with the intersection point (i.e. a position relationship between a polygonal line of an associated handwriting curve and an edge of a polygon), whether the polygonal line where the intersection point is located passes through the edge of the polygon may be determined according to the position relationship, and if so, the intersection point may be determined to be a passing intersection point; if not, the intersection point can be determined to be a non-crossing intersection point.
In an embodiment, a corresponding relationship between the position relationship and the crossing intersection or the non-crossing intersection may be pre-constructed, and then the corresponding relationship may be queried after the position relationship is determined, so as to determine that the intersection is the crossing intersection or the non-crossing intersection.
In an embodiment, the above-mentioned manner of determining whether the intersection is a crossing intersection according to the position relationship can also be referred to the embodiment shown in fig. 4A described below, and will not be described in detail herein.
S305: and if the intersection point is determined to be a crossing intersection point, determining the intersection point as a segmentation point of the handwriting curve.
In one embodiment, after the crossing intersection points are screened out from the intersection points, the crossing intersection points can be determined as segmentation points for subsequently segmenting the handwriting curve.
As can be seen from the above description, in this embodiment, the position information of each intersection point is calculated, the position relationship between the polygonal line of the handwriting curve associated with the intersection point and the edge line of the polygon is determined according to the position information of each intersection point, and then whether the intersection point is a crossing intersection point is determined according to the position relationship, and when the intersection point is determined to be a crossing intersection point, the intersection point is determined as a dividing point for dividing the handwriting curve, so that the dividing point for dividing the handwriting curve can be accurately screened out from a plurality of intersection points, and then the subsequent division of the handwriting curve based on the dividing point can be realized, any complicated handwriting can be divided, and the handwriting located in the erasing area after the division can be erased at one time, so that the handwriting erasing process can be simplified, the handwriting erasing efficiency can be improved, and the user experience can be improved.
FIG. 4A is a flow chart illustrating a determination of whether the intersection is a crossing intersection based on the positional relationship according to an exemplary embodiment of the present application; FIG. 4B is a diagram illustrating a position relationship between a polyline of a handwriting curve and an edge of a polygon associated with an intersection point according to an exemplary embodiment of the present application; FIG. 4C is a schematic diagram illustrating a positional relationship between a polyline of a handwriting curve and an edge of a polygon associated with an intersection point according to yet another exemplary embodiment of the present application;
on the basis of the above embodiments, the present embodiment takes an example of determining whether the intersection is a crossing intersection according to the position relationship. As shown in fig. 4A, the determining whether the intersection is a crossing intersection according to the position relationship in step S304 may include the following steps S401 to S405:
s401: determining whether the positional relationship is a first relationship (i.e., crossing a through relationship); if yes, go to step S402; if not, step S403 is executed.
S402: and determining the intersection point as a crossing intersection point.
S403: determining whether the positional relationship is a second relationship (i.e., a non-traversing not-through relationship); if yes, go to step S404; if not, go to step S405.
S404: and determining the intersection point as a non-crossing intersection point.
S405: and determining the intersection points to be crossing intersection points or non-crossing intersection points according to the limit idea.
For example, as shown in fig. 4B, for the intersection point P0, if the polygonal line of the associated handwriting curve (hereinafter referred to as the polygonal line) is P2-P0-P1 and the edge of the associated polygon is P4-P0-P3, as can be seen from fig. 4B, the polygonal line P2-P0-P1 crosses the edge P4-P0-P3 of the polygon, the position relationship can be determined as crossing the through relationship, and in this case, the intersection point P0 can be determined as the crossing intersection point;
however, if the broken line of the handwriting curve associated with the intersection point P0 (hereinafter referred to as the broken line) is P2-P0-P1 and the edge of the associated polygon is P5-P0-P6, as can be seen from FIG. 4B, the broken line P2-P0-P1 does not cross the edge of the polygon P5-P0-P6 (i.e., the two edges of P2-P0-P1 are located on the same side of the edge of the polygon P5-P0-P6), then the position relationship can be determined to be a non-crossing not _ through relationship, in which case, the intersection point P0 can be determined to be a non-crossing intersection point.
From the above description, it is simple to determine whether the intersection point is a crossing intersection point or a non-crossing intersection point according to the through relationship and the not _ through relationship, and a method for determining whether the intersection point is a crossing intersection point or a non-crossing intersection point according to the relationship from coincidence to leaving and the relationship from coincidence to away from the node _ node will be described below.
As shown in FIG. 4C, for the intersection point P0, if the polyline of the associated handwriting curve is P2-P0-P1, i.e. the prefix line segment is P2-P0, the suffix line segment is P0-P1, and the prefix edge of the polygon associated with the intersection point P0 is F1-P0, and the suffix edge of the associated polygon is P0-P3, the relationship can be determined as a coincide-leave relationship, i.e. the first half P2-P0 of the handwriting curve P2-P0-P1 coincides with the edge F1-P0 of the polygon (coincide), and the second half P0-P1 does not coincide with the edge P0-P3 of the polygon, but leaves the edge of the polygon (leave), thus the relationship is determined as coincide _ leave, i.e. from coincidence to leaving.
However, if the polyline of the handwriting curve associated with the intersection point P0 is P1-P0-P2, i.e., the prefix line segment is P1-P0, the suffix line segment is P0-P2, and the edge of the polygon associated with the intersection point P0 is P3-P0-F1 (or F1-P0-P3), then the relationship can be determined as always _ coincide, i.e., the first half P1-P0 of the handwriting curve P1-P0-P2 does not coincide with the edge F1-P0 of the polygon (always), and the second half P0-P2 coincides with the edge P0-F1 of the polygon (coincide), i.e., from separation to coincidence (always _ coincide).
In an embodiment, for the position relationship being a coordinate _ leave relationship or an away _ coordinate relationship, the intersection may be determined to be a crossing intersection or a non-crossing intersection according to the concept of a limit, which is explained in detail below.
Generally speaking, judging whether the broken line of any handwriting curve passes through the polygon only needs to judge whether the line segment is intersected with the side line of the polygon. However, in practical implementations, situations may occur in which the polyline coincides with an edge of the polygon (i.e., the erased area), or the end point of the handwriting curve falls on the erased area boundary, and so on. For these situations, it is difficult to determine whether the polygonal line of the handwriting curve passes through the edge line of the polygon, and once a determination error occurs, the handwriting partially inside the erasing area is not erased, or the handwriting outside the erasing area is erased, which may result in the accuracy of erasing the handwriting being reduced. In the embodiment, a certain point on a broken line of a handwriting curve is assumed to be positioned at a certain side of a polygon edge, a limit thought is utilized, a superposed line segment is regarded as infinitely approaching the edge from one side of the polygon edge, the side where the superposed line segment is positioned is recorded, and the subsequent result of not changing the record is specified, so that the degradation situation can be completely converted into the non-degradation situation, and the engineering implementation complexity is reduced to a certain extent.
With continued reference to FIG. 4C, when P2-P0 and F1-P0 coincide, it can be assumed that there exists a point Q on F1-P0, which is located at one side of P2-P0 and infinitely close to P2-P0 (e.g., the topological location of Q is located at the location of Q1 in FIG. C). On the basis, the edge lines F1-P0 of the polygon can be regarded as curves F1-Q1-P0, and further the situation that F1-P0 is located on the side of the polygon and the coincide is converted into non-coincide can be determined.
It should be noted that when determining the crossing condition of the intersection point F1 (i.e. determining that it is a crossing intersection point or a non-crossing intersection point), since the positional relationship between P2-P0 and F1-P0 is calculated for the first time, it can be assumed that Q is located at a certain side of P2-P0 (e.g. the position of Q1 shown in fig. 4C), so that the line segment F1-P0 can be approximated by the curves F1-Q1-P0, and the conclusion can be reached: not _ through (i.e., the fold line P4-F1-P0 is equivalent to P4-F1-Q1 and does not cross P2-F1-P0).
On this basis, when determining the crossing of the intersection point P0, the position of Q cannot be arbitrarily specified again, but the previous assumption should be continued, assuming that Q is still located at the position of Q1 shown in fig. 4C of P2-P0.
For example, if the currently specified Q is located on the other side of P2-P0 (i.e., the position of Q2 in FIG. 4C), then the conclusion is: F1-P0-P3 (i.e., Q2-P0-P3) crosses the fold line P2-P0-P1. If the point P4 is assumed to be located outside the polygon, the P4-F1 is located outside the polygon, and the positional relationship between the P4-F1-P0 (i.e. the P4-F1-Q1) and the P2-P0 is a not _ through relationship, that is, the F1-P0 is also determined to be located outside the polygon; whereas the positional relationship of F1-P0-P3 (i.e., Q2-P0-P3) and P2-P0 is through, since each through will change topological properties (i.e., "inner" will become "outer" through a through and "outer" will become "inner" through a through), then it can be determined that P0-P3 is inside the polygon. However, as can be seen from the graph of fig. 4C, P0-P3 is located on the same side of the polygon as P4-F1, i.e., P0-P3 is also located outside the polygon, which indicates that when the crossing condition of the intersection point P0 is determined, i.e., the positional relationship of P2-P0 and F1-P0 is determined again, the topological position of Q can not be designated at will, and the calculation using the topological position Q1 should be continued using the previous assumption.
In general, when determining the position relationship between P2-P0 and F1-P0 (i.e. determining the crossing condition of the intersection points F1 and P0), information can be recorded by using an intermediate variable IdMap. When the crossing condition of the intersection point F1 is determined, namely the position relation of P2-P0 and F1-P0 is calculated for the first time, the key is the id pair (id1 and id2) of P2-P0 and F1-P0, the value of left (the position of Q1 in FIG. 4C) of the left side of P2-P0 is used as Q, and the obtained key-value pair is inserted into IdMap.
Then, when the crossing condition of the intersection point P0 is determined, the positions of P2-P0 and F1-P0 are determined to be coincide again, at this time, the topological position of Q needs to be determined again, at this time, whether a key (F1-P0: id1, P2-P0: id2) already exists in IdMap is searched, if so, the value (left) is taken out, an infinite approximation point Q1 is constructed by using left, and F1-P0-P3 is replaced by Q1-P0-P3 for determination, so that the conclusion of not _ through can be obtained, and the conclusion is correct through verification (the topological attribute does not change, P3-P0 and P4-F1 are located on the same side of P2-P0), and accordingly, the determination result can be obtained: P4-F1, F1-Q1, Q1-P0 and P0-P3 are all located outside the polygon (the assumption that the previous point P4 is located outside the polygon is still used), i.e. both intersection points F1 and P0 are non-crossing intersection points.
It should be noted that in practical implementation, it is not necessary to actually calculate the geometric position of Q, and it is sufficient to calculate its topological position (left or right).
As can be seen from the above description, in this embodiment, it is determined that the position relationship between the polygonal line and the polygonal line of the handwriting curve associated with the intersection point is a crossing through relationship, a non-crossing not crossing node _ through relationship, a coincidence relationship to a leaving core _ leave relationship, or a separation relationship to a coincidence alpha _ core relationship, and then it is determined whether the intersection point is a crossing intersection point according to the obtained position relationship, so that it can be accurately determined whether each intersection point is a crossing intersection point, and further it can be realized that a segmentation point of a segmentation handwriting curve is screened out from the intersection points, and it is realized that the handwriting curve is subsequently segmented based on the segmentation point, any complicated handwriting can be segmented, and the segmented handwriting is erased at one time, so that the purposes of simplifying the handwriting erasing process, improving the handwriting erasing efficiency, and improving the user experience are achieved.
In the prior art, a method for judging whether a handwriting curve is located in an erasing area generally refers to that the handwriting curve is regarded as a broken line, and then two end points of the broken line are judged, but only whether the two end points are respectively located in a polygon can be judged, and for a non-convex polygon, even if the two end points of a line segment are located in the polygon, the whole broken line cannot be judged to be located in the polygon. Moreover, when the erasing area is complex, it is necessary to sequentially calculate whether each end point is located in the erasing area and whether each end point is located in the polygon, and for the complex polygon, it is also necessary to sequentially compare each edge, and the calculation amount is large. In the embodiment, by using the odd-even judgment criterion of the polygon, the topological property of the handwriting curve relative to the polygon is changed once after the handwriting curve crosses the edge of the polygon, namely from inside to outside or from outside to inside, so that the order of the intersection points and whether the handwriting curve crosses the polygon at each intersection point or not are only required to be determined, a large amount of calculation can be omitted, and the interface response delay after erasing is reduced. Moreover, any polygon can be validated instead of being validated only for the convex polygon convex or some polygons satisfying specific conditions like some methods, that is, any complicated erasing area can be supported theoretically.
FIG. 5A is a flowchart illustrating how to determine a partial curve of the handwriting curve located within the polygon according to the segmentation points and the information of the positions of the starting points of the handwriting curve according to an exemplary embodiment of the present application; FIG. 5B is a diagram illustrating the segmentation of the handwriting curve according to the segmentation points and the position information of the starting points of the handwriting curve according to an exemplary embodiment of the present application.
On the basis of the above embodiments, this embodiment exemplifies how to determine a partial curve of the handwriting curve located within the polygon according to the segmentation point and the information of the position of the starting point of the handwriting curve. As shown in fig. 5A, the determining a partial curve of the handwriting curve located within the polygon according to the segmentation point and the information of the position of the starting point of the handwriting curve in step S203 may include the following steps S501 to S503:
s501: determining whether a starting point of the handwriting curve is located inside or outside the polygon; if yes, go to step S502; if not, go to step S503.
In one embodiment, after determining the information of the position of the starting point of the handwriting curve, it may be determined whether the starting point of the handwriting curve is located inside or outside the polygon according to the information.
In one implementation, the corresponding areas inside and outside the polygon may be determined according to the position information of each end point of the polygon and the connection relationship between adjacent end points, and then whether the starting point is located inside or outside the polygon may be determined according to the position information of the starting point of the handwriting curve.
In one embodiment, the above-mentioned manner of determining whether the starting point of the handwriting curve is located inside or outside the polygon can also be referred to the following embodiment shown in fig. 6, which will not be described in detail herein.
S502: and determining the curves with the odd number segments as partial curves positioned in the polygon. The odd-numbered curve is a curve with an odd number obtained by dividing the handwriting curve based on a dividing point, such as a curve with a number of 1, 3, 5 … … (2n +1), and the like.
S503: and determining the even-numbered curve segment as a partial curve located in the polygon. The even-numbered curve is a curve with an even number, such as a curve with a number of 2, 4, 5 … … (2n) and the like, obtained by dividing the handwriting curve based on a dividing point.
In an embodiment, after obtaining each segmentation point, the coordinates of each segmentation point and the sequence of the segmentation points on the handwriting curve can be recorded, and further the handwriting curve can be segmented according to the position of the starting point of the obtained handwriting curve relative to the polygon.
For example, as shown in FIG. 5B, P0-P1-P2-P3-P4-P5 represents a handwriting curve, and the resulting segmentation points (i.e., crossing intersection points) are C1, C2 and C3, then the handwriting curve can be segmented into the following multi-segment sub-curves:
(1)P0-C1;(2)C1-P1-P2-C2;(3)C2-P3-C3;(4)C3-P4-P5。
on the basis, the position of the multi-segment sub-curve relative to the polygon can be determined according to the position of the starting point P0 of the handwriting curve relative to the polygon, as shown in the following table I:
watch 1
Figure GDA0002912040630000191
As can be seen from the above table, if the starting point P0 is located outside the polygon, the sub-curve of the odd-numbered segment (i.e., segment 1: P0-P1, segment 3: C2-P3-C3) is determined as the second partial curve located outside the polygon, and the sub-curve of the even-numbered segment (i.e., segment 2: C1-P1-P2-C2, segment 4: C3-P4-P5) is determined as the first partial curve located inside the polygon.
And if the starting point P0 is located within the polygon, determining the sub-curve of the odd-numbered segment (i.e. segment 1: P0-P1, segment 3: C2-P3-C3) as the first partial curve located within the polygon, and determining the sub-curve of the even-numbered segment (i.e. segment 2: C1-P1-P2-C2, segment 4: C3-P4-P5) as the first partial curve located outside the polygon.
It should be noted that if it is determined that the starting point is located on the edge of the polygon, not inside or outside the polygon, the embodiment shown in fig. 6 below can be referred to, and detailed description thereof is omitted.
As can be seen from the above description, in this embodiment, by determining whether the starting point is located inside or outside the polygon, when the starting point is located inside the polygon, the sub-curve in the odd-numbered segment is determined as a partial curve located inside the polygon, and when the starting point is located outside the polygon, the sub-curve in the even-numbered segment is determined as a partial curve located inside the polygon, so that the handwriting curve can be segmented based on the segmentation point, and further, the partial handwriting curve located inside the polygon after segmentation can be erased at one time, thereby achieving the purposes of simplifying the handwriting erasing process, improving the efficiency of handwriting erasing, and improving the user experience.
FIG. 6 is a flowchart illustrating how to determine whether the starting point of the handwriting curve is inside or outside the polygon according to the position information of the starting point of the handwriting curve; on the basis of the above embodiments, the present embodiment exemplifies how to determine whether the starting point of the handwriting curve is located inside or outside the polygon according to the position information of the starting point of the handwriting curve. As shown in FIG. 6, the step S501 of determining whether the starting point of the handwriting curve is located inside or outside the polygon according to the position information of the starting point of the handwriting curve may include the following steps S601-S605:
s601: determining whether the starting point is located on an edge of the polygon; if not, go to step S602; if yes, go to step S603;
s602: and judging whether the starting point is positioned inside or outside the polygon by utilizing a winding number WindingNumber algorithm based on the starting point position information of the handwriting curve.
S603: and moving a simulation point along the handwriting curve from the starting point.
S604: when the simulation point leaves the edge of the polygon for the first time, determining whether the simulation point is located in the polygon currently, if so, executing a step S605; if not, go to step S606;
s605: determining that the starting point is outside the polygon;
s606: determining that the starting point is located within the polygon.
As is apparent from the above description, the present embodiment determines whether the starting point is located inside or outside the polygon by using a number-of-wraps algorithm based on the position information of the starting point of the handwriting curve when it is determined that the starting point is not located on the side line of the polygon; when the starting point is determined to be located on the side line of the polygon, the starting point is determined to be located inside or outside the polygon according to a method that the assumed virtual point moves along the handwriting curve, so that the position of the starting point of the handwriting curve relative to the polygon can be accurately determined, and further the subsequent segmentation of the handwriting curve based on the segmentation point and the starting point of the handwriting curve can be realized, so that the handwriting located inside the polygon after segmentation is erased at one time, the process of erasing the handwriting is simplified, the efficiency of erasing the handwriting is improved, and the user experience is improved.
FIG. 7 is a block diagram of a pen erasing apparatus according to an exemplary embodiment of the present application; as shown in fig. 7, the apparatus includes: an erasing curve obtaining module 110, a polygon obtaining module 120, and a handwriting curve erasing module 130, wherein:
an erasing curve obtaining module 110, configured to obtain an erasing curve for erasing a handwriting curve drawn in an erasing mode, where the handwriting curve is a curve drawn in a pen drawing mode;
a polygon obtaining module 120, configured to connect a starting point and an end point of the erasure curve to obtain a polygon;
and the handwriting curve erasing module 130 is used for determining a partial curve positioned in the polygon from the handwriting curve and erasing the partial curve.
As can be seen from the above description, in the embodiment, the erasing curve for erasing the handwriting curve drawn in the erasing mode is obtained, the starting point and the end point of the erasing curve are connected to obtain the polygon, and then the partial curve located in the polygon is determined and erased from the handwriting curve.
FIG. 8 is a block diagram of a pen erasing apparatus according to another exemplary embodiment of the present application; the erasing curve obtaining module 210, the polygon obtaining module 220, and the handwriting curve erasing module 230 have the same functions as the erasing curve obtaining module 110, the polygon obtaining module 120, and the handwriting curve erasing module 130 in the embodiment shown in fig. 7, and are not described herein again. As shown in fig. 8, the handwriting curve erasing module 230 may include:
a handwriting intersection point determining unit 231 for determining an intersection point of the polygon and the handwriting curve;
a segmentation point determination unit 232, configured to screen a segmentation point of the handwriting curve from the determined at least one intersection point;
and a partial curve determining unit 233, configured to determine a partial curve in the handwriting curve, where the partial curve is located within the polygon, according to the segmentation point and the position information of the starting point of the handwriting curve.
In an embodiment, the dividing point determining unit 232 may further be configured to:
determining position information of each intersection point, wherein the position information of each intersection point comprises a first straight line segment from a first specified endpoint to the intersection point along the handwriting curve, a second straight line segment from the intersection point to a second specified endpoint along the handwriting curve, a third straight line segment from a third specified endpoint to the intersection point along the edge of the polygon, and a fourth straight line segment from the intersection point to a fourth specified endpoint along the edge of the polygon; the first designated endpoint and the second designated endpoint are endpoints on the handwriting curve closest to the intersection point, and the third designated endpoint and the fourth designated endpoint are endpoints on the edge of the polygon closest to the intersection point;
determining a first target line of each intersection point according to the first straight line segment and the second straight line segment of each intersection point, and determining a second target line of each intersection point according to the third straight line segment and the fourth straight line segment of each intersection point;
determining a positional relationship between the first target line and the second target line;
determining whether the intersection point is a crossing intersection point or not according to the position relation;
and when the intersection point is determined to be a crossing intersection point, determining the intersection point as a segmentation point of the handwriting curve.
In an embodiment, the dividing point determining unit 232 may further be configured to:
if the position relation is a first relation for representing that the first target line passes through the second target line, determining the intersection point as a passing intersection point;
if the position relation is a second relation used for representing that the first target line does not cross the second target line, determining that the intersection point is a non-crossing intersection point;
and if the position relation is a third relation used for representing that the first target line and the second target line are overlapped to separate from each other or a fourth relation used for representing that the first target line and the second target line are separated to overlap with each other, determining that the intersection point is a crossing intersection point or a non-crossing intersection point according to a limit thought.
In an embodiment, the partial curve determination unit 233 may further be configured to:
determining whether the starting point of the handwriting curve is positioned inside or outside the polygon according to the position information of the starting point of the handwriting curve;
when the starting point is positioned in the polygon, determining an odd-numbered curve as a partial curve positioned in the polygon, wherein the odd-numbered curve is a curve with an odd number obtained by dividing the handwriting curve based on a dividing point;
and when the starting point is positioned outside the polygon, determining an even-numbered curve as a partial curve positioned inside the polygon, wherein the even-numbered curve is a curve with an even number obtained by segmenting the handwriting curve based on a segmentation point.
In an embodiment, the partial curve determination unit 233 may further be configured to:
determining whether the starting point is located on an edge of the polygon;
if not, judging whether the starting point is positioned inside or outside the polygon by utilizing a winding number WindingNumber algorithm based on the starting point position information of the handwriting curve;
if so, moving a simulation point along the handwriting curve from the starting point, and when the simulation point leaves the edge line of the polygon for the first time, if the simulation point is currently located in the polygon, determining that the starting point is located outside the polygon; otherwise, determining that the starting point is located within the polygon.
The embodiment of the handwriting erasing device can be applied to network equipment. The device embodiments may be implemented by software, or by hardware, or by a combination of hardware and software. The software implementation is taken as an example, and is formed by reading corresponding computer program instructions in the nonvolatile memory into the memory for operation through the processor of the device where the software implementation is located as a logical means. From a hardware level, as shown in fig. 9, it is a hardware structure diagram of a device where the handwriting erasing apparatus of the present invention is located, except for the processor, the network interface, the memory and the nonvolatile memory shown in fig. 9, the device where the apparatus is located in the embodiment may also include other hardware, such as a forwarding chip responsible for processing a message, and the like; the device may also be a distributed device in terms of hardware structure, and may include multiple interface cards to facilitate expansion of message processing at the hardware level.
Embodiments of the present invention also provide a computer-readable storage medium, on which a computer program is stored, and the computer program is processed by a processor to implement the embodiments shown in fig. 1 to 6.
For the device embodiments, since they substantially correspond to the method embodiments, reference may be made to the partial description of the method embodiments for relevant points. The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of the application. One of ordinary skill in the art can understand and implement it without inventive effort.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The above description is only exemplary of the present application and should not be taken as limiting the present application, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the scope of protection of the present application.

Claims (8)

1. A method for erasing a handwriting, comprising:
acquiring an erasing curve which is drawn in an erasing mode and used for erasing a handwriting curve, wherein the handwriting curve is a curve drawn in a drawing pen mode;
connecting the starting point and the end point of the erasing curve to obtain a polygon;
determining a partial curve positioned in the polygon from the handwriting curve and erasing the partial curve;
the determining a partial curve located within the polygon from the handwriting curve includes:
determining the intersection point of the polygon and the handwriting curve;
screening out the segmentation points of the handwriting curve from the determined at least one intersection point;
determining a partial curve positioned in the polygon in the handwriting curve according to the segmentation point and the initial point position information of the handwriting curve;
wherein:
determining a partial curve in the handwriting curve located in the polygon according to the segmentation point and the position information of the starting point of the handwriting curve, including: determining whether the starting point of the handwriting curve is positioned inside or outside the polygon according to the position information of the starting point of the handwriting curve; if the starting point is located in the polygon, determining an odd-numbered curve as a partial curve located in the polygon, wherein the odd-numbered curve is a curve with an odd number obtained by dividing the handwriting curve based on a dividing point; if the starting point is positioned outside the polygon, determining an even-numbered curve as a partial curve positioned inside the polygon, wherein the even-numbered curve is a curve with an even number obtained by segmenting the handwriting curve based on a segmentation point; and/or the presence of a gas in the gas,
the step of screening out the segmentation points of the handwriting curve from the determined at least one intersection point comprises the following steps: determining position information of each intersection point, wherein the position information of each intersection point comprises a first straight line segment from a first specified endpoint to the intersection point along the handwriting curve, a second straight line segment from the intersection point to a second specified endpoint along the handwriting curve, a third straight line segment from a third specified endpoint to the intersection point along the edge of the polygon, and a fourth straight line segment from the intersection point to a fourth specified endpoint along the edge of the polygon; the first designated endpoint and the second designated endpoint are endpoints on the handwriting curve closest to the intersection point, and the third designated endpoint and the fourth designated endpoint are endpoints on the edge of the polygon closest to the intersection point; determining a first target line of each intersection point according to the first straight line segment and the second straight line segment of each intersection point, and determining a second target line of each intersection point according to the third straight line segment and the fourth straight line segment of each intersection point; determining a positional relationship between the first target line and the second target line; determining whether the intersection point is a crossing intersection point according to the position relation, wherein the crossing intersection point comprises an intersection point formed by the handwriting curve crossing the edge line of the polygon; and if the intersection point is determined to be a crossing intersection point, determining the intersection point as a segmentation point of the handwriting curve.
2. The method of claim 1, wherein the determining whether the intersection point is a crossing intersection point according to the positional relationship comprises:
if the position relation is a first relation for representing that the first target line passes through the second target line, determining the intersection point as a passing intersection point;
if the position relation is a second relation used for representing that the first target line does not cross the second target line, determining that the intersection point is a non-crossing intersection point;
and if the position relation is a third relation used for representing that the first target line and the second target line are overlapped to separate from each other or a fourth relation used for representing that the first target line and the second target line are separated to overlap with each other, determining that the intersection point is a crossing intersection point or a non-crossing intersection point according to a limit thought.
3. A method as claimed in claim 1, wherein the determining whether the starting point of the handwriting curve is located inside or outside the polygon according to the starting point position information of the handwriting curve comprises:
determining whether the starting point is located on an edge of the polygon;
if not, judging whether the starting point is positioned inside or outside the polygon by utilizing a winding number WindingNumber algorithm based on the starting point position information of the handwriting curve;
if so, moving a simulation point along the handwriting curve from the starting point, and when the simulation point leaves the edge line of the polygon for the first time, if the simulation point is currently located in the polygon, determining that the starting point is located outside the polygon; otherwise, determining that the starting point is located within the polygon.
4. A handwriting erasing apparatus, comprising:
the erasing curve acquiring module is used for acquiring an erasing curve which is drawn in an erasing mode and used for erasing a handwriting curve, and the handwriting curve is drawn in a pen drawing mode;
the polygon obtaining module is used for connecting the starting point and the end point of the erasing curve to obtain a polygon;
the handwriting curve erasing module is used for determining and erasing partial curves positioned in the polygon from the handwriting curves;
the handwriting curve erasing module comprises:
the handwriting intersection point determining unit is used for determining the intersection point of the polygon and the handwriting curve;
the segmentation point determining unit is used for screening out segmentation points of the handwriting curve from the determined at least one intersection point;
a partial curve determining unit, configured to determine a partial curve located within the polygon in the handwriting curve according to the segmentation point and the start point position information of the handwriting curve;
wherein:
the partial curve determination unit is further configured to: determining whether the starting point of the handwriting curve is positioned inside or outside the polygon according to the position information of the starting point of the handwriting curve; when the starting point is positioned in the polygon, determining an odd-numbered curve as a partial curve positioned in the polygon, wherein the odd-numbered curve is a curve with an odd number obtained by dividing the handwriting curve based on a dividing point; when the starting point is positioned outside the polygon, determining an even-numbered curve as a partial curve positioned inside the polygon, wherein the even-numbered curve is a curve with an even number obtained by dividing the handwriting curve based on a dividing point; and/or the presence of a gas in the gas,
the division point determination unit is configured to: determining position information of each intersection point, wherein the position information of each intersection point comprises a first straight line segment from a first specified endpoint to the intersection point along the handwriting curve, a second straight line segment from the intersection point to a second specified endpoint along the handwriting curve, a third straight line segment from a third specified endpoint to the intersection point along the edge of the polygon, and a fourth straight line segment from the intersection point to a fourth specified endpoint along the edge of the polygon; the first designated endpoint and the second designated endpoint are endpoints on the handwriting curve closest to the intersection point, and the third designated endpoint and the fourth designated endpoint are endpoints on the edge of the polygon closest to the intersection point; determining a first target line of each intersection point according to the first straight line segment and the second straight line segment of each intersection point, and determining a second target line of each intersection point according to the third straight line segment and the fourth straight line segment of each intersection point; determining a positional relationship between the first target line and the second target line; determining whether the intersection point is a crossing intersection point according to the position relation, wherein the crossing intersection point comprises an intersection point formed by the handwriting curve crossing the edge line of the polygon; and when the intersection point is determined to be a crossing intersection point, determining the intersection point as a segmentation point of the handwriting curve.
5. The apparatus of claim 4, wherein the segmentation point determination unit is further configured to:
if the position relation is a first relation for representing that the first target line passes through the second target line, determining the intersection point as a passing intersection point;
if the position relation is a second relation used for representing that the first target line does not cross the second target line, determining that the intersection point is a non-crossing intersection point;
and if the position relation is a third relation used for representing that the first target line and the second target line are overlapped to separate from each other or a fourth relation used for representing that the first target line and the second target line are separated to overlap with each other, determining that the intersection point is a crossing intersection point or a non-crossing intersection point according to a limit thought.
6. The apparatus of claim 4, wherein the partial curve determination unit is further configured to:
determining whether the starting point is located on an edge of the polygon;
if not, judging whether the starting point is positioned inside or outside the polygon by utilizing a winding number WindingNumber algorithm based on the starting point position information of the handwriting curve;
if so, moving a simulation point along the handwriting curve from the starting point, and when the simulation point leaves the edge line of the polygon for the first time, if the simulation point is currently located in the polygon, determining that the starting point is located outside the polygon; otherwise, determining that the starting point is located within the polygon.
7. An electronic device, characterized in that the electronic device comprises:
a processor;
a memory configured to store processor-executable instructions;
wherein the processor is configured to perform any of claims 1-3.
8. A computer-readable storage medium, on which a computer program is stored, characterized in that the program realizes any of the claims 1-3 when being processed by a processor.
CN201810429247.3A 2018-05-08 2018-05-08 Handwriting erasing method and device Active CN110458920B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201810429247.3A CN110458920B (en) 2018-05-08 2018-05-08 Handwriting erasing method and device
PCT/CN2019/085045 WO2019214489A1 (en) 2018-05-08 2019-04-29 Curve erasure

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810429247.3A CN110458920B (en) 2018-05-08 2018-05-08 Handwriting erasing method and device

Publications (2)

Publication Number Publication Date
CN110458920A CN110458920A (en) 2019-11-15
CN110458920B true CN110458920B (en) 2021-09-21

Family

ID=68467683

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810429247.3A Active CN110458920B (en) 2018-05-08 2018-05-08 Handwriting erasing method and device

Country Status (2)

Country Link
CN (1) CN110458920B (en)
WO (1) WO2019214489A1 (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111274344A (en) * 2020-01-20 2020-06-12 东南大学 Multi-target buffer area merging method for regularly selecting and rejecting arc sections
CN111736745B (en) * 2020-07-27 2020-12-25 深圳市千分一智能技术有限公司 Stroke erasing method, device, equipment and readable storage medium
CN111736751B (en) * 2020-08-26 2021-03-26 深圳市千分一智能技术有限公司 Stroke redrawing method, device and readable storage medium
CN113282214A (en) * 2021-05-21 2021-08-20 Oppo广东移动通信有限公司 Stroke rendering method, device, storage medium and terminal
CN113345384B (en) * 2021-05-28 2022-06-10 深圳市爱码讯实业发展有限公司 Handwriting erasing method and system for handwriting board
CN113592735A (en) * 2021-07-23 2021-11-02 作业帮教育科技(北京)有限公司 Text page image restoration method and system, electronic equipment and computer readable medium
CN113610946B (en) * 2021-08-03 2024-05-14 深圳市闪联信息技术有限公司 Method for dividing drawing handwriting by using blackboard eraser function

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101477694A (en) * 2008-12-02 2009-07-08 广东威创视讯科技股份有限公司 Handwriting erasing method and apparatus
CN101609560A (en) * 2009-07-16 2009-12-23 广东威创视讯科技股份有限公司 A kind of method of erasing handwriting
CN104537701A (en) * 2015-01-22 2015-04-22 江苏中威科技软件***有限公司 Operation method of vector lines
CN104992460A (en) * 2015-05-28 2015-10-21 深圳市创易联合科技有限公司 Method for erasing vector scripts
CN105574907A (en) * 2015-12-18 2016-05-11 广州视睿电子科技有限公司 Information processing method and device
CN106325737A (en) * 2016-08-03 2017-01-11 青岛海信电器股份有限公司 Method and equipment for erasing writing path
CN106910232A (en) * 2017-02-24 2017-06-30 青岛海信电器股份有限公司 Line drawing eraser removes method and device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3564371B2 (en) * 2000-09-01 2004-09-08 日本電気株式会社 Figure editing apparatus and method
US9996256B2 (en) * 2014-06-19 2018-06-12 Fujian Foxit Software Development Joint Stock Co., Ltd. Method for erasing electronic handwriting on a clipboard
CN106097414B (en) * 2016-05-31 2018-11-13 福建天泉教育科技有限公司 Curve method for deleting and system

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101477694A (en) * 2008-12-02 2009-07-08 广东威创视讯科技股份有限公司 Handwriting erasing method and apparatus
CN101609560A (en) * 2009-07-16 2009-12-23 广东威创视讯科技股份有限公司 A kind of method of erasing handwriting
CN104537701A (en) * 2015-01-22 2015-04-22 江苏中威科技软件***有限公司 Operation method of vector lines
CN104992460A (en) * 2015-05-28 2015-10-21 深圳市创易联合科技有限公司 Method for erasing vector scripts
CN105574907A (en) * 2015-12-18 2016-05-11 广州视睿电子科技有限公司 Information processing method and device
CN106325737A (en) * 2016-08-03 2017-01-11 青岛海信电器股份有限公司 Method and equipment for erasing writing path
CN106910232A (en) * 2017-02-24 2017-06-30 青岛海信电器股份有限公司 Line drawing eraser removes method and device

Also Published As

Publication number Publication date
WO2019214489A1 (en) 2019-11-14
CN110458920A (en) 2019-11-15

Similar Documents

Publication Publication Date Title
CN110458920B (en) Handwriting erasing method and device
US10373359B2 (en) Method and device for erasing a writing path on an infrared electronic white board, and a system for writing on an infrared electronic white board
US20180129897A1 (en) Handwriting-based predictive population of partial virtual keyboards
US10359920B2 (en) Object management device, thinking assistance device, object management method, and computer-readable storage medium
KR20100135281A (en) Method and tool for recognizing a hand-drawn table
CN109074547B (en) Text message ordering based on message content
CN105335039A (en) Method and device for moving object among pages of editable document
CN104658609B (en) The method and system that error correcting code for storage system is distributed
CN107544863B (en) Data storage method and device
JP2020098387A (en) Causal relationship display system and method
CN106325596A (en) Automatic handwriting error correction method and system
CN105184838A (en) Picture processing method and terminal
US11080472B2 (en) Input processing method and input processing device
CN109542776A (en) Page comparison method, device and equipment
CN104572917A (en) Method and device for locking data and distributed storage system
JP2010122987A (en) Object processing apparatus, processing method thereof and program
CN104503868A (en) Data synchronizing method, device and system
JP6413171B2 (en) Method and apparatus for entering handwritten characters
CN106802768B (en) Erasing method of memory device
JP6375886B2 (en) Parity layout determination program, parity layout determination method, storage apparatus and storage system
CN115202589B (en) Placement group member selection method, device and equipment and readable storage medium
CN104021806A (en) Data processing method and data processing equipment
CN110619116A (en) Data processing method, device, terminal and storage medium
US9507794B2 (en) Method and apparatus for distributed processing of file
CN113467671A (en) Text selection method and device, terminal equipment and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant