CN113963079A - Graph drawing method, electronic device, and storage medium - Google Patents

Graph drawing method, electronic device, and storage medium Download PDF

Info

Publication number
CN113963079A
CN113963079A CN202110954165.2A CN202110954165A CN113963079A CN 113963079 A CN113963079 A CN 113963079A CN 202110954165 A CN202110954165 A CN 202110954165A CN 113963079 A CN113963079 A CN 113963079A
Authority
CN
China
Prior art keywords
graph
point information
handwriting
real
time
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110954165.2A
Other languages
Chinese (zh)
Inventor
程超
李武冈
宋红阳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhangyue Technology Co Ltd
Original Assignee
Zhangyue Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhangyue Technology Co Ltd filed Critical Zhangyue Technology Co Ltd
Priority to CN202110954165.2A priority Critical patent/CN113963079A/en
Publication of CN113963079A publication Critical patent/CN113963079A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/20Drawing from basic elements, e.g. lines or circles
    • G06T11/206Drawing of charts or graphs

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Processing Or Creating Images (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The invention relates to a graph drawing method, an electronic device and a storage medium. The graph drawing method comprises the following steps: receiving handwriting drawing operation on an ink screen, and displaying a real-time drawing graph; when detecting that the handwriting drawing operation stops, acquiring handwriting point information of a real-time drawing graph; correcting the handwriting point information to obtain characteristic point information; and performing standard graph fitting based on the characteristic point information to obtain a target drawing graph, and replacing the real-time drawing graph with the target drawing graph to display on the ink screen. The method and the device can display the real-time drawn graph on the ink screen along with the handwriting drawing of the user, and can replace the displayed real-time drawn graph with the standard drawn graph obtained by point fitting after correction processing through correcting the handwriting points of the real-time drawn graph, so that the standard degree of the handwriting drawn graph in the ink screen is improved, and the drawing experience effect of the user is further improved.

Description

Graph drawing method, electronic device, and storage medium
Technical Field
The present disclosure relates to the field of ink screen display technologies, and in particular, to a graph drawing method, an electronic device, and a storage medium.
Background
The electronic ink screen achieves a display effect close to that of the conventional paper using an electrophoresis technique, and thus is also called "electronic paper".
At present, a handwriting function can be added into an ink screen reader to expand the application scene of the ink screen reader, and a user can draw different graphs according to different requirements. However, when the user draws the graph, the graph is not standard enough, and the appearance and experience are influenced.
Disclosure of Invention
In order to solve the technical problem that the drawing of the graph in the ink screen is not standard enough, the disclosure provides a graph drawing method, electronic equipment and a storage medium, so that the standard degree of the graph drawn in the ink screen is improved.
In a first aspect, an embodiment of the present disclosure provides a graph drawing method, including:
receiving handwriting drawing operation on an ink screen, and displaying a real-time drawing graph;
when detecting that the handwriting drawing operation stops, acquiring handwriting point information of a real-time drawing graph;
correcting the handwriting point information to obtain characteristic point information;
and performing standard graph fitting based on the characteristic point information to obtain a target drawing graph, and replacing the real-time drawing graph with the target drawing graph to display on the ink screen.
In a second aspect, an embodiment of the present disclosure provides an electronic device, including:
a processor;
a memory for storing executable instructions;
wherein the processor is configured to read the executable instructions from the memory and execute the executable instructions to perform the following operations:
receiving handwriting drawing operation on an ink screen, and displaying a real-time drawing graph;
when detecting that the handwriting drawing operation stops, acquiring handwriting point information of a real-time drawing graph;
correcting the handwriting point information to obtain characteristic point information;
and performing standard graph fitting based on the characteristic point information to obtain a target drawing graph, and replacing the real-time drawing graph with the target drawing graph to display on the ink screen.
In a third aspect, the present disclosure provides a computer-readable storage medium storing a computer program, which, when executed by a processor, causes the processor to implement the graph drawing method of the first aspect.
One of the above technical solutions has the following advantages or beneficial effects:
according to the graph drawing method, the electronic device and the storage medium of the embodiment of the disclosure, the handwriting drawing operation on the ink screen can be received, the real-time drawing graph is displayed, when the handwriting drawing operation is detected to be stopped, the handwriting point information of the real-time drawing graph is obtained, then the handwriting point information is corrected to obtain the characteristic point information, standard graph fitting is carried out based on the characteristic point information to obtain the target drawing graph, and the real-time drawing graph is replaced by the target drawing graph to be displayed on the ink screen. The embodiment of the disclosure can display the real-time drawing graph along with the handwriting drawing of the user in the ink screen, and can replace the displayed real-time drawing graph with the standard drawing graph obtained by point fitting after correction processing through correcting the handwriting points of the real-time drawing graph, thereby improving the standard degree of the handwriting drawing graph in the ink screen and further improving the drawing experience effect of the user.
Drawings
The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numbers refer to the same or similar elements. It should be understood that the drawings are schematic and that elements and features are not necessarily drawn to scale.
Fig. 1 is a schematic flow chart diagram of a graph drawing method according to an embodiment of the present disclosure;
fig. 2 is a schematic flow chart diagram of another graphics rendering method provided in the embodiments of the present disclosure;
FIG. 3 is a schematic diagram of a rendering graph in real time according to an embodiment of the disclosure;
FIG. 4 is a schematic diagram of a target rendering graph according to an embodiment of the disclosure;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but rather are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order, and/or performed in parallel. Moreover, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "include" and variations thereof as used herein are open-ended, i.e., "including but not limited to". The term "based on" is "based, at least in part, on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions for other terms will be given in the following description.
It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence relationship of the functions performed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
At present, the handwriting function can be added into the ink screen reader to expand the application scene of the ink screen reader, a user can draw different graphs according to different requirements, for example, the user can record the feeling of reading books at any time and any place or can optionally scribble, draw, write and the like through the built-in notebook function, and the interactivity and entertainment are enhanced. However, when the user draws the graph, the graph is not standard enough, and the appearance and experience are influenced.
In order to solve the above problem, embodiments of the present disclosure provide a method for drawing a graph, which is described below with reference to specific embodiments.
Fig. 1 is a flowchart of a method for drawing a graphic according to an embodiment of the present disclosure, which may be executed by a graphic drawing apparatus, where the apparatus may be implemented by software and/or hardware, and may be generally integrated in an electronic device using an ink screen, which may be, but is not limited to, various readers. As shown in fig. 1, the method includes:
step 101, receiving a handwriting drawing operation on an ink screen, and displaying a real-time drawing graph.
The ink screen can be a screen which does not emit light and realizes the display effect by external reflection, and the display effect of the ink screen is very similar to that of a paper material, so that the ink screen can be compared with the experience of reading of the paper material. The handwriting drawing operation may be an operation triggered by the user's input on the ink screen through a stylus, which may be a generic term for any device capable of inputting on the ink screen.
In the embodiment of the disclosure, the graph drawing device can perform real-time detection on the trigger operation of the user on the ink screen through a preset detection program, when the handwriting drawing operation of the user on the ink screen is detected, the coordinate information of the handwriting point of the handwriting drawing operation can be continuously acquired, the real-time drawing graph is generated based on the coordinate information of the handwriting point, and the real-time drawing graph is synchronously presented on the ink screen.
Optionally, displaying the real-time rendered graph includes: and displaying the real-time drawing graph in a local refreshing mode, wherein the real-time drawing graph changes along with the progress of the handwriting drawing operation. The partial refresh mode may be a mode for refreshing only a partial area corresponding to a handwriting drawing operation of the ink screen, for example, a DU mode. With the progress of the handwriting drawing operation, the graph drawing device can acquire the coordinate information of a new handwriting point in real time, update the real-time drawing graph, and display the continuously updated real-time drawing graph on the ink screen at the position where the handwriting drawing operation passes through in a local refreshing mode.
According to the scheme, the real-time drawing graph corresponding to the handwriting drawing operation is displayed on the ink screen in the local refreshing mode, the real-time performance of handwriting presentation is guaranteed, and the follow-up property of graph display is further guaranteed.
And 102, when the handwriting drawing operation is detected to stop, acquiring handwriting point information of the real-time drawing graph.
The handwriting points can be understood as the position points where the handwriting drawing operation passes on the ink screen, the handwriting point information can comprise coordinates of a plurality of handwriting points, and the number of the specific handwriting points is not limited.
In the embodiment of the present disclosure, detecting that the handwriting drawing operation is stopped may include: when the operation of lifting the pen tip is detected based on the electromagnetic induction signal, it is determined that the handwriting drawing operation is stopped.
The graph drawing device can detect the operation of a pen point of the handwriting pen in the ink screen through an electromagnetic induction signal, one-time handwriting drawing operation can comprise the falling operation, the moving operation and the lifting operation of the pen point, and when the graph drawing device receives the electromagnetic induction signal, the graph drawing device can determine that the falling operation of the pen point is detected and starts the handwriting drawing operation; when the reception of the electromagnetic induction signal is stopped, it is determined that the operation of lifting the pen tip is detected, and it is determined that the handwriting drawing operation is stopped.
After determining that the handwriting drawing operation is stopped, the drawing device may acquire coordinates of each trace point of the real-time drawn figure for later use.
And 103, correcting the handwriting point information to obtain characteristic point information.
The correction processing may be an adjustment operation toward a standard graph performed on the handwriting point information according to the graph characteristics of the real-time drawn graph. The feature point information may be information obtained after the correction processing, and may include coordinates of a plurality of feature points.
Specifically, after acquiring the handwriting point information for drawing the graph in real time, the graph drawing device may use a preset correction algorithm or a preset correction program to correct the handwriting point information to obtain coordinates of a plurality of feature points, that is, to obtain the feature point information. The embodiment of the present disclosure is not limited to the above-mentioned correction algorithm or correction program, and may determine according to an actual situation, for example, the correction processing may be implemented by calling an Application Programming Interface (API) of a corresponding function in an OpenCV software library.
The OpenCV software library is a cross-platform computer vision and machine learning software library issued based on BSD license (open source), can run on Linux, Windows, Android and Mac OS operating systems, is lightweight and efficient, consists of a series of C functions and a small number of C + + classes, provides interfaces of languages such as Python, Ruby, MATLAB and the like, and comprises a plurality of processing algorithms in the aspects of image processing and computer vision.
Exemplarily, fig. 2 is a schematic flow chart of another graph drawing method provided by the embodiment of the present disclosure, and as shown in fig. 2, the correcting process is performed on the handwriting point information to obtain the feature point information, which may include the following steps:
step 201, drawing a handwriting graph in a blank picture according to the coordinates of the plurality of stroke points to obtain an image to be processed.
The graph drawing device can establish a blank picture after detecting that the handwriting drawing operation is stopped and acquiring handwriting point information of a real-time drawn graph, draw the handwriting graph in the blank picture according to the acquired handwriting point information, and determine the picture including the handwriting graph as an image to be processed.
The handwriting point information of the scheme only comprises coordinate information, other data such as pressure-sensitive data and the like are eliminated, the workload is reduced, the drawn handwriting graph is simplified, and the efficiency is improved.
And step 202, carrying out data volume reduction processing on the image to be processed to obtain a binary image.
The data amount reduction processing may be an operation of reducing the data amount of the image to be processed by one or more graphics processing methods.
In this embodiment of the present disclosure, performing data amount reduction processing on an image to be processed to obtain a binarized image may include: constructing a minimum circumscribed rectangle of the handwriting graph in the image to be processed; screenshot is carried out on the image to be processed according to the minimum external rectangle of the handwriting graph to obtain an intermediate image; and carrying out binarization processing and denoising processing on the intermediate image to obtain a binarization image.
The minimum bounding rectangle may be a maximum range of a two-dimensional shape represented by two-dimensional coordinates, and the two-dimensional shape is not particularly limited, and may include, for example, a point, a straight line, a polygon, and the like. The binary image can be an image of an image to be processed after the binary processing, and the binary processing can be a process of setting the gray value of a pixel point on the image to be 0 or 255, namely, the whole image presents an obvious black-and-white effect.
After obtaining the image to be processed, the image drawing device can construct a minimum circumscribed rectangle surrounding the handwriting image in the image to be processed, and perform screenshot operation on the image to be processed according to the minimum circumscribed rectangle to obtain an intermediate image only including a local image corresponding to the minimum circumscribed rectangle; and then, performing binarization processing and noise reduction processing on the intermediate image to obtain a binarized image.
In the scheme, the data volume of the image to be processed is reduced, so that the data volume of the image can be reduced, the subsequent calculation amount can be reduced, and the processing efficiency is improved.
And 203, performing data sampling and data correction on the binary image to obtain coordinates of a plurality of feature points, and determining the coordinates of the plurality of feature points as feature point information.
Where data sampling may be sampling is the operation of converting an image into a set of discrete sampling points.
In the embodiment of the present disclosure, performing data sampling and data correction on a binarized image to obtain coordinates of a plurality of feature points, includes: carrying out data sampling on the binary image based on preset sampling precision to obtain coordinates of a plurality of sampling points; and carrying out data correction on the coordinates of the plurality of sampling points by adopting a graph correction algorithm to obtain the coordinates of the plurality of characteristic points.
The sampling precision may be a sampling interval of data sampling, and the higher the sampling precision is, the more sampling points are, the more finely the image can be represented, for example, the sharper the graph for the corner is when the sampling precision is higher, and the rounder the graph is otherwise. The pattern correction algorithm may be a processing algorithm capable of correcting the sampling point based on the characteristics of the sampling point, and is not limited in particular, for example, the pattern correction algorithm may be a correction algorithm in an OpenCV software library.
Specifically, the graph drawing device may obtain a preset sampling precision, and perform data acquisition on the binarized image according to the sampling precision to obtain coordinates of a plurality of sampling points; and then, analyzing the coordinates of the plurality of sampling points by adopting a graph correction algorithm to simulate a standard graph to which the sampling points belong, then, correcting data according to the characteristics of the simulated standard graph to obtain the coordinates of a plurality of characteristic points, and determining the coordinates of the plurality of characteristic points as characteristic point information. It will be appreciated that the feature points may or may not coincide with the sample points described above.
And step 104, performing standard graph fitting based on the characteristic point information to obtain a target drawing graph, and replacing the real-time drawing graph with the target drawing graph to display on the ink screen.
The standard graph may be a graph having a standard two-dimensional shape, for example, the standard graph may be a line segment, a broken line, a circle, and the like, without limitation.
In the embodiment of the present disclosure, performing standard graph fitting based on the feature point information to obtain a target drawing graph may include: and fitting the standard graph by adopting a corresponding target fitting algorithm according to the number of the characteristic points in the characteristic point information to obtain a target drawing graph.
The number of feature points corresponding to different standard graphs is different, and for example, the number of feature points corresponding to one line segment is smaller, for example, 3, and the number of feature points corresponding to one circle is larger, for example, 11. When the graph drawing device performs standard graph fitting based on the feature point information, the number of the feature points can be determined first, a corresponding target fitting algorithm is determined according to the number of the feature points, and the target drawing graph is obtained by performing standard graph fitting by using the target fitting algorithm.
Optionally, performing standard graph fitting by using a corresponding target fitting algorithm according to the number of the feature points in the feature point information to obtain a target drawing graph, where the method includes: when the number of the characteristic points in the characteristic point information is larger than or equal to the preset number, carrying out ellipse fitting by adopting an ellipse fitting algorithm based on the characteristic point information to obtain a target drawing graph; and when the number of the characteristic points in the characteristic point information is less than the preset number, fitting a line segment or a broken line by adopting a straight line fitting algorithm based on the characteristic point information to obtain a target drawing graph.
The preset number may be a preset number threshold of one feature point, and may be specifically set according to an actual situation, for example, the preset number may be 11.
The graph drawing device can compare the number of the feature points in the feature point information with a preset number, if the number of the feature points is larger than or equal to the preset number, the fact that the current user draws in an ellipse or a circle by handwriting is indicated, the target fitting algorithm is an ellipse fitting algorithm, ellipse fitting can be carried out according to the ellipse fitting algorithm based on coordinates of a plurality of feature points, and the obtained ellipse or circle is a target drawing graph; if the number of the characteristic points is less than the preset number, the current user handwriting drawing is a line segment or a broken line, the target fitting algorithm is a straight line fitting algorithm, the straight line fitting algorithm can be adopted to fit the line segment or the broken line based on the coordinates of the plurality of the characteristic points, and the obtained line segment or broken line is the target drawing graph. The ellipse fitting algorithm and the straight line fitting algorithm may be any algorithms capable of achieving fitting, for example, algorithms capable of achieving ellipse fitting and straight line fitting in an OpenCV software library may be used. By setting the threshold value of the number of the characteristic points, the drawing intention of the user can be accurately and quickly judged, and a proper graph fitting algorithm is selected to draw a target drawing graph.
After the graph drawing device obtains the target drawing graph, the real-time drawing graph in the ink screen can be erased, and the target drawing graph is displayed in a local refreshing mode.
For example, fig. 3 is a schematic diagram of a real-time drawing graph provided by an embodiment of the present disclosure, and as shown in fig. 3, two real-time drawing graphs, which are an irregular line segment 301 and an irregular circle 302 in the graph, are shown in an ink screen 300.
Fig. 4 is a schematic diagram of a target drawing graph provided by an embodiment of the present disclosure, and as shown in fig. 4, two target drawing graphs after correction are shown in an ink screen 400, which are a line segment 401 and a circle 402 in the figure. Compared to fig. 3, the line segment 401 in fig. 4 is more standard than the irregular line segment 301 in fig. 3, and the circle 402 in fig. 4 is more standard than the irregular circle 302 in fig. 3.
According to the graph drawing method disclosed by the embodiment of the disclosure, the handwriting drawing operation on the ink screen can be received, the real-time drawing graph is displayed, when the handwriting drawing operation is detected to be stopped, the handwriting point information of the real-time drawing graph is obtained, then the handwriting point information is corrected to obtain the characteristic point information, standard graph fitting is carried out based on the characteristic point information to obtain the target drawing graph, and the real-time drawing graph is replaced by the target drawing graph to be displayed on the ink screen. The embodiment of the disclosure can display the real-time drawing graph along with the handwriting drawing of the user in the ink screen, and can replace the displayed real-time drawing graph with the standard drawing graph obtained by point fitting after correction processing through correcting the handwriting points of the real-time drawing graph, thereby improving the standard degree of the handwriting drawing graph in the ink screen and further improving the drawing experience effect of the user.
In some embodiments, after detecting that the handwriting drawing operation is stopped, the graphic drawing method may further include: judging whether the stop duration of the handwriting drawing operation is greater than a preset threshold value or not; acquiring handwriting point information for drawing a graph in real time, comprising the following steps: and when the stop duration of the handwriting drawing operation is greater than a preset threshold, executing to acquire handwriting point information of the real-time drawing graph.
The preset threshold may be a preset time period, for example, the preset threshold may be set to 500 milliseconds, and the preset threshold may be used to determine whether the current real-time drawing graph is drawn in one stroke.
Specifically, the graph drawing device may compare a stop duration of the handwriting drawing operation with a preset threshold after detecting that the handwriting drawing operation is stopped, and if the stop duration is greater than the preset threshold, it indicates that the current real-time drawn graph is not drawn in one stroke, and may perform subsequent acquisition of handwriting point information of the real-time drawn graph, perform correction processing on the handwriting point information, and further display a corrected target drawn graph; if the stop duration is less than or equal to the preset threshold, the current real-time drawing graph is drawn in one stroke, and the real-time drawing graph is continuously displayed.
In the scheme, after the handwriting drawing operation of the user is detected to stop, whether the stopping of the current user belongs to a short pause in a one-stroke drawing process or a non-one-stroke drawing process can be determined by comparing the stopping duration with a threshold value, if the stopping of the current user belongs to the non-one-stroke drawing process, the handwriting point of the real-time drawing graph before the stopping can be corrected, then the non-one-stroke drawing process is continued, and the correction of the complete real-time drawing graph before the non-one-stroke drawing is realized by correcting the partial graph before the stopping in the one-to-one non-stroke drawing process; if the short pause in the one-stroke drawing process is determined, the real-time drawing graph can be continuously displayed without any processing, and the handwriting point is corrected after one-stroke drawing is finished, so that the corrected display of the real-time drawing graph drawn by one stroke can be realized, the corrected display of the real-time drawing graph drawn by a non-stroke can be realized, and the flexibility and the usability are stronger.
In some embodiments, after obtaining handwriting point information for drawing a graph in real time, the graph drawing method may further include: judging whether the real-time drawn graph is a standard graph or not based on the handwriting point information; correcting the handwriting point information to obtain characteristic point information, wherein the characteristic point information comprises the following steps: and when the real-time drawn graph is determined to be the standard graph, performing correction processing on the handwriting point information to obtain the characteristic point information.
The real-time drawn graph corresponding to the handwriting drawing operation can be in any shape, and the correction of the real-time drawn graph is only performed on the standard graph in the embodiment of the disclosure, so that the graph drawing device can judge whether the real-time drawn graph is a standard graph or not based on the handwriting point information after acquiring the handwriting point information of the real-time drawn graph, if so, the correction processing of the handwriting point information can be executed, and otherwise, the correction processing is not performed.
Optionally, determining that the real-time drawing graph is a standard graph may include: matching the handwriting point information in a pre-established standard graph library, and determining that the real-time drawn graph is a standard graph when the matching is successful, wherein the standard graph library comprises handwriting point information of a plurality of standard graphs.
The standard graph library may be a database that is pre-established and includes handwriting point information of a plurality of standard graphs, and the number and the type of the standard graphs may be set according to an actual situation, which is not limited in the embodiment of the present disclosure. It will be appreciated that the standard graphics library supports updating, modifying, etc. operations.
When the graph drawing device judges whether the real-time drawn graph is a standard graph, the handwriting point information of the real-time drawn graph can be matched with the handwriting point information of each standard graph in the standard graph library, and when the matching degree is greater than or equal to a matching degree threshold value, the matching is determined to be successful, so that the real-time drawn graph can be determined to be the standard graph; and when the matching degree is smaller than the threshold value of the matching degree, determining that the matching fails, and further determining that the real-time drawn graph is not the standard graph.
According to the scheme, whether the graph is the standard graph or not can be judged before the graph drawn in real time is corrected, and subsequent correction processing is carried out when the graph drawn in real time is determined to be the standard graph, so that errors caused after non-standard graph correction are avoided, the accuracy of graph display in an ink screen is improved, and the drawing experience effect of a user is further improved.
Embodiments of the present disclosure also provide an electronic device that may include a processor and a memory, which may be used to store executable instructions. Wherein the processor may be configured to read the executable instructions from the memory and execute the executable instructions to perform the following operations: receiving handwriting drawing operation on an ink screen, and displaying a real-time drawing graph; when detecting that the handwriting drawing operation stops, acquiring handwriting point information of a real-time drawing graph; correcting the handwriting point information to obtain characteristic point information; and performing standard graph fitting based on the characteristic point information to obtain a target drawing graph, and replacing the real-time drawing graph with the target drawing graph to display on the ink screen.
Fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure. The electronic device 500 in the embodiment of the present invention may be the electronic device described above. It should be further noted that the electronic device 500 shown in fig. 5 is only an example, and should not bring any limitation to the functions and the scope of the application of the embodiments of the present invention.
The electronic device 500 conventionally includes a processor 510 and a computer program product or computer-readable medium in the form of a memory 520. The memory 520 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read only memory), an EPROM, a hard disk, or a ROM. The memory 520 has a memory space 521 for executable instructions (or program code) 5211 for performing any of the method steps in the above-described graph drawing method. For example, the memory space 521 for executable instructions may include respective executable instructions 5211 for implementing various steps in the above graphics rendering method, respectively. The executable instructions may be read from or written to one or more computer program products. These computer program products comprise a program code carrier such as a hard disk, a Compact Disc (CD), a memory card or a floppy disk. Such computer program products are typically portable or fixed storage units. The memory unit may have a memory segment or a memory space or the like arranged similarly to the memory 520 in the electronic device of fig. 5. The executable instructions may be compressed, for example, in a suitable form. Typically, the memory unit comprises executable instructions for performing the steps of the graphics rendering method according to the invention, i.e. code that is readable by a processor, such as the processor 510 for example, which when run by an electronic device, causes the electronic device to perform the individual steps of the graphics rendering method described above.
Embodiments of the present invention further provide a computer-readable storage medium, on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the processor executes the graph drawing method provided by the embodiments of the present invention.
The computer-readable storage medium may take any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may include, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
In an embodiment of the present invention, computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including but not limited to an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
Various component embodiments of the invention may be implemented in whole or in part in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that a microprocessor or Digital Signal Processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components in a graphics rendering apparatus according to embodiments of the present invention. The present invention may also be embodied as apparatus or device programs (e.g., computer programs and computer program products) for performing a portion or all of the methods described herein. Such programs implementing the present invention may be stored on computer-readable media or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or in any other form.
According to one or more embodiments of the present disclosure, there is provided a graphic drawing method including:
receiving handwriting drawing operation on an ink screen, and displaying a real-time drawing graph;
when detecting that the handwriting drawing operation stops, acquiring handwriting point information of a real-time drawing graph;
correcting the handwriting point information to obtain characteristic point information;
and performing standard graph fitting based on the characteristic point information to obtain a target drawing graph, and replacing the real-time drawing graph with the target drawing graph to display on the ink screen.
Optionally, displaying the real-time rendered graph includes:
and displaying the real-time drawing graph in a local refreshing mode, wherein the real-time drawing graph changes along with the progress of the handwriting drawing operation.
Optionally, detecting that the handwriting drawing operation is stopped includes:
when the operation of lifting the pen tip is detected based on the electromagnetic induction signal, it is determined that the handwriting drawing operation is stopped.
Optionally, the handwriting point information includes coordinates of a plurality of handwriting points, and the handwriting point information is corrected to obtain feature point information, including:
drawing a handwriting graph in the blank picture according to the coordinates of the plurality of stroke points to obtain an image to be processed;
carrying out data volume reduction processing on an image to be processed to obtain a binary image;
and performing data sampling and data correction on the binary image to obtain coordinates of a plurality of characteristic points, and determining the coordinates of the plurality of characteristic points as characteristic point information.
Optionally, the data amount reduction processing is performed on the image to be processed to obtain a binarized image, and the method includes:
constructing a minimum circumscribed rectangle of the handwriting graph in the image to be processed;
screenshot is carried out on the image to be processed according to the minimum external rectangle of the handwriting graph to obtain an intermediate image;
and carrying out binarization processing and denoising processing on the intermediate image to obtain a binarization image.
Optionally, the data sampling and data correction are performed on the binarized image to obtain coordinates of a plurality of feature points, including:
carrying out data sampling on the binary image based on preset sampling precision to obtain coordinates of a plurality of sampling points;
and carrying out data correction on the coordinates of the plurality of sampling points by adopting a graph correction algorithm to obtain the coordinates of the plurality of characteristic points.
Optionally, performing standard graph fitting based on the feature point information to obtain a target drawing graph, including:
and fitting the standard graph by adopting a corresponding target fitting algorithm according to the number of the characteristic points in the characteristic point information to obtain a target drawing graph.
Optionally, performing standard graph fitting by using a corresponding target fitting algorithm according to the number of the feature points in the feature point information to obtain a target drawing graph, including:
when the number of the characteristic points in the characteristic point information is larger than or equal to the preset number, carrying out ellipse fitting by adopting an ellipse fitting algorithm based on the characteristic point information to obtain a target drawing graph;
and when the number of the characteristic points in the characteristic point information is less than the preset number, fitting a line segment or a broken line by adopting a straight line fitting algorithm based on the characteristic point information to obtain a target drawing graph.
Optionally, after detecting that the handwriting drawing operation is stopped, the method further includes:
judging whether the stop duration of the handwriting drawing operation is greater than a preset threshold value or not;
acquiring handwriting point information for drawing a graph in real time, comprising the following steps:
and when the stop duration of the handwriting drawing operation is greater than a preset threshold, executing to acquire handwriting point information of the real-time drawing graph.
Optionally, after obtaining handwriting point information of a real-time drawing graph, the method further includes:
judging whether the real-time drawn graph is a standard graph or not based on the handwriting point information;
correcting the handwriting point information to obtain characteristic point information, wherein the characteristic point information comprises the following steps:
and when the real-time drawn graph is determined to be the standard graph, performing correction processing on the handwriting point information to obtain the characteristic point information.
Optionally, determining that the real-time drawing graph is a standard graph includes:
matching the handwriting point information in a pre-established standard graph library, and determining that the real-time drawn graph is a standard graph when the matching is successful, wherein the standard graph library comprises handwriting point information of a plurality of standard graphs.
In accordance with one or more embodiments of the present disclosure, there is provided an electronic device including:
a processor;
a memory for storing processor-executable instructions;
a processor to read executable instructions from the memory and execute the instructions to perform the following operations:
receiving handwriting drawing operation on an ink screen, and displaying a real-time drawing graph;
when detecting that the handwriting drawing operation stops, acquiring handwriting point information of a real-time drawing graph;
correcting the handwriting point information to obtain characteristic point information;
and performing standard graph fitting based on the characteristic point information to obtain a target drawing graph, and replacing the real-time drawing graph with the target drawing graph to display on the ink screen.
Optionally, the executable instructions further cause the processor to:
wherein displaying real-time rendered graphics comprises:
and displaying the real-time drawing graph in a local refreshing mode, wherein the real-time drawing graph changes along with the progress of the handwriting drawing operation.
Optionally, the executable instructions further cause the processor to:
wherein detecting that the handwriting drawing operation is stopped comprises:
when the operation of lifting the pen tip is detected based on the electromagnetic induction signal, it is determined that the handwriting drawing operation is stopped.
Optionally, the executable instructions further cause the processor to:
wherein, handwriting point information includes the coordinate of a plurality of stroke points, carries out correction processing to handwriting point information, obtains characteristic point information, includes:
drawing a handwriting graph in the blank picture according to the coordinates of the plurality of stroke points to obtain an image to be processed;
carrying out data volume reduction processing on an image to be processed to obtain a binary image;
and performing data sampling and data correction on the binary image to obtain coordinates of a plurality of characteristic points, and determining the coordinates of the plurality of characteristic points as characteristic point information.
Optionally, the executable instructions further cause the processor to:
the method for reducing the data volume of the image to be processed to obtain the binary image comprises the following steps:
constructing a minimum circumscribed rectangle of the handwriting graph in the image to be processed;
screenshot is carried out on the image to be processed according to the minimum external rectangle of the handwriting graph to obtain an intermediate image;
and carrying out binarization processing and denoising processing on the intermediate image to obtain a binarization image.
Optionally, the executable instructions further cause the processor to:
the data sampling and data correction are carried out on the binary image to obtain the coordinates of a plurality of feature points, and the method comprises the following steps:
carrying out data sampling on the binary image based on preset sampling precision to obtain coordinates of a plurality of sampling points;
and carrying out data correction on the coordinates of the plurality of sampling points by adopting a graph correction algorithm to obtain the coordinates of the plurality of characteristic points.
Optionally, the executable instructions further cause the processor to:
wherein, standard graph fitting is carried out based on the characteristic point information to obtain a target drawing graph, and the method comprises the following steps:
and fitting the standard graph by adopting a corresponding target fitting algorithm according to the number of the characteristic points in the characteristic point information to obtain a target drawing graph.
Optionally, the executable instructions further cause the processor to:
the method for obtaining the target drawing graph by adopting the corresponding target fitting algorithm to perform standard graph fitting according to the number of the feature points in the feature point information comprises the following steps:
when the number of the characteristic points in the characteristic point information is larger than or equal to the preset number, carrying out ellipse fitting by adopting an ellipse fitting algorithm based on the characteristic point information to obtain a target drawing graph;
and when the number of the characteristic points in the characteristic point information is less than the preset number, fitting a line segment or a broken line by adopting a straight line fitting algorithm based on the characteristic point information to obtain a target drawing graph.
Optionally, the executable instructions further cause the processor to:
wherein, after detecting that the handwriting drawing operation is stopped, the method further comprises:
judging whether the stop duration of the handwriting drawing operation is greater than a preset threshold value or not;
acquiring handwriting point information for drawing a graph in real time, comprising the following steps:
and when the stop duration of the handwriting drawing operation is greater than a preset threshold, executing to acquire handwriting point information of the real-time drawing graph.
Optionally, the executable instructions further cause the processor to:
after acquiring handwriting point information of a real-time drawing graph, the method further comprises the following steps:
judging whether the real-time drawn graph is a standard graph or not based on the handwriting point information;
correcting the handwriting point information to obtain characteristic point information, wherein the characteristic point information comprises the following steps:
and when the real-time drawn graph is determined to be the standard graph, performing correction processing on the handwriting point information to obtain the characteristic point information.
Optionally, the executable instructions further cause the processor to:
wherein, confirm that draws the figure in real time as the standard figure, include:
matching the handwriting point information in a pre-established standard graph library, and determining that the real-time drawn graph is a standard graph when the matching is successful, wherein the standard graph library comprises handwriting point information of a plurality of standard graphs.
According to one or more embodiments of the present disclosure, there is provided a computer-readable storage medium storing a computer program for executing any of the graphic drawing methods as provided by the present disclosure.
The foregoing description is only exemplary of the preferred embodiments of the invention and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents is encompassed without departing from the spirit of the disclosure. For example, the above features and (but not limited to) features having similar functions disclosed in the present invention are mutually replaced to form the technical solution.
Further, while operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limitations on the scope of the invention. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.

Claims (10)

1. A method of drawing a graphic, comprising:
receiving handwriting drawing operation on an ink screen, and displaying a real-time drawing graph;
when the handwriting drawing operation is detected to stop, acquiring handwriting point information of the real-time drawing graph;
correcting the stroke point information to obtain characteristic point information;
and performing standard graph fitting based on the characteristic point information to obtain a target drawing graph, and replacing the real-time drawing graph with the target drawing graph to display on the ink screen.
2. The method of claim 1, wherein said displaying the real-time rendered graphic comprises:
and displaying the real-time drawing graph in a local refreshing mode, wherein the real-time drawing graph changes along with the progress of the handwriting drawing operation.
3. The method of claim 1, wherein the detecting that the handwriting drawing operation is stopped comprises:
when a pen tip lift-up operation is detected based on the electromagnetic induction signal, it is determined that the handwriting drawing operation is stopped.
4. The method according to claim 1, wherein the track point information includes coordinates of a plurality of track points, and the correction processing is performed on the track point information to obtain feature point information, including:
drawing a handwriting graph in a blank picture according to the coordinates of the plurality of stroke points to obtain an image to be processed;
carrying out data volume reduction processing on the image to be processed to obtain a binary image;
and carrying out data sampling and data correction on the binary image to obtain coordinates of a plurality of characteristic points, and determining the coordinates of the plurality of characteristic points as the characteristic point information.
5. The method according to claim 4, wherein performing data amount reduction processing on the image to be processed to obtain a binarized image comprises:
constructing a minimum circumscribed rectangle of the handwriting graph in the image to be processed;
screenshot is carried out on the image to be processed according to the minimum circumscribed rectangle of the handwriting graph to obtain an intermediate image;
and carrying out binarization processing and denoising processing on the intermediate image to obtain the binarization image.
6. The method according to claim 4, wherein the data sampling and data correcting the binarized image to obtain coordinates of a plurality of feature points comprises:
carrying out data sampling on the binary image based on preset sampling precision to obtain coordinates of a plurality of sampling points;
and carrying out data correction on the coordinates of the plurality of sampling points by adopting a graph correction algorithm to obtain the coordinates of the plurality of characteristic points.
7. The method of claim 1, wherein performing a standard graph fit based on the feature point information to obtain a target drawing graph comprises:
and fitting a standard graph by adopting a corresponding target fitting algorithm according to the number of the characteristic points in the characteristic point information to obtain the target drawing graph.
8. The method according to claim 7, wherein performing standard graph fitting according to the number of feature points in the feature point information by using a corresponding target fitting algorithm to obtain the target drawing graph comprises:
when the number of the feature points in the feature point information is larger than or equal to the preset number, performing ellipse fitting by adopting an ellipse fitting algorithm based on the feature point information to obtain the target drawing graph;
and when the number of the characteristic points in the characteristic point information is smaller than the preset number, fitting a line segment or a broken line by adopting a straight line fitting algorithm based on the characteristic point information to obtain the target drawing graph.
9. An electronic device, comprising:
a processor;
a memory for storing executable instructions;
wherein the processor is configured to read the executable instructions from the memory and execute the executable instructions to:
receiving handwriting drawing operation on an ink screen, and displaying a real-time drawing graph;
when the handwriting drawing operation is detected to stop, acquiring handwriting point information of the real-time drawing graph;
correcting the stroke point information to obtain characteristic point information;
and performing standard graph fitting based on the characteristic point information to obtain a target drawing graph, and replacing the real-time drawing graph with the target drawing graph to display on the ink screen.
10. A computer-readable storage medium, characterized in that the storage medium stores a computer program which, when executed by a processor, causes the processor to implement a graphics rendering method as claimed in any of the preceding claims 1-8.
CN202110954165.2A 2021-08-19 2021-08-19 Graph drawing method, electronic device, and storage medium Pending CN113963079A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110954165.2A CN113963079A (en) 2021-08-19 2021-08-19 Graph drawing method, electronic device, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110954165.2A CN113963079A (en) 2021-08-19 2021-08-19 Graph drawing method, electronic device, and storage medium

