CN114415876A - Hand-drawn image processing method and device and electronic equipment - Google Patents

Hand-drawn image processing method and device and electronic equipment Download PDF

Info

Publication number
CN114415876A
CN114415876A CN202210074288.1A CN202210074288A CN114415876A CN 114415876 A CN114415876 A CN 114415876A CN 202210074288 A CN202210074288 A CN 202210074288A CN 114415876 A CN114415876 A CN 114415876A
Authority
CN
China
Prior art keywords
hand
drawn image
standardized
point
drawn
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
CN202210074288.1A
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.)
Beijing Barley Land Information Technology Co ltd
Original Assignee
Beijing Barley Land Information 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 Beijing Barley Land Information Technology Co ltd filed Critical Beijing Barley Land Information Technology Co ltd
Priority to CN202210074288.1A priority Critical patent/CN114415876A/en
Publication of CN114415876A publication Critical patent/CN114415876A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0481Interaction techniques based on graphical user interfaces [GUI] based on specific properties of the displayed interaction object or a metaphor-based environment, e.g. interaction with desktop elements like windows or icons, or assisted by a cursor's changing behaviour or appearance
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0487Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser
    • G06F3/0488Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser using a touch-screen or digitiser, e.g. input of commands through traced gestures
    • G06F3/04883Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser using a touch-screen or digitiser, e.g. input of commands through traced gestures for inputting data by handwriting, e.g. gesture or text
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/20Drawing from basic elements, e.g. lines or circles
    • G06T11/203Drawing of straight lines or curves

Abstract

The application discloses a hand-drawn image processing method and device and electronic equipment. The method comprises the following steps: acquiring a hand-drawn image and hand-drawn track information corresponding to the hand-drawn image; determining the number of contours in the hand-drawn image; when the number of the outlines is 0, judging whether the hand-drawn image is a line segment or not based on the hand-drawn track information, if so, generating a corresponding standardized line segment, otherwise, completing the hand-drawn image into a closed image and determining that the number of the outlines of the hand-drawn image is 1; when the number of the outlines is 1, determining fitting points of the hand-drawn image, and generating a corresponding standardized graph based on the fitting points and a preset rule; when the number of the contours is larger than 1, generating a corresponding standardized graph based on the number of the contours. Therefore, the requirement of drawing accuracy when a user draws a target is lowered, and the user can draw a standard graph through the whiteboard quickly.

Description

Hand-drawn image processing method and device and electronic equipment
Technical Field
The application relates to the technical field of drawing, in particular to a hand-drawn image processing method and device and electronic equipment.
Background
Whiteboard software in intelligent equipment is widely applied to scenes such as conferences, offices, teaching and the like. The user can input some images on the whiteboard interfaces of different device clients.
However, it is difficult to draw a standard graphic through a whiteboard quickly due to input limitations of a device such as a mouse or a stylus.
Disclosure of Invention
In view of the above, embodiments of the present application are directed to providing a method, an apparatus, and an electronic device for processing a hand-drawn image, so as to solve the problem in the prior art that it is difficult to draw a standard graphic through a whiteboard quickly.
According to a first aspect of embodiments of the present application, there is provided a hand-drawn image processing method, including:
acquiring a hand-drawn image and hand-drawn track information corresponding to the hand-drawn image;
determining the number of contours in the hand-drawn image;
when the number of the outlines is 0, judging whether the hand-drawn image is a line segment or not based on the hand-drawn track information, if so, generating a corresponding standardized line segment, otherwise, completing the hand-drawn image into a closed image and determining that the number of the outlines of the hand-drawn image is 1;
when the number of the outlines is 1, determining fitting points of the hand-drawn image, and generating a corresponding standardized graph based on the fitting points and a preset rule;
when the number of the contours is larger than 1, generating a corresponding standardized graph based on the number of the contours.
In one embodiment, the standardized graphic includes: and the standardized button graph is used for calling the preset instruction.
In an embodiment, the determining whether the hand-drawn image is a line segment based on the hand-drawn trajectory information includes:
determining a starting point coordinate, a coordinate of the Mth track point after the starting point, an end point coordinate and a coordinate of the Nth track point before the end point based on the hand-drawn track information;
determining a first auxiliary line based on the coordinates of the starting point and the coordinates of the Mth track point after the starting point, and determining a second auxiliary line based on the coordinates of the end point and the coordinates of the Nth track point before the end point; wherein the intersection point of the first auxiliary line and the second auxiliary line is an auxiliary point; m is a positive integer; n is a positive integer;
determining a distance between the auxiliary point and the end point based on the coordinates of the auxiliary point and the end point coordinates;
and if the distance between the auxiliary point and the end point exceeds a preset first threshold value, determining the hand-drawn image as a line segment.
In one embodiment, the generating the corresponding normalized line segment includes:
and generating a line segment with the corresponding position of the starting point of the hand-drawn image as the starting point and the corresponding position of the end point of the hand-drawn image as the end point based on the starting point coordinate and the end point coordinate of the hand-drawn image.
In an embodiment, the complementing the hand-drawn image into a closed image includes:
and connecting the starting point of the hand-drawn image with the auxiliary point, and connecting the end point of the hand-drawn image with the auxiliary point to complement the hand-drawn image into a closed image.
In an embodiment, the determining a fitting point of the hand-drawn image comprises:
selecting two points which are farthest away from each other in the hand-drawn image as fitting points;
connecting the fitting points to obtain a fitting graph;
determining a point on the hand-drawn image farthest from the fitting graph as a target point;
judging whether the distance between the target point and the fitting graph exceeds a preset second threshold value or not;
if yes, determining the target point as a newly added fitting point, and executing the step of connecting the fitting points to obtain a fitting graph.
In one embodiment, the generating a corresponding standardized graph based on the fitting point and a preset rule includes:
determining the number of fitting points;
when the number of the fitting points is 3, generating a standardized isosceles triangle or a standardized equilateral triangle based on the lengths of three sides of the fitting graph;
when the number of the fitting points is 4, generating a standardized square, a standardized rectangle, a standardized parallelogram or a standardized isosceles trapezoid based on the angle information and the side length information of the fitting graph;
when the number of the fitting points is larger than 4, determining a minimum bounding rectangle of the hand-drawn image, and generating a standardized perfect circle or a standardized ellipse based on the minimum bounding rectangle of the hand-drawn image.
In one embodiment, the generating a corresponding normalized graph based on the number of contours includes:
if the number of the outlines is 6, generating a standardized pentagram;
if the number of the outlines is 2, generating a standardized note;
wherein the standardized five-pointed star and the standardized notepad both belong to the standardized graph; the standardized note is a standardized button used for calling a preset note instruction.
According to a second aspect of embodiments of the present application, there is provided a hand-drawn image processing apparatus, the apparatus including: the acquisition module is used for acquiring a hand-drawn image and hand-drawn track information corresponding to the hand-drawn image; the determining module is used for determining the number of the contours in the hand-drawn image; the first generation module is used for judging whether the hand-drawn image is a line segment or not based on the hand-drawn track information when the number of the outlines is 0, if so, generating a corresponding standardized line segment, otherwise, completing the hand-drawn image into a closed image and determining that the number of the outlines of the hand-drawn image is 1; the second generation module is used for determining fitting points of the hand-drawn image when the number of the outlines is 1, and generating a corresponding standardized graph based on the fitting points and a preset rule; and the third generation module is used for generating a corresponding standardized graph based on the number of the outlines when the number of the outlines is larger than 1.
According to a third aspect of embodiments of the present application, there is provided an electronic apparatus, including: a processor; a memory for storing the processor-executable instructions; the processor is configured to perform the method according to any of the above embodiments.
According to a fourth aspect of embodiments of the present application, there is provided a computer-readable storage medium storing a computer program for executing the method of any of the above embodiments.
In the scheme provided by the embodiment of the application, a user only needs to input a hand-drawn image similar to an actual expected target of the user, then the intelligent device acquires the hand-drawn image and hand-drawn track information, information such as the number of contours and the number of feature points is determined based on the hand-drawn track information and the hand-drawn image, and then a standardized graph corresponding to the hand-drawn image is generated based on a preset rule. Therefore, the requirement of drawing accuracy when a user draws a target is lowered, and the user can draw a standard graph through the whiteboard quickly.
Drawings
The above and other objects, features and advantages of the present application will become more apparent by describing in more detail embodiments of the present application with reference to the attached drawings. The accompanying drawings are included to provide a further understanding of the embodiments of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain the principles of the application. In the drawings, like reference numbers generally represent like parts or steps.
Fig. 1 is a schematic diagram illustrating an implementation environment provided by an embodiment of the present application.
Fig. 2 is a flowchart illustrating a method for processing a hand-drawn image according to an embodiment of the present disclosure.
Fig. 3 is a schematic flow chart illustrating a process of determining whether a hand-drawn image is a line segment according to an embodiment of the present application.
Fig. 4 is a schematic flow chart for determining a fitting point according to an embodiment of the present application.
Fig. 5 is a schematic diagram illustrating a fitting process in the hand-drawn image processing method according to an embodiment of the present application.
Fig. 6 is a schematic diagram illustrating a correspondence between a hand-drawn image and a line segment or a standardized graph according to an embodiment of the present application.
Fig. 7 is a schematic diagram illustrating a correspondence relationship between a hand-drawn image and a standardized graph according to an embodiment of the application.
Fig. 8 is a flowchart illustrating a method for processing a hand-drawn image according to an embodiment of the present disclosure.
Fig. 9 is a block diagram illustrating an image processing apparatus according to an embodiment of the present application.
Fig. 10 is a block diagram illustrating an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Summary of the application
Whiteboard software in intelligent equipment is widely applied to scenes such as conferences, offices, teaching and the like. The user may use the whiteboard interface on the client of a different device to make some image inputs. However, when a user hand-draws an image in a whiteboard, the hand-drawn pattern is irregular, and does not achieve the effect of a standard pattern, and the aesthetic degree is low.
In order to solve the above problems, in the embodiments of the present application, an algorithm is used to automatically identify a user hand-drawn image in real time, so as to help the user convert an irregular figure drawn by hand into a standardized figure (such as an equilateral triangle, a regular quadrangle, a regular circle, and a preset standardized button figure).
Having described the general principles of the present application, various non-limiting embodiments of the present application will now be described with reference to the accompanying drawings.
Exemplary System
Fig. 1 is a schematic diagram illustrating an implementation environment provided by an embodiment of the present application. The implementation environment includes an input device, a smart device, and a display device.
The input equipment is a white board and is used for a user to carry out hand drawing and input hand-drawn images. The intelligent device is in communication connection with the input device and used for acquiring the hand-drawn image and calculating based on the hand-drawn image and hand-drawn track information corresponding to the hand-drawn image to obtain a standardized graph or a standardized button. And the display device is in communication connection with the intelligent device and is used for displaying the standardized graph or the standardized buttons.
It should be noted that, depending on the actual application scenario, the specific devices of the input device, the smart device, and the display device are also different. For example, in a meeting or teaching scene, the input device and the intelligent device may be a preset computer with an input function, and the display device is a projection screen and a screen of the computer. The conference host or the instructor carries out hand drawing on the computer through a mouse to obtain a hand-drawn image, then the computer carries out calculation based on the hand-drawn image to obtain a standardized graph, and then the computer carries out display based on a projection screen and a screen of the computer. For example, in a work scenario and when the tool is a tablet computer, the input device and the display device may be a touch display screen of the tablet computer, and the smart device is a processing module inside the tablet computer.
In some optional embodiments, the input device may also be an external hand-drawing board.
Exemplary method
Fig. 2 is a flowchart illustrating a method for processing a hand-drawn image according to an embodiment of the present disclosure. The method illustrated in fig. 2 is executed by a smart device (e.g., a mobile phone, a server, and a computer), but the embodiment of the present application is not limited thereto. As shown in fig. 2, the method includes the following.
S210: and acquiring a hand-drawn image and hand-drawn track information corresponding to the hand-drawn image.
In the solution provided by an embodiment, in order to simplify the processing flow of the hand-drawn image, some requirements are made on the drawing process of the user, for example: the hand-drawn image is required to be as close as possible to the actual target that the user wants to obtain, and the user is required to finish the hand-drawn image in one stroke.
In practical application, the actual process of the hand-drawing by the user can be regarded as the process that the device continuously collects track points input by the user, so that the hand-drawing track information corresponding to the hand-drawing image can be acquired while the hand-drawing image is collected.
S220: determining the number of contours in the hand-drawn image.
It should be noted that, in the field of graphics processing, the number of outlines is worth the number of outlines of the smallest closed graphic unit in the picture, i.e. the smallest closed graphic unit. For example: the number of the profiles of one circle is 1; the number of contours of the two ellipses that intersect is 3.
S230: and when the number of the outlines is 0, judging whether the hand-drawn image is a line segment or not based on the hand-drawn track information, if so, generating a corresponding standardized line segment, otherwise, completing the hand-drawn image into a closed image and determining that the number of the outlines of the hand-drawn image is 1.
S240: and when the number of the outlines is 1, determining fitting points of the hand-drawn image, and generating a corresponding standardized graph based on the fitting points and a preset rule.
In one embodiment, the standardized graph may include: standardized isosceles triangles, standardized equilateral triangles, standardized squares, standardized rectangles, standardized parallelograms, standardized isosceles trapezoids, standardized true circles, and standardized ellipses.
S250: when the number of the contours is larger than 1, generating a corresponding standardized graph based on the number of the contours.
It should be noted that the standardized graph includes: and the standardized button graph is used for calling the preset instruction.
In some embodiments, step S250 may include: if the number of the outlines is 6, generating a standardized pentagram; if the number of the outlines is 2, generating a standardized note; wherein the standardized five-pointed star and the standardized notepad both belong to the standardized figure. The standardized note is a standardized button graph used for calling a preset note instruction.
It should be noted that the above description is only based on the cases of the number of contours being 2 and 6, and not limited thereto, and in practical applications, the setting may be based on the actual requirements of the user. Specific correspondence rules are set based on the graphics that the user actually wants to draw.
In the scheme provided by the embodiment of the application, a user only needs to input a hand-drawn image similar to an actual expected target of the user, then the intelligent device acquires the hand-drawn image and hand-drawn track information, information such as the number of contours and the number of feature points is determined based on the hand-drawn track information and the hand-drawn image, and then a standardized graph corresponding to the hand-drawn image is generated based on a preset rule. Therefore, the requirement of drawing accuracy when the user draws the target is reduced, and the user can draw a standard graph quickly through the whiteboard.
Furthermore, there are various ways to determine whether the hand-drawn image is a line segment. The present application will be described by taking only two of them as examples: a method for judging whether a hand-drawn image is a line segment is as follows:
and determining fitting points of the hand-drawn image, and determining the closed image as a line segment when the number of the fitting points is 2. The principle of this approach is that in order to draw other standardized graphics in the present application, there are necessarily a plurality of fitting points in the hand-drawn image drawn by the user. If the user-drawn hand-drawn image has only two fitting points, the purpose of the user-drawn hand-drawn image should be to draw line segments.
Another way to determine whether the hand-drawn image is a line segment is as follows: the determination is made based on the distance between the end point and the assist point. Specifically, referring to fig. 3, the process for determining whether the hand-drawn image is a line segment is specifically as follows:
and S310, determining a starting point coordinate, an Mth track point coordinate after the starting point, an end point coordinate and an Nth track point coordinate before the end point based on the hand-drawn track information.
It should be noted that the coordinates of the starting point refer to the coordinates of the trace point collected first when the user draws by hand, and the coordinates of the mth trace point after the starting point refer to the coordinates of the mth trace point collected by the device when the user draws by hand; the end point coordinate refers to the coordinate of the trace point which is finally collected when the user draws by hand; the Nth track point before the end point refers to the coordinate of the Nth track point from the last to the last acquired by the equipment when the user draws by hand.
S320, determining a first auxiliary line based on the coordinates of the starting point and the coordinates of the Mth track point after the starting point, and determining a second auxiliary line based on the coordinates of the end point and the coordinates of the Nth track point before the end point; wherein the intersection point of the first auxiliary line and the second auxiliary line is an auxiliary point; m is a positive integer; n is a positive integer.
Specifically, the first auxiliary line is determined based on the coordinates of the starting point and the coordinates of the mth track point after the starting point as follows: and (4) making a straight line passing through the starting point and the Mth track point after the starting point on the hand-drawn track. And determining a second auxiliary line as follows based on the terminal point coordinate and the coordinate of the Nth track point before the terminal point: and (4) making a straight line passing through the end point and the Nth track point before the end point on the hand-drawn track. The intersection point of the two straight lines is an auxiliary point.
In practical application, the values of M and N can be selected based on the speed of the device for acquiring the trace points. Specifically, M may be, but is not limited to, 5; n may be, but is not limited to, 5. The values of M and N should be much smaller than the number of trace points in the hand-drawn trace information. Specifically, the values of M and N should be less than one fifth of the number of trace points in the hand-drawn trace information.
S330, determining the distance between the auxiliary point and the terminal point based on the coordinate of the auxiliary point and the terminal point coordinate.
S340, if the distance between the auxiliary point and the end point exceeds a preset first threshold value, determining that the hand-drawn image is a line segment.
The specific principle of the step of judging whether the hand-drawn image is a line segment is as follows: the standardized graphs given by the embodiment of the application can be regarded as closed images. If the user wishes to draw a closed figure, rather than a line segment, the auxiliary point and the end point should be within a preset range, i.e., the auxiliary point and the end point are closer together. Therefore, if the distance between the auxiliary point and the end point exceeds the preset first threshold, the user can be regarded as wishing to draw a line segment, and in this case, a corresponding standardized line segment can be generated.
Further, the specific steps of completing the hand-drawn image into a closed image include: and connecting the starting point of the hand-drawn image with the auxiliary point, and connecting the end point of the hand-drawn image with the auxiliary point to complement the hand-drawn image into a closed image.
If the assist point position is not specified in the manner shown in fig. 3 when "determining whether or not the hand-drawn image is a line segment", it is necessary to specify the position of the assist point first when "complementing the hand-drawn image into a closed image" is executed. Namely: before the step of connecting the starting point of the hand-drawn image and the auxiliary point, and connecting the end point of the hand-drawn image and the auxiliary point to complement the hand-drawn image as a closed image is performed, the steps S310 and S320 are performed to determine the position of the auxiliary point.
In practical applications, the processing of the closed image is mainly a fitting operation. Fig. 4 is a schematic flow chart for determining a fitting point according to an embodiment of the present application. Fig. 5 is a schematic diagram illustrating a fitting process in the hand-drawn image processing method according to an embodiment of the present application. Referring to fig. 4 and 5, in the scheme provided in the embodiment of the present application, a process of determining a fitting point of the hand-drawn image includes:
s410, selecting two points with the farthest distance in the hand-drawn image as fitting points.
Taking a trapezoidal hand-drawn image (as shown in fig. 5 (a)) as an example, two points farthest away from each other in the hand-drawn image are selected, specifically referring to two black points in the image shown in fig. 5 (b).
And S420, connecting the fitting points to obtain a fitting graph.
It should be noted that there are various specific connection methods of the fitting points. A specific connection method is provided in the present application, when there are two fitting points (as shown in fig. 5 (c)), only two fitting points need to be connected. If the number of the fitting points is multiple, the fitting points can be connected into a closed graph.
Specifically, an implementation of "connecting the fitting points into a closed graph (as shown in (e), (g) in fig. 5)" may include: and determining the sequence of the points of the hand-drawn image corresponding to each fitting point when the points are drawn based on the hand-drawn track information, sequencing the fitting points based on the sequence when the points are drawn, connecting the fitting points according to the sequence to obtain line segments, and then connecting the line segments at the head to obtain a fitting graph.
Implementations of "connecting the fitted points as one closed graph" may further include: and searching another fitting point closest to the fitting point by taking any one fitting point as a starting point, connecting the two fitting points, then searching an unconnected fitting point closest to the fitting point by taking the just-connected fitting point as the starting point, and connecting the two fitting points. And continuously executing the operation of connecting the fitting points until all the fitting points are connected to obtain a broken line connecting all the fitting points, and then connecting the head and the tail of the broken line to obtain a fitting graph.
And S430, determining a point on the hand-drawn image farthest from the fitting graph as a target point.
In the case of graphic processing, a specific procedure for "determining a target point" in which any one of the graphics is composed of a plurality of points may be to calculate the distance between each point of each hand-drawn image and the fitted graphics, and then determine the point farthest from the fitted graphics based on the distance. Of course, in practical applications, the specific calculation steps may be simplified based on some policies.
S440, judging whether the distance between the target point and the fitting graph exceeds a preset second threshold value.
And S450, if yes, determining the target point as a newly added fitting point, and executing the step of connecting the fitting points to obtain a fitting graph.
It should be noted that, in the solution provided in this embodiment of the present application (as shown in (d) and (f) in fig. 5), if the distance between the target point and the fitting graph exceeds the preset second threshold, it may be considered that the previous fitting effect is not ideal, and the target point needs to be regarded as a new fitting point to be fitted again, that is: step S420, step S430, step S440, and step S450 are re-executed. If the distance between the target point and the fitting graph does not exceed the preset second threshold, the previous fitting effect is considered to be ideal, and the fitting can be considered to be completed.
In an embodiment, referring to fig. 6, the step S240 of "generating a corresponding normalized graph based on the fitting point and a preset rule" includes:
and S610, determining the number of the fitting points.
And S620, when the number of the fitting points is 3, generating a standardized isosceles triangle or a standardized equilateral triangle based on the lengths of the three sides of the fitting graph.
Specifically, the difference values of the lengths of the three sides of the fitting graph are calculated, and if the difference values do not exceed a preset value, a standardized equilateral triangle is generated; if the difference value exceeds the preset value, judging whether the difference of the side lengths of the two sides does not exceed a preset threshold value, and if the difference of the side lengths of the two sides does not exceed the preset threshold value, generating an isosceles triangle.
It should be noted that, if a scene with only 2 triangles (an isosceles triangle and an equilateral triangle) is set, when the fitting graph is determined to be a triangle and not to be an equilateral triangle, the hand-drawn image can be directly determined to be an isosceles triangle.
And S630, when the number of the fitting points is 4, generating a standardized square, a standardized rectangle, a standardized parallelogram or a standardized isosceles trapezoid based on the angle information and the side length information of the fitting graph.
Specifically, when the fitting graph is a quadrangle, the graph desired by the user may be: square, rectangle, parallelogram, isosceles trapezoid. Further, when the side length difference value is lower than a preset value and one corner is a right angle, a square is generated. And when the side length difference value is higher than the preset value and one corner is a right angle, generating a rectangle. When the ratio of the length sum of two adjacent edges to the length sum of the other two edges is 1 and the four corners are not right angles; generating a parallelogram; if the conditions are not the same and the side lengths of a group of opposite sides are basically the same, namely the difference value of the side lengths of the group of opposite sides is lower than the preset difference value, an isosceles trapezoid is generated.
And S640, when the number of the fitting points is larger than 4, determining the minimum circumscribed rectangle of the hand-drawn image, and generating a standardized perfect circle or a standardized ellipse based on the minimum circumscribed rectangle of the hand-drawn image.
If the number of fitting points is greater than 4, the shape corresponding to the hand-drawn image can be considered as a standardized perfect circle or a standardized ellipse. The difference between perfect circles and ellipses is the aspect ratio of the smallest circumscribed rectangle. Based on this, in the scheme provided in the embodiment of the present application, when the number of fitting points is greater than 4, an operation of determining a minimum circumscribed rectangle of the hand-drawn image is performed, and if the aspect ratio of the minimum circumscribed rectangle is greater than a preset ratio, an ellipse is generated, otherwise, a perfect circle is generated.
Based on the above preferred embodiments, the present application provides a method for processing a hand-drawn image; in the method, the corresponding relationship between the hand-drawn image and the standardized graph is shown in FIG. 7; specifically, referring to fig. 8, the method for processing a hand-drawn image according to the embodiment of the present application includes:
s801, acquiring a hand-drawn image and hand-drawn track information corresponding to the hand-drawn image.
S802, determining the number of the outlines in the hand-drawn image.
Further, based on the number of contours, step S803, step S810, step S819, and step S820 are performed.
And S803, when the number of the outlines is 0, determining a starting point coordinate, an M track point coordinate after the starting point, an end point coordinate and an Nth track point coordinate before the end point based on the hand-drawn track information.
S804, determining a first auxiliary line based on the coordinates of the starting point and the coordinates of the Mth track point after the starting point, and determining a second auxiliary line based on the coordinates of the end point and the coordinates of the Nth track point before the end point; wherein the intersection point of the first auxiliary line and the second auxiliary line is an auxiliary point.
Wherein M is a positive integer; n is a positive integer;
s805, determining a distance between the auxiliary point and the end point based on the coordinates of the auxiliary point and the end point coordinates.
S806, judging whether the distance between the auxiliary point and the end point exceeds a preset first threshold value.
If yes, go to step S807, otherwise go to step S808.
And S807, generating a line segment taking the corresponding position of the starting point of the hand-drawn image as the starting point and the corresponding position of the end point of the hand-drawn image as the end point based on the starting point coordinate and the end point coordinate of the hand-drawn image.
If the start point and the end point can be approximately regarded as being on a horizontal line, a horizontal line segment is generated as a normalized line segment. Correspondingly, if the starting point and the end point can be approximately regarded as a straight line perpendicular to the horizontal line, a line segment perpendicular to the horizontal line is generated as a standardized line segment
And S808, connecting the starting point and the auxiliary point of the hand-drawn image, and connecting the end point and the auxiliary point of the hand-drawn image to complement the hand-drawn image into a closed image.
And S809, determining the number of the outlines of the hand-drawn image to be 1.
After the hand-drawn image is completed, the number of outlines of the hand-drawn image changes from 0 to 1.
S810, when the number of the outlines is 1, selecting two points which are farthest away from each other in the hand-drawn image as fitting points.
And S811, connecting the fitting points to obtain a fitting graph.
And S812, determining a point on the hand-drawn image farthest from the fitting graph as a target point.
S813, judging whether the distance between the target point and the fitting graph exceeds a preset second threshold value.
If so, go to step S814, otherwise go to step S815.
S814, determining the target point as a newly added fitting point.
After step S814, the process goes to step S811 to form a loop.
And S815, determining the number of the fitting points.
Based on the number of fitting points, step S816, step S817, and step S818 are performed.
And S816, when the number of the fitting points is 3, generating a standardized isosceles triangle or a standardized equilateral triangle based on the lengths of the three sides of the fitting graph.
And S817, when the number of the fitting points is 4, generating a standardized square, a standardized rectangle, a standardized parallelogram or a standardized isosceles trapezoid based on the angle information and the side length information of the fitting graph.
S818, when the number of the fitting points is larger than 4, determining the minimum bounding rectangle of the hand-drawn image, and generating a standardized perfect circle or a standardized ellipse based on the minimum bounding rectangle of the hand-drawn image.
S819, when the number of the outlines is 2, a standardized note is generated.
And S820, when the number of the outlines is 6, generating a standardized pentagram.
In the scheme provided by the embodiment of the application, a user only needs to input a hand-drawn image similar to an actual expected target of the user, then the intelligent device acquires the hand-drawn image and hand-drawn track information, information such as the number of contours and the number of feature points is determined based on the hand-drawn track information and the hand-drawn image, and then a standardized graph corresponding to the hand-drawn image is generated based on a preset rule. Therefore, the requirement of drawing accuracy when a user draws a target is lowered, and the user can draw a standard graph through the whiteboard quickly.
Exemplary devices
The embodiment of the device can be used for executing the embodiment of the method. For details which are not disclosed in the embodiments of the apparatus of the present application, reference is made to the embodiments of the method of the present application.
Fig. 9 is a block diagram illustrating a hand-drawn image processing apparatus according to an embodiment of the present application. As shown in fig. 9, the hand-drawn image processing apparatus according to the embodiment of the present application includes:
the acquisition module 91 is configured to acquire a hand-drawn image and hand-drawn trajectory information corresponding to the hand-drawn image;
a determining module 92 for determining the number of contours in the hand-drawn image;
a first generating module 93, configured to, when the number of contours is 0, determine whether the hand-drawn image is a line segment based on the hand-drawn trajectory information, if so, generate a corresponding standardized line segment, otherwise, complement the hand-drawn image as a closed image and determine that the number of contours of the hand-drawn image is 1;
a second generating module 94, configured to determine a fitting point of the hand-drawn image when the number of the contours is 1, and generate a corresponding standardized graph based on the fitting point and a preset rule;
a third generating module 95, configured to generate a corresponding normalized graph based on the number of contours when the number of contours is greater than 1.
In one embodiment, the standardized graphic includes: and the standardized button graph is used for calling the preset instruction.
In an embodiment, the determining whether the hand-drawn image is a line segment based on the hand-drawn trajectory information includes: determining a starting point coordinate, a coordinate of the Mth track point after the starting point, an end point coordinate and a coordinate of the Nth track point before the end point based on the hand-drawn track information; determining a first auxiliary line based on the coordinates of the starting point and the coordinates of the Mth track point after the starting point, and determining a second auxiliary line based on the coordinates of the end point and the coordinates of the Nth track point before the end point; wherein the intersection point of the first auxiliary line and the second auxiliary line is an auxiliary point; m is a positive integer; n is a positive integer; determining a distance between the auxiliary point and the end point based on the coordinates of the auxiliary point and the end point coordinates; and if the distance between the auxiliary point and the end point exceeds a preset first threshold value, determining the hand-drawn image as a line segment.
In one embodiment, the generating the corresponding normalized line segment includes: and generating a line segment with the corresponding position of the starting point of the hand-drawn image as the starting point and the corresponding position of the end point of the hand-drawn image as the end point based on the starting point coordinate and the end point coordinate of the hand-drawn image.
In an embodiment, the complementing the hand-drawn image into a closed image includes: and connecting the starting point of the hand-drawn image with the auxiliary point, and connecting the end point of the hand-drawn image with the auxiliary point to complement the hand-drawn image into a closed image.
In an embodiment, the determining a fitting point of the hand-drawn image comprises: selecting two points which are farthest away from each other in the hand-drawn image as fitting points; connecting the fitting points to obtain a fitting graph;
determining a point on the hand-drawn image farthest from the fitting graph as a target point; judging whether the distance between the target point and the fitting graph exceeds a preset second threshold value or not; if yes, determining the target point as a newly added fitting point, and executing the step of connecting the fitting points to obtain a fitting graph.
In one embodiment, the generating a corresponding standardized graph based on the fitting point and a preset rule includes: determining the number of fitting points; when the number of the fitting points is 3, generating a standardized isosceles triangle or a standardized equilateral triangle based on the lengths of three sides of the fitting graph; when the number of the fitting points is 4, generating a standardized square, a standardized rectangle, a standardized parallelogram or a standardized isosceles trapezoid based on the angle information and the side length information of the fitting graph; when the number of the fitting points is larger than 4, determining a minimum bounding rectangle of the hand-drawn image, and generating a standardized perfect circle or a standardized ellipse based on the minimum bounding rectangle of the hand-drawn image.
In one embodiment, the generating a corresponding normalized graph based on the number of contours includes: if the number of the outlines is 2, generating a standardized note; if the number of the outlines is 6, generating a standardized pentagram; wherein the standardized five-pointed star and the standardized notepad both belong to the standardized graph; the standardized notepad is a standardized button graph used for calling a preset notepad instruction.
Exemplary electronic device
Next, an electronic apparatus according to an embodiment of the present application is described with reference to fig. 10. FIG. 10 illustrates a block diagram of an electronic device in accordance with an embodiment of the present application.
As shown in fig. 10, the electronic device includes one or more processors 1010 and memory 1020.
The processor 1010 may be a Central Processing Unit (CPU) or other form of processing unit having data processing capabilities and/or instruction execution capabilities, and may control other components in the electronic device to perform desired functions.
Memory 1020 may include one or more computer program products that may include various forms of computer-readable storage media, such as volatile memory and/or non-volatile memory. The volatile memory may include, for example, Random Access Memory (RAM), cache memory (cache), and/or the like. The non-volatile memory may include, for example, Read Only Memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium and executed by processor 1010 to implement the image processing methods of the various embodiments of the present application described above and/or other desired functions. Various contents such as category correspondence may also be stored in the computer-readable storage medium.
In one example, the electronic device may further include: an input device 1030 and an output device 1040, which are interconnected by a bus system and/or other form of connection mechanism (not shown).
The input device 1030 may also include, for example, a keyboard, a mouse, and the like. The output device 1040 may output various information including the bone classification and segmentation result to the outside. The output devices 1040 may include, for example, a display, speakers, a printer, and a communication network and remote output devices connected thereto, among others.
Of course, for simplicity, only some of the components of the electronic device relevant to the present application are shown in fig. 10, and components such as buses, input/output interfaces, and the like are omitted. In addition, the electronic device may include any other suitable components, depending on the particular application.
Exemplary computer program product and computer-readable storage Medium
In addition to the above-described methods and apparatus, embodiments of the present application may also be a computer program product comprising computer program instructions that, when executed by a processor, cause the processor to perform the steps in the image processing method according to various embodiments of the present application described in the "exemplary methods" section of this specification, supra.
The computer program product may be written with program code for performing the operations of embodiments of the present application in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like 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 computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server.
Furthermore, embodiments of the present application may also be a computer-readable storage medium having stored thereon computer program instructions that, when executed by a processor, cause the processor to perform steps in an image processing method according to various embodiments of the present application described in the "exemplary methods" section above in this specification.
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 foregoing description has been presented for purposes of illustration and description. Furthermore, the description is not intended to limit embodiments of the application to the form disclosed herein. While a number of example aspects and embodiments have been discussed above, those of skill in the art will recognize certain variations, modifications, alterations, additions and sub-combinations thereof.

Claims (10)

1. A hand-drawn image processing method is characterized by comprising the following steps:
acquiring a hand-drawn image and hand-drawn track information corresponding to the hand-drawn image;
determining the number of contours in the hand-drawn image;
when the number of the outlines is 0, judging whether the hand-drawn image is a line segment or not based on the hand-drawn track information, if so, generating a corresponding standardized line segment, otherwise, completing the hand-drawn image into a closed image and determining that the number of the outlines of the hand-drawn image is 1;
when the number of the outlines is 1, determining fitting points of the hand-drawn image, and generating a corresponding standardized graph based on the fitting points and a preset rule;
when the number of the contours is larger than 1, generating a corresponding standardized graph based on the number of the contours.
2. The hand-drawn image processing method according to claim 1, wherein the standardized graphics comprise: and the standardized button graph is used for calling the preset instruction.
3. The method for processing the hand-drawn image according to claim 1, wherein the determining whether the hand-drawn image is a line segment based on the hand-drawn trajectory information includes:
determining a starting point coordinate, a coordinate of the Mth track point after the starting point, an end point coordinate and a coordinate of the Nth track point before the end point based on the hand-drawn track information;
determining a first auxiliary line based on the coordinates of the starting point and the coordinates of the Mth track point after the starting point, and determining a second auxiliary line based on the coordinates of the end point and the coordinates of the Nth track point before the end point; wherein the intersection point of the first auxiliary line and the second auxiliary line is an auxiliary point; m is a positive integer; n is a positive integer;
determining a distance between the auxiliary point and the end point based on the coordinates of the auxiliary point and the end point coordinates;
and if the distance between the auxiliary point and the end point exceeds a preset first threshold value, determining the hand-drawn image as a line segment.
4. The method of hand-drawn image processing according to claim 1, wherein the generating corresponding normalized line segments comprises:
and generating a line segment with the corresponding position of the starting point of the hand-drawn image as the starting point and the corresponding position of the end point of the hand-drawn image as the end point based on the starting point coordinate and the end point coordinate of the hand-drawn image.
5. The method for processing the hand-drawn image according to claim 3, wherein the complementing the hand-drawn image into a closed image comprises:
and connecting the starting point of the hand-drawn image with the auxiliary point, and connecting the end point of the hand-drawn image with the auxiliary point to complement the hand-drawn image into a closed image.
6. The hand-drawn image processing method of claim 1, wherein the determining a fitting point of the hand-drawn image comprises:
selecting two points which are farthest away from each other in the hand-drawn image as fitting points;
connecting the fitting points to obtain a fitting graph;
determining a point on the hand-drawn image farthest from the fitting graph as a target point;
judging whether the distance between the target point and the fitting graph exceeds a preset second threshold value or not;
if yes, determining the target point as a newly added fitting point, and executing the step of connecting the fitting points to obtain a fitting graph.
7. The hand-drawn image processing method according to claim 6, wherein the generating a corresponding standardized graph based on the fitting points and a preset rule comprises:
determining the number of fitting points;
when the number of the fitting points is 3, generating a standardized isosceles triangle or a standardized equilateral triangle based on the lengths of three sides of the fitting graph;
when the number of the fitting points is 4, generating a standardized square, a standardized rectangle, a standardized parallelogram or a standardized isosceles trapezoid based on the angle information and the side length information of the fitting graph;
when the number of the fitting points is larger than 4, determining a minimum bounding rectangle of the hand-drawn image, and generating a standardized perfect circle or a standardized ellipse based on the minimum bounding rectangle of the hand-drawn image.
8. The hand-drawn image processing method according to any one of claims 1 to 7, wherein the generating a corresponding normalized graph based on the number of contours comprises:
if the number of the outlines is 2, generating a standardized note;
if the number of the outlines is 6, generating a standardized pentagram;
wherein the standardized five-pointed star and the standardized notepad both belong to the standardized graph; the standardized notepad is a standardized button graph used for calling a preset notepad instruction.
9. A hand-drawn image processing apparatus, characterized in that the apparatus comprises:
the acquisition module is used for acquiring a hand-drawn image and hand-drawn track information corresponding to the hand-drawn image;
the determining module is used for determining the number of the contours in the hand-drawn image;
the first generation module is used for judging whether the hand-drawn image is a line segment or not based on the hand-drawn track information when the number of the outlines is 0, if so, generating a corresponding standardized line segment, otherwise, completing the hand-drawn image into a closed image and determining that the number of the outlines of the hand-drawn image is 1;
the second generation module is used for determining fitting points of the hand-drawn image when the number of the outlines is 1, and generating a corresponding standardized graph based on the fitting points and a preset rule;
and the third generation module is used for generating a corresponding standardized graph based on the number of the outlines when the number of the outlines is larger than 1.
10. An electronic device comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the steps of the method of any one of claims 1 to 8 when executing the computer program.
CN202210074288.1A 2022-01-21 2022-01-21 Hand-drawn image processing method and device and electronic equipment Pending CN114415876A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210074288.1A CN114415876A (en) 2022-01-21 2022-01-21 Hand-drawn image processing method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210074288.1A CN114415876A (en) 2022-01-21 2022-01-21 Hand-drawn image processing method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN114415876A true CN114415876A (en) 2022-04-29

