Method and system for drawing text on electronic whiteboard, electronic whiteboard and storage medium
By automatically identifying and optimizing the writing area of the electronic whiteboard, it solves the problem of confusing writing on the blackboard caused by illegible handwriting in the drawing board input method, and enables users to freely write on the blackboard and the generated text is beautiful and easy to read.
Patent Information
- Application Number
- CN202210189443.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-28
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2042-02-28
AI Technical Summary
The drawing board input method of the existing electronic whiteboard causes the writing on the blackboard to be confusing due to illegible handwriting, which hinders the user's reading.
By acquiring touch events, updating the vertex coordinates of the writing area, identifying text, determining the number and location information of text, automatically optimizing font size and position, generating standard text, and automatically optimizing handwriting on the blackboard.
Users can freely write on the blackboard without being restricted by text formats. The generated text is beautiful and easy to read, avoiding the problem of difficult to read handwritten content.
Smart Images

Figure CN114546175B
Abstract
Description
Technical Field
[0001] The present application relates to electronic technology, and in particular to a text drawing method and system for an electronic whiteboard, an electronic whiteboard and a storage medium. Background Art
[0002] At present, electronic whiteboards are widely used in teaching, conferences and other fields. Due to its installation characteristics, handwriting input has become an important input method. At present, there are two ways of handwriting input, one is the input method form, and the other is the drawing board form. For the input method form, after the user writes in a certain range of writing area, the text will be filled into the text, and the input is performed according to a specific font, size and paragraph method. The user is equivalent to entering text into a document. For the drawing board form, the drawing board usually only records the touch track of the user's input, and records the user's writing truthfully in a graphical way. In this way, the user can write on the blackboard flexibly without being restricted by the document format.
[0003] However, for the input method in the form of a drawing board, the user's handwriting may be sloppy, resulting in a messy blackboard, which hinders the user's reading. Summary of the invention
[0004] The present invention aims to solve at least one of the technical problems existing in the prior art. To this end, the present invention provides a text drawing method, system, electronic whiteboard and storage medium for electronic whiteboard to automatically optimize handwritten blackboard writing.
[0005] On the one hand, an embodiment of the present application provides a method for drawing text on an electronic whiteboard, comprising the following steps:
[0006] Get touch events;
[0007] updating vertex coordinates of a current writing area according to a touch event, wherein the writing area is a rectangle surrounding a number of tracks classified as one writing area;
[0008] Recognize the characters in the writing area as characters to be drawn;
[0009] Determine the number of characters in the current writing area;
[0010] Determine the font size of the text to be drawn and the position information of the text to be drawn according to the current number of characters and the vertex coordinate information of the writing area;
[0011] The text to be drawn is drawn according to the font size and position information.
[0012] In some embodiments, determining the font size of the characters to be drawn according to the current number of characters and the vertex coordinate information of the writing area specifically includes:
[0013] Determine the height and width of the writing area according to the vertex coordinate information of the writing area;
[0014] When the current number of characters is 1, the font size of the characters to be drawn is determined by the larger one of the height and the width of the writing area;
[0015] When the current number of characters is greater than 1, the font size of the characters to be drawn is determined by dividing the width of the writing area by the number of characters.
[0016] In some embodiments, the position information of the text to be drawn is determined by:
[0017] The center position of the writing area is determined according to the vertex coordinate information of the writing area, and the center position is used as a reference point for the vertical centering of the text to be drawn.
[0018] In some embodiments, identifying the characters in the writing area and determining the number of characters in the current writing area specifically includes:
[0019] The characters in the writing area are recognized by OCR technology, and the number of characters in the current writing area is determined according to the OCR recognition result.
[0020] In some embodiments, the vertex coordinates of the current writing area are updated according to the touch event, specifically:
[0021] Obtaining a touch event for the current writing area and determining a track of the touch event;
[0022] Obtaining a touch event for the current writing area and determining a track of the touch event;
[0023] If the minimum X coordinate in the track of the touch event is smaller than the X coordinate of the left vertex of the current writing area, the X coordinate of the left vertex of the current writing area is updated to the minimum X coordinate in the track of the touch event;
[0024] If the maximum X coordinate in the track of the touch event is greater than the X coordinate of the right vertex of the current writing area, the X coordinate of the right vertex of the current writing area is updated to the maximum X coordinate in the track of the touch event;
[0025] If the minimum Y coordinate in the track of the touch event is smaller than the Y coordinate of the upper vertex of the current writing area, the Y coordinate of the upper vertex of the current writing area is updated to the minimum Y coordinate in the track of the touch event;
[0026] If the maximum Y coordinate in the track of the touch event is greater than the Y coordinate of the lower vertex of the current writing area, the Y coordinate of the lower vertex of the current writing area is updated to the maximum Y coordinate in the track of the touch event;
[0027] The coordinate system has the upper left corner of the display screen as the vertex, the Y axis extends downward, and the X axis extends rightward.
[0028] In some embodiments, the method further comprises the following steps:
[0029] Get the input instruction and determine the font of the text to be drawn according to the input instruction.
[0030] In some embodiments, the method further comprises the following steps:
[0031] Determining whether the trajectories of multiple touch events belong to the same writing area according to the time when the touch events corresponding to the trajectories of the touch events are generated;
[0032] When the time difference between the touch events corresponding to the trajectories of two touch events is less than a preset value, it is determined that the trajectories of the two touch events belong to the same writing area.
[0033] On the other hand, an embodiment of the present application provides a text drawing system for an electronic whiteboard, comprising:
[0034] Memory, used to store programs;
[0035] The processor is used to load the program to execute the text drawing method of the electronic whiteboard.
[0036] On the other hand, an embodiment of the present application provides an electronic whiteboard, including:
[0037] Touch screen, used to display content and capture touch signals;
[0038] Memory, used to store programs;
[0039] The processor is used to load the program to execute the text drawing method of the electronic whiteboard.
[0040] On the other hand, an embodiment of the present application provides a storage medium storing a program, wherein the program, when executed by a processor, implements the text drawing method of the electronic whiteboard.
[0041] The embodiment of the present application obtains a touch event; updates the vertex coordinates of the current writing area according to the touch event, identifies the text in the writing area as the text to be drawn, then determines the number of characters in the current writing area, determines the font size of the text to be drawn according to the current number of characters and the vertex coordinate information of the writing area, and the position information of the text to be drawn, draws the text to be drawn according to the font size and position information, and can generate standard text according to the position of the user's blackboard writing and the size of the blackboard writing, so that the user can write freely on the blackboard according to the actual situation without being restricted by the specific text format, and can automatically generate a standard font to prevent handwritten content from being difficult to read. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0043] Figure 1 It is a flow chart of a method for drawing text on an electronic whiteboard provided in an embodiment of the present application;
[0044] Figure 2 This is a schematic diagram of a text drawing effect provided in an embodiment of the present application. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described through the implementation method with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present application.
[0046] In the description of the present invention, "several" means more than one, "many" means more than two, "greater than", "less than", "exceed", etc. are understood to exclude the number itself, and "above", "below", "within", etc. are understood to include the number itself. If there is a description of "first" or "second", it is only used for the purpose of distinguishing the technical features, and cannot be understood as indicating or implying the relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features.
[0047] In the description of the present invention, unless otherwise clearly defined, words such as "setting" should be understood in a broad sense, and technicians in the relevant technical field can reasonably determine the specific meaning of the above words in the present invention in combination with the specific content of the technical solution.
[0048] In the description of the present invention, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples", or "some examples" means that the specific features or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0049] Reference Figure 1 and Figure 2 The present application embodiment provides a method for drawing text on an electronic whiteboard, comprising the following steps:
[0050] Step S1, obtaining a touch event. A touch event refers to MotionEvent, which is a class of Android native screen touch events, and can record the event type (including ACTION_DOWN press, ACTION_MOVE move, ACTION_UP lift, etc.) and the touch XY axis coordinate position, etc.
[0051] Step S2: Update the vertex coordinates of the current writing area according to the touch event, where the writing area is a rectangle surrounding a number of tracks classified as one writing area. Figure 2 As shown, the outer rectangle 200 of the handwriting input is determined by the boundary reached by the input content. In this embodiment, the position of the writing area can be modified by updating the fixed point coordinates of the rectangle where the writing area is located. When a point that does not belong to the writing area appears in the touch track, the range of the writing area can be updated according to the coordinate point that is far away from the current area in the X coordinate and Y coordinate.
[0052] Specifically, the vertex coordinates of the current writing area are updated according to the touch event, specifically:
[0053] Obtaining a touch event for the current writing area and determining a track of the touch event;
[0054] If the minimum X coordinate in the track of the touch event is smaller than the X coordinate of the left vertex of the current writing area, the X coordinate of the left vertex of the current writing area is updated to the minimum X coordinate in the track of the touch event;
[0055] If the maximum X coordinate in the track of the touch event is greater than the X coordinate of the right vertex of the current writing area, the X coordinate of the right vertex of the current writing area is updated to the maximum X coordinate in the track of the touch event;
[0056] If the minimum Y coordinate in the track of the touch event is smaller than the Y coordinate of the upper vertex of the current writing area, the Y coordinate of the upper vertex of the current writing area is updated to the minimum Y coordinate in the track of the touch event;
[0057] If the maximum Y coordinate in the track of the touch event is greater than the Y coordinate of the lower vertex of the current writing area, the Y coordinate of the lower vertex of the current writing area is updated to the maximum Y coordinate in the track of the touch event;
[0058] The coordinate system has the upper left corner of the display screen as the vertex, the Y axis extends downward, and the X axis extends rightward.
[0059] You can declare a RectF rectangle object (rectF), and then update the upper, lower, left, and right positions of the outer rectangle according to the XY axis coordinates passed in each MotionEvent event. The code is as follows:
[0060] Above: if(event.getY() <rectF.top){
[0061] rectF.top = event.getY();
[0062] }
[0063] Below: if (event.getY()>rectF.bottom) {
[0064] rectF.bottom=event.getY();
[0065] }
[0066] Left: if(event.getX() <rectF.left){
[0067] rectF.left = event.getX();
[0068] }
[0069] Right: if (event.getX()>rectF.right) {
[0070] rectF.right = event.getX();
[0071] }
[0072] Step S3: Identify the characters in the writing area as characters to be drawn.
[0073] In this embodiment, the text in the writing area is recognized through OCR (Optical Character Recognition) technology. OCR technology is a relatively mature recognition technology, which can recognize the text in the pattern.
[0074] Step S4: Determine the number of characters in the current writing area.
[0075] Determine the number of characters in the current writing area according to the recognition result of OCR. The number of characters in the current writing area can be determined by counting the OCR output result.
[0076] Step S5: Determine the font size of the text to be drawn and the position information of the text to be drawn according to the current number of characters and the vertex coordinate information of the writing area.
[0077] Considering that in the case of single-character writing, there are some characters with a large difference in the true width and height in the horizontal and vertical directions, such as "一" and "1", in order to be closest to the size of handwritten text, the single-character and multi-character cases need to be distinguished.
[0078] In the case of multi-characters, the font size is the width of the writing area divided by the number of characters. The specific code is as follows:
[0079] int length = text.length();
[0080] float textSize = (float)rectF.width() / length;
[0081] In the case of a single character, the maximum value of the width and height of the writing area is the font size. Specifically as follows:
[0082] float textSize = Math.max(rectF.width(), rectF.height());
[0083] Therefore, in this embodiment, step S5 specifically includes:
[0084] Determine the height and width of the writing area according to the vertex coordinate information of the writing area. The height and width of the writing area can be calculated according to the coordinates of the vertices.
[0085] When the current number of characters is 1, determine the font size of the text to be drawn with the larger one of the height and width of the writing area. If the number of characters is 1, choosing the larger one of the height and width in the writing area can avoid characters with a smaller outer frame such as "1" or "一".
[0086] When the current number of characters is greater than 1, the font size of the characters to be drawn is determined by dividing the width of the writing area by the number of characters. When the number of characters is greater than 1, the font size can be determined by dividing the width by the number of characters. Figure 2 It can be seen that the outer rectangle 200 of the original writing area may be relatively flat (assuming that the aspect ratio is greater than the number of characters). At this time, the outer rectangle 300 corresponding to the generated font may be higher than the outer rectangle 200 of the writing area.
[0087] The position information of the characters to be drawn is determined in the following manner: The center position 400 of the writing area is determined according to the vertex coordinate information of the writing area, and the center position is used as a reference point for the vertical centering of the characters to be drawn.
[0088] Specifically, declare a RectF text rectangle object (textRectF) and set the font size to the brush paint: paint.setTextSize(textSize);
[0089] The corresponding real line height can be obtained by specifying the brush of the text size. In order to better meet the visual experience, the text is displayed vertically in the center of the writing area to obtain the display rectangular area position of the line of text on the screen.
[0090] Step S6: Draw the text to be drawn according to the font size and position information.
[0091] In this step, the drawn text is refreshed and displayed according to the system's refresh rules, and the current handwritten content is replaced.
[0092] Specifically, according to the coordinate data of the display rectangular area, the midpoint X-axis coordinate and the reference line Y-axis coordinate can be calculated, and the standard font text close to the handwritten text size can be drawn, as follows:
[0093] / / Get the XY coordinate value of the midpoint of the display rectangular area
[0094] floatcenterX=textRectF.centerX();
[0095] floatcenterY=textRectF.centerY();
[0096] / / Calculate the Y-axis coordinate of the baseline when the text is displayed in the center according to the Y-axis coordinate of the midpoint of the display rectangular area and the font size.
[0097] Paint.FontMetrics metrics=paint.getFontMetrics();
[0098] floatbaseLine=centerY-(metrics.bottom-metrics.top) / 2-metrics.top;
[0099] / / Use the drawText method, pass in the midpoint X-axis coordinate and the baseline Y-axis coordinate parameters, and draw with a centered solid style brush.
[0100] paint.setTextAlign(Paint.Align.CENTER);
[0101] paint.setStyle(Paint.Style.FILL);
[0102] canvas.drawText(text,centerX,baseLine,paint);
[0103] This embodiment determines the writing area according to the touch time, recognizes the characters in the writing area, and determines the position and size of the characters to be drawn according to the number of characters and the position and size of the writing area. This does not limit the user's free blackboard writing, and can also generate corresponding standard characters according to the position and size of the handwritten characters. It is both beautiful and does not affect the user's free blackboard writing.
[0104] In some embodiments, in order to allow the user to select the text he wants to use, the method further includes the following steps:
[0105] Get the input instruction, and determine the font of the text to be drawn according to the input instruction. Specifically, the user can select the color and font of the text through the setting interface or toolbar. After the user selects, this information will be saved in the configuration file, and the system draws the text according to the font pointed to in the configuration file.
[0106] In some embodiments, whether the touch events belong to the same writing area is determined according to the time when the touch events are generated. If the interval is too long, it means that the user may be writing on the blackboard again in another place. The method further includes the following steps:
[0107] According to the time when the touch events corresponding to the touch event trajectories are generated, it is determined whether the trajectories of multiple touch events belong to the same writing area.
[0108] When the time difference between the touch events corresponding to the trajectories of two touch events is less than a preset value, it is determined that the trajectories of the two touch events belong to the same writing area.
[0109] In addition, when judging, the position of the blackboard should also be combined to determine whether the trajectory of the touch event belongs to the same writing area. For example, line breaks and writing text at a certain distance. If the trajectory of two touch events is greater than a certain distance, it is also determined that they do not belong to the same writing area. It should be understood that when drawing text, the entire writing area will be drawn. In other words, when you write a line of text by hand, the system will draw the text when it determines that the writing has stopped and the writing area has been fixed.
[0110] On the other hand, an embodiment of the present application provides a text drawing system for an electronic whiteboard, comprising:
[0111] Memory, used to store programs;
[0112] The processor is used to load the program to execute the text drawing method of the electronic whiteboard.
[0113] On the other hand, an embodiment of the present application provides an electronic whiteboard, including:
[0114] Touch screen, used to display content and capture touch signals;
[0115] Memory, used to store programs;
[0116] The processor is used to load the program to execute the text drawing method of the electronic whiteboard.
[0117] On the other hand, an embodiment of the present application provides a storage medium storing a program, wherein the program, when executed by a processor, implements the text drawing method of the electronic whiteboard.
[0118] If the integrated unit described in the present application is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes 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 storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store program codes.
[0119] Note that the above are only preferred embodiments of the present application and the technical principles used. Those skilled in the art will understand that the present application is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present application. Therefore, although the present application is described in more detail through the above embodiments, the present application is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present application, and the scope of the present application is determined by the scope of the appended claims.
Claims
1. A method for drawing text on an electronic whiteboard, characterized in that: The following steps are involved: Get touch events; updating vertex coordinates of a current writing area according to a touch event, wherein the writing area is a rectangle surrounding a number of tracks classified as one writing area; Recognize the characters in the writing area as characters to be drawn; Determine the number of characters in the current writing area; Determine the font size of the text to be drawn and the position information of the text to be drawn according to the current number of characters and the vertex coordinate information of the writing area; Drawing the text to be drawn according to the font size and position information specifically includes: obtaining the X-axis and Y-axis coordinate values of the midpoint of the writing area, calculating the Y-axis coordinate of the baseline where the text to be drawn is located when it is displayed in the center according to the Y-axis coordinate value and the font size, and drawing the text to be drawn according to the Y-axis coordinate of the baseline and the X-axis coordinate value; The step of determining the font size of the characters to be drawn according to the current number of characters and the vertex coordinate information of the writing area specifically includes: Determine the height and width of the writing area according to the vertex coordinate information of the writing area; When the current number of characters is 1, the font size of the characters to be drawn is determined by the larger one of the height and the width of the writing area; When the current number of characters is greater than 1, the font size of the characters to be drawn is determined by dividing the width of the writing area by the number of characters.
2. The method for drawing text on an electronic whiteboard according to claim 1, characterized in that: The position information of the text to be drawn is determined by the following method: The center position of the writing area is determined according to the vertex coordinate information of the writing area, and the center position is used as a reference point for the vertical centering of the text to be drawn.
3. The method for drawing text on an electronic whiteboard according to claim 1, characterized in that: Identifying the characters in the writing area and determining the number of characters in the current writing area are specifically: The characters in the writing area are recognized by OCR technology, and the number of characters in the current writing area is determined according to the OCR recognition result.
4. The method for drawing text on an electronic whiteboard according to claim 1, characterized in that: Update the vertex coordinates of the current writing area according to the touch event, specifically: Obtaining a touch event for the current writing area and determining a track of the touch event; If the minimum X coordinate in the track of the touch event is smaller than the X coordinate of the left vertex of the current writing area, the X coordinate of the left vertex of the current writing area is updated to the minimum X coordinate in the track of the touch event; If the maximum X coordinate in the track of the touch event is greater than the X coordinate of the right vertex of the current writing area, the X coordinate of the right vertex of the current writing area is updated to the maximum X coordinate in the track of the touch event; If the minimum Y coordinate in the track of the touch event is smaller than the Y coordinate of the upper vertex of the current writing area, the Y coordinate of the upper vertex of the current writing area is updated to the minimum Y coordinate in the track of the touch event; If the maximum Y coordinate in the track of the touch event is greater than the Y coordinate of the lower vertex of the current writing area, the Y coordinate of the lower vertex of the current writing area is updated to the maximum Y coordinate in the track of the touch event; The coordinate system has the upper left corner of the display screen as the vertex, the Y axis extends downward, and the X axis extends rightward.
5. The method for drawing text on an electronic whiteboard according to claim 1, characterized in that: The method further comprises the following steps: Get the input instruction, and determine the font of the text to be drawn according to the input instruction.
6. The method for drawing text on an electronic whiteboard according to claim 1, characterized in that: The method further comprises the following steps: Determining whether the trajectories of multiple touch events belong to the same writing area according to the time when the touch events corresponding to the trajectories of the touch events are generated; When the time difference between the touch events corresponding to the trajectories of two touch events is less than a preset value, it is determined that the trajectories of the two touch events belong to the same writing area.
7. A text drawing system for an electronic whiteboard, characterized in that: include: Memory, used to store programs; A processor is used to load a program to execute the text drawing method of the electronic whiteboard as described in any one of claims 1 to 6.
8. An electronic whiteboard, characterized in that: include: Touch screen, used to display content and capture touch signals; Memory, used to store programs; A processor is used to load the program to execute the text drawing method of the electronic whiteboard as described in any one of claims 1-6.
9. A storage medium, characterized in that: It stores a program, and when the program is executed by a processor, the text drawing method of the electronic whiteboard as described in any one of claims 1 to 6 is implemented.
