WO2023016493A1 - Handwriting erasing method and apparatus, storage medium, and electronic device - Google Patents

Handwriting erasing method and apparatus, storage medium, and electronic device Download PDF

Info

Publication number
WO2023016493A1
WO2023016493A1 PCT/CN2022/111482 CN2022111482W WO2023016493A1 WO 2023016493 A1 WO2023016493 A1 WO 2023016493A1 CN 2022111482 W CN2022111482 W CN 2022111482W WO 2023016493 A1 WO2023016493 A1 WO 2023016493A1
Authority
WO
WIPO (PCT)
Prior art keywords
handwriting
erasing
point
points
bitmap image
Prior art date
Application number
PCT/CN2022/111482
Other languages
French (fr)
Chinese (zh)
Inventor
郑少庭
Original Assignee
广州视源电子科技股份有限公司
广州视睿电子科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 广州视源电子科技股份有限公司, 广州视睿电子科技有限公司 filed Critical 广州视源电子科技股份有限公司
Publication of WO2023016493A1 publication Critical patent/WO2023016493A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0487Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser
    • G06F3/0488Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser using a touch-screen or digitiser, e.g. input of commands through traced gestures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0487Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser
    • G06F3/0488Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser using a touch-screen or digitiser, e.g. input of commands through traced gestures
    • G06F3/04883Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser using a touch-screen or digitiser, e.g. input of commands through traced gestures for inputting data by handwriting, e.g. gesture or text
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0487Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser
    • G06F3/0488Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser using a touch-screen or digitiser, e.g. input of commands through traced gestures
    • G06F3/04886Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser using a touch-screen or digitiser, e.g. input of commands through traced gestures by partitioning the display area of the touch-screen or the surface of the digitising tablet into independently controllable areas, e.g. virtual keyboards or menus
    • 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