Family

ID=81274970

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210074288.1A Pending CN114415876A (en) 2022-01-21 2022-01-21 Hand-drawn image processing method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN114415876A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114926563A (en) * 2022-07-18 2022-08-19 广州中望龙腾软件股份有限公司 Automatic graph supplementing method and device and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20010055035A1 (en) * 2000-04-07 2001-12-27 Naoto Kinjo Image processing method and system using computer graphics
CN101393648A (en) * 2008-10-07 2009-03-25 广东威创视讯科技股份有限公司 Recognition method for hand drawing geometrical drawing
CN113436294A (en) * 2021-06-01 2021-09-24 浪潮金融信息技术有限公司 Hand-drawn geometric figure normalization method, system and storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20010055035A1 (en) * 2000-04-07 2001-12-27 Naoto Kinjo Image processing method and system using computer graphics
CN101393648A (en) * 2008-10-07 2009-03-25 广东威创视讯科技股份有限公司 Recognition method for hand drawing geometrical drawing
CN113436294A (en) * 2021-06-01 2021-09-24 浪潮金融信息技术有限公司 Hand-drawn geometric figure normalization method, system and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
张天序: "《计算机辅助设计实例教程》", 中国建材工业出版社, pages: 266 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114926563A (en) * 2022-07-18 2022-08-19 广州中望龙腾软件股份有限公司 Automatic graph supplementing method and device and storage medium

Similar Documents

Publication Publication Date Title
US8963836B2 (en) Method and system for gesture-based human-machine interaction and computer-readable medium thereof
US10373359B2 (en) Method and device for erasing a writing path on an infrared electronic white board, and a system for writing on an infrared electronic white board
US20220319139A1 (en) Multi-endpoint mixed-reality meetings
CN110035329B (en) Image processing method, device and storage medium
WO2019000681A1 (en) Information layout method, device, apparatus and computer storage medium
CN114138165B (en) Pattern recognition method, apparatus, device and storage medium
KR20220061985A (en) Method and corresponding device for selecting graphic objects
US11474627B2 (en) Method, apparatus and device for erasing handwriting on electronic whiteboard
CN112083870B (en) Information identification method and equipment
CN114415876A (en) Hand-drawn image processing method and device and electronic equipment
EP2618237B1 (en) Gesture-based human-computer interaction method and system, and computer storage media
CN115589786A (en) Method, device and system for recognizing hand-drawn figure and computer readable storage medium
JP6607243B2 (en) Information processing apparatus, information processing method, and program
JP2022138285A (en) Display device, display method and program
CN113485590A (en) Touch operation method and device
WO2020132863A1 (en) Continuous writing method and display terminal
CN112465692A (en) Image processing method, device, equipment and storage medium
CN113837194B (en) Image processing method, image processing apparatus, electronic device, and storage medium
CN112740151A (en) Data input method of terminal equipment, terminal equipment and storage medium
CN115035261B (en) Method, device, equipment and medium for generating collision device
CN113538623B (en) Method, device, electronic equipment and storage medium for determining target image
JP2018181169A (en) Information processor, and information processor control method, computer program, and storage medium
CN112199760B (en) Structure size labeling method and device, terminal equipment and storage medium
US20220375118A1 (en) Method and apparatus for identifying vehicle cross-line, electronic device and storage medium
CN115358251A (en) Graphic code identification method, graphic code identification device 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