Publications (1)

Publication Number Publication Date
CN113963079A true CN113963079A (en) 2022-01-21

Family

ID=79460507

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110954165.2A Pending CN113963079A (en) 2021-08-19 2021-08-19 Graph drawing method, electronic device, and storage medium

Country Status (1)

Country Link
CN (1) CN113963079A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114550663A (en) * 2022-02-10 2022-05-27 广州文石信息科技有限公司 Ink screen scribble refreshing method and device
CN114639358A (en) * 2022-03-29 2022-06-17 青岛海信移动通信技术股份有限公司 Ink screen refreshing method, terminal device, storage medium and program product
CN117369665A (en) * 2023-10-16 2024-01-09 深圳市大我云读写科技有限公司 Electronic paper handwriting display method, device, equipment and storage medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114550663A (en) * 2022-02-10 2022-05-27 广州文石信息科技有限公司 Ink screen scribble refreshing method and device
CN114639358A (en) * 2022-03-29 2022-06-17 青岛海信移动通信技术股份有限公司 Ink screen refreshing method, terminal device, storage medium and program product
CN114639358B (en) * 2022-03-29 2024-03-29 青岛海信移动通信技术有限公司 Ink screen refreshing method, terminal device, storage medium and program product
CN117369665A (en) * 2023-10-16 2024-01-09 深圳市大我云读写科技有限公司 Electronic paper handwriting display method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
CN113963079A (en) Graph drawing method, electronic device, and storage medium
CN110378966B (en) Method, device and equipment for calibrating external parameters of vehicle-road coordination phase machine and storage medium
CN109711508B (en) Image processing method and device
CN111625668B (en) Object detection and candidate filtering system
CN113454646A (en) Method and system for processing images
CN113256583A (en) Image quality detection method and apparatus, computer device, and medium
CN113962306A (en) Image processing method, image processing device, electronic equipment and computer readable storage medium
CN111949156A (en) Chinese character writing test method and system of writing device and writing device
CN112149570B (en) Multi-person living body detection method, device, electronic equipment and storage medium
CN114549993A (en) Method, system and device for scoring line segment image in experiment and readable storage medium
CN111680546A (en) Attention detection method, attention detection device, electronic equipment and storage medium
CN112308069A (en) Click test method, device, equipment and storage medium for software interface
CN114495103B (en) Text recognition method and device, electronic equipment and medium
CN112307944A (en) Dish inventory information processing method, dish delivery method and related device
CN110796130A (en) Method, device and computer storage medium for character recognition
EP3635632A1 (en) Detecting font size in a digital image
US11238620B2 (en) Implicit structured light decoding method, computer equipment and readable storage medium
CN109034117B (en) Video extraction method and device
CN108171144B (en) Information processing method, information processing device, electronic equipment and storage medium
CN110675361A (en) Method and device for establishing video detection model and video detection
US9405375B2 (en) Translation and scale invariant features for gesture recognition
CN114140547B (en) Image generation method and device
CN114842476A (en) Watermark detection method and device and model training method and device
CN115359008A (en) Display interface testing method and device, storage medium and electronic equipment
CN114418848A (en) Video processing method and device, storage medium and electronic equipment

Legal Events

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