Definitions

  • the present application relates to the field of touch technology, in particular, to a handwriting erasing method, device, storage medium and electronic equipment.
  • the existing encircling and erasing schemes for electronic handwriting generally erase the handwriting points in the erasing area by judging whether the handwriting points are in the encircled erasing area.
  • the erasing area can be regarded as a polygon of any shape. Judging whether the handwriting point is in the erasing area is actually judging whether a point is inside or outside the polygon.
  • the ray method is usually used, that is, a ray is made from a point , calculate the number of intersections between it and the boundary of the polygon, if the number of intersections is odd, then the point is inside the polygon, otherwise the point is outside the polygon. If the erasing area is larger, the number of sides of the polygon will be more, and the number of handwriting points in the erasing area will also be more, and the calculation will be more time-consuming.
  • the existing technical solution has the problem of very time-consuming calculation in the scenario where multiple handwritings are selected in a large erasing area.
  • the embodiments of the present application provide a handwriting erasing method, device, storage medium and electronic equipment.
  • an embodiment of the present application provides a method for erasing handwriting, which is applied to a whiteboard application of a terminal device, where the canvas of the whiteboard application includes first handwriting, and the method includes:
  • the second handwriting is displayed on the canvas.
  • the embodiment of the present application provides a handwriting erasing device, the handwriting erasing device comprising:
  • an erasing track generating module configured to display on the canvas an erasing track following the circling operation in response to the circling operation on the first handwriting;
  • a pixel point marking module configured to create a bitmap image corresponding to the canvas, mark all pixels in the erasing area corresponding to the erasing track in the bitmap image, and generate an image on the canvas for a mask covering said erased area;
  • An edge pixel determination module configured to determine edge pixel points of the first handwriting in the bitmap image based on the marked pixel points
  • a handwriting erasing module configured to perform handwriting erasing processing on the first handwriting based on the edge pixels in the bitmap image to obtain second handwriting;
  • a handwriting display module configured to display the second handwriting on the canvas.
  • an embodiment of the present application provides a storage medium, where a plurality of instructions are stored in the storage medium, and the instructions are adapted to be loaded by a processor and execute the above method steps.
  • an embodiment of the present application provides an electronic device, which may include: a processor and a memory; wherein, the memory stores a computer program, and the computer program is adapted to be loaded by the processor and execute the above-mentioned method step.
  • the erasing track following the circle selection operation is displayed on the canvas, and then a bitmap image corresponding to the canvas is created, and the erasure track in the bitmap image is marked All pixels in the corresponding erasing area, based on the marked pixels, determine the edge pixels of the first handwriting in the bitmap image, and perform handwriting on the first handwriting based on the edge pixels in the bitmap image Erase processing to obtain the second handwriting, and finally display the second handwriting on the canvas.
  • This application simplifies the judgment of handwriting by creating a bitmap image corresponding to the canvas, and marking the pixels in the erased area in the bitmap image to distinguish the handwriting points in the erased area and outside the erased area
  • the process of judging whether the point is within the erasing area improves the efficiency of handwriting erasing.
  • a mask for covering the erasing area is generated on the canvas before handwriting erasing is completed, so that users can see the erasing area intuitively , which improves the user experience.
  • Fig. 1 provides the schematic flow chart of a kind of handwriting erasing method for the embodiment of the present application
  • Fig. 2 provides a schematic diagram of an example of handwriting for the embodiment of the present application
  • Fig. 3 proposes a schematic flow chart of a handwriting erasing method for the embodiment of the present application
  • Figure 4 provides an example schematic diagram of generating an erasing track for the embodiment of the present application
  • FIG. 5 provides an exemplary schematic diagram of setting an erasing area for an embodiment of the present application
  • Fig. 6 provides an exemplary schematic diagram of determining a group of handwriting points for the embodiment of the present application
  • FIG. 7 provides an exemplary schematic diagram of determining edge pixel points for an embodiment of the present application.
  • Fig. 8 provides an exemplary schematic diagram of redrawing handwriting for the embodiment of the present application.
  • Fig. 9 provides an exemplary schematic diagram of redrawing handwriting for the embodiment of the present application.
  • Figure 10 provides a schematic structural view of a handwriting erasing device according to an embodiment of the present application.
  • FIG. 11 is a schematic structural diagram of an edge pixel determination module provided in an embodiment of the present application.
  • Fig. 12 is a schematic structural diagram of a handwriting erasing module provided by the embodiment of the present application.
  • Fig. 13 is a schematic structural diagram of a handwriting erasing module provided by the embodiment of the present application.
  • FIG. 14 provides a schematic structural diagram of an electronic device according to an embodiment of the present application.
  • the present application provides a handwriting erasing method.
  • the handwriting erasing method is applied to the whiteboard application of the terminal device. Firstly, in response to the circle selection operation on the first written handwriting, the erasing track following the circle selection operation is displayed on the canvas. Then create a bitmap image corresponding to the canvas, mark all the pixels in the erasing area corresponding to the erasing track in the bitmap image, and determine the edge pixels of the first handwriting in the bitmap image based on the marked pixels , and perform handwriting erasing processing on the first handwriting based on the edge pixels in the bitmap image to obtain the second handwriting, and finally display the second handwriting on the canvas.
  • This application simplifies the judgment of handwriting points by creating a bitmap image corresponding to the canvas, and marking the pixels in the erased area in the bitmap image to distinguish the handwriting points in the erasing area and outside the erasing area
  • the process of judging whether it is within the erasing area improves the efficiency of handwriting erasing, and at the same time generates a mask on the canvas to cover the erasing area before the handwriting erasing is completed, so that the user can see the erasing area intuitively. Guaranteed user experience.
  • FIG. 1 provides a schematic flowchart of a handwriting erasing method according to the embodiment of the present application.
  • the handwriting erasing method may include the following steps S101-S105.
  • Canvas refers to the container used to carry content in the whiteboard application. All written handwriting, drawn graphics, tables, or inserted files in the whiteboard application are carried by the canvas.
  • the size of the canvas can be the same as the display window of the whiteboard application, or larger than the display window of the whiteboard application. In one embodiment, the size of the canvas is larger than the display window of the whiteboard application, and when content such as handwriting is moved in the display window of the whiteboard application, the size of the canvas can be expanded.
  • the handwriting points following the circle selection operation are captured, and based on the captured handwriting points Build an erase track curve and display it in the canvas.
  • the erasing track refers to the selection track formed during the circle selection operation, because the purpose of the circle selection operation is to select the handwriting to be erased, therefore, the selection track formed during the circle selection operation is called erasure track.
  • the whiteboard application should set a handwriting erasing instruction, and in response to the setting of the handwriting erasing instruction being completed, execute the circle selection operation on the first written handwriting.
  • the handwriting erasing command can be set through the pre-set command button on the whiteboard application interface, or a preset designated action, or voice control.
  • S102 create a bitmap image corresponding to the canvas, mark all pixels in the erased area corresponding to the erased track in the bitmap image, and generate a mask for covering the erased area on the canvas;
  • bitmap image corresponding to the current display interface of the canvas is created.
  • the bitmap image includes all objects displayed on the canvas.
  • the objects include the first handwriting and the erasing track, and the area corresponding to the erasing track (also That is, the circled area selected by the circle selection operation) is used as the erasing area, and all pixels in the erasing area corresponding to the erasing track are marked in the bitmap image, and at the same time, a mask for covering the erasing area is generated on the canvas.
  • the erasing area may be a closed area generated by end-to-end connection of erasing trajectories, and the erasing area may be a rectangle, a circle, a triangle or any irregular shape.
  • the erasing area can start from the first handwriting point of the erasing track, end at the last handwriting point of the erasing track, and use the straight line connecting the starting point and the end point as a diagonal to generate a rectangular area. Use the rectangular area as the erasing area.
  • the erasing area can start from the first handwriting point of the erasing track, end at the last handwriting point of the erasing track, take the starting point as the center, and start from The distance to the end point is the radius to generate a circular area, and the circular area is used as the erased area.
  • Bitmap images are composed of pixels, and each pixel is assigned a specific position and color value. Bitmap images are related to resolution, that is, an image of a certain area contains a fixed number of pixels.
  • the handwriting is erased with the edge pixels as the boundary of the track to be erased.
  • the handwriting point group located at the edge of the erasing area in each pixel point, and the handwriting point group includes the second erasing track point
  • the time stamp of the second erasing track point is adjacent to the time stamp of the second reserved handwriting point, and it is determined to be erased in the writing handwriting between the second erasing track point and the second reserved handwriting point
  • the edge pixels of the track, the pixels corresponding to the second erasing track point are marked pixels, and the pixels corresponding to the second retained handwriting point are non-marked pixels.
  • the above-mentioned second handwriting point is the corresponding handwriting point in the first written handwriting in the bitmap image
  • the second erasing track point refers to the second handwriting point located in the erasing area in the bitmap image
  • the second reserved handwriting point refers to the second handwriting point located in The second stamp outside the erased area in the bitmap image.
  • the touch panel samples the touch operation through a certain sampling frequency, it will sample multiple handwriting points on the writing path.
  • the pen or hand is always in contact with the touch panel.
  • the trajectory of a continuous writing can be considered as a collection of handwriting points on the writing path. These handwriting points will have a unique coordinate on the touch panel. and timestamp marks, these handwriting points are connected in sequence according to the time stamps to generate handwriting.
  • FIG. 2 provides an exemplary schematic diagram of handwriting for the embodiment of the present application.
  • the whiteboard application samples touch operations based on the touch panel, and obtains multiple handwriting points 01 on the writing path.
  • the handwriting 02 is obtained by sequential connection, and the handwriting 02 is displayed on the canvas.
  • the handwriting point 01 is only illustrative, and is not displayed during the actual writing process. What the user sees is the process of generating handwriting in real time following the movement of the pen tip.
  • the circle selection operation when the circle selection operation is performed on the touch panel, corresponding touch data will be generated, and the change of the circle selection operation can be determined according to the change of the touch data. Confirm that the end of the circle selection operation is determined by the change of the touch data.
  • the circle selection operation ends that is, when the user lifts the pen or hand, the touch data will no longer change, so you can confirm the end of the circle selection operation, so as to further Subsequent erasing processing is performed based on the content circled by the circle selection operation.
  • the written handwriting in the erasing area in the first handwriting is erased with edge pixels as the boundary, and the second handwriting is obtained after the erased handwriting is removed from the first handwriting.
  • the second handwriting generated in the bitmap image is displayed on the canvas.
  • the content displayed on the canvas of the whiteboard application does not change, and the handwriting erasing process is performed on the first handwriting in the bitmap image to obtain the 2.
  • the second handwriting is displayed on the canvas.
  • the display of the mask layer is stopped, and the relevant canvas is no longer displayed.
  • the visual effect of the user is to perform a circle selection operation on the first handwriting, set a mask to display the erasure area corresponding to the circle selection operation, and then the handwriting in the erasure area covered by the mask is erased.
  • a mask covering the erased area is generated, which can visually display the circled handwriting and provide clear prompts for the handwriting to be erased, so the user can
  • the position of the circle selection operation is adjusted in real time, and the selected handwriting to be erased is judged in combination with the display area of the mask layer that changes in real time, so that the method can adjust the handwriting to be erased in time.
  • the method also includes the steps of:
  • the erasing area keeps changing with the circle selection operation, and correspondingly, the display area of the mask layer also keeps changing.
  • the corresponding erase operation is performed to erase the selected area. Writing handwriting, at this time there is no more erasing area, then stop displaying the corresponding mask.
  • FIG. 3 is a schematic flowchart of a handwriting erasing method proposed in the embodiment of the present application.
  • the handwriting erasing method may include the following steps S201 to S209.
  • the signal of the erasing track is sampled to obtain a continuous series of first handwriting points, and the first handwriting points are marked with time stamps.
  • the erasing track when drawing the erasing track, may also be drawn by selecting an erasing control.
  • the erasing tracks are formed by connecting the first handwriting points according to the sequence of the time stamps of the first handwriting points.
  • steps S201 to S202 which provides an exemplary schematic diagram of generating erasing tracks for the embodiment of the present application.
  • the first handwriting 02-ABC there is the first handwriting 02-ABC in the canvas of the whiteboard application. If you want to erase the first handwriting 02-ABC, you can select the erase control or set the handwriting erasing command in the touch
  • the panel draws the erasing track, the touch panel captures the erasing track signal in real time, generates a series of first handwriting points 03, and connects the first handwriting points in the order of time stamps in the shown canvas to form the erasing track 04 .
  • S203 create a bitmap image corresponding to the canvas, determine the area within the erasing track in the bitmap image as the erasing area, and generate a mask for covering the erasing area in the canvas;
  • bitmap image one-to-one corresponding to the canvas is created, and the area within the erasing track is determined in the bitmap image as the erasing area.
  • the erasing area may be a closed area generated by end-to-end connection of erasing trajectories, and the erasing area may be a rectangle, a circle, a triangle or any irregular shape.
  • a mask for covering the erased area is generated in the canvas.
  • bitmap image is not displayed in the current display interface of the canvas, and a mask layer is generated in the canvas, and the mask layer is used to cover the erasing area, which is convenient for the user to intuitively see which part of the handwriting in the area will be erased remove.
  • bitmap image all pixels in the erasing area are set to a specified color, and the specified color is different from the color of the first handwriting.
  • steps S203 to S204 provides an exemplary schematic diagram of setting an erasing area for the embodiment of the present application.
  • the first handwriting 02-ABC and erasing track 04 are arranged, then the area in the erasing track 04 is the erasing area 05, and will be erased in the shown bitmap image All pixels in area 05 are set to gray.
  • each second handwriting point in the first handwriting corresponds to a unique time stamp mark
  • the pixel points corresponding to each second handwriting point are traversed in sequence according to the order of time stamps, and the pixel points corresponding to each second handwriting point are judged.
  • color value determine the second handwriting point whose color value is the specified color as the second erasing track point
  • the second erasing track point and the second reserved handwriting point are a handwriting point group.
  • the color value of the second erasing track point is the specified color, and the color value of the second reserved handwriting point is not the erasing color, then the second erasing track point refers to the area located in the erased area in the bitmap image Handwriting point, the second reserved handwriting point refers to the handwriting point located outside the erasing area in the bitmap image, therefore, there is a track to be erased between the second erasing track point and the second reserved handwriting point adjacent to the time stamp edge pixels.
  • FIG. 6 provides an exemplary schematic diagram of determining a handwriting point group for the embodiment of the present application.
  • the data storage form of the handwriting ABC in the bitmap image in the shown bitmap image is the second handwriting point with a time stamp, as shown in Figure 6, the shown handwriting point 06 is the first handwriting
  • the gray area shown is the circled erasing area, and each second handwriting point is partly located in the erasing area, and partly located outside the erasing area.
  • each time stamp traverse each shown second handwriting point, judge the color value of the pixel point corresponding to each second handwriting point, determine the second handwriting point whose color value is gray as the second erasing track point, and The second handwriting point whose color value is not gray is determined as the second reserved handwriting point, and the second erasing track point and the second reserved handwriting point adjacent to the time stamp are determined to be a handwriting point group, as shown in Figure 5, the second Script point 9 and the second scribe point 10 are two second scribe points adjacent to the time stamp, wherein the pixel color value of the second scribe point 9 is not gray, and the pixel color value of the second scribe point 10 is gray, then determine the first The second handwriting point 9 is the second reserved handwriting point, the second handwriting point 10 is the second erasing track point, and the second handwriting point 9 and the second handwriting point 10 are a handwriting point group.
  • a dichotomy method is used to find the dichotomous pixel points between the second erasing track point and the second retained handwriting point, and the dichotomous pixel points are used as edge pixel points in the first handwriting.
  • the sampling frequency of the touch panel is inversely proportional to the distance between adjacent handwriting points.
  • the sampling frequency of the existing touch panel is very high, and the corresponding second erasing track point and the second reserved handwriting point The distance between them is very small. Therefore, the binary pixel point determined by the five-time binary method is usually close enough to the edge of the erasing area, so the binary pixel point is used as the edge pixel point of the track to be erased.
  • FIG. 7 provides an exemplary schematic diagram of determining edge pixel points for the embodiment of the present application.
  • FIG. 7 takes the second handwriting point 9 and the second handwriting point 10 shown in FIG. 6 as an example, and uses the dichotomy method to determine the edge pixels between the second handwriting point 9 and the second handwriting point 10 .
  • the bitmap image is composed of pixels, and the shown second handwriting point 9 and the second handwriting point 10 are respectively Corresponding to a pixel point
  • the dichotomy method to determine the dichotomy point 2 between the bisector 1 and the second handwriting point 10 is the specified color gray, and then use the dichotomy method to determine between the dichotomy point 2
  • the edge pixel is used as the starting handwriting point or the ending handwriting point, and the starting handwriting point or the ending handwriting point is inserted into the handwriting point queue composed of handwriting points of non-specified colors in the written handwriting to generate a new handwriting point queue , according to the time stamp sequence of each handwriting point in the new handwriting point queue, connect each handwriting point.
  • the edge pixel is the termination handwriting point; If the time stamp of the second reserved handwriting point in the handwriting point group corresponding to the edge pixel is behind, and the time stamp of the second erased track point is in front, then the edge pixel is the starting handwriting point.
  • the ending handwriting point is only connected to the previous handwriting point in the handwriting point queue, and not connected to the back handwriting point. The starting handwriting point is not connected to the front handwriting point in the handwriting point queue, but only connected to the next handwriting point.
  • FIG. 8 provides an exemplary schematic diagram of redrawing handwriting according to the embodiment of the present application.
  • the first handwriting 701 shown has 10 handwriting points, according to the timestamp order, the handwriting of the first handwriting 701
  • Each second handwriting point in the point formation is successively handwriting point 1, handwriting point 2, handwriting point 3, handwriting point 4, handwriting point 5, handwriting point 6, handwriting point 7, handwriting point 8, handwriting point 9, handwriting point 10, Written 1, Written 2, Written 5, Written 6, Written 9 and Written 10 are located outside the erasing area, and Written 3, Written 4, Written 7, and Written 8 are located in the erased area
  • the edge pixel point is the termination handwriting point; if the edge pixel The time stamp of the second reserved handwriting point in the handwriting point group corresponding to the point is at the back, and the time stamp of the second erasing track point is at the front, so the edge pixel point is the starting handwriting point.
  • edge pixel point 1 is As for the ending handwriting point, it can be known in the same way that the edge pixel point 2 is the starting handwriting point, the edge pixel point 3 is the ending handwriting point, and the edge pixel point 4 is the starting handwriting point.
  • the starting handwriting point or the ending handwriting point is inserted into the handwriting point queue formed by the handwriting points of non-designated colors in the written handwriting, and the new handwriting point queue generated is successively handwriting point 1, handwriting point 2, edge pixel point 1 ( end stroke point), edge pixel point 2 (start stroke point), stroke point 5, stroke point 6, edge pixel point 3 (end stroke point), edge pixel point 4 (start stroke point), stroke point 9, stroke point At point 10, the handwriting points in the new handwriting point queue are sequentially connected to obtain the second handwriting 703 .
  • FIG. 9 provides an exemplary schematic diagram of redrawing handwriting according to the embodiment of the present application.
  • first handwriting 801-123 and erasing area 802 in the shown bitmap image among shown first writing handwriting 801-123, 1 is the handwriting intersecting with shown erasing area, 2 is The handwriting and 3 in the shown erasing area are completely outside the shown erasing area, then 1 and 2 shown in the figure are the first handwriting segment 803, and the first handwriting segment is erased before redrawing the writing handwriting, and then The second handwriting segment 804 in the first handwriting outside the erased area is redrawn based on the edge pixels and the second handwriting points in the first handwriting which are not of the designated color.
  • the second handwriting in the bitmap image is displayed on the canvas to complete handwriting erasing.
  • each first handwriting point is connected to generate an erasing track, and then a bitmap image corresponding to the canvas is created to determine the bitmap
  • the area within the erasing track in the image is the erasing area, and a mask showing the erasing area is generated in the canvas, so that the user can see the erasing area intuitively, which improves the user experience;
  • All pixels in the erasing area are set to the designated color, then traverse the pixels corresponding to the second handwriting points in the first handwriting according to the time stamp sequence, and determine the handwriting point group located at the edge of the erasing area in each pixel point, Based on the handwriting point group and determine the edge pixels of the first handwriting by dichotomy, the accuracy of handwriting erasure is guaranteed; finally erase the first handwriting in the bitmap image, and based on the edge pixels and the first handwriting The second hand
  • the handwriting erasing device provided by the embodiment of the present application will be described in detail below with reference to FIG. 10 . It should be noted that the handwriting erasing device in Figure 10 is used to execute the method of the embodiments shown in Figures 1 to 9 of the present application. For the convenience of description, only the parts related to the embodiments of the present application are shown. For details not disclosed, please refer to the embodiments shown in FIGS. 1 to 9 of this application.
  • the handwriting erasing device 1 of the embodiment of the present application may include: an erasing track generating module 11 , a pixel marking module 12 , an edge pixel determining module 13 , a handwriting erasing module 14 , and a handwriting display module 15 .
  • an erasing track generating module 11 may include: an erasing track generating module 11 , a pixel marking module 12 , an edge pixel determining module 13 , a handwriting erasing module 14 , and a handwriting display module 15 .
  • Erasing track generating module 11 for responding to the circle selection operation to the first written handwriting, display on the canvas the erasing track following the circle selection operation;
  • the pixel point marking module 12 is used to create a bitmap image corresponding to the canvas, mark all pixels in the erasing area corresponding to the erasing track in the bitmap image, and generate a mask for covering the erasing area on the canvas ;
  • the edge pixel determination module 13 is used to determine the edge pixel points of the first handwriting in the bitmap image based on the marked pixel points;
  • the handwriting erasing module 14 is used to perform handwriting erasing processing on the first handwriting based on edge pixels in the bitmap image to obtain the second handwriting;
  • the handwriting display module 15 is configured to display the second handwriting on the canvas.
  • the erasing trajectory generating module 11 is specifically used for:
  • the pixel point marking module 12 is specifically used for:
  • the edge pixel determination module 13 includes:
  • the handwriting point group determination unit 131 is used to traverse the corresponding pixel points of each second handwriting point in the first handwriting according to the time stamp sequence, and determine the handwriting point group located at the edge of the erasing area in each pixel point.
  • the handwriting point group includes A second erasing track point of a specified color and a second reserved handwriting point of a non-specified color, the time stamp of the second erasing track point is adjacent to the time stamp of the second reserved handwriting point;
  • the pixel point determination unit 132 is configured to determine edge pixel points of the first handwriting based on the handwriting point group.
  • the pixel point determination unit 132 is specifically used for:
  • the bisection pixel between the second erasing track point and the second reserved handwriting point is searched for using a bisection method, and the bisection pixel is used as an edge pixel point of the first handwriting.
  • the handwriting erasing module 14 includes:
  • the first handwriting erasing unit 141 is used for erasing the first handwriting in the bitmap image
  • the first handwriting drawing unit 142 is configured to redraw the handwriting outside the erased area in the bitmap image based on the edge pixel points and the second handwriting points of the first handwriting of a non-specified color to obtain the second handwriting.
  • the first handwriting drawing unit 141 is specifically used for:
  • the handwriting points are connected to obtain the second handwriting.
  • the handwriting erasing module 14 includes:
  • the second handwriting erasing unit 143 is used for erasing all the first handwriting segments in the first handwriting within the erasing area and intersecting with the erasing area;
  • the second handwriting drawing unit 144 is used to redraw the second handwriting segment outside the erasing area in the first handwriting segment based on the edge pixel points and the second handwriting point of the first handwriting segment of a non-designated color, so as to obtain the second written handwriting .
  • the second handwriting drawing unit 143 is specifically used for:
  • the handwriting points are connected to obtain the second handwriting.
  • the handwriting erasing device when the handwriting erasing device provided by the above-mentioned embodiments executes the handwriting erasing method, the division of the above-mentioned functional modules is used as an example for illustration. In practical applications, the above-mentioned functions can be allocated by different functions according to needs Module completion means that the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.
  • the handwriting erasing device and the handwriting erasing method embodiments provided by the above embodiments belong to the same idea, and the implementation process thereof is detailed in the method embodiments, and will not be repeated here.
  • each first handwriting point is connected to generate an erasing track, and then a bitmap image corresponding to the canvas is created to determine the bitmap
  • the area within the erasing track in the image is the erasing area, and a mask showing the erasing area is generated in the canvas, so that the user can see the erasing area intuitively, which improves the user experience;
  • All pixels in the erasing area are set to the designated color, then traverse the pixels corresponding to the second handwriting points in the first handwriting according to the time stamp sequence, and determine the handwriting point group located at the edge of the erasing area in each pixel point, Based on the handwriting point group and determine the edge pixels of the first handwriting by dichotomy, the accuracy of handwriting erasure is guaranteed; finally erase the first handwriting in the bitmap image, and based on the edge pixels and the first handwriting The second hand
  • the embodiment of the present application also provides a computer storage medium, the computer storage medium can store a plurality of instructions, the instructions are suitable for being loaded by the processor and executing the handwriting erasing method of the embodiment shown in the above-mentioned Figures 1 to 9, specifically For the execution process, reference may be made to the specific descriptions of the embodiments shown in FIGS. 1 to 9 , and details are not repeated here.
  • the present application also provides a computer program product, the computer program product stores at least one instruction, at least one instruction is loaded by the processor and executes the handwriting erasing method of the embodiment shown in the above-mentioned Figures 1 to 9, the specific execution process Reference may be made to the specific descriptions of the embodiments shown in FIGS. 1 to 9 , and details are not repeated here.
  • the electronic device 1000 may include: at least one processor 1001, at least one memory 1002, at least one network interface 1003, at least one input and output interface 1004, at least one communication bus 1005 and at least one display unit 1006.
  • the processor 1001 may include one or more processing cores.
  • the processor 1001 uses various interfaces and lines to connect various parts of the entire electronic device 1000, and executes or executes instructions, programs, code sets or instruction sets stored in the memory 1002, and calls data stored in the memory 1002 to execute Various functions and processing data of the terminal 1000.
  • the memory 1002 can be a high-speed RAM memory, or a non-volatile memory, such as at least one disk memory.
  • the memory 1002 may also be at least one storage device located away from the aforementioned processor 1001 .
  • the network interface 1003 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface).
  • the communication bus 1005 is used to realize connection communication between these components.
  • the display unit 1006 may be a touch panel.
  • the memory 1002 as a storage medium may include an operating system, a network communication module, an input/output interface module, and a handwriting erasing program.
  • the input and output interface 1004 is mainly used to provide an input interface for the user and the access device, and obtain data input by the user and the access device.
  • the processor 1001 can be used to call the handwriting erasing program stored in the memory 1002, and specifically perform the following operations:
  • the processor 1001 displays an erasing track following the circle selection operation on the canvas in response to the circle selection operation on the first handwriting, specifically perform the following operations:
  • the processor 1001 when the processor 1001 marks all the pixels in the erasing area corresponding to the erasing track in the bitmap image, it specifically performs the following operations:
  • determine the edge pixels of the first handwriting in the bitmap image including:
  • the handwriting point group located at the edge of the erasing area in each pixel point, and the handwriting point group includes the second erasing track point of the specified color and the second reserved handwriting point of a non-specified color, the time stamp of the second erasing track point is adjacent to the time stamp of the second reserved handwriting point;
  • Edge pixel points of the first handwriting are determined based on the handwriting point group.
  • the processor 1001 determines the edge pixel points of the first handwriting based on the handwriting point group, it specifically performs the following operations:
  • the bisection pixel between the second erasing track point and the second reserved handwriting point is searched for using a bisection method, and the bisection pixel is used as an edge pixel point of the first handwriting.
  • the processor 1001 when the processor 1001 performs handwriting erasing processing on the first handwriting based on the edge pixels in the bitmap image to obtain the second handwriting, specifically perform the following operations:
  • the processor 1001 when the processor 1001 redraws the handwriting outside the erased area based on the edge pixels and the second handwriting points of a non-specified color in the first handwriting to obtain the second handwriting, specifically perform the following operations:
  • the handwriting points are connected to obtain the second handwriting.
  • the processor 1001 when the processor 1001 performs handwriting erasing processing on the first handwriting based on the edge pixels in the bitmap image to obtain the second handwriting, specifically perform the following operations:
  • the processor 1001 redraws the second handwriting segment outside the erasing area in the first handwriting segment based on the edge pixel points and the second handwriting point of a non-designated color in the first handwriting segment to obtain the second written handwriting , specifically perform the following operations:
  • the handwriting points are connected to obtain the second handwriting.
  • each first handwriting point is connected to generate an erasing track, and then a bitmap image corresponding to the canvas is created to determine the bitmap
  • the area within the erasing track in the image is the erasing area, and a mask showing the erasing area is generated in the canvas, so that the user can see the erasing area intuitively, which improves the user experience;
  • All pixels in the erasing area are set to the designated color, then traverse the pixels corresponding to the second handwriting points in the first handwriting according to the time stamp sequence, and determine the handwriting point group located at the edge of the erasing area in each pixel point, Based on the handwriting point group and determine the edge pixels of the first handwriting by dichotomy, the accuracy of handwriting erasure is guaranteed; finally erase the first handwriting in the bitmap image, and based on the edge pixels and the first handwriting The second hand
  • the disclosed device can be implemented in other ways.
  • the device embodiments described above are only illustrative, such as the division of units, which is only a logical function division, and there may be other division methods in actual implementation, for example, multiple units or components can be combined or integrated into Another system, or some features may be ignored, or not implemented.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be through some service interfaces, and the indirect coupling or communication connection of devices or units may be in electrical or other forms.
  • a unit described as a separate component may or may not be physically separated, and a component displayed as a unit may or may not be a physical unit, that is, it may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.
  • An integrated unit may be stored in a computer-readable memory if implemented in the form of a software function unit and sold or used as an independent product.
  • the technical solution of the present application is essentially or part of the contribution to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory.
  • Several instructions are included to make an electronic device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods in the various embodiments of the present application.
  • the aforementioned memory includes: U disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
  • the program can be stored in a computer-readable memory, and the memory can include: flash memory disk, read-only memory (Read-Only Memory, ROM), random access device (Random Access Memory, RAM), magnetic disk or optical disk, etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Processing Or Creating Images (AREA)
  • Position Input By Displaying (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The present application discloses a handwriting erasing method and apparatus, a storage medium, and an electronic device. The method comprises: displaying, in response to a circle selection operation on a first handwriting, an erasing trajectory on a canvas following the circle selection operation; then creating a bitmap image corresponding to the canvas, and marking all pixel points in an erasing area corresponding to the erasing trajectory in the bitmap image; determining edge pixel points of the first handwriting in the bitmap image on the basis of the marked pixel points; performing handwriting erasing processing on the first handwriting in the bitmap image on the basis of the edge pixel points to obtain a second handwriting; and finally displaying the second handwriting on the canvas, thereby implementing efficient and rapid circle selection and erasing for handwritings.

Description

笔迹擦除方法、装置、存储介质及电子设备Handwriting erasing method, device, storage medium and electronic equipment 技术领域technical field
本申请涉及触控技术领域,具体而言,涉及一种笔迹擦除方法、装置、存储介质及电子设备。The present application relates to the field of touch technology, in particular, to a handwriting erasing method, device, storage medium and electronic equipment.
背景技术Background technique
现有的对电子笔迹的圈选擦除方案一般是通过判断笔迹点是否在圈选的擦除区域内,对在擦除区域内的笔迹点进行擦除。擦除区域可看作一个任意形状的多边形,判断笔迹点是否在擦除区域内,实际上就是判断一点在多边形的内部或外部,现有的方案中通常采用射线法,即从一点做一条射线,计算它跟多边形边界的交点个数,如果交点个数为奇数,那么点在多边形内部,否则点在多边形外部。如果擦除区域越大,则多边形的边数越多,擦除区域内的笔迹点数也越多,计算也就越耗时。The existing encircling and erasing schemes for electronic handwriting generally erase the handwriting points in the erasing area by judging whether the handwriting points are in the encircled erasing area. The erasing area can be regarded as a polygon of any shape. Judging whether the handwriting point is in the erasing area is actually judging whether a point is inside or outside the polygon. In the existing schemes, the ray method is usually used, that is, a ray is made from a point , calculate the number of intersections between it and the boundary of the polygon, if the number of intersections is odd, then the point is inside the polygon, otherwise the point is outside the polygon. If the erasing area is larger, the number of sides of the polygon will be more, and the number of handwriting points in the erasing area will also be more, and the calculation will be more time-consuming.
现有技术方案在大擦除区域选中多笔迹的场景下,存在计算非常耗时的问题。The existing technical solution has the problem of very time-consuming calculation in the scenario where multiple handwritings are selected in a large erasing area.
发明内容Contents of the invention
为了解决上述问题,本申请实施例提供了一种笔迹擦除方法、装置、存储介质及电子设备。In order to solve the above problems, the embodiments of the present application provide a handwriting erasing method, device, storage medium and electronic equipment.
第一方面,本申请实施例提供了一种笔迹擦除方法,应用于终端设备的白板应用中,所述白板应用的画布上包括第一书写笔迹,所述方法包括:In the first aspect, an embodiment of the present application provides a method for erasing handwriting, which is applied to a whiteboard application of a terminal device, where the canvas of the whiteboard application includes first handwriting, and the method includes:
响应于对所述第一书写笔迹的圈选操作,在所述画布上显示跟随所述圈选操作的擦除轨迹,所述擦除轨迹包括基于所述圈选操作所捕捉的笔迹点所构建的笔迹曲线;In response to a circle-selecting operation on the first written handwriting, displaying on the canvas an erasing track following the circle-selecting operation, the erasing track comprising the points constructed based on the handwriting points captured by the circle-selecting operation handwriting curve;
创建与所述画布对应的位图图像,标记所述位图图像中擦除轨迹对应的擦除区域内的所有像素点;Create a bitmap image corresponding to the canvas, and mark all pixels in the erasing area corresponding to the erasing track in the bitmap image;
基于标记后的所述像素点,在所述位图图像中确定所述第一书写笔迹的边缘像素点;determining edge pixels of the first handwriting in the bitmap image based on the marked pixels;
在所述位图图像中基于所述边缘像素点对所述第一书写笔迹进行笔迹擦除处理,得到第二书写笔迹;performing handwriting erasing processing on the first handwriting based on the edge pixels in the bitmap image to obtain second handwriting;
在所述画布上显示所述第二书写笔迹。The second handwriting is displayed on the canvas.
第二方面,本申请实施例提供了一种笔迹擦除装置,所述笔迹擦除装置包括:In the second aspect, the embodiment of the present application provides a handwriting erasing device, the handwriting erasing device comprising:
擦除轨迹生成模块,用于响应于对所述第一书写笔迹的圈选操作,在所述画布上显示跟随所述圈选操作的擦除轨迹;an erasing track generating module, configured to display on the canvas an erasing track following the circling operation in response to the circling operation on the first handwriting;
像素点标记模块,用于创建与所述画布对应的位图图像,标记所述位图图像中所述擦除轨迹对应的擦除区域内的所有像素点,并在所述画布上生成用于覆盖所述擦除区域的蒙层;A pixel point marking module, configured to create a bitmap image corresponding to the canvas, mark all pixels in the erasing area corresponding to the erasing track in the bitmap image, and generate an image on the canvas for a mask covering said erased area;
边缘像素确定模块,用于基于标记后的所述像素点,在所述位图图像中确定所述第一书写笔迹的边缘像素点;An edge pixel determination module, configured to determine edge pixel points of the first handwriting in the bitmap image based on the marked pixel points;
笔迹擦除模块,用于在所述位图图像中基于所述边缘像素点对所述第一书写笔迹进行笔迹擦除处理,得到第二书写笔迹;A handwriting erasing module, configured to perform handwriting erasing processing on the first handwriting based on the edge pixels in the bitmap image to obtain second handwriting;
笔迹显示模块,用于在所述画布上显示所述第二书写笔迹。A handwriting display module, configured to display the second handwriting on the canvas.
第三方面,本申请实施例提供了一种存储介质,所述存储介质存储有多条指令,所述指令适于由处理器加载并执行上述的方法步骤。In a third aspect, an embodiment of the present application provides a storage medium, where a plurality of instructions are stored in the storage medium, and the instructions are adapted to be loaded by a processor and execute the above method steps.
第四方面,本申请实施例提供了一种电子设备,可包括:处理器和存储器;其中,所述存储器存储有计算机程序,所述计算机程序适于由所述处理器加载并执行上述的方法步骤。In a fourth aspect, an embodiment of the present application provides an electronic device, which may include: a processor and a memory; wherein, the memory stores a computer program, and the computer program is adapted to be loaded by the processor and execute the above-mentioned method step.
本申请一些实施例提供的技术方案带来的有益效果至少包括:The beneficial effects brought by the technical solutions provided by some embodiments of the present application at least include:
在本申请实施例中,响应于对第一书写笔迹的圈选操作,在画布上显示跟随圈选操作的擦除轨迹,然后创建与画布对应的位图图像,标记位图图像中擦除轨迹对应的擦除区域内的所有像素点,基于标记后的像素点,在位图图像中确定第一书写笔迹的边缘像素点,并在位图图像中基于边缘像素点对第一书写笔迹进行笔迹擦除处理,得到第二书写笔迹,最后在画布上显示第二书写笔迹。本申请通过创建与画布对应的位图图像,并通过在位图图像中对擦除区域内的像素点进行标记的方式来区分擦除区域内和擦除区域外的笔迹点,简化了判断笔迹点是否位于擦除区域内的判断流程,提高了笔迹擦除的效率,同时在笔迹擦除完成之前在画布上生成用于覆盖擦除区域的蒙层,使用户可以直观的看到擦除区域,提升了用户体验。In the embodiment of the present application, in response to the circle selection operation on the first handwriting, the erasing track following the circle selection operation is displayed on the canvas, and then a bitmap image corresponding to the canvas is created, and the erasure track in the bitmap image is marked All pixels in the corresponding erasing area, based on the marked pixels, determine the edge pixels of the first handwriting in the bitmap image, and perform handwriting on the first handwriting based on the edge pixels in the bitmap image Erase processing to obtain the second handwriting, and finally display the second handwriting on the canvas. This application simplifies the judgment of handwriting by creating a bitmap image corresponding to the canvas, and marking the pixels in the erased area in the bitmap image to distinguish the handwriting points in the erased area and outside the erased area The process of judging whether the point is within the erasing area improves the efficiency of handwriting erasing. At the same time, a mask for covering the erasing area is generated on the canvas before handwriting erasing is completed, so that users can see the erasing area intuitively , which improves the user experience.
附图说明Description of drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例中所需使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the accompanying drawings required in the embodiments will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present application. For Those of ordinary skill in the art can also obtain other drawings based on these drawings without making creative efforts.
图1为本申请实施例提供了一种笔迹擦除方法的流程示意图;Fig. 1 provides the schematic flow chart of a kind of handwriting erasing method for the embodiment of the present application;
图2为本申请实施例提供了一种笔迹书写的举例示意图;Fig. 2 provides a schematic diagram of an example of handwriting for the embodiment of the present application;
图3为本申请实施例提出了一种笔迹擦除方法的流程示意图;Fig. 3 proposes a schematic flow chart of a handwriting erasing method for the embodiment of the present application;
图4为本申请实施例提供了一种生成擦除轨迹的举例示意图Figure 4 provides an example schematic diagram of generating an erasing track for the embodiment of the present application
图5为本申请实施例提供了一种设置擦除区域的举例示意图;FIG. 5 provides an exemplary schematic diagram of setting an erasing area for an embodiment of the present application;
图6为本申请实施例提供了一种确定笔迹点组的举例示意图;Fig. 6 provides an exemplary schematic diagram of determining a group of handwriting points for the embodiment of the present application;
图7为本申请实施例提供了一种确定边缘像素点的举例示意图;FIG. 7 provides an exemplary schematic diagram of determining edge pixel points for an embodiment of the present application;
图8为本申请实施例提供了一种重绘书写笔迹的举例示意图;Fig. 8 provides an exemplary schematic diagram of redrawing handwriting for the embodiment of the present application;
图9为本申请实施例提供了一种重绘书写笔迹的举例示意图;Fig. 9 provides an exemplary schematic diagram of redrawing handwriting for the embodiment of the present application;
图10为本申请实施例提供了一种笔迹擦除装置的结构示意图;Figure 10 provides a schematic structural view of a handwriting erasing device according to an embodiment of the present application;
图11为本申请实施例提供的一种边缘像素确定模块的结构示意图;FIG. 11 is a schematic structural diagram of an edge pixel determination module provided in an embodiment of the present application;
图12为本申请实施例提供的一种笔迹擦除模块的结构示意图;Fig. 12 is a schematic structural diagram of a handwriting erasing module provided by the embodiment of the present application;
图13为本申请实施例提供的一种笔迹擦除模块的结构示意图;Fig. 13 is a schematic structural diagram of a handwriting erasing module provided by the embodiment of the present application;
图14为本申请实施例提供了一种电子设备的结构示意图。FIG. 14 provides a schematic structural diagram of an electronic device according to an embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
在下述介绍中,术语“第一”、“第二”仅为用于描述的目的,而不能理解为指示或暗示相对重要性。下述介绍提供了本申请的多个实施例,不同实施例之间可以替换或者合并组合,因此本申请也可认为包含所记载的相同和/或不同实施例的所有可能组合。因而,如果一个实施例包含特征A、B、C,另一个实施例包含特征B、D,那么本申请也应视为包括含有A、B、C、D的一个或多个所有其他可能的组合的实施例,尽管该实施例可能并未在以下内容中有明确的文字记载。In the following introduction, the terms "first" and "second" are only used for the purpose of description, and should not be understood as indicating or implying relative importance. The following introduction provides multiple embodiments of the present application, and different embodiments can be replaced or combined and combined, so the present application can also be considered to include all possible combinations of the same and/or different embodiments described. Thus, if one embodiment contains features A, B, C, and another embodiment contains features B, D, then the application should also be considered to include all other possible combinations containing one or more of A, B, C, D Although this embodiment may not be clearly written in the following content.
下面的描述提供了示例,并且不对权利要求书中阐述的范围、适用性或示例进行限制。可以在不脱离本申请内容的范围的情况下,对描述的元素的功能和布置做出改变。各个示例可以适当省略、替代或添加各种过程或组件。例如所描述的方法可以以所描述的顺序不同的顺序来执行,并且可以添加、省略或组合各种步骤。此外,可以将关于一些示例描述的特征组合到其他示例中。The following description provides examples, and does not limit the scope, applicability or examples set forth in the claims. Changes may be made in the function and arrangement of described elements without departing from the scope of the disclosure. Various examples may omit, substitute, or add various procedures or components as appropriate. For example, the methods described may be performed in an order different from that described, and various steps may be added, omitted, or combined. Furthermore, features described with respect to some examples may be combined into other examples.
随着可触控终端的迅速发展,线上授课、远程会议、电子笔迹等逐渐在替代原有的书写记录方式。用户在使用可触控终端进行书写时,不可避免的会出现一些错误,需要对已书写的笔迹进行擦除,一种简单高效的笔迹擦除方式可以极大地提高用户对终端的使用体验,提高书写效率。With the rapid development of touchable terminals, online teaching, remote meetings, electronic handwriting, etc. are gradually replacing the original writing and recording methods. When users use a touchable terminal to write, some mistakes will inevitably occur, and the written handwriting needs to be erased. A simple and efficient handwriting erasing method can greatly improve the user's experience in using the terminal and improve Writing efficiency.
本申请提供了一种笔迹擦除方法,笔迹擦除方法应用于终端设备的白板应用中,首先响应于对第一书写笔迹的圈选操作,在画布上显示跟随圈选操作的擦除轨迹,然后创建与画布对应的位图图像,标记位图图像中擦除轨迹对应的擦除区域内的所有像素点,基于标记后的像素点,在位图图像中确定第一书写笔迹的边缘像素点,并在位图图像中基于边缘像素点对第一书写笔迹进行笔迹擦除处理,得到第二书写笔迹,最后在画布上显示第二书写笔迹。本申请通过创建与画布对应的位图图像,并通过在位图图像中对擦除区域内的像素点进行标记的方式区分擦除区域内和擦除区域外的笔迹点,简化了判断笔迹点是否位于擦除区域内的判断流程,提高了笔迹擦除的效率,同时在笔迹擦除完成之前在画布上生成用于覆盖擦除区域的蒙层,使用户可以直观的看到擦除区域,保证了用户体验。The present application provides a handwriting erasing method. The handwriting erasing method is applied to the whiteboard application of the terminal device. Firstly, in response to the circle selection operation on the first written handwriting, the erasing track following the circle selection operation is displayed on the canvas. Then create a bitmap image corresponding to the canvas, mark all the pixels in the erasing area corresponding to the erasing track in the bitmap image, and determine the edge pixels of the first handwriting in the bitmap image based on the marked pixels , and perform handwriting erasing processing on the first handwriting based on the edge pixels in the bitmap image to obtain the second handwriting, and finally display the second handwriting on the canvas. This application simplifies the judgment of handwriting points by creating a bitmap image corresponding to the canvas, and marking the pixels in the erased area in the bitmap image to distinguish the handwriting points in the erasing area and outside the erasing area The process of judging whether it is within the erasing area improves the efficiency of handwriting erasing, and at the same time generates a mask on the canvas to cover the erasing area before the handwriting erasing is completed, so that the user can see the erasing area intuitively. Guaranteed user experience.
下面将结合图1~图8,对本申请实施例提供的笔迹擦除方法进行详细介绍。The handwriting erasing method provided by the embodiment of the present application will be described in detail below with reference to FIGS. 1 to 8 .
请参见图1,为本申请实施例提供了一种笔迹擦除方法的流程示意图。如图1所示,笔迹擦除方法可以包括以下步骤S101~S105。Please refer to FIG. 1 , which provides a schematic flowchart of a handwriting erasing method according to the embodiment of the present application. As shown in Fig. 1, the handwriting erasing method may include the following steps S101-S105.
S101,响应于对第一书写笔迹的圈选操作,在画布上显示跟随圈选操作的擦除轨迹;S101, in response to a circle selection operation on the first handwriting, displaying an erasing track following the circle selection operation on the canvas;
画布,即canvas,是指白板应用中用于承载内容的容器,白板应用中的所有书写笔迹、绘制的图形、表格,或者插入的文件等内容均是由画布承载的。对于白板应用来说,画布的尺寸可以与白板应用的显示窗口一致,也可以比白板应用的显示窗口大。在一个实施例中,画布的尺寸大于白板应用的显示窗口,且当在白板应用的显示窗口中移动书写笔迹等内容时,可以对画布的尺寸进行扩展。Canvas, or canvas, refers to the container used to carry content in the whiteboard application. All written handwriting, drawn graphics, tables, or inserted files in the whiteboard application are carried by the canvas. For the whiteboard application, the size of the canvas can be the same as the display window of the whiteboard application, or larger than the display window of the whiteboard application. In one embodiment, the size of the canvas is larger than the display window of the whiteboard application, and when content such as handwriting is moved in the display window of the whiteboard application, the size of the canvas can be expanded.
在本申请实施例中,当检测到用户在终端设备的白板应用中针对显示窗口上的第一书写笔迹有圈选操作时,实施捕捉跟随圈选操作的笔迹点,基于所捕获的各笔迹点构建擦除轨迹曲线,并在画布中显示。这里,擦除轨迹是指圈选操作过程中所形成的选择轨迹,因为圈选操作的目的在于选择要擦除的笔迹,因此,这里将圈选操作过程中所形成的选择轨迹称为擦除轨迹。In the embodiment of the present application, when it is detected that the user performs a circle selection operation on the first handwriting on the display window in the whiteboard application of the terminal device, the handwriting points following the circle selection operation are captured, and based on the captured handwriting points Build an erase track curve and display it in the canvas. Here, the erasing track refers to the selection track formed during the circle selection operation, because the purpose of the circle selection operation is to select the handwriting to be erased, therefore, the selection track formed during the circle selection operation is called erasure track.
可选的,在用户进行圈选操作之前,应对白板应用设置笔迹擦除指令,响应于笔迹擦除指令的设置完成,执行对第一书写笔迹的圈选操作。笔迹擦除指令可以通过白板应用界面的事先设置好的指令按键、或预设的指定动作、或语音控制的方式进行设置。Optionally, before the user performs the circle selection operation, the whiteboard application should set a handwriting erasing instruction, and in response to the setting of the handwriting erasing instruction being completed, execute the circle selection operation on the first written handwriting. The handwriting erasing command can be set through the pre-set command button on the whiteboard application interface, or a preset designated action, or voice control.
S102,创建与画布对应的位图图像,标记位图图像中擦除轨迹对应的擦除区域内的所有像素点,并在画布上生成用于覆盖擦除区域的蒙层;S102, create a bitmap image corresponding to the canvas, mark all pixels in the erased area corresponding to the erased track in the bitmap image, and generate a mask for covering the erased area on the canvas;
具体的,创建与画布当前显示界面一一对应的位图图像,位图图像中包括画布中显示的所有对象,对象包括第一书写笔迹以及擦除轨迹,将擦除轨迹所对应的区域(也就是圈选操作所圈选的区域)作为擦除区域,在位图图像中标记擦除轨迹对应的擦除区域内的所有像素点,同时在画布上生成用于覆盖擦除区域的蒙层。Specifically, a bitmap image corresponding to the current display interface of the canvas is created. The bitmap image includes all objects displayed on the canvas. The objects include the first handwriting and the erasing track, and the area corresponding to the erasing track (also That is, the circled area selected by the circle selection operation) is used as the erasing area, and all pixels in the erasing area corresponding to the erasing track are marked in the bitmap image, and at the same time, a mask for covering the erasing area is generated on the canvas.
可选的,擦除区域可以是将擦除轨迹进行首尾连接生成的闭合区域,擦除区域可以是矩形、圆形、三角形或任意不规则形状。Optionally, the erasing area may be a closed area generated by end-to-end connection of erasing trajectories, and the erasing area may be a rectangle, a circle, a triangle or any irregular shape.
例如,擦除区域可以是以擦除轨迹的第一个笔迹点为起点,以擦除轨迹的最后一个笔迹点为终点,以起点和终点相连接而成的直线为对角线生成矩形区域,将矩形区域作为擦除区域。For example, the erasing area can start from the first handwriting point of the erasing track, end at the last handwriting point of the erasing track, and use the straight line connecting the starting point and the end point as a diagonal to generate a rectangular area. Use the rectangular area as the erasing area.
可选的,一种可实现的方式中,擦除区域可以是以擦除轨迹的第一个笔迹点为起点,以擦除轨迹的最后一个笔迹点为终点,以起点为圆心,并以起点到终点的距离为半径生成圆形区域,将圆形区域作为擦除区域。Optionally, in an achievable manner, the erasing area can start from the first handwriting point of the erasing track, end at the last handwriting point of the erasing track, take the starting point as the center, and start from The distance to the end point is the radius to generate a circular area, and the circular area is used as the erased area.
位图图像由像素组成,每个像素都被分配一个特定位置和颜色值,位图图像与分辨率有关,即在一定面积的图像上包含有固定数量的像素。Bitmap images are composed of pixels, and each pixel is assigned a specific position and color value. Bitmap images are related to resolution, that is, an image of a certain area contains a fixed number of pixels.
S103,基于标记后的像素点,在位图图像中确定第一书写笔迹的边缘像素点;S103, based on the marked pixels, determine edge pixels of the first handwriting in the bitmap image;
如果书写笔迹中存在一条连续完整的笔迹,该笔迹的一部分位于擦除区域内,一部分位于擦除区域外,此时需要确定该笔迹位于擦除区域内的部分笔迹和位于擦除区域外的部分笔迹之间的边缘像素点,以边缘像素点为待擦除轨迹的边界进行笔迹擦除。If there is a continuous and complete handwriting in the handwriting, a part of the handwriting is located in the erasure area, and a part is located outside the erasure area, then it is necessary to determine the part of the handwriting located in the erasure area and the part outside the erasure area The edge pixels between the handwriting, the handwriting is erased with the edge pixels as the boundary of the track to be erased.
具体的,按照时间戳先后顺序遍历第一书写笔迹中各第二笔迹点对应的像素点,在各像素点中确定位于擦除区域边缘的笔迹点组,笔迹点组包括第二擦除轨迹点和第二保留笔迹点,第二擦除轨迹点的时间戳与第二保留笔迹点的时间戳相邻,在第二擦除轨迹点和第二保留笔迹点之间确定书写笔迹中待擦除轨迹的边缘像素点,第二擦除轨迹点对应的像素点为标记像素点,第二保留笔迹点对应的像素点为非标记像素点。Specifically, traverse the pixels corresponding to the second handwriting points in the first written handwriting according to the time stamp sequence, and determine the handwriting point group located at the edge of the erasing area in each pixel point, and the handwriting point group includes the second erasing track point With the second reserved handwriting point, the time stamp of the second erasing track point is adjacent to the time stamp of the second reserved handwriting point, and it is determined to be erased in the writing handwriting between the second erasing track point and the second reserved handwriting point The edge pixels of the track, the pixels corresponding to the second erasing track point are marked pixels, and the pixels corresponding to the second retained handwriting point are non-marked pixels.
上述第二笔迹点即位图图像中第一书写笔迹中对应的笔迹点,第二擦除轨迹点是指位于位图图像中擦除区域内的第二笔迹点,第二保留笔迹点是指位于位图图像中擦除区域外的第二笔迹点。The above-mentioned second handwriting point is the corresponding handwriting point in the first written handwriting in the bitmap image, the second erasing track point refers to the second handwriting point located in the erasing area in the bitmap image, and the second reserved handwriting point refers to the second handwriting point located in The second stamp outside the erased area in the bitmap image.
需要说明的是,在笔迹的书写过程中,由于触控面板是通过一定的采样频率对触控操作进行采样,因此会采样到书写路径上的多个笔迹点,一段连续的书写过程中,书写笔(或手)是一直与触控面板接触的状态,一次连续的书写的轨迹可以认为是一系列在书写路径上的笔迹点的集合,这些笔迹点在触控面板上会有一个唯一的坐标和时间戳标记,将这些笔迹点按照时间戳的先后顺序依次连接起来即生成书写笔迹。It should be noted that during the writing process of handwriting, since the touch panel samples the touch operation through a certain sampling frequency, it will sample multiple handwriting points on the writing path. During a continuous writing process, writing The pen (or hand) is always in contact with the touch panel. The trajectory of a continuous writing can be considered as a collection of handwriting points on the writing path. These handwriting points will have a unique coordinate on the touch panel. and timestamp marks, these handwriting points are connected in sequence according to the time stamps to generate handwriting.
请一并参见图2,为本申请实施例提供了一种笔迹书写的举例示意图。Please also refer to FIG. 2 , which provides an exemplary schematic diagram of handwriting for the embodiment of the present application.
如图2所示,在书写过程中,白板应用基于触控面板对触控操作进行采样,得到书写路径上的多个 笔迹点01,根据笔迹点在触控面板上的坐标和时间戳标记进行顺序连接得到书写笔迹02,并在画布中显示书写笔迹02。笔迹点01仅为示意性的,在实际书写过程中是不显示的,用户看到的是跟随笔尖的移动,实时生成书写笔迹的过程。As shown in Figure 2, during the writing process, the whiteboard application samples touch operations based on the touch panel, and obtains multiple handwriting points 01 on the writing path. The handwriting 02 is obtained by sequential connection, and the handwriting 02 is displayed on the canvas. The handwriting point 01 is only illustrative, and is not displayed during the actual writing process. What the user sees is the process of generating handwriting in real time following the movement of the pen tip.
S104,确认圈选操作结束后,在位图图像中基于边缘像素点对第一书写笔迹进行笔迹擦除处理,得到对第一书写笔迹进行擦除后的第二书写笔迹;S104, after confirming that the circle selection operation is completed, perform handwriting erasing processing on the first handwriting based on edge pixels in the bitmap image, to obtain second handwriting after erasing the first handwriting;
具体的,当在触控面板上进行圈选操作时,将会产生响应的触控数据,根据触控数据的变化可以确定圈选操作的变化情况。确认圈选操作结束是通过触控数据的变化来确定的,当圈选操作结束,即用户提笔或者抬手时,触控数据将不再发生变化,因此可以确认圈选操作结束,从而进一步基于圈选操作所圈选的内容来进行后续的擦除处理。具体的,在位图图像中以边缘像素点为边界,擦除第一书写笔迹中位于擦除区域内的书写笔迹,第一书写笔迹去掉所擦除的书写笔迹后即得到第二书写笔迹。Specifically, when the circle selection operation is performed on the touch panel, corresponding touch data will be generated, and the change of the circle selection operation can be determined according to the change of the touch data. Confirm that the end of the circle selection operation is determined by the change of the touch data. When the circle selection operation ends, that is, when the user lifts the pen or hand, the touch data will no longer change, so you can confirm the end of the circle selection operation, so as to further Subsequent erasing processing is performed based on the content circled by the circle selection operation. Specifically, in the bitmap image, the written handwriting in the erasing area in the first handwriting is erased with edge pixels as the boundary, and the second handwriting is obtained after the erased handwriting is removed from the first handwriting.
S105,在画布上显示第二书写笔迹。S105, displaying the second handwriting on the canvas.
具体的,将位图图像中生成的第二书写笔迹在画布上显示。Specifically, the second handwriting generated in the bitmap image is displayed on the canvas.
可以理解的是,在位图图像中进行笔迹擦除的过程中,白板应用的画布中显示的内容是不发生变化的,在位图图像中对第一书写笔迹进行笔迹擦除处理并得到第二书写笔迹后,再将第二书写笔迹在画布中显示,在笔迹擦除完成后,停止蒙层的显示,并且不再显示相关画布。用户在实际擦除过程中,视觉效果为,在第一书写笔迹上进行圈选操作,将圈选操作对应的擦除区域设置蒙层进行显示,然后蒙层覆盖的擦除区域内的书写笔迹就被擦除。这种方式,在圈选操作的过程中,生成覆盖擦除区域的蒙层,可以直观地显示所圈选的书写笔迹,对要擦除的书写笔迹进行明确的提示,因此用户可以在圈选的过程中实时调整圈选操作的位置,结合实时变化的蒙层的显示区域来判断所选择的待擦除的书写笔迹,从而本方法可以及时调整要擦除的书写笔迹。It can be understood that, in the process of erasing handwriting in the bitmap image, the content displayed on the canvas of the whiteboard application does not change, and the handwriting erasing process is performed on the first handwriting in the bitmap image to obtain the 2. After the handwriting is written, the second handwriting is displayed on the canvas. After the handwriting is erased, the display of the mask layer is stopped, and the relevant canvas is no longer displayed. During the actual erasing process, the visual effect of the user is to perform a circle selection operation on the first handwriting, set a mask to display the erasure area corresponding to the circle selection operation, and then the handwriting in the erasure area covered by the mask is erased. In this way, during the circle selection operation, a mask covering the erased area is generated, which can visually display the circled handwriting and provide clear prompts for the handwriting to be erased, so the user can During the process, the position of the circle selection operation is adjusted in real time, and the selected handwriting to be erased is judged in combination with the display area of the mask layer that changes in real time, so that the method can adjust the handwriting to be erased in time.
在一个实施例中,本方法还包括步骤:In one embodiment, the method also includes the steps of:
根据圈选操作的实时的位置变化,调整蒙层的显示区域。在圈选操作的过程中,擦除区域不断跟随圈选操作而变化,相应的,蒙层的显示区域也一直发生变化,当圈选操作结束后,执行响应的擦除操作,擦除选择的书写笔迹,此时不再存在擦除区域,则停止显示相应蒙层。Adjust the display area of the mask layer according to the real-time position change of the circle selection operation. During the circle selection operation, the erasing area keeps changing with the circle selection operation, and correspondingly, the display area of the mask layer also keeps changing. When the circle selection operation ends, the corresponding erase operation is performed to erase the selected area. Writing handwriting, at this time there is no more erasing area, then stop displaying the corresponding mask.
在本申请实施例中,通过创建与画布对应的位图图像,并通过在位图图像中对擦除区域内的像素点进行标记的方式来区分擦除区域内和擦除区域外的笔迹点,简化了判断笔迹点是否位于擦除区域内的判断流程,提高了笔迹擦除的效率,并在笔迹擦除过程中计算笔迹擦除的边缘像素点,保证了笔迹擦除的精度,同时在笔迹擦除完成之前在画布上生成用于覆盖擦除区域的蒙层,使用户可以直观的看到擦除区域,提升了用户体验。In the embodiment of this application, by creating a bitmap image corresponding to the canvas, and marking the pixels in the erased area in the bitmap image to distinguish the handwriting points in the erased area and outside the erased area , which simplifies the judgment process of judging whether a handwriting point is located in the erasing area, improves the efficiency of handwriting erasing, and calculates the edge pixels of handwriting erasing in the handwriting erasing process, ensuring the accuracy of handwriting erasing, and at the same time Before the handwriting is erased, a mask is generated on the canvas to cover the erased area, so that the user can see the erased area intuitively, which improves the user experience.
请参见图3,为本申请实施例提出了一种笔迹擦除方法的流程示意图。如图3所示,笔迹擦除方法可以包括以下步骤S201~步骤S209。Please refer to FIG. 3 , which is a schematic flowchart of a handwriting erasing method proposed in the embodiment of the present application. As shown in FIG. 3 , the handwriting erasing method may include the following steps S201 to S209.
S201,根据圈选操作,实时捕捉圈选操作对应的擦除轨迹信号,对擦除轨迹信号进行采样,生成连续多个第一笔迹点;S201. According to the circle selection operation, capture the erasure track signal corresponding to the circle selection operation in real time, sample the erasure track signal, and generate a plurality of continuous first handwriting points;
具体的,对擦除轨迹的信号进行采样得到连续的、一系列的第一笔迹点,第一笔迹点上标记有时间戳。Specifically, the signal of the erasing track is sampled to obtain a continuous series of first handwriting points, and the first handwriting points are marked with time stamps.
本申请一个实施例中,在绘制擦除轨迹时,也可以通过选择擦除控件的方式进行擦除轨迹的绘制。In an embodiment of the present application, when drawing the erasing track, the erasing track may also be drawn by selecting an erasing control.
S202,将各第一笔迹点进行连接生成擦除轨迹;S202, connecting each first handwriting point to generate an erasing track;
具体的,按照各第一笔迹点的时间戳的先后顺序将各第一笔迹点进行连接形成擦除轨迹。Specifically, the erasing tracks are formed by connecting the first handwriting points according to the sequence of the time stamps of the first handwriting points.
步骤S201~步骤S202请一并参见图4,为本申请实施例提供了一种生成擦除轨迹的举例示意图。Please refer to FIG. 4 together for steps S201 to S202 , which provides an exemplary schematic diagram of generating erasing tracks for the embodiment of the present application.
如图4所示,在白板应用的画布中有第一书写笔迹02-ABC,若要针对第一书写笔迹02-ABC进行擦除,通过选择擦除控件或设置笔迹擦除指令,在触控面板绘制擦除轨迹,触控面板实时捕捉擦除轨迹信号,生成一系列的第一笔迹点03,将各第一笔迹点按照时间戳的先后顺序在所示画布中进行连接形成擦除轨迹04。As shown in Figure 4, there is the first handwriting 02-ABC in the canvas of the whiteboard application. If you want to erase the first handwriting 02-ABC, you can select the erase control or set the handwriting erasing command in the touch The panel draws the erasing track, the touch panel captures the erasing track signal in real time, generates a series of first handwriting points 03, and connects the first handwriting points in the order of time stamps in the shown canvas to form the erasing track 04 .
S203,创建与画布对应的位图图像,确定位图图像中擦除轨迹内的区域为擦除区域,并在画布中生成用于覆盖擦除区域的蒙层;S203, create a bitmap image corresponding to the canvas, determine the area within the erasing track in the bitmap image as the erasing area, and generate a mask for covering the erasing area in the canvas;
具体的,创建与画布一一对应的位图图像,在位图图像中确定擦除轨迹内的区域为擦除区域。Specifically, a bitmap image one-to-one corresponding to the canvas is created, and the area within the erasing track is determined in the bitmap image as the erasing area.
可选的,擦除区域可以是将擦除轨迹进行首尾连接生成的闭合区域,擦除区域可以是矩形、圆形、三角形或任意不规则形状。Optionally, the erasing area may be a closed area generated by end-to-end connection of erasing trajectories, and the erasing area may be a rectangle, a circle, a triangle or any irregular shape.
优选的,在画布中生成用于覆盖擦除区域的蒙层。Preferably, a mask for covering the erased area is generated in the canvas.
具体的,位图图像并不显示在画布的当前显示界面中,在画布中生成蒙层,蒙层用于覆盖擦除区域,可以方便用户直观的看到哪部分区域内的笔迹将会被擦除。Specifically, the bitmap image is not displayed in the current display interface of the canvas, and a mask layer is generated in the canvas, and the mask layer is used to cover the erasing area, which is convenient for the user to intuitively see which part of the handwriting in the area will be erased remove.
S204,将位图图像中擦除区域内的所有像素点设置为指定颜色;S204, setting all pixels in the erased area in the bitmap image to a specified color;
具体的,在位图图像中将擦除区域内的所有像素点设置为指定颜色,指定颜色不同于第一书写笔迹的颜色。Specifically, in the bitmap image, all pixels in the erasing area are set to a specified color, and the specified color is different from the color of the first handwriting.
步骤S203~步骤S204请一并参见图5,为本申请实施例提供了一种设置擦除区域的举例示意图。Please refer to FIG. 5 together for steps S203 to S204 , which provides an exemplary schematic diagram of setting an erasing area for the embodiment of the present application.
如图5所示,在位图图像中有第一书写笔迹02-ABC以及擦除轨迹04,则擦除轨迹04内的区域为擦除区域05,并在所示位图图像中将擦除区域05内的所有像素点设置为灰色。As shown in Figure 5, in the bitmap image, the first handwriting 02-ABC and erasing track 04 are arranged, then the area in the erasing track 04 is the erasing area 05, and will be erased in the shown bitmap image All pixels in area 05 are set to gray.
S205,按照时间戳先后顺序遍历第一书写笔迹中各第二笔迹点对应的像素点,在各像素点中确定位于擦除区域边缘的笔迹点组,笔迹点组包括指定颜色的第二擦除轨迹点和非指定颜色的第二保留笔迹点,第二擦除轨迹点的时间戳与第二保留笔迹点的时间戳相邻;S205, traversing the pixels corresponding to the second handwriting points in the first written handwriting according to the time stamp sequence, and determining the handwriting point group located at the edge of the erasing area in each pixel point, and the handwriting point group includes the second erasing of the specified color The track point and the second reserved handwriting point of a non-specified color, the time stamp of the second erasing track point is adjacent to the time stamp of the second reserved handwriting point;
具体的,第一书写笔迹中的各第二笔迹点对应有唯一时间戳标记,按照时间戳的先后顺序依次遍历各第二笔迹点对应的像素点,判断各第二笔迹点对应的像素点的颜色值,将颜色值为指定颜色的第二笔迹点确定为第二擦除轨迹点,将颜色值不为指定颜色的第二笔迹点确定为第二保留笔迹点,确定时间戳相邻的第二擦除轨迹点和第二保留笔迹点为一个笔迹点组。Specifically, each second handwriting point in the first handwriting corresponds to a unique time stamp mark, and the pixel points corresponding to each second handwriting point are traversed in sequence according to the order of time stamps, and the pixel points corresponding to each second handwriting point are judged. color value, determine the second handwriting point whose color value is the specified color as the second erasing track point, determine the second handwriting point whose color value is not the specified color as the second reserved handwriting point, and determine the second handwriting point adjacent to the time stamp The second erasing track point and the second reserved handwriting point are a handwriting point group.
不难理解,第二擦除轨迹点的颜色值为指定颜色,第二保留笔迹点的颜色值不为擦除颜色,则第二擦除轨迹点是指位于位图图像中擦除区域内的笔迹点,第二保留笔迹点是指位于位图图像中擦除区域外的笔迹点,因此,时间戳相邻的第二擦除轨迹点和第二保留笔迹点中间存在一条待擦除轨迹的边缘像素点。通过在位图图像中对擦除区域内像素点设置指定颜色的方式来区分擦除区域内和擦除区域外的笔迹点,简化了笔迹擦除过程中判断笔迹点是否位于擦除区域内的判断流程,相比现有方案中的判断方式,简单、快捷,提高了笔迹擦除的效率。It is not difficult to understand that the color value of the second erasing track point is the specified color, and the color value of the second reserved handwriting point is not the erasing color, then the second erasing track point refers to the area located in the erased area in the bitmap image Handwriting point, the second reserved handwriting point refers to the handwriting point located outside the erasing area in the bitmap image, therefore, there is a track to be erased between the second erasing track point and the second reserved handwriting point adjacent to the time stamp edge pixels. By setting the specified color for the pixels in the erasing area in the bitmap image to distinguish the handwriting points in the erasing area and outside the erasing area, it simplifies the process of judging whether the handwriting points are located in the erasing area during handwriting erasing Compared with the judgment method in the existing scheme, the judgment process is simple and fast, and the efficiency of handwriting erasure is improved.
请一并参见图6,为本申请实施例提供了一种确定笔迹点组的举例示意图。Please also refer to FIG. 6 , which provides an exemplary schematic diagram of determining a handwriting point group for the embodiment of the present application.
可以理解的是,位图图像中书写笔迹ABC在所示位图图像中的数据保存形式为带有时间戳的第二笔迹点,如图6所示,所示笔迹点06为第一书写笔迹ABC的各第二笔迹点,所示灰色区域为圈选的擦除区域,各第二笔迹点部分位于擦除区域内,部分位于擦除区域外。按照各时间戳的先后顺序遍历各所示第二笔迹点,判断各第二笔迹点对应的像素点的颜色值,将颜色值为灰色的第二笔迹点确定为第二擦除轨迹点,将颜色值不为灰色的第二笔迹点确定为第二保留笔迹点,确定时间戳相邻的第二擦除轨迹点和第二保留笔迹点为一个笔迹点组,如图5所示,第二笔迹点9和第二笔迹点10为时间戳相邻的两个第二笔迹点,其中第二笔迹点9的像素颜色值不是灰色,第二笔迹点10的像素颜色值是灰色,则确定第二笔迹点9为第二保留笔迹点,第二笔迹点10为第二擦除轨迹点,且第二笔迹点9和第二笔迹点10为一个笔迹点组。It can be understood that the data storage form of the handwriting ABC in the bitmap image in the shown bitmap image is the second handwriting point with a time stamp, as shown in Figure 6, the shown handwriting point 06 is the first handwriting For the second handwriting points of ABC, the gray area shown is the circled erasing area, and each second handwriting point is partly located in the erasing area, and partly located outside the erasing area. According to the sequence of each time stamp, traverse each shown second handwriting point, judge the color value of the pixel point corresponding to each second handwriting point, determine the second handwriting point whose color value is gray as the second erasing track point, and The second handwriting point whose color value is not gray is determined as the second reserved handwriting point, and the second erasing track point and the second reserved handwriting point adjacent to the time stamp are determined to be a handwriting point group, as shown in Figure 5, the second Script point 9 and the second scribe point 10 are two second scribe points adjacent to the time stamp, wherein the pixel color value of the second scribe point 9 is not gray, and the pixel color value of the second scribe point 10 is gray, then determine the first The second handwriting point 9 is the second reserved handwriting point, the second handwriting point 10 is the second erasing track point, and the second handwriting point 9 and the second handwriting point 10 are a handwriting point group.
S206,基于笔迹点组确定第一书写笔迹的边缘像素点;S206. Determine the edge pixel points of the first handwriting based on the handwriting point group;
具体的,使用二分法查找第二擦除轨迹点和第二保留笔迹点之间的二分像素点,将二分像素点作为第一书写笔迹中的边缘像素点。Specifically, a dichotomy method is used to find the dichotomous pixel points between the second erasing track point and the second retained handwriting point, and the dichotomous pixel points are used as edge pixel points in the first handwriting.
一般的,触控面板的采样频率与相邻的笔迹点之间的距离成反比,现有的触控面板的采样频率是非常高的,对应的第二擦除轨迹点和第二保留笔迹点之间距离是非常小的,因此,通常使用五次二分法确定的二分像素点已经足够接近擦除区域的边缘,因此将该二分像素点作为待擦除轨迹的边缘像素点。Generally, the sampling frequency of the touch panel is inversely proportional to the distance between adjacent handwriting points. The sampling frequency of the existing touch panel is very high, and the corresponding second erasing track point and the second reserved handwriting point The distance between them is very small. Therefore, the binary pixel point determined by the five-time binary method is usually close enough to the edge of the erasing area, so the binary pixel point is used as the edge pixel point of the track to be erased.
请一并参见图7,为本申请实施例提供了一种确定边缘像素点的举例示意图。Please also refer to FIG. 7 , which provides an exemplary schematic diagram of determining edge pixel points for the embodiment of the present application.
图7以图6中所示第二笔迹点9和第二笔迹点10为例,使用二分法确定第二笔迹点9和第二笔迹点10之间的边缘像素点。如图7所示,将第二笔迹点9和第二笔迹点10之间的距离放大后可以观察到位图图像由一个个像素点组成,所示第二笔迹点9和第二笔迹点10分别对应一个像素点,根据第二笔迹点9和第二笔迹点10之间的像素点个数使用二分法确定二分点1,如图所示二分点1的像素颜色值不是指定颜色灰色,再在二分点1和第二笔迹点10之间使用二分法确定二分点2,如图所示二分点2的像素颜色值是指定颜色灰色,然后在二分点2和二分点1之间使用二分法确定二分点3,如图所示二分点3的像素颜色值不是指定颜色灰色,继续在二分点3和二分点2之间使用二分法确定二分点4,由于二分点4的像素颜色值不是指定颜色灰色,因此最后在二分点4和二分点2之间使用二分法确定二分点5,如图所示二分点5非常接近擦除区域的边缘,因此将二分点5作为第二笔迹点9和第二笔迹点10之间的边缘像素点。通过二分法的方式确定第一书写笔迹的边缘像素点,可以精确地确定第一书写笔迹的边缘像素点,保证了笔迹擦除的精度。FIG. 7 takes the second handwriting point 9 and the second handwriting point 10 shown in FIG. 6 as an example, and uses the dichotomy method to determine the edge pixels between the second handwriting point 9 and the second handwriting point 10 . As shown in Figure 7, after enlarging the distance between the second handwriting point 9 and the second handwriting point 10, it can be observed that the bitmap image is composed of pixels, and the shown second handwriting point 9 and the second handwriting point 10 are respectively Corresponding to a pixel point, use the dichotomy method to determine the bisection point 1 according to the number of pixels between the second handwriting point 9 and the second handwriting point 10, as shown in the figure, the pixel color value of the bisection point 1 is not the specified color gray, and then in Use the dichotomy method to determine the dichotomy point 2 between the bisector 1 and the second handwriting point 10, as shown in the figure, the pixel color value of the bisector 2 is the specified color gray, and then use the dichotomy method to determine between the dichotomy point 2 and the dichotomy point 1 Dichotomy point 3, as shown in the figure, the pixel color value of bisector point 3 is not the specified color gray, continue to use the dichotomy method between bisector point 3 and dichotomy point 2 to determine dichotomy point 4, because the pixel color value of dichotomy point 4 is not the specified color Gray, so finally use the dichotomy method to determine the dichotomy point 5 between the bisector 4 and the dichotomy point 2, as shown in the figure, the dichotomy point 5 is very close to the edge of the erased area, so the dichotomy point 5 is used as the second handwriting point 9 and the second handwriting point 10 edge pixels between two handwriting points. Determining the edge pixel points of the first handwriting by means of dichotomy can accurately determine the edge pixel points of the first handwriting, thereby ensuring the accuracy of handwriting erasure.
S207,擦除位图图像中的第一书写笔迹;S207, erasing the first handwriting in the bitmap image;
S208,基于边缘像素点以及第一书写笔迹中非指定颜色的第二笔迹点在位图图像中重绘擦除区域之外的书写笔迹,得到第二书写笔迹。S208. Redraw the handwriting outside the erased area in the bitmap image based on the edge pixel points and the second handwriting points in the first handwriting of a non-specified color to obtain the second handwriting.
具体的,将边缘像素点作为起始笔迹点或者终止笔迹点,将起始笔迹点或者终止笔迹点插入至书写笔迹中非指定颜色的笔迹点组成的笔迹点队列中,生成新的笔迹点队列,按照新的笔迹点队列中各笔迹点的时间戳先后顺序,将各笔迹点进行连接。Specifically, the edge pixel is used as the starting handwriting point or the ending handwriting point, and the starting handwriting point or the ending handwriting point is inserted into the handwriting point queue composed of handwriting points of non-specified colors in the written handwriting to generate a new handwriting point queue , according to the time stamp sequence of each handwriting point in the new handwriting point queue, connect each handwriting point.
可以理解的是,若边缘像素点对应的笔迹点组中的第二保留笔迹点的时间戳标记在前,第二擦除轨迹点的时间戳标记在后,则边缘像素点为终止笔迹点;若边缘像素点对应的笔迹点组中的第二保留笔迹点的时间戳标记在后,第二擦除轨迹点的时间戳标记在前,则边缘像素点为起始笔迹点。终止笔迹点仅与笔迹点队列中前面一个笔迹点连接,后面不连接笔迹点,起始笔迹点在笔迹点队列中前面不连接笔迹点,仅与后面一个笔迹点连接。请参见图8,为本申请实施例提供了一种重绘书写笔迹的举例示意图。It can be understood that if the time stamp of the second reserved handwriting point in the handwriting point group corresponding to the edge pixel is in the front, and the time stamp of the second erasing track point is behind, then the edge pixel is the termination handwriting point; If the time stamp of the second reserved handwriting point in the handwriting point group corresponding to the edge pixel is behind, and the time stamp of the second erased track point is in front, then the edge pixel is the starting handwriting point. The ending handwriting point is only connected to the previous handwriting point in the handwriting point queue, and not connected to the back handwriting point. The starting handwriting point is not connected to the front handwriting point in the handwriting point queue, but only connected to the next handwriting point. Please refer to FIG. 8 , which provides an exemplary schematic diagram of redrawing handwriting according to the embodiment of the present application.
如图8所示,所示位图图像中有一条第一书写笔迹701以及擦除区域702,所示第一书写笔迹701有10个笔迹点,按照时间戳顺序,第一书写笔迹701的笔迹点队列中各第二笔迹点依次为笔迹点1、笔迹点2、笔迹点3、笔迹点4、笔迹点5、笔迹点6、笔迹点7、笔迹点8、笔迹点9、笔迹点10,所示笔迹点1、笔迹点2、笔迹点5、笔迹点6、笔迹点9和笔迹点10位于擦除区域外,笔迹点3、笔迹点4、笔迹点7、笔迹点8位于擦除区域内,所示笔迹点2和笔迹点3之间有边缘像素点1,所示笔迹点4和笔迹点5之间有边缘像素点2,所示笔迹点6和笔迹点7之间有边缘像素点3,所示笔迹点8和笔迹点9之间有边缘像素点4。按照上述若边缘像素点对应的笔迹点组中的第二保留笔迹点的时间戳标记在前,第二擦除轨迹点的时间戳标记在后,则边缘像素点为终止笔迹点;若边缘像素点对应的笔迹点组中的第二保留笔迹点的时间戳标记在后,第二擦除轨迹点的时间戳标记在前,则边缘像素点为起始笔迹点。不难看出边缘像素点1对应的笔迹点组中包括笔迹点2和笔迹点3,其中笔迹点2为第二保留笔迹点,笔迹点3为第二擦除轨迹点,则边缘像素点1为终止笔迹点,同理可知,边缘像素点2为起始笔迹点,边缘像素点3为终止笔迹点,边缘像素点4为起始笔迹点。然后将起始笔迹点或者终止笔迹点插入至书写笔迹中非指定颜色的笔迹点组成的笔迹点队列中,生成的新的笔迹点队列依次为笔迹点1、笔迹点2、边缘像素点1(终止笔迹点)、边缘像素点2(起始笔迹点)、笔迹点5、笔迹点6、边缘像素点3(终止笔迹点)、边缘像素点4(起始笔迹点)、笔迹点9、笔迹点10,将新的笔迹点队列中各笔迹点依次顺序连接得到第二书写笔迹703。As shown in Figure 8, there is a first handwriting 701 and an erasing area 702 in the shown bitmap image, the first handwriting 701 shown has 10 handwriting points, according to the timestamp order, the handwriting of the first handwriting 701 Each second handwriting point in the point formation is successively handwriting point 1, handwriting point 2, handwriting point 3, handwriting point 4, handwriting point 5, handwriting point 6, handwriting point 7, handwriting point 8, handwriting point 9, handwriting point 10, Written 1, Written 2, Written 5, Written 6, Written 9 and Written 10 are located outside the erasing area, and Written 3, Written 4, Written 7, and Written 8 are located in the erased area Inside, there is an edge pixel point 1 between the shown handwriting point 2 and the handwriting point 3, there is an edge pixel point 2 between the shown handwriting point 4 and the handwriting point 5, and there is an edge pixel point between the shown handwriting point 6 and the handwriting point 7 At point 3, there is an edge pixel point 4 between the handwriting point 8 and the handwriting point 9 shown. According to the above, if the time stamp mark of the second reserved handwriting point in the handwriting point group corresponding to the edge pixel point is in front, and the time stamp mark of the second erasing track point is behind, then the edge pixel point is the termination handwriting point; if the edge pixel The time stamp of the second reserved handwriting point in the handwriting point group corresponding to the point is at the back, and the time stamp of the second erasing track point is at the front, so the edge pixel point is the starting handwriting point. It is not difficult to see that the handwriting point group corresponding to edge pixel point 1 includes handwriting point 2 and handwriting point 3, wherein handwriting point 2 is the second reserved handwriting point, and handwriting point 3 is the second erasing track point, then edge pixel point 1 is As for the ending handwriting point, it can be known in the same way that the edge pixel point 2 is the starting handwriting point, the edge pixel point 3 is the ending handwriting point, and the edge pixel point 4 is the starting handwriting point. Then the starting handwriting point or the ending handwriting point is inserted into the handwriting point queue formed by the handwriting points of non-designated colors in the written handwriting, and the new handwriting point queue generated is successively handwriting point 1, handwriting point 2, edge pixel point 1 ( end stroke point), edge pixel point 2 (start stroke point), stroke point 5, stroke point 6, edge pixel point 3 (end stroke point), edge pixel point 4 (start stroke point), stroke point 9, stroke point At point 10, the handwriting points in the new handwriting point queue are sequentially connected to obtain the second handwriting 703 .
可选的,在一种可实现的方式中,还可以擦除第一书写笔迹中全部位于擦除区域内以及与擦除区域相交的第一笔迹段,然后基于边缘像素点以及第一笔迹段中非指定颜色的第二笔迹点重绘第一笔迹段中位于擦除区域外的第二笔迹段。Optionally, in an achievable manner, it is also possible to erase all the first handwriting segments in the first handwriting that are located in the erasing area and intersecting with the erasing area, and then based on the edge pixels and the first handwriting segment Redraws the second stroke segment of the first stroke segment that is outside the erased area.
请参见图9,为本申请实施例提供了一种重绘书写笔迹的举例示意图。Please refer to FIG. 9 , which provides an exemplary schematic diagram of redrawing handwriting according to the embodiment of the present application.
如图9所示,所示位图图像中有第一书写笔迹801-123以及擦除区域802,所示第一书写笔迹801-123中1为与所示擦除区域相交的笔迹、2为所示擦除区域内的笔迹、3完全位于所示擦除区域外,则图中 所示1和2为第一笔迹段803,在重绘书写笔迹前将第一笔迹段进行擦除,然后基于边缘像素点以及第一笔迹中非指定颜色的第二笔迹点重绘第一笔迹中位于所示擦除区域外的第二笔迹段804。As shown in Figure 9, there are first handwriting 801-123 and erasing area 802 in the shown bitmap image, among shown first writing handwriting 801-123, 1 is the handwriting intersecting with shown erasing area, 2 is The handwriting and 3 in the shown erasing area are completely outside the shown erasing area, then 1 and 2 shown in the figure are the first handwriting segment 803, and the first handwriting segment is erased before redrawing the writing handwriting, and then The second handwriting segment 804 in the first handwriting outside the erased area is redrawn based on the edge pixels and the second handwriting points in the first handwriting which are not of the designated color.
S209,在画布上显示第二书写笔迹。S209, displaying the second handwriting on the canvas.
将位图图像中的第二书写笔迹显示在画布中,完成笔迹擦除。The second handwriting in the bitmap image is displayed on the canvas to complete handwriting erasing.
在本申请实施例中,通过实时捕捉擦除轨迹信号,生成连续多个第一笔迹点,将各第一笔迹点进行连接生成擦除轨迹,然后创建与画布对应的位图图像,确定位图图像中擦除轨迹内的区域为擦除区域,并在画布中生成显示擦除区域的蒙层,使用户可以直观的看到擦除区域,提升了用户体验;然后在位图图像中将擦除区域内的所有像素点设置为指定颜色,接着按照时间戳先后顺序遍历第一书写笔迹中各第二笔迹点对应的像素点,在各像素点中确定位于擦除区域边缘的笔迹点组,再基于笔迹点组并通过二分法确定第一书写笔迹的边缘像素点,保证了笔迹擦除的精度;最后擦除位图图像中的第一书写笔迹,并基于边缘像素点以及第一书写笔迹中非指定颜色的第二笔迹点在位图图像中重绘擦除区域之外的书写笔迹,得到第二书写笔迹,通过在位图图像中对擦除区域内像素点设置指定颜色的方式来区分擦除区域内和擦除区域外的笔迹点,简化了笔迹擦除过程中判断笔迹点是否位于擦除区域内的判断流程,提高了笔迹擦除的效率。In the embodiment of the present application, by capturing the erasing track signal in real time, a plurality of consecutive first handwriting points are generated, each first handwriting point is connected to generate an erasing track, and then a bitmap image corresponding to the canvas is created to determine the bitmap The area within the erasing track in the image is the erasing area, and a mask showing the erasing area is generated in the canvas, so that the user can see the erasing area intuitively, which improves the user experience; All pixels in the erasing area are set to the designated color, then traverse the pixels corresponding to the second handwriting points in the first handwriting according to the time stamp sequence, and determine the handwriting point group located at the edge of the erasing area in each pixel point, Based on the handwriting point group and determine the edge pixels of the first handwriting by dichotomy, the accuracy of handwriting erasure is guaranteed; finally erase the first handwriting in the bitmap image, and based on the edge pixels and the first handwriting The second handwriting point of the non-specified color in the bitmap image redraws the handwriting outside the erasing area to obtain the second handwriting, by setting the specified color for the pixels in the erasing area in the bitmap image Distinguishes the handwriting points inside and outside the erasing area, simplifies the process of judging whether the handwriting points are located in the erasing area during handwriting erasing, and improves the efficiency of handwriting erasing.
下面将结合图10,对本申请实施例提供的笔迹擦除装置进行详细介绍。需要说明的是,图10中的笔迹擦除装置,用于执行本申请图1~图9所示实施例的方法,为了便于说明,仅示出了与本申请实施例相关的部分,具体技术细节未揭示的,请参照本申请图1~图9所示的实施例。The handwriting erasing device provided by the embodiment of the present application will be described in detail below with reference to FIG. 10 . It should be noted that the handwriting erasing device in Figure 10 is used to execute the method of the embodiments shown in Figures 1 to 9 of the present application. For the convenience of description, only the parts related to the embodiments of the present application are shown. For details not disclosed, please refer to the embodiments shown in FIGS. 1 to 9 of this application.
请参见图10,为本申请实施例提供了一种笔迹擦除装置的结构示意图。如图10所示,本申请实施例的笔迹擦除装置1可以包括:擦除轨迹生成模块11、像素点标记模块12、边缘像素确定模块13、笔迹擦除模块14、笔迹显示模块15。具体包括:Please refer to FIG. 10 , which provides a schematic structural diagram of a handwriting erasing device according to an embodiment of the present application. As shown in FIG. 10 , the handwriting erasing device 1 of the embodiment of the present application may include: an erasing track generating module 11 , a pixel marking module 12 , an edge pixel determining module 13 , a handwriting erasing module 14 , and a handwriting display module 15 . Specifically include:
擦除轨迹生成模块11,用于响应于对第一书写笔迹的圈选操作,在画布上显示跟随圈选操作的擦除轨迹;Erasing track generating module 11, for responding to the circle selection operation to the first written handwriting, display on the canvas the erasing track following the circle selection operation;
像素点标记模块12,用于创建与画布对应的位图图像,标记位图图像中擦除轨迹对应的擦除区域内的所有像素点,并在画布上生成用于覆盖擦除区域的蒙层;The pixel point marking module 12 is used to create a bitmap image corresponding to the canvas, mark all pixels in the erasing area corresponding to the erasing track in the bitmap image, and generate a mask for covering the erasing area on the canvas ;
边缘像素确定模块13,用于基于标记后的像素点,在位图图像中确定第一书写笔迹的边缘像素点;The edge pixel determination module 13 is used to determine the edge pixel points of the first handwriting in the bitmap image based on the marked pixel points;
笔迹擦除模块14,用于在位图图像中基于边缘像素点对第一书写笔迹进行笔迹擦除处理,得到第二书写笔迹;The handwriting erasing module 14 is used to perform handwriting erasing processing on the first handwriting based on edge pixels in the bitmap image to obtain the second handwriting;
笔迹显示模块15,用于在画布上显示第二书写笔迹。The handwriting display module 15 is configured to display the second handwriting on the canvas.
可选的,擦除轨迹生成模块11,具体用于:Optionally, the erasing trajectory generating module 11 is specifically used for:
实时捕捉擦除轨迹信号,生成连续多个第一笔迹点;Real-time capture of erasing track signals to generate multiple consecutive first handwriting points;
将各第一笔迹点进行连接生成擦除轨迹。Connect each first handwriting point to generate an erasing track.
可选的,像素点标记模块12,具体用于:Optionally, the pixel point marking module 12 is specifically used for:
确定位图图像中擦除轨迹内的区域为擦除区域;Determine the area within the erasing track in the bitmap image as the erasing area;
将位图图像中擦除区域内的所有像素点设置为指定颜色;Set all pixels in the erased area of the bitmap image to the specified color;
可选的,如图11所示,边缘像素确定模块13,包括:Optionally, as shown in Figure 11, the edge pixel determination module 13 includes:
笔迹点组确定单元131,用于按照时间戳先后顺序遍历第一书写笔迹中各第二笔迹点对应的像素点,在各像素点中确定位于擦除区域边缘的笔迹点组,笔迹点组包括指定颜色的第二擦除轨迹点和非指定颜色的第二保留笔迹点,第二擦除轨迹点的时间戳与第二保留笔迹点的时间戳相邻;The handwriting point group determination unit 131 is used to traverse the corresponding pixel points of each second handwriting point in the first handwriting according to the time stamp sequence, and determine the handwriting point group located at the edge of the erasing area in each pixel point. The handwriting point group includes A second erasing track point of a specified color and a second reserved handwriting point of a non-specified color, the time stamp of the second erasing track point is adjacent to the time stamp of the second reserved handwriting point;
像素点确定单元132,用于基于笔迹点组确定第一书写笔迹的边缘像素点。The pixel point determination unit 132 is configured to determine edge pixel points of the first handwriting based on the handwriting point group.
可选的,像素点确定单元132,具体用于:Optionally, the pixel point determination unit 132 is specifically used for:
使用二分法查找第二擦除轨迹点和第二保留笔迹点之间的二分像素点,将二分像素点作为第一书写笔迹的边缘像素点。The bisection pixel between the second erasing track point and the second reserved handwriting point is searched for using a bisection method, and the bisection pixel is used as an edge pixel point of the first handwriting.
可选的,如图12所示,笔迹擦除模块14,包括:Optionally, as shown in Figure 12, the handwriting erasing module 14 includes:
第一笔迹擦除单元141,用于擦除位图图像中的第一书写笔迹;The first handwriting erasing unit 141 is used for erasing the first handwriting in the bitmap image;
第一笔迹绘制单元142,用于基于边缘像素点以及第一书写笔迹中非指定颜色的第二笔迹点在位图图像中重绘擦除区域之外的书写笔迹,得到第二书写笔迹。The first handwriting drawing unit 142 is configured to redraw the handwriting outside the erased area in the bitmap image based on the edge pixel points and the second handwriting points of the first handwriting of a non-specified color to obtain the second handwriting.
可选的,第一笔迹绘制单元141,具体用于:Optionally, the first handwriting drawing unit 141 is specifically used for:
将边缘像素点作为起始笔迹点或者终止笔迹点;Use the edge pixel as the starting or ending stroke point;
将起始笔迹点或者终止笔迹点插入至书写笔迹中非指定颜色的第二笔迹点组成的笔迹点队列中,生成新的笔迹点队列;Inserting the starting handwriting point or the ending handwriting point into the handwriting point queue composed of the second handwriting point of the non-specified color in the written handwriting to generate a new handwriting point queue;
按照新的笔迹点队列中各笔迹点的时间戳先后顺序,将各笔迹点进行连接,得到第二书写笔迹。According to the time stamp sequence of each handwriting point in the new handwriting point queue, the handwriting points are connected to obtain the second handwriting.
可选的,如图13所示,笔迹擦除模块14,包括:Optionally, as shown in Figure 13, the handwriting erasing module 14 includes:
第二笔迹擦除单元143,用于擦除第一书写笔迹中全部位于擦除区域内以及与擦除区域相交的第一笔迹段;The second handwriting erasing unit 143 is used for erasing all the first handwriting segments in the first handwriting within the erasing area and intersecting with the erasing area;
第二笔迹绘制单元144,用于基于边缘像素点以及第一笔迹段中非指定颜色的第二笔迹点重绘第一笔迹段中位于擦除区域外的第二笔迹段,得到第二书写笔迹。The second handwriting drawing unit 144 is used to redraw the second handwriting segment outside the erasing area in the first handwriting segment based on the edge pixel points and the second handwriting point of the first handwriting segment of a non-designated color, so as to obtain the second written handwriting .
可选的,第二笔迹绘制单元143,具体用于:Optionally, the second handwriting drawing unit 143 is specifically used for:
将边缘像素点作为起始笔迹点或者终止笔迹点;Use the edge pixel as the starting or ending stroke point;
将起始笔迹点或者终止笔迹点插入至第一笔迹段中非指定颜色的第二笔迹点组成的笔迹点队列中,生成新的笔迹点队列;Inserting the starting handwriting point or the ending handwriting point into the handwriting point queue composed of the second handwriting point of the non-specified color in the first handwriting segment to generate a new handwriting point queue;
按照新的笔迹点队列中各笔迹点的时间戳先后顺序,将各笔迹点进行连接,得到第二书写笔迹。According to the time stamp sequence of each handwriting point in the new handwriting point queue, the handwriting points are connected to obtain the second handwriting.
需要说明的是,上述实施例提供的笔迹擦除装置在执行笔迹擦除方法时,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将设备的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。另外,上述实施例提供的笔迹擦除装置与笔迹擦除方法实施例属于同一构思,其体现实现过程详见方法实施例,这里不再赘述。It should be noted that, when the handwriting erasing device provided by the above-mentioned embodiments executes the handwriting erasing method, the division of the above-mentioned functional modules is used as an example for illustration. In practical applications, the above-mentioned functions can be allocated by different functions according to needs Module completion means that the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the handwriting erasing device and the handwriting erasing method embodiments provided by the above embodiments belong to the same idea, and the implementation process thereof is detailed in the method embodiments, and will not be repeated here.
在本申请实施例中,通过实时捕捉擦除轨迹信号,生成连续多个第一笔迹点,将各第一笔迹点进行连接生成擦除轨迹,然后创建与画布对应的位图图像,确定位图图像中擦除轨迹内的区域为擦除区域,并在画布中生成显示擦除区域的蒙层,使用户可以直观的看到擦除区域,提升了用户体验;然后在位图图像中将擦除区域内的所有像素点设置为指定颜色,接着按照时间戳先后顺序遍历第一书写笔迹中各第二笔迹点对应的像素点,在各像素点中确定位于擦除区域边缘的笔迹点组,再基于笔迹点组并通过二分法确定第一书写笔迹的边缘像素点,保证了笔迹擦除的精度;最后擦除位图图像中的第一书写笔迹,并基于边缘像素点以及第一书写笔迹中非指定颜色的第二笔迹点在位图图像中重绘擦除区域之外的书写笔迹,得到第二书写笔迹,通过在位图图像中对擦除区域内像素点设置指定颜色的方式来区分擦除区域内和擦除区域外的笔迹点,简化了笔迹擦除过程中判断笔迹点是否位于擦除区域内的判断流程,提高了笔迹擦除的效率。In the embodiment of the present application, by capturing the erasing track signal in real time, a plurality of consecutive first handwriting points are generated, each first handwriting point is connected to generate an erasing track, and then a bitmap image corresponding to the canvas is created to determine the bitmap The area within the erasing track in the image is the erasing area, and a mask showing the erasing area is generated in the canvas, so that the user can see the erasing area intuitively, which improves the user experience; All pixels in the erasing area are set to the designated color, then traverse the pixels corresponding to the second handwriting points in the first handwriting according to the time stamp sequence, and determine the handwriting point group located at the edge of the erasing area in each pixel point, Based on the handwriting point group and determine the edge pixels of the first handwriting by dichotomy, the accuracy of handwriting erasure is guaranteed; finally erase the first handwriting in the bitmap image, and based on the edge pixels and the first handwriting The second handwriting point of the non-specified color in the bitmap image redraws the handwriting outside the erasing area to obtain the second handwriting, by setting the specified color for the pixels in the erasing area in the bitmap image Distinguishes the handwriting points inside and outside the erasing area, simplifies the process of judging whether the handwriting points are located in the erasing area during handwriting erasing, and improves the efficiency of handwriting erasing.
本申请实施例还提供了一种计算机存储介质,计算机存储介质可以存储有多条指令,指令适于由处理器加载并执行如上述图1~图9所示实施例的笔迹擦除方法,具体执行过程可以参见图1~图9所示实施例的具体说明,在此不进行赘述。The embodiment of the present application also provides a computer storage medium, the computer storage medium can store a plurality of instructions, the instructions are suitable for being loaded by the processor and executing the handwriting erasing method of the embodiment shown in the above-mentioned Figures 1 to 9, specifically For the execution process, reference may be made to the specific descriptions of the embodiments shown in FIGS. 1 to 9 , and details are not repeated here.
本申请还提供了一种计算机程序产品,该计算机程序产品存储有至少一条指令,至少一条指令由处理器加载并执行如上述图1~图9所示实施例的笔迹擦除方法,具体执行过程可以参见图1~图9所示实施例的具体说明,在此不进行赘述。The present application also provides a computer program product, the computer program product stores at least one instruction, at least one instruction is loaded by the processor and executes the handwriting erasing method of the embodiment shown in the above-mentioned Figures 1 to 9, the specific execution process Reference may be made to the specific descriptions of the embodiments shown in FIGS. 1 to 9 , and details are not repeated here.
请参见图14,为本申请实施例提供了一种电子设备的结构示意图。如图14所示,电子设备1000可以包括:至少一个处理器1001,至少一个存储器1002,至少一个网络接口1003,至少一个输入输出接口1004,至少一个通讯总线1005和至少一个显示单元1006。其中,处理器1001可以包括一个或者 多个处理核心。处理器1001利用各种接口和线路连接整个电子设备1000内的各个部分,通过运行或执行存储在存储器1002内的指令、程序、代码集或指令集,以及调用存储在存储器1002内的数据,执行终端1000的各种功能和处理数据。存储器1002可以是高速RAM存储器,也可以是非不稳定的存储器(non-volatile memory),例如至少一个磁盘存储器。存储器1002可选的还可以是至少一个位于远离前述处理器1001的存储装置。其中,网络接口1003可选的可以包括标准的有线接口、无线接口(如WI-FI接口)。通信总线1005用于实现这些组件之间的连接通信。显示单元1006可以是触控面板。如图14所示,作为一种存储介质的存储器1002中可以包括操作系统、网络通信模块、输入输出接口模块以及笔迹擦除程序。Please refer to FIG. 14 , which provides a schematic structural diagram of an electronic device according to an embodiment of the present application. As shown in FIG. 14 , the electronic device 1000 may include: at least one processor 1001, at least one memory 1002, at least one network interface 1003, at least one input and output interface 1004, at least one communication bus 1005 and at least one display unit 1006. Wherein, the processor 1001 may include one or more processing cores. The processor 1001 uses various interfaces and lines to connect various parts of the entire electronic device 1000, and executes or executes instructions, programs, code sets or instruction sets stored in the memory 1002, and calls data stored in the memory 1002 to execute Various functions and processing data of the terminal 1000. The memory 1002 can be a high-speed RAM memory, or a non-volatile memory, such as at least one disk memory. Optionally, the memory 1002 may also be at least one storage device located away from the aforementioned processor 1001 . Wherein, the network interface 1003 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The communication bus 1005 is used to realize connection communication between these components. The display unit 1006 may be a touch panel. As shown in FIG. 14 , the memory 1002 as a storage medium may include an operating system, a network communication module, an input/output interface module, and a handwriting erasing program.
在图14所示的电子设备1000中,输入输出接口1004主要用于为用户以及接入设备提供输入的接口,获取用户以及接入设备输入的数据。In the electronic device 1000 shown in FIG. 14 , the input and output interface 1004 is mainly used to provide an input interface for the user and the access device, and obtain data input by the user and the access device.
在一个实施例中。In one embodiment.
处理器1001可以用于调用存储器1002中存储的笔迹擦除程序,并具体执行以下操作:The processor 1001 can be used to call the handwriting erasing program stored in the memory 1002, and specifically perform the following operations:
响应于对第一书写笔迹的圈选操作,在画布上显示跟随圈选操作的擦除轨迹;In response to a framing operation on the first handwriting, displaying on the canvas an erasing trail following the circling operation;
创建与画布对应的位图图像,标记位图图像中擦除轨迹对应的擦除区域内的所有像素点,并在画布上生成用于覆盖擦除区域的蒙层;Create a bitmap image corresponding to the canvas, mark all pixels in the erased area corresponding to the erased track in the bitmap image, and generate a mask on the canvas to cover the erased area;
基于标记后的像素点,在位图图像中确定第一书写笔迹的边缘像素点;Determine edge pixels of the first handwriting in the bitmap image based on the marked pixels;
在位图图像中基于边缘像素点对第一书写笔迹进行笔迹擦除处理,得到第二书写笔迹;Performing handwriting erasing processing on the first handwriting based on edge pixels in the bitmap image to obtain second handwriting;
在画布上显示第二书写笔迹。Displays the second handwriting on the canvas.
可选的,处理器1001在执行响应于对第一书写笔迹的圈选操作,在画布上显示跟随圈选操作的擦除轨迹时,具体执行以下操作:Optionally, when the processor 1001 displays an erasing track following the circle selection operation on the canvas in response to the circle selection operation on the first handwriting, specifically perform the following operations:
实时捕捉擦除轨迹信号,生成连续多个第一笔迹点;Real-time capture of erasing track signals to generate multiple consecutive first handwriting points;
将各第一笔迹点进行连接生成擦除轨迹。Connect each first handwriting point to generate an erasing track.
可选的,处理器1001在执行标记位图图像中擦除轨迹对应的擦除区域内的所有像素点时,具体执行以下操作:Optionally, when the processor 1001 marks all the pixels in the erasing area corresponding to the erasing track in the bitmap image, it specifically performs the following operations:
确定位图图像中擦除轨迹内的区域为擦除区域;Determine the area within the erasing track in the bitmap image as the erasing area;
将位图图像中擦除区域内的所有像素点设置为指定颜色;Set all pixels in the erased area of the bitmap image to the specified color;
基于标记后的像素点,确定位图图像中第一书写笔迹的边缘像素点,包括:Based on the marked pixels, determine the edge pixels of the first handwriting in the bitmap image, including:
按照时间戳先后顺序遍历第一书写笔迹中各第二笔迹点对应的像素点,在各像素点中确定位于擦除区域边缘的笔迹点组,笔迹点组包括指定颜色的第二擦除轨迹点和非指定颜色的第二保留笔迹点,第二擦除轨迹点的时间戳与第二保留笔迹点的时间戳相邻;Traverse the pixels corresponding to the second handwriting points in the first written handwriting according to the time stamp sequence, determine the handwriting point group located at the edge of the erasing area in each pixel point, and the handwriting point group includes the second erasing track point of the specified color and the second reserved handwriting point of a non-specified color, the time stamp of the second erasing track point is adjacent to the time stamp of the second reserved handwriting point;
基于笔迹点组确定第一书写笔迹的边缘像素点。Edge pixel points of the first handwriting are determined based on the handwriting point group.
可选的,处理器1001在执行基于笔迹点组确定第一书写笔迹的边缘像素点时,具体执行以下操作:Optionally, when the processor 1001 determines the edge pixel points of the first handwriting based on the handwriting point group, it specifically performs the following operations:
使用二分法查找第二擦除轨迹点和第二保留笔迹点之间的二分像素点,将二分像素点作为第一书写笔迹的边缘像素点。The bisection pixel between the second erasing track point and the second reserved handwriting point is searched for using a bisection method, and the bisection pixel is used as an edge pixel point of the first handwriting.
可选的,处理器1001在执行在位图图像中基于边缘像素点对第一书写笔迹进行笔迹擦除处理,得到第二书写笔迹时,具体执行以下操作:Optionally, when the processor 1001 performs handwriting erasing processing on the first handwriting based on the edge pixels in the bitmap image to obtain the second handwriting, specifically perform the following operations:
擦除位图图像中的第一书写笔迹;erasing the first handwriting in the bitmap image;
基于边缘像素点以及第一书写笔迹中非指定颜色的第二笔迹点在位图图像中重绘擦除区域之外的书写笔迹,得到第二书写笔迹。Redrawing the handwriting outside the erased area in the bitmap image based on the edge pixels and the second handwriting points of the first handwriting not of the specified color to obtain the second handwriting.
可选的,处理器1001在执行基于边缘像素点以及第一书写笔迹中非指定颜色的第二笔迹点重绘擦除区域之外的书写笔迹,得到第二书写笔迹时,具体执行以下操作:Optionally, when the processor 1001 redraws the handwriting outside the erased area based on the edge pixels and the second handwriting points of a non-specified color in the first handwriting to obtain the second handwriting, specifically perform the following operations:
将边缘像素点作为起始笔迹点或者终止笔迹点;Use the edge pixel as the starting or ending stroke point;
将起始笔迹点或者终止笔迹点插入至书写笔迹中非指定颜色的第二笔迹点组成的笔迹点队列中,生成新的笔迹点队列;Inserting the starting handwriting point or the ending handwriting point into the handwriting point queue composed of the second handwriting point of the non-specified color in the written handwriting to generate a new handwriting point queue;
按照新的笔迹点队列中各笔迹点的时间戳先后顺序,将各笔迹点进行连接,得到第二书写笔迹。According to the time stamp sequence of each handwriting point in the new handwriting point queue, the handwriting points are connected to obtain the second handwriting.
可选的,处理器1001在执行在位图图像中基于边缘像素点对第一书写笔迹进行笔迹擦除处理,得到第二书写笔迹时,具体执行以下操作:Optionally, when the processor 1001 performs handwriting erasing processing on the first handwriting based on the edge pixels in the bitmap image to obtain the second handwriting, specifically perform the following operations:
擦除第一书写笔迹中全部位于擦除区域内以及与擦除区域相交的第一笔迹段;Erase all the first handwriting segments within the erasing area and intersecting with the erasing area in the first handwriting;
基于边缘像素点以及第一笔迹段中非指定颜色的第二笔迹点重绘第一笔迹段中位于擦除区域外的第二笔迹段,得到第二书写笔迹。Redrawing the second handwriting segment outside the erasing area in the first handwriting segment based on the edge pixels and the second handwriting point of the first handwriting segment of a non-specified color to obtain a second handwriting.
可选的,处理器1001在执行基于边缘像素点以及第一笔迹段中非指定颜色的第二笔迹点重绘第一笔迹段中位于擦除区域外的第二笔迹段,得到第二书写笔迹时,具体执行以下操作:Optionally, the processor 1001 redraws the second handwriting segment outside the erasing area in the first handwriting segment based on the edge pixel points and the second handwriting point of a non-designated color in the first handwriting segment to obtain the second written handwriting , specifically perform the following operations:
将边缘像素点作为起始笔迹点或者终止笔迹点;Use the edge pixel as the starting or ending stroke point;
将起始笔迹点或者终止笔迹点插入至第一笔迹段中非指定颜色的第二笔迹点组成的笔迹点队列中,生成新的笔迹点队列;Inserting the starting handwriting point or the ending handwriting point into the handwriting point queue composed of the second handwriting point of the non-specified color in the first handwriting segment to generate a new handwriting point queue;
按照新的笔迹点队列中各笔迹点的时间戳先后顺序,将各笔迹点进行连接,得到第二书写笔迹。According to the time stamp sequence of each handwriting point in the new handwriting point queue, the handwriting points are connected to obtain the second handwriting.
在本申请实施例中,通过实时捕捉擦除轨迹信号,生成连续多个第一笔迹点,将各第一笔迹点进行连接生成擦除轨迹,然后创建与画布对应的位图图像,确定位图图像中擦除轨迹内的区域为擦除区域,并在画布中生成显示擦除区域的蒙层,使用户可以直观的看到擦除区域,提升了用户体验;然后在位图图像中将擦除区域内的所有像素点设置为指定颜色,接着按照时间戳先后顺序遍历第一书写笔迹中各第二笔迹点对应的像素点,在各像素点中确定位于擦除区域边缘的笔迹点组,再基于笔迹点组并通过二分法确定第一书写笔迹的边缘像素点,保证了笔迹擦除的精度;最后擦除位图图像中的第一书写笔迹,并基于边缘像素点以及第一书写笔迹中非指定颜色的第二笔迹点在位图图像中重绘擦除区域之外的书写笔迹,得到第二书写笔迹,通过在位图图像中对擦除区域内像素点设置指定颜色的方式来区分擦除区域内和擦除区域外的笔迹点,简化了笔迹擦除过程中判断笔迹点是否位于擦除区域内的判断流程,提高了笔迹擦除的效率。In the embodiment of the present application, by capturing the erasing track signal in real time, a plurality of consecutive first handwriting points are generated, each first handwriting point is connected to generate an erasing track, and then a bitmap image corresponding to the canvas is created to determine the bitmap The area within the erasing track in the image is the erasing area, and a mask showing the erasing area is generated in the canvas, so that the user can see the erasing area intuitively, which improves the user experience; All pixels in the erasing area are set to the designated color, then traverse the pixels corresponding to the second handwriting points in the first handwriting according to the time stamp sequence, and determine the handwriting point group located at the edge of the erasing area in each pixel point, Based on the handwriting point group and determine the edge pixels of the first handwriting by dichotomy, the accuracy of handwriting erasure is guaranteed; finally erase the first handwriting in the bitmap image, and based on the edge pixels and the first handwriting The second handwriting point of the non-specified color in the bitmap image redraws the handwriting outside the erasing area to obtain the second handwriting, by setting the specified color for the pixels in the erasing area in the bitmap image Distinguishes the handwriting points inside and outside the erasing area, simplifies the process of judging whether the handwriting points are located in the erasing area during handwriting erasing, and improves the efficiency of handwriting erasing.
本领域的技术人员可以清楚地了解到本申请的技术方案可借助软件和/或硬件来实现。本说明书中的“单元”和“模块”是指能够独立完成或与其他部件配合完成特定功能的软件和/或硬件,其中硬件例如可以是现场可编程门阵列(Field-ProgrammaBLE Gate Array,FPGA)、集成电路(Integrated Circuit,IC)等。Those skilled in the art can clearly understand that the technical solutions of the present application can be realized by means of software and/or hardware. "Unit" and "module" in this specification refer to software and/or hardware that can complete specific functions independently or in cooperation with other components, where the hardware can be, for example, Field Programmable Gate Array (Field-ProgrammaBLE Gate Array, FPGA) , Integrated Circuit (Integrated Circuit, IC), etc.
需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本申请所必须的。It should be noted that for the foregoing method embodiments, for the sake of simple description, they are expressed as a series of action combinations, but those skilled in the art should know that the present application is not limited by the described action sequence. Depending on the application, certain steps may be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification belong to preferred embodiments, and the actions and modules involved are not necessarily required by this application.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。In the foregoing embodiments, the descriptions of each embodiment have their own emphases, and for parts not described in detail in a certain embodiment, reference may be made to relevant descriptions of other embodiments.
在本申请所提供的几个实施例中,应该理解到,所揭露的装置,可通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些服务接口,装置或单元的间接耦合或通信连接,可以是电性或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed device can be implemented in other ways. For example, the device embodiments described above are only illustrative, such as the division of units, which is only a logical function division, and there may be other division methods in actual implementation, for example, multiple units or components can be combined or integrated into Another system, or some features may be ignored, or not implemented. In another point, the mutual coupling or direct coupling or communication connection shown or discussed may be through some service interfaces, and the indirect coupling or communication connection of devices or units may be in electrical or other forms.
作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。A unit described as a separate component may or may not be physically separated, and a component displayed as a unit may or may not be a physical unit, that is, it may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.
集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储器中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储器中,包括若干指令用以使得一台电子设备(可为个人计算机、服务器或者网络设备等)执行本申请各个实施例方法的全部或部分步骤。而前述的存储器包括:U盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。An integrated unit may be stored in a computer-readable memory if implemented in the form of a software function unit and sold or used as an independent product. Based on this understanding, the technical solution of the present application is essentially or part of the contribution to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory. Several instructions are included to make an electronic device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods in the various embodiments of the present application. The aforementioned memory includes: U disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通进程序来指令相关的硬件来完成,该程序可以存储于一计算机可读存储器中,存储器可以包括:闪存盘、只读存储器(Read-Only Memory,ROM)、随机存取器(Random Access Memory,RAM)、磁盘或光盘等。Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above-mentioned embodiments can be completed by entering a program to instruct related hardware. The program can be stored in a computer-readable memory, and the memory can include: flash memory disk, read-only memory (Read-Only Memory, ROM), random access device (Random Access Memory, RAM), magnetic disk or optical disk, etc.
以上者,仅为本公开的示例性实施例,不能以此限定本公开的范围。即但凡依本公开教导所作的等效变化与修饰,皆仍属本公开涵盖的范围内。本领域技术人员在考虑说明书及实践这里的公开后,将容易想到本公开的其它实施方案。本申请旨在涵盖本公开的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本公开的一般性原理并包括本公开未记载的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本公开的范围和精神由权利要求限定。The above are merely exemplary embodiments of the present disclosure, and should not limit the scope of the present disclosure. That is, all equivalent changes and modifications made according to the teachings of the present disclosure still fall within the scope of the present disclosure. Other embodiments of the disclosure will be readily apparent to those skilled in the art from consideration of the specification and practice of the disclosure herein. This application is intended to cover any modification, use or adaptation of the present disclosure, and these modifications, uses or adaptations follow the general principles of the present disclosure and include common knowledge or conventional technical means in the technical field not described in the present disclosure . The specification and examples are to be considered exemplary only, with the scope and spirit of the present disclosure defined by the claims.

Claims (16)

  1. 一种笔迹擦除方法,其特征在于,应用于终端设备的白板应用中,所述白板应用的画布上包括第一书写笔迹,所述方法包括:A method for erasing handwriting is characterized in that it is applied to a whiteboard application of a terminal device, and the canvas of the whiteboard application includes first handwriting, and the method includes:
    响应于对所述第一书写笔迹的圈选操作,在所述画布上显示跟随所述圈选操作的擦除轨迹,所述擦除轨迹包括基于所述圈选操作所捕捉的笔迹点所构建的笔迹曲线;In response to a circle-selecting operation on the first written handwriting, displaying on the canvas an erasing track following the circle-selecting operation, the erasing track comprising the points constructed based on the handwriting points captured by the circle-selecting operation handwriting curve;
    创建与所述画布对应的位图图像,标记所述位图图像中所述擦除轨迹对应的擦除区域内的所有像素点;Create a bitmap image corresponding to the canvas, and mark all pixels in the erasing area corresponding to the erasing track in the bitmap image;
    基于标记后的所述像素点,在所述位图图像中确定所述第一书写笔迹的边缘像素点;determining edge pixels of the first handwriting in the bitmap image based on the marked pixels;
    在所述位图图像中基于所述边缘像素点对所述第一书写笔迹进行笔迹擦除处理,得到第二书写笔迹;performing handwriting erasing processing on the first handwriting based on the edge pixels in the bitmap image to obtain second handwriting;
    在所述画布上显示所述第二书写笔迹。The second handwriting is displayed on the canvas.
  2. 根据权利要求1所述的方法,其特征在于,所述响应于对所述第一书写笔迹的圈选操作,在所述画布上显示跟随所述圈选操作的擦除轨迹,包括:The method according to claim 1, wherein in response to the circle-select operation on the first handwriting, displaying on the canvas an erasing track following the circle-select operation comprises:
    根据所述圈选操作,实时捕捉所述圈选操作对应的擦除轨迹信号,对所述擦除轨迹信号进行采样,生成连续多个第一笔迹点;According to the circle selection operation, capture the erasure track signal corresponding to the circle selection operation in real time, sample the erasure track signal, and generate a plurality of continuous first handwriting points;
    将各所述第一笔迹点进行连接生成擦除轨迹。Connecting each of the first handwriting points to generate an erasing track.
  3. 根据权利要求2所述的方法,其特征在于,所述将各所述第一笔迹点进行连接生成擦除轨迹,具体为:The method according to claim 2, wherein said connecting each of said first handwriting points to generate an erasing track is specifically:
    按照各所述第一笔迹点的时间戳的先后顺序,将各所述第一笔迹点进行连接形成擦除轨迹。According to the sequence of the time stamps of the first handwriting points, the first handwriting points are connected to form an erasing track.
  4. 根据权利要求1所述的方法,其特征在于,所述擦除区域为将所述擦除轨迹进行首尾连接生成的闭合区域。The method according to claim 1, wherein the erasing area is a closed area generated by connecting the erasing tracks end-to-end.
  5. 根据权利要求1所述的方法,其特征在于,所述标记所述位图图像中所述擦除轨迹对应的擦除区域内的所有像素点,包括:The method according to claim 1, wherein the marking all pixels in the erasing area corresponding to the erasing track in the bitmap image comprises:
    确定所述位图图像中所述擦除轨迹内的区域为擦除区域;Determining an area within the erasing track in the bitmap image as an erasing area;
    将所述位图图像中所述擦除区域内的所有像素点设置为指定颜色;Set all pixels in the erased area in the bitmap image to a specified color;
    所述基于标记后的所述像素点,确定所述位图图像中所述第一书写笔迹的边缘像素点,包括:The determining the edge pixels of the first handwriting in the bitmap image based on the marked pixels includes:
    按照时间戳先后顺序遍历所述第一书写笔迹中各第二笔迹点对应的像素点,在各所述像素点中确定位于所述擦除区域边缘的笔迹点组,所述笔迹点组包括指定颜色的第二擦除轨迹点和非所述指定颜色的第二保留笔迹点,所述第二擦除轨迹点的时间戳与所述第二保留笔迹点的时间戳相邻;Traverse the pixel points corresponding to the second handwriting points in the first written handwriting according to the time stamp sequence, and determine the handwriting point groups located at the edge of the erasing area in each of the pixel points, and the handwriting point groups include specified A second erasing track point of a color and a second reserved handwriting point not of the specified color, the time stamp of the second erased track point is adjacent to the time stamp of the second reserved handwriting point;
    基于所述笔迹点组确定所述第一书写笔迹的边缘像素点。Determine edge pixel points of the first handwriting based on the set of handwriting points.
  6. 根据权利要求5所述的方法,其特征在于,所述基于所述笔迹点组确定所述第一书写笔迹的边缘像素点,包括:The method according to claim 5, wherein said determining the edge pixel points of said first handwriting based on said handwriting point group comprises:
    使用二分法查找所述第二擦除轨迹点和所述第二保留笔迹点之间的二分像素点,将所述二分像素点作为所述第一书写笔迹的边缘像素点。A dichotomy method is used to find a dichotomous pixel point between the second erasing track point and the second retained handwriting point, and the dichotomous pixel point is used as an edge pixel point of the first handwriting.
  7. 根据权利要求1所述的方法,其特征在于,所述创建与所述画布对应的位图图像,标记所述位图图像中所述擦除轨迹对应的擦除区域内的所有像素点的步骤中,还包括:The method according to claim 1, characterized in that, the step of creating a bitmap image corresponding to the canvas and marking all pixels in the erasing area corresponding to the erasing track in the bitmap image , also includes:
    在所述画布上生成用于覆盖所述擦除区域的蒙层。A mask covering the erased area is generated on the canvas.
  8. 根据权利要求7所述的方法,其特征在于,所述方法还包括步骤:The method according to claim 7, characterized in that the method further comprises the steps of:
    根据所述圈选操作的实时的位置变化,调整所述蒙层的显示区域。According to the real-time position change of the circle selection operation, the display area of the mask layer is adjusted.
  9. 根据权利要求7所述的方法,其特征在于,所述在所述位图图像中基于所述边缘像素点对所述第一书写笔迹进行笔迹擦除处理,得到第二书写笔迹的过程中,还包括:The method according to claim 7, characterized in that, in the process of performing handwriting erasure processing on the first handwriting based on the edge pixels in the bitmap image to obtain the second handwriting, Also includes:
    停止显示所述蒙层。Stop showing the mask.
  10. 根据权利要求1所述的方法,其特征在于,所述在所述位图图像中基于所述边缘像素点对所述第一书写笔迹进行笔迹擦除处理,得到第二书写笔迹,包括:The method according to claim 1, wherein the step of erasing the first handwriting based on the edge pixels in the bitmap image to obtain the second handwriting includes:
    擦除所述位图图像中的第一书写笔迹;erasing the first handwriting in the bitmap image;
    基于所述边缘像素点以及所述第一书写笔迹中非所述指定颜色的第二笔迹点在所述位图图像中重绘所述擦除区域之外的书写笔迹,得到第二书写笔迹。Redrawing the handwriting outside the erasing area in the bitmap image based on the edge pixels and the second handwriting points in the first handwriting that are not of the specified color to obtain second handwriting.
  11. 根据权利要求10所述的方法,其特征在于,所述基于所述边缘像素点以及所述第一书写笔迹中非所述指定颜色的第二笔迹点重绘所述擦除区域之外的书写笔迹,得到第二书写笔迹,包括:The method according to claim 10, characterized in that, redrawing the writing outside the erased area based on the edge pixel points and the second handwriting points in the first handwriting that are not of the specified color Handwriting, to obtain second handwriting, including:
    将所述边缘像素点作为起始笔迹点或者终止笔迹点;Using the edge pixel as a starting handwriting point or an ending handwriting point;
    将所述起始笔迹点或者所述终止笔迹点插入至所述书写笔迹中非所述指定颜色的第二笔迹点组成的笔迹点队列中,生成新的笔迹点队列;Inserting the starting handwriting point or the ending handwriting point into a handwriting point queue composed of second handwriting points other than the specified color in the written handwriting to generate a new handwriting point queue;
    按照所述新的笔迹点队列中各笔迹点的时间戳先后顺序,将各所述笔迹点进行连接,得到第二书写笔迹。According to the time stamp sequence of each handwriting point in the new handwriting point queue, the handwriting points are connected to obtain the second handwriting.
  12. 根据权利要求1所述的方法,其特征在于,所述在所述位图图像中基于所述边缘像素点对所述第一书写笔迹进行笔迹擦除处理,得到第二书写笔迹,包括:The method according to claim 1, wherein the step of erasing the first handwriting based on the edge pixels in the bitmap image to obtain the second handwriting includes:
    擦除所述第一书写笔迹中全部位于所述擦除区域内以及与所述擦除区域相交的第一笔迹段;erasing all the first handwriting segments within the erasing area and intersecting with the erasing area in the first handwriting;
    基于所述边缘像素点以及所述第一笔迹段中非所述指定颜色的第二笔迹点重绘所述第一笔迹段中位于所述擦除区域外的第二笔迹段,得到第二书写笔迹。Redrawing a second handwriting segment in the first handwriting segment outside the erasing area based on the edge pixels and the second handwriting points in the first handwriting segment that are not of the specified color to obtain a second writing handwriting.
  13. 根据权利要求12所述的方法,其特征在于,所述基于所述边缘像素点以及所述第一笔迹段中非所述指定颜色的第二笔迹点重绘所述第一笔迹段中位于所述擦除区域外的第二笔迹段,得到第二书写笔迹,包括:The method according to claim 12, characterized in that, redrawing the first handwriting segment located in the first handwriting segment based on the edge pixel points and the second handwriting points of the first handwriting segment that are not of the specified color The second handwriting segment outside the erasing area is obtained to obtain the second handwriting, including:
    将所述边缘像素点作为起始笔迹点或者终止笔迹点;Using the edge pixel as a starting handwriting point or an ending handwriting point;
    将所述起始笔迹点或者所述终止笔迹点插入至所述第一笔迹段中非所述指定颜色的第二笔迹点组成的笔迹点队列中,生成新的笔迹点队列;Inserting the starting handwriting point or the ending handwriting point into a handwriting point queue composed of second handwriting points not of the specified color in the first handwriting segment to generate a new handwriting point queue;
    按照所述新的笔迹点队列中各笔迹点的时间戳先后顺序,将各所述笔迹点进行连接,得到第二书写笔迹。According to the time stamp sequence of each handwriting point in the new handwriting point queue, the handwriting points are connected to obtain the second handwriting.
  14. 一种笔迹擦除装置,其特征在于,所述装置包括:A handwriting erasing device is characterized in that said device comprises:
    擦除轨迹生成模块,用于响应于对所述第一书写笔迹的圈选操作,在所述画布上显示跟随所述圈选操作的擦除轨迹;an erasing track generating module, configured to display on the canvas an erasing track following the circling operation in response to the circling operation on the first handwriting;
    像素点标记模块,用于创建与所述画布对应的位图图像,标记所述位图图像中所述擦除轨迹对应的擦除区域内的所有像素点;A pixel marking module, configured to create a bitmap image corresponding to the canvas, and mark all pixels in the erasing area corresponding to the erasing track in the bitmap image;
    边缘像素确定模块,用于基于标记后的所述像素点,在所述位图图像中确定所述第一书写笔迹的边缘像素点;An edge pixel determination module, configured to determine edge pixel points of the first handwriting in the bitmap image based on the marked pixel points;
    笔迹擦除模块,用于在所述位图图像中基于所述边缘像素点对所述第一书写笔迹进行笔迹擦除处理, 得到第二书写笔迹;A handwriting erasing module, configured to perform handwriting erasing processing on the first handwriting based on the edge pixels in the bitmap image to obtain second handwriting;
    笔迹显示模块,用于在所述画布上显示所述第二书写笔迹。A handwriting display module, configured to display the second handwriting on the canvas.
  15. 一种存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1~13中任意一项所述方法的步骤。A storage medium, on which a computer program is stored, wherein, when the computer program is executed by a processor, the steps of the method in any one of claims 1-13 are realized.
  16. 一种电子设备,其特征在于,包括:处理器和存储器;其中,所述存储器存储有计算机程序,所述计算机程序适于由所述处理器加载并执行如权利要求1~13中任意一项所述方法的步骤。An electronic device, characterized by comprising: a processor and a memory; wherein, the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing any one of claims 1-13 The steps of the method.
PCT/CN2022/111482 2021-08-11 2022-08-10 Handwriting erasing method and apparatus, storage medium, and electronic device WO2023016493A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110922002.6 2021-08-11
CN202110922002.6A CN115705141A (en) 2021-08-11 2021-08-11 Handwriting erasing method and device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
WO2023016493A1 true WO2023016493A1 (en) 2023-02-16

Family

ID=85180781

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/111482 WO2023016493A1 (en) 2021-08-11 2022-08-10 Handwriting erasing method and apparatus, storage medium, and electronic device

Country Status (2)

Country Link
CN (1) CN115705141A (en)
WO (1) WO2023016493A1 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130093733A1 (en) * 2010-04-13 2013-04-18 Kenji Yoshida Handwriting input board and information processing system using handwriting input board
CN106325737A (en) * 2016-08-03 2017-01-11 青岛海信电器股份有限公司 Method and equipment for erasing writing path
CN108733296A (en) * 2018-04-28 2018-11-02 广州视源电子科技股份有限公司 Method for deleting, device and the equipment of written handwriting
CN109407954A (en) * 2018-09-11 2019-03-01 宁波思骏科技有限公司 A kind of method for deleting and system of handwriting trace

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130093733A1 (en) * 2010-04-13 2013-04-18 Kenji Yoshida Handwriting input board and information processing system using handwriting input board
CN106325737A (en) * 2016-08-03 2017-01-11 青岛海信电器股份有限公司 Method and equipment for erasing writing path
CN108733296A (en) * 2018-04-28 2018-11-02 广州视源电子科技股份有限公司 Method for deleting, device and the equipment of written handwriting
CN109407954A (en) * 2018-09-11 2019-03-01 宁波思骏科技有限公司 A kind of method for deleting and system of handwriting trace

Also Published As

Publication number Publication date
CN115705141A (en) 2023-02-17

Similar Documents

Publication Publication Date Title
US11301200B2 (en) Method of providing annotation track on the content displayed on an interactive whiteboard, computing device and non-transitory readable storage medium
CN108334486B (en) Table control method, device, equipment and storage medium
CN110069204B (en) Graph processing method, device and equipment based on writing track and storage medium
CN108304132B (en) Graph display method, device, equipment and storage medium
CN110297550B (en) Label display method and device, screen throwing equipment, terminal and storage medium
CN110045909B (en) Ellipse processing method, device and equipment based on writing track and storage medium
CN108733296B (en) Method, device and equipment for erasing handwriting
CN110928614B (en) Interface display method, device, equipment and storage medium
CN108492349B (en) Processing method, device and equipment for writing strokes and storage medium
CN104331234B (en) A kind of method and apparatus for performing mapping operation
CN114327064A (en) Plotting method, system, equipment and storage medium based on gesture control
CN113093969A (en) Hand-drawn track rendering method, device, electronic equipment, medium and program product
CN109814787B (en) Key information determination method, device, equipment and storage medium
CN110297558B (en) Multi-touch control method and device, intelligent interaction panel and storage medium
CN111580903A (en) Real-time voting method, device, terminal equipment and storage medium
WO2019218622A1 (en) Element control method, apparatus, and device, and storage medium
WO2023016493A1 (en) Handwriting erasing method and apparatus, storage medium, and electronic device
JP4886570B2 (en) Information processing apparatus, information processing method, and program
CN113849106B (en) Page turning handwriting processing method, device, electronic device and storage medium
CN106371644B (en) Method and device for simultaneously writing by multiple persons on screen
CN112068836B (en) G code generation method and device of dispenser, terminal equipment and storage medium
CN103853470A (en) Data processing and displaying method, device and system
WO2020133386A1 (en) Note partial selection method, apparatus, electronic terminal and readable storage medium
CN113934394B (en) Method, device and terminal equipment for realizing memory display in display screen
WO2023000613A1 (en) Display device and method for displaying chart

Legal Events

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

Ref document number: 22855473

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE