Drawing method and device, computing equipment and program product

By extracting the contour features of the material image and drawing the target contour on the drawing window, the problem that drawing software in the prior art cannot automatically generate complex graphics is solved, the drawing efficiency and accuracy are improved, and the graphics modification process is simplified.

CN118644569APending Publication Date: 2024-09-13UNIONTECH SOFTWARE TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410773326.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-14
Publication Date
2024-09-13

AI Technical Summary

Technical Problem

Existing drawing software cannot automatically generate drawing graphics based on imported pictures, resulting in low efficiency and accuracy in drawing complex graphics, and cumbersome graphics modifications.

Method used

By obtaining the material image, extract the material outline and original position points, perform coordinate conversion and then draw the target outline on the drawing window, and add drag points at locations with larger bending angles to adjust the shape.

Benefits of technology

It improves drawing efficiency and graphics accuracy, enables users to quickly draw complex graphics, and simplifies the secondary adjustment process of graphics.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118644569A
    Figure CN118644569A
Patent Text Reader

Abstract

The invention discloses a drawing method and device, computing equipment and a program product, the method is executed in the drawing device of the computing equipment, a drawing window of the drawing device is provided with canvas, and the method comprises the following steps: acquiring a material image imported into the drawing device; a material contour is extracted from the material image, original position points are extracted from the material contour, the original position points comprise key points and / or feature points of interest in the material contour, and the material contour comprises an original contour point set used for describing the shape of a target object in the material image; based on a coordinate system of a drawing device and the size of the canvas, performing coordinate conversion on the original position point, and mapping the original position point to the canvas to obtain a target position point; and drawing a target contour of the target object on the canvas based on the target position point. According to the invention, drawing can be automatically carried out based on the imported material image, the drawing efficiency is improved, and complex graphs can be conveniently drawn.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a drawing method, a drawing device, a computing device and a program product. Background Art

[0002] Drawing software is different from professional image editing software such as GIMP and PhotoShop. It is often used for creation and communication. For example, you can use drawing software to draw a sketch, or use drawing software as an electronic whiteboard.

[0003] Compared with handwriting, drawing with drawing software is more difficult and generally cannot be done accurately, especially for drawing some complex graphics. Therefore, when using drawing software to create, users often want to make secondary creations based on some ready-made materials, such as putting pets, decorations and other materials into the work. Existing drawing software does not yet provide the function of drawing based on picture features, and it is impossible to automatically generate drawing graphics by importing pictures.

[0004] The existing drawing method mainly relies on manual drawing by the user, and the drawing software automatically adds drawing points in response to the changes in the user's mouse trajectory, and draws the corresponding graphics according to the context. This method has a high degree of freedom, but it takes a long time to draw complex graphics, and it will cause trouble for users who are not good at drawing. In addition, if you want to modify the graphics after drawing, you need to use an "eraser" to erase it and then redraw it. It can be seen that the existing drawing software has the following defects: the accuracy of mouse operation is not as accurate as handwriting, and it is difficult to draw complex graphics in a short time; if secondary adjustments are required after the graphics are drawn, the operation is cumbersome, and the original graphics need to be cleared first and then redrawn; because it is impossible to automatically generate drawing graphics based on imported pictures, the drawing efficiency and accuracy are low.

[0005] Therefore, a drawing method is needed to solve the problems existing in the above technical solutions. Summary of the invention

[0006] To this end, the present invention provides a drawing method and device to solve or at least alleviate the above problems.

[0007] According to one aspect of the present invention, there is provided a drawing method, which is executed in a drawing device of a computing device, wherein a drawing window of the drawing device has a canvas, and the method comprises: acquiring a material image imported into the drawing device; extracting a material outline from the material image, and extracting original position points from the material outline, wherein the original position points include key points and / or feature points of interest in the material outline, and the material outline includes an original outline point set for describing the shape of a target object in the material image; based on the coordinate system of the drawing device and the size of the canvas, the original position points are coordinate-converted and mapped onto the canvas to obtain target position points; based on the target position points, a target outline of the target object is drawn on the canvas.

[0008] Optionally, in the drawing method according to the present invention, the target contour includes multiple target contour points; the method further includes: determining one or more target contour points in the target contour whose bending angle exceeds an angle threshold as jumping points; and adjusting the position of each of the jumping points to adjust the shape of the target contour.

[0009] Optionally, in the drawing method according to the present invention, determining one or more target contour points in the target contour whose bending angles exceed an angle threshold as jumping points includes: traversing each target contour point in the target contour, and for any target contour point, determining the angle between the any target contour point and two adjacent target contour points of the any target contour point as the bending angle corresponding to the any target contour point; if the bending angle corresponding to the any target contour point exceeds the angle threshold, determining the any target contour point as a jumping point; adjusting the position of each jumping point to adjust the shape of the target contour, including: adding a drag point at each jumping point; and adjusting the position of the jumping point corresponding to the drag point in response to an editing operation on each drag point to adjust the shape of the target contour.

[0010] Optionally, in the drawing method according to the present invention, obtaining a material image imported into the drawing device includes: in response to the operation of dragging the material image into the drawing window and releasing the material image, obtaining the material image and loading it into the memory of the computing device; recording the position where the material image is released as the starting position for extracting a material outline from the material image; extracting the material outline from the material image includes: extracting the material outline from the material image based on the starting position.

[0011] Optionally, in the drawing method according to the present invention, extracting the material contour from the material image includes: grayscale processing the material image to obtain a grayscale material image; noise filtering the grayscale material image; edge detection on the grayscale material image after noise filtering to identify edges in the grayscale material image and generate a binary image; extracting the material contour from the binary image.

[0012] Optionally, in the drawing method according to the present invention, edge detection is performed on the grayscale material image after noise filtering, including: using the Canny edge detection algorithm to perform edge detection on the grayscale material image after noise filtering; and the material contour is extracted from the binary image, including: using the findContours function in the OpenCV library to extract the material contour from the binary image.

[0013] Optionally, in the drawing method according to the present invention, extracting original position points from the material outline includes: based on a predetermined sampling rate, extracting multiple original contour points from the original contour point set of the material outline as original position points; based on multiple original coordinate values ​​corresponding to the multiple original contour points, obtaining original position point data and storing them.

[0014] Optionally, in the drawing method according to the present invention, based on the coordinate system of the drawing device and the size of the canvas, the original position point is coordinate-converted and mapped onto the canvas to obtain a target position point, including: determining a scaling factor based on the size of the canvas and the range of the original position point data, the size of the canvas including the canvas width and the canvas height; for each original coordinate value in the original position point data, scaling the original coordinate value proportionally based on the scaling factor to obtain a corresponding target coordinate value; obtaining target position point data based on each target coordinate value corresponding to each original coordinate value; and mapping the target position point data onto the canvas based on the coordinate system of the drawing device to obtain a target position point.

[0015] Optionally, in the drawing method according to the present invention, based on the target position point, the target outline of the target object is drawn on the canvas, including: based on the current context information of the drawing device, determining line color parameters and line thickness parameters; based on the target position point, using drawing lines corresponding to the line color parameters and line thickness parameters to draw the target outline of the target object on the canvas.

[0016] According to one aspect of the present invention, there is provided a drawing device, which is deployed in a computing device, wherein a drawing window of the drawing device has a canvas, and the drawing device comprises: an acquisition module, adapted to acquire a material image imported into the drawing device; an extraction module, adapted to extract a material outline from the material image, and to extract original position points from the material outline, wherein the original position points include key points and / or feature points of interest in the material outline, and the material outline includes an original outline point set for describing the shape of a target object in the material image; a conversion module, adapted to perform coordinate conversion on the original position points based on the coordinate system of the drawing device and the size of the canvas, and then map the original position points onto the canvas to obtain target position points; and a drawing module, adapted to draw a target outline of the target object on the canvas based on the target position points.

[0017] According to one aspect of the present invention, a computing device is provided, comprising: at least one processor; and a memory storing program instructions, wherein the program instructions are configured to be suitable for being executed by the at least one processor, and the program instructions include instructions for executing the drawing method described above.

[0018] According to one aspect of the present invention, a computer program product is provided, comprising a computer program / instruction, wherein the computer program / instruction implements the method as described above when executed by a processor.

[0019] According to one aspect of the present invention, a readable storage medium storing program instructions is provided. When the program instructions are read and executed by a computing device, the computing device executes the drawing method described above.

[0020] According to the technical solution of the present invention, a drawing method and a drawing device are provided. For a material image imported by a user, a material outline is automatically extracted from the material image, and an original position point is extracted from the material outline. Then, based on the coordinate system of the drawing device and the size of the canvas, the original position point is converted into a coordinate and mapped to the canvas to obtain a target position point, and the target outline of the target object can be automatically drawn on the canvas based on the target position point. It can be seen that according to the technical solution of the present invention, it is possible to extract contour features based on the material image imported by the user and automatically draw the drawing. In this way, the user only needs to import the material image to automatically draw the graphics, which improves the drawing efficiency and facilitates the drawing of complex graphics.

[0021] Furthermore, the present invention adds drag points at positions where the bending angle of the target contour changes greatly, thereby facilitating users to dynamically adjust the initially drawn target contour to improve the accuracy of the final drawn graphics, and can further improve the user's drawing and creation efficiency.

[0022] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to achieve the above and related purposes, some illustrative aspects are described herein in conjunction with the following description and accompanying drawings, which indicate various ways in which the principles disclosed herein can be practiced, and all aspects and their equivalents are intended to fall within the scope of the claimed subject matter. By reading the following detailed description in conjunction with the accompanying drawings, the above and other purposes, features and advantages of the present invention will become more apparent. Throughout the present invention, the same reference numerals generally refer to the same parts or elements.

[0024] Figure 1 A schematic diagram of a computing device 100 provided according to an embodiment of the present invention is shown;

[0025] Figure 2 A schematic flow chart of a drawing method 200 provided according to an embodiment of the present invention is shown;

[0026] Figure 3 A schematic diagram showing a method of drawing a target outline on a canvas of a drawing window according to an embodiment of the present invention is shown;

[0027] Figure 4 A schematic diagram showing how to adjust the shape of a target contour according to an embodiment of the present invention is shown;

[0028] Figure 5 A schematic diagram of a drawing device 500 provided according to an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0029] The exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present invention and to enable the scope of the present invention to be fully communicated to those skilled in the art.

[0030] Existing drawing software does not provide the function of drawing based on image features, cannot automatically draw graphics based on imported images, is difficult to draw complex graphics, and is difficult to make secondary adjustments after the graphics are drawn.

[0031] In view of the above technical problems, an embodiment of the present invention proposes a drawing method, which can extract contour features based on a material image imported by a user and automatically draw a drawing, so that the user only needs to import the material image to automatically draw a figure, which improves the drawing efficiency and facilitates the drawing of complex figures. In addition, the present invention can also identify jump points from the initially drawn target contour, and facilitate secondary adjustment of the target contour based on the jump points, which can improve the accuracy of the final drawn figure and improve the user's drawing and creation efficiency.

[0032] The embodiments of the present invention will be described in detail below with reference to the accompanying drawings.

[0033] Figure 1 FIG. 1 is a schematic diagram of a computing device 100 provided according to an embodiment of the present invention. Figure 1 As shown, in a basic configuration, the computing device 100 includes at least one processing unit 102 and a system memory 104. According to one aspect, depending on the configuration and type of the computing device, the processing unit 102 can be implemented as a processor. The system memory 104 includes, but is not limited to, volatile storage (e.g., random access memory), non-volatile storage (e.g., read-only memory), flash memory, or any combination of such memories. According to one aspect, the system memory 104 includes an operating system 105.

[0034] According to one aspect, operating system 105 is suitable for controlling the operation of computing device 100, for example. Furthermore, examples are practiced in conjunction with graphics libraries, other operating systems, or any other application programs, and are not limited to any particular application or system. Figure 1 The basic configuration is shown in FIG. 1 by those components within the dashed lines. According to one aspect, computing device 100 has additional features or functionality. For example, according to one aspect, computing device 100 includes additional data storage devices (removable and / or non-removable), such as magnetic disks, optical disks, or tapes. Such additional storage Figure 1 1 is illustrated by a removable storage device 109 and a non-removable storage device 110.

[0035] As stated above, according to one aspect, a program module 103 is stored in the system memory 104. According to one aspect, the program module 103 may include one or more application programs, and the present invention does not limit the type of application program, for example, the application program may include: email and contact application programs, word processing application programs, spreadsheet application programs, database application programs, slide show application programs, drawing or computer-aided application programs, web browser application programs, etc.

[0036] According to one aspect, the program module 103 may include a plurality of program instructions suitable for executing the drawing method 200 of the present invention, so that the computing device 100 is configured to execute the drawing method 200 of the present invention.

[0037] According to one aspect, the program module 103 may include a drawing device 500 , and the drawing device 500 may be configured to execute the drawing method 200 of the present invention.

[0038] According to one aspect, the examples may be practiced on a circuit comprising discrete electronic components, a packaged or integrated electronic chip containing logic gates, a circuit utilizing a microprocessor, or a single chip containing electronic components or a microprocessor. Figure 1 Each or many components shown in can be integrated into a system on a chip (SOC) on a single integrated circuit to practice examples. According to one aspect, such a SOC device may include one or more processing units, a graphics unit, a communication unit, a system virtualization unit, and various application functions, all of which are integrated (or "burned") into a chip substrate as a single integrated circuit. When operated via SOC, the functions described in this article can be operated via a dedicated logic integrated with other components of the computing device 100 on a single integrated circuit (chip). Embodiments of the present invention can also be practiced using other technologies capable of performing logical operations (such as AND, OR, and NOT), including but not limited to mechanical, optical, fluid, and quantum technologies. In addition, embodiments of the present invention can be practiced in a general-purpose computer or in any other circuit or system.

[0039] According to one aspect, the computing device 100 may also have one or more input devices 112, such as a keyboard, a mouse, a pen, a voice input device, a touch input device, etc. Output devices 114 may also be included, such as a display, a speaker, a printer, etc. The aforementioned devices are examples and other devices may also be used. The computing device 100 may include one or more communication connections 116 that allow communication with other computing devices 118. Examples of suitable communication connections 116 include, but are not limited to: RF transmitter, receiver and / or transceiver circuits; Universal Serial Bus (USB), parallel and / or serial ports.

[0040] The term computer-readable medium as used herein includes computer storage media. Computer storage media may include volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (e.g., computer-readable instructions, data structures, or program modules 103). System memory 104, removable storage device 109, and non-removable storage device 110 are all examples of computer storage media (i.e., memory storage). Computer storage media may include random access memory (RAM), read-only memory (ROM), electrically erasable read-only memory (EEPROM), flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical storage, cassettes, tapes, disk storage or other magnetic storage devices, or any other products that can be used to store information and can be accessed by computing device 100. According to one aspect, any such computer storage medium can be a part of computing device 100. Computer storage media do not include carrier waves or other propagated data signals.

[0041] According to one aspect, communication media is implemented by computer readable instructions, data structures, program modules 103, or other data in a modulated data signal (e.g., a carrier wave or other transport mechanism), and includes any information delivery media. According to one aspect, the term "modulated data signal" describes a signal that has one or more characteristics set or changed in such a manner as to encode information in the signal. By way of example and not limitation, communication media includes wired media such as a wired network or direct-wired connection, and wireless media such as acoustic, radio frequency (RF), infrared, and other wireless media.

[0042] In an embodiment according to the present invention, the computing device 100 is configured to execute the drawing method 200 of the present invention. The computing device 100 includes one or more processors and one or more readable storage media storing program instructions. When the program instructions are configured to be executed by one or more processors, the computing device executes the drawing method 200 in the embodiment of the present invention.

[0043] In an embodiment according to the present invention, a drawing device 500 is deployed in the computing device 100, and the drawing device 500 can run on the operating system of the computing device 100, and the drawing device 500 is suitable for executing the drawing method 200 of the present invention. By executing the drawing method 200 of the present invention, contour features can be extracted based on the material image imported by the user and drawing can be performed automatically.

[0044] Figure 2The flowchart of a drawing method 200 provided according to an embodiment of the present invention is shown. The drawing method 200 can be executed in a drawing device 500 of a computing device (eg, the aforementioned computing device 100).

[0045] It should be noted that after the drawing device 500 is started, a drawing window of the drawing device 500 may be displayed on the display of the computing device 100. The drawing window has a canvas for drawing graphics.

[0046] like Figure 2 As shown, the drawing method 200 includes the following steps 210-240.

[0047] In step 210 , the drawing device 500 of the computing device may obtain a material image imported into the drawing device 500 by a user.

[0048] In step 220 , the drawing device 500 of the computing device may extract a material outline from the material image, and extract an original position point from the material outline.

[0049] It should be noted that the original position points include key points and / or interesting feature points in the material contour. The material contour includes an original contour point set (or polygon set), and the material contour is used to describe the shape of the target object in the material image.

[0050] In step 230, the drawing device 500 of the computing device may perform coordinate conversion on the original position point based on the coordinate system of the drawing device 500 and the size of the canvas and then map it onto the canvas to obtain the target position point. In this way, the position point can be correctly positioned on the canvas.

[0051] In step 240 , the drawing device 500 of the computing device may draw a target outline of the target object on the canvas based on the target position point. Figure 3 A schematic diagram showing drawing a target outline on a canvas of a drawing window according to an embodiment of the present invention is shown.

[0052] It can be seen that the drawing method 200 provided according to the embodiment of the present invention can extract contour features based on the material image imported by the user and automatically draw the drawing. In this way, the user only needs to import the material image to automatically draw the graphics, which improves the drawing efficiency and facilitates the drawing of complex graphics.

[0053] In addition, in some embodiments, after the target outline of the target object is drawn on the canvas, the shape of the target outline may be dynamically adjusted. Figure 4 A schematic diagram showing the adjustment of the shape of the target contour according to an embodiment of the present invention is shown.

[0054] It should be noted that the target contour includes a plurality of target contour points. After the drawing device 500 of the computing device draws the target contour of the target object on the canvas, it can determine one or more target contour points in the target contour whose bending angle exceeds the angle threshold, and use the one or more target contour points in the target contour whose bending angle exceeds the angle threshold as jumping points. Furthermore, by adjusting the positions of each jumping point, the shape of the target contour can be conveniently adjusted. In this way, it is convenient for the user to perform secondary editing on the initially drawn graphics (target contour) to improve the accuracy of the final drawn graphics, and it can improve the user's drawing and creation efficiency.

[0055] In some embodiments, the drawing device 500 of the computing device can determine one or more target contour points in the target contour whose bending angle exceeds the angle threshold in the following manner: traverse each target contour point in the target contour, and for any target contour point, determine the angle between the any target contour point and two adjacent target contour points of the any target contour point, and use the angle as the bending angle corresponding to the any target contour point. If the bending angle corresponding to any target contour point exceeds the angle threshold, it means that the position of the any target contour point is the position where the bending angle of the target contour changes greatly, so that the any target contour point can be determined as a jump point. It should be noted that in the embodiments of the present invention, the angle threshold can be set by those skilled in the art according to actual needs, and the present invention does not limit the specific value of the angle threshold.

[0056] In addition, if Figure 4 As shown, the position of each jumping point can be adjusted in the following manner: the drawing device 500 of the computing device can add a corresponding drag point ( Figure 4 The user may then edit each drag point; the drawing device 500 of the computing device may adjust the position of the jump point corresponding to each drag point in response to the user's editing operation on each drag point, thereby adjusting the shape of the target outline.

[0057] Based on this, by adding drag points at positions where the bending angle of the target contour changes greatly, it is convenient for users to dynamically adjust the initially drawn target contour to improve the accuracy of the final drawn graphics, and can improve the user's drawing and creation efficiency.

[0058] In some embodiments, the drawing device 500 of the computing device may calculate the angle between any target contour point and two adjacent target contour points of the target contour point (the bending angle corresponding to any target contour point) by using vector operations or trigonometric functions.

[0059] For example, the target contour includes the following target contour points: P1 (x1, y1), P2 (x2, y2), P3 (x3, y3), P2 can be used as any target contour point whose angle (bending angle) is to be calculated, and P1 and P3 are two adjacent target contour points of P2. The angle between P2 and P1 and P3 can be calculated in the following way: First, two vectors are determined by calculating the coordinate interpolation of P2 and P1 and P3 respectively: v1 = (x2-x1, y2-y1) and v2 = (x3-x2, y3-y2). Then, the arccosine function can be used to calculate the angle between the two vectors. Specifically, the angle between the two vectors is calculated by the following formula: angle = arccos((v1·v2) / (|v1|*|v2|. In the formula, · represents the dot product operation, and |v1| and |v2| represent the moduli of the two vectors. The calculated angle between the two vectors is the angle between P2 and P1 and P3, that is, the bending angle corresponding to P1.

[0060] In some embodiments, the user can import the material image into the drawing device 500 by dragging the material image into the drawing window of the drawing device 500. Accordingly, in step 210, the drawing device 500 of the computing device can obtain the material image imported into the drawing device 500 by the user in the following manner: in response to the user dragging the material image into the drawing window and releasing the material image, the material image is obtained, and the material image can be loaded into the memory of the computing device so as to perform subsequent processing operations on the material image.

[0061] In addition, the drawing device 500 of the computing device may also record the position where the user releases the material image in the drawing window (eg, the position where the mouse is released), and use the position where the material image is released as the starting position for extracting the material outline from the material image.

[0062] In step 220 , the drawing device 500 of the computing device may extract a material outline from the material image based on the above starting position.

[0063] In some embodiments, in step 220 , the drawing device 500 of the computing device extracts the material outline from the material image in the following specific manner.

[0064] First, the material image may be grayed to obtain a gray material image. Here, the graying of the material image may be achieved by weighted averaging the values ​​of the RGB color channels of the material image.

[0065] Subsequently, the grayscale material image may be subjected to noise filtering. Specifically, before edge detection, the grayscale material image may be subjected to noise filtering by Gaussian filtering to reduce the influence of noise on the edge detection result.

[0066] Afterwards, edge detection may be performed on the grayscale material image after noise filtering to identify edges in the grayscale material image and generate a binary image. In the binary image, edge pixel values ​​are white, and non-edge pixel values ​​are black. In some embodiments, the drawing device 500 of the computing device may use the Canny edge detection algorithm to perform edge detection on the grayscale material image after noise filtering to identify edges in the grayscale material image and generate a binary image.

[0067] Finally, the contour extraction algorithm can be used to extract the material contour from the binary image. In a specific embodiment, the drawing device 500 of the computing device can use the findContours function in the OpenCV library to extract the material contour from the binary image. It should be noted that OpenCV, the full name of which is Open Source Computer Vision Library, is a cross-platform computer vision and machine learning software library.

[0068] In some embodiments, in step 220, the drawing device 500 of the computing device may extract the original position points from the material outline in the following manner: based on a predetermined sampling rate, extract multiple original contour points from the original contour point set of the material outline as the original position points. Furthermore, the original position point data may be obtained based on multiple original coordinate values ​​corresponding to the multiple original contour points, and the original position point data may be stored.

[0069] It should be understood that the original position point data may be used to represent a plurality of original coordinate values ​​corresponding to a plurality of original contour points extracted from an original contour point set of the material contour.

[0070] Further, the drawing device 500 of the computing device can generate an original coordinate set list based on the multiple original coordinate values ​​corresponding to the multiple original contour points, and use the original coordinate set list as the original position point data. In some embodiments, the original position point data can be stored in a container as input data for the next step (step 230).

[0071] In some embodiments, in step 230 , the drawing device 500 of the computing device may perform coordinate conversion on the original position point in the following manner.

[0072] First, the coordinate system of the drawing device 500 may be determined, and the size of the canvas (including the canvas width and the canvas height) may be obtained. The coordinate system of the drawing device 500 may be, for example, a Cartesian coordinate system.

[0073] Then, the scaling factor may be determined based on the size of the canvas and the range of the original position point data (the actual data range before coordinate conversion).

[0074] Next, for each original coordinate value in the original position point data, the original coordinate value can be scaled proportionally based on the scaling factor to obtain the target coordinate value corresponding to the original coordinate value. Based on each target coordinate value corresponding to each original coordinate value, the target position point data (i.e., the scaled position point data) can be obtained. For example, if the width and height of the canvas are twice the range of the original position point data, respectively, the scaling factor can be determined to be 0.5, so that each original coordinate value in the original position point data can be multiplied by 0.5 to achieve proportional scaling of the original coordinate value.

[0075] Finally, the target location point data can be mapped onto the canvas based on the coordinate system (eg, Cartesian coordinate system) of the drawing device 500 to obtain the target location point. The origin of the target location point data (corresponding to the point at the starting position) can be mapped onto the origin of the canvas.

[0076] In some embodiments, in step 240, the drawing device 500 of the computing device draws the target outline of the target object on the canvas in the following specific manner: determine the line color parameter and the line thickness parameter based on the current context information of the drawing device 500. Then, based on the target position point, the target outline of the target object can be drawn on the canvas using the drawing line corresponding to the line color parameter and the line thickness parameter.

[0077] Figure 5 A schematic diagram of a drawing device 500 provided according to an embodiment of the present invention is shown. The drawing device 500 may be deployed in a computing device 100, and the drawing device 500 is configured to execute the drawing method 200 of the present invention.

[0078] It should be noted that after the drawing device 500 is started, a drawing window of the drawing device 500 may be displayed on the display of the computing device 100. The drawing window has a canvas for drawing graphics.

[0079] like Figure 5 As shown, in an embodiment of the present invention, the drawing device 500 includes an acquisition module 510, an extraction module 520, a conversion module 530 and a drawing module 540 which are sequentially communicatively connected.

[0080] The acquisition module 510 is used to acquire the material image imported into the drawing device.

[0081] The extraction module 520 is used to extract the material contour from the material image and extract the original position points from the material contour, wherein the original position points include key points and / or feature points of interest in the material contour, and the material contour includes a set of original contour points for describing the shape of the target object in the material image.

[0082] The conversion module 530 is used to perform coordinate conversion on the original position point based on the coordinate system of the drawing device and the size of the canvas, and then map the original position point onto the canvas to obtain the target position point.

[0083] The drawing module 540 is used to draw the target outline of the target object on the canvas based on the target position point.

[0084] It should be noted that the acquisition module 510, extraction module 520, conversion module 530 and drawing module 540 are respectively used to execute the aforementioned steps 210 to 240. Here, the specific execution logic of each module can be found in the description of steps 210 to 240 in the above method 200, which will not be repeated here.

[0085] According to the drawing method 200 in the embodiment of the present invention, for the material image imported by the user, the material contour is automatically extracted from the material image, and the original position point is extracted from the material contour. Then, based on the coordinate system of the drawing device and the size of the canvas, the original position point is converted into a coordinate and mapped to the canvas to obtain the target position point, and the target contour of the target object can be automatically drawn on the canvas based on the target position point. It can be seen that according to the technical solution of the present invention, the contour features can be extracted based on the material image imported by the user and the drawing can be automatically performed. In this way, the user only needs to import the material image to automatically draw the graphics, which improves the drawing efficiency and facilitates the drawing of complex graphics.

[0086] Furthermore, the present invention adds drag points at positions where the bending angle of the target contour changes greatly, thereby facilitating users to dynamically adjust the initially drawn target contour to improve the accuracy of the final drawn graphics, and can further improve the user's drawing and creation efficiency.

[0087] The various techniques described herein may be implemented in combination with hardware or software, or a combination thereof. Thus, the method and apparatus of the present invention, or some aspects or parts of the method and apparatus of the present invention may be in the form of program codes (i.e., instructions) embedded in a tangible medium, such as a removable hard disk, a USB flash drive, a floppy disk, a CD-ROM, or any other machine-readable storage medium, wherein when the program is loaded into a machine such as a computer and executed by the machine, the machine becomes a device for practicing the present invention.

[0088] In the case where the program code is executed on a programmable computer, the mobile terminal generally includes a processor, a storage medium readable by the processor (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device. The memory is configured to store the program code; the processor is configured to execute the drawing method of the present invention according to the instructions in the program code stored in the memory.

[0089] By way of example and not limitation, readable media include readable storage media and communication media. Readable storage media stores information such as computer readable instructions, data structures, program modules or other data. Communication media generally embody computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transmission mechanism, and include any information transfer medium. Any combination of the above is also included within the scope of readable media.

[0090] In the description provided herein, algorithms and displays are not inherently related to any particular computer, virtual system or other device. Various general purpose systems can also be used together with the examples of the present invention. According to the above description, it is obvious that the structure required for constructing such systems. In addition, the present invention is not directed to any specific programming language either. It should be understood that various programming languages ​​can be utilized to implement the content of the present invention described herein, and the above description of specific languages ​​is for the purpose of disclosing the best mode of the present invention.

[0091] In the description provided herein, a large number of specific details are described. However, it is understood that embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.

[0092] Similarly, it should be understood that in order to streamline the present disclosure and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of the present invention, various features of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof.

[0093] Those skilled in the art will appreciate that the modules or units or components of the devices in the examples disclosed herein may be arranged in the devices described in the embodiment, or alternatively may be located in one or more devices different from the devices in the examples. The modules in the foregoing examples may be combined into one module or may be divided into multiple submodules.

[0094] Unless otherwise specified, the use of ordinal numbers "first", "second", "third", etc. to describe common objects merely indicates that different instances of similar objects are involved and is not intended to imply that the objects so described must have a given order in time, space, order or in any other manner.

Claims

1. A drawing method, executed in a drawing device of a computing device, wherein a drawing window of the drawing device has a canvas, wherein the method include: Acquire a material image imported into the drawing device; Extracting a material contour from the material image, and extracting original position points from the material contour, wherein the original position points include key points and / or interesting feature points in the material contour, and the material contour includes an original contour point set for describing the shape of the target object in the material image; Based on the coordinate system of the drawing device and the size of the canvas, the original position point is converted into coordinates and then mapped onto the canvas to obtain a target position point; Based on the target position point, a target outline of the target object is drawn on the canvas.

2. The method according to claim 1, in, The target contour includes a plurality of target contour points; the method further includes: Determine one or more target contour points in the target contour whose bending angle exceeds an angle threshold as jumping points; The positions of the various jumping points are adjusted so as to adjust the shape of the target contour.

3. The method according to claim 2, in, Determining one or more target contour points in the target contour whose bending angle exceeds an angle threshold as jumping points includes: Traversing each target contour point in the target contour, for any target contour point, determining an angle between the any target contour point and two adjacent target contour points of the any target contour point as a bending angle corresponding to the any target contour point; If the bending angle corresponding to any target contour point exceeds the angle threshold, determining any target contour point as a jump point; Adjusting the position of each of the jump points so as to adjust the shape of the target contour includes: Adding a drag point at each of the jumping points; In response to the editing operation on each of the drag points, the position of the jump point corresponding to the drag point is adjusted so as to adjust the shape of the target outline.

4. The method according to any one of claims 1 to 3, in, Acquiring a material image imported into the drawing device, comprising: In response to an operation of dragging a material image into the drawing window and releasing the material image, acquiring the material image and loading it into a memory of the computing device; Recording the position where the material image is released as the starting position for extracting the material outline from the material image; Extracting a material outline from the material image includes: Based on the starting position, a material outline is extracted from the material image.

5. The method according to any one of claims 1 to 4, in, Extracting a material outline from the material image includes: grayscale the material image to obtain a grayscale material image; Performing noise filtering on the grayscale material image; Performing edge detection on the grayscale material image after noise filtering to identify edges in the grayscale material image and generate a binary image; A material contour is extracted from the binary image.

6. The method according to claim 5, in, Perform edge detection on the grayscale material image after noise filtering, including: Use the Canny edge detection algorithm to perform edge detection on the grayscale material image after noise filtering; Extracting a material contour from the binary image includes: The findContours function in the OpenCV library is used to extract the material contour from the binary image.

7. The method according to any one of claims 1 to 6, in, Extracting the original position point from the material outline includes: Based on a predetermined sampling rate, extracting a plurality of original contour points from the original contour point set of the material contour as original position points; Based on the multiple original coordinate values ​​corresponding to the multiple original contour points, original position point data is obtained and stored.

8. The method according to claim 7, in, Based on the coordinate system of the drawing device and the size of the canvas, the original position point is converted into coordinates and then mapped onto the canvas to obtain a target position point, including: Determining a scaling factor based on the size of the canvas and the range of the original position point data, wherein the size of the canvas includes a canvas width and a canvas height; For each original coordinate value in the original position point data, scaling the original coordinate value in equal proportion based on the scaling factor to obtain a corresponding target coordinate value; Based on each target coordinate value corresponding to each original coordinate value, obtaining target position point data; Based on the coordinate system of the drawing device, the target position point data is mapped onto the canvas to obtain the target position point.

9. The method according to any one of claims 1 to 8, in, Drawing a target outline of the target object on the canvas based on the target position point includes: Determining line color parameters and line thickness parameters based on current context information of the drawing device; Based on the target position point, a target outline of the target object is drawn on the canvas using a drawing line corresponding to the line color parameter and the line thickness parameter.

10. A drawing device, deployed in a computing device, wherein a drawing window of the drawing device has a canvas, and the drawing device include: An acquisition module, adapted to acquire a material image imported into the drawing device; an extraction module, adapted to extract a material contour from the material image, and extract original position points from the material contour, wherein the original position points include key points and / or interesting feature points in the material contour, and the material contour includes an original contour point set for describing the shape of the target object in the material image; A conversion module, adapted to perform coordinate conversion on the original position point based on the coordinate system of the drawing device and the size of the canvas, and then map the original position point onto the canvas to obtain a target position point; The drawing module is adapted to draw a target outline of the target object on the canvas based on the target position point.

11. A computing device, include: at least one processor; and A memory storing program instructions, wherein the program instructions are configured to be processed by the at least one processor, and the program instructions include instructions for processing the method according to any one of claims 1 to 9.

12. A computer program product comprising a computer program / instructions, in, When the computer program / instructions are executed by a processor, the method according to any one of claims 1 to 9 is implemented.

13. A readable storage medium storing program instructions, which, when read and processed by a computing device, enables the computing device to process the method according to any one of claims 1 to 9.

Citation Information

Cited By

  • Identification drawing system of outdoor pattern customization robot and drawing method thereof

    CN121414862A