CN110969674A - Method and device for generating winding drawing, terminal equipment and readable storage medium - Google Patents
Method and device for generating winding drawing, terminal equipment and readable storage medium Download PDFInfo
- Publication number
- CN110969674A CN110969674A CN201911122307.8A CN201911122307A CN110969674A CN 110969674 A CN110969674 A CN 110969674A CN 201911122307 A CN201911122307 A CN 201911122307A CN 110969674 A CN110969674 A CN 110969674A
- Authority
- CN
- China
- Prior art keywords
- path
- image
- points
- sub
- generating
- 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.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T11/00—2D [Two Dimensional] image generation
- G06T11/001—Texturing; Colouring; Generation of texture or colour
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T11/00—2D [Two Dimensional] image generation
- G06T11/20—Drawing from basic elements, e.g. lines or circles
- G06T11/203—Drawing of straight lines or curves
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/13—Edge detection
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Image Generation (AREA)
Abstract
The invention discloses a method, a device, terminal equipment and a readable storage medium for generating a winding picture, wherein the method comprises the following steps: acquiring an original image and extracting an image edge; setting a plurality of dividing points on the image edge, selecting any one dividing point as a starting point, and then generating a total drawing path; and drawing the painting corresponding to the original image according to the division points and the total painting path. By implementing the embodiment of the invention, the painting works with the effect of the winding painting can be drawn, and the problem that the display effect of the painting works generated by the existing automatic painting is single is solved.
Description
Technical Field
The invention relates to the technical field of automatic drawing, in particular to a method and a device for generating a winding picture, a terminal device and a readable storage medium.
Background
The winding picture is an art drawing picture with yarns wound on nails, compared with a plane drawing picture, the effect of the drawing picture is customized at will, different personalities can be wound on the same element, the layering sense of line superposition is high, and the winding picture is deeply favored by users.
In the existing automatic painting technology, an automatic painting device generally receives an original image, and a painting work which is the same as the original image is painted on a painting carrier such as a painting paper according to the original image, so that the finally generated painting work has a single display effect.
Disclosure of Invention
The embodiment of the invention provides a method and a device for generating a winding picture, terminal equipment and a readable storage medium, which can be used for drawing a painting with the effect of the winding picture and solving the problem that the existing painting generated by automatic painting has single display effect.
An embodiment of the present invention provides a method for generating a winding drawing, including:
acquiring an original image, and then extracting an image edge of the original image;
setting a plurality of dividing points on the image edge, selecting any one of the dividing points as a starting point, and then generating a total drawing path according to the following steps:
step S1, connecting the initial point with the other division points one by one to obtain a plurality of connecting line segments;
step S2, taking the connecting line segment containing the most image main pixel points as a drawing sub-path, and then adjusting the gray value of the image main pixel points in the drawing sub-path to 255; the image main pixel points are pixel points with the gray value not being 255;
and step S3, taking the end point of the drawing sub-path as a new starting point, and repeatedly executing the step S1 and the step S2 until all areas covered by the pairwise connecting lines among the division points are traversed, so as to obtain a plurality of drawing sub-paths.
Step S4, connecting all the drawing sub paths in sequence according to the sequence of path generation to obtain the total drawing path;
and drawing the painting works corresponding to the original images on a painting carrier according to the division points and the total painting path.
Further, the extracting the image edge of the original image specifically includes: and extracting the image edge of the original image through a Soble edge detection algorithm.
Further, before the extracting the image edge of the original image, the method further includes: and carrying out gray level processing on the original image, then carrying out equal scaling on the processed original image, and storing the scaled original image in a grid with the same size as the drawing area of the drawing carrier so as to enable the original image and the drawing carrier to form a corresponding mapping relation.
Further, the setting of the plurality of division points on the image edge specifically includes:
and calculating the perimeter of the image edge, equally dividing the perimeter of the image edge into a plurality of sub-line segments, and taking the division point of each sub-line segment as the division point.
Further, the drawing a pictorial work corresponding to the original image on a drawing carrier according to each of the division points and the total drawing path specifically includes:
drawing each division point on the drawing carrier according to the mapping relation between the original drawing and the drawing carrier to obtain a plurality of drawing points;
and connecting the drawing points according to the total drawing path to obtain the drawing.
On the basis of the above method item embodiments, the present invention correspondingly provides apparatus item embodiments;
the embodiment of the invention provides a device for generating a winding picture, which comprises an image edge extraction module, a drawing path generation module and a drawing module, wherein the image edge extraction module is used for extracting an image edge; the drawing path generation module includes: a connection line segment generating unit, a drawing sub path generating unit, a cycle executing unit and a total path generating unit;
the image edge extraction module is used for acquiring an original image and then extracting the image edge of the original image;
the drawing path generating module is used for setting a plurality of dividing points on the image edge, selecting any one of the dividing points as a starting point, and then generating a total drawing path according to a plurality of units;
the connecting line segment generating unit is used for connecting the starting point with the other dividing points one by one to obtain a plurality of connecting line segments;
the drawing sub-path generating unit is used for taking a connecting line segment containing the most image main pixel points as a drawing sub-path, and then adjusting the gray value of the image main pixel points in the drawing sub-path to 255; the image main pixel points are pixel points with the gray value not being 255;
the circular execution unit is used for taking the end point of the drawing sub-path as a new starting point, controlling the connecting line segment generation unit and the drawing sub-path generation unit to repeatedly execute respective functions until all regions covered by pairwise connecting lines between the division points are traversed, and obtaining a plurality of drawing sub-paths;
the total path generating unit is used for sequentially connecting all the drawing sub-paths according to the sequence of path generation to obtain the total drawing path;
and the drawing module is used for drawing the painting works corresponding to the original images on a painting carrier according to the division points and the total painting path.
On the basis of the embodiment of the method item, the invention correspondingly provides an embodiment of the terminal equipment item;
another embodiment of the present invention provides a terminal device, which includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, and the processor executes the computer program to implement the method for generating a wire drawing according to any one of the method embodiments of the present invention.
On the basis of the above method item embodiments, the present invention correspondingly provides storage medium item embodiments;
another embodiment of the present invention provides a readable storage medium, which includes a stored computer program, where when the computer program runs, the computer program controls an apparatus on which the computer readable storage medium is located to execute the method for generating a wire-winding drawing according to any one of the method embodiments of the present invention.
The invention has the following beneficial effects:
the embodiment of the invention provides a method, a device, a terminal device and a readable storage medium for generating a winding picture, wherein the method comprises the steps of firstly obtaining an original image and extracting an image edge, then dividing the image edge to obtain a plurality of division points, taking any division point as a starting point, then connecting the starting point with other division points one by one to obtain a connecting line segment, then selecting the connecting line segment containing most image main body pixel points from the plurality of connecting line segments to be used as a drawing sub-path, adjusting the gray values of all the image main body pixel points in the sub-path to be 255, then taking the end point of the drawing sub-path as a new starting point, then connecting the new starting point with other division points, repeatedly executing subsequent steps to obtain a plurality of subsequent drawing sub-paths, and stopping the repeatedly executed process until the gray values of all the pixel points in the original image are 255, then, all the sub paths are connected in sequence according to the generated sequence to obtain a total drawing path; and finally, drawing the painting works corresponding to the original images on the painting carriers according to the total painting paths and the division points to generate the painting works with the winding painting display effect, so that the problem that the existing automatic painting method can only generate the painting works consistent with the original images and the display effect of the painting works is single is solved.
Drawings
Fig. 1 is a schematic flow chart of a method for generating a wire winding drawing according to an embodiment of the present invention.
FIG. 2 is a schematic diagram illustrating the effect of a pictorial representation generated by a method of generating a wire-wound painting according to an embodiment of the present invention.
FIG. 3 is a schematic diagram illustrating another effect of a pictorial representation generated by a method of generating a wire-wound painting according to an embodiment of the present invention.
Fig. 4 is a schematic structural diagram of an apparatus for generating a winding drawing according to an embodiment of the present invention.
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.
As shown in fig. 1, a flow chart of a method for generating a winding drawing according to an embodiment of the present invention includes the following steps:
a, acquiring an original image, and then extracting the image edge of the original image;
b, setting a plurality of dividing points on the image edge, selecting any one of the dividing points as a starting point, and then generating a total drawing path:
and C, drawing the painting works corresponding to the original images on a painting carrier according to the division points and the total painting path.
For the step a, specifically, an image to be drawn uploaded by a user may be received as an original image, and of course, a pre-stored image may also be called from a system database as the original image, and then an image edge of the original image is extracted. Specifically, before the image edge of the original image is extracted, the method further includes performing gray processing on the original image, then performing equal scaling on the processed original image, and storing the scaled original image in a grid with the same size as the drawing area of the drawing carrier, so that the original image and the drawing carrier form a corresponding mapping relationship. It should be noted that the grid herein refers to a grid generated and displayed by a terminal device, for example, a computer, and this step can be understood as covering the scaled original image in the grid, and since the size of the grid is the same as the size of the drawing area of the drawing carrier, according to the position of each pixel point in the original image in the grid, the position of each pixel point in the original image in the drawing carrier, specifically the row of the grid, as the abscissa, and the column of the grid as the ordinate, can be mapped, and the coordinates of each pixel point in the scaled image to which the storage grid belongs are obtained; based on the coordinates, finding out corresponding points matched with the drawing area of the drawing carrier, and forming a binding relationship between the corresponding points and the drawing area. The original image and the drawing carrier form a corresponding mapping relationship, which means that the positions of all pixel points in the original image are mapped in the drawing carrier. The preferable painting carrier can be but is not limited to painting paper;
the gray processing is carried out on the original image, the texture characteristic information of the color image cannot be influenced, and each pixel point in the image can be represented by only one gray value, so that the image processing efficiency is greatly improved. The implementation algorithm is not limited, the gray value of each pixel point of the image is calculated by adopting a weighted average method in the embodiment, and the value range is 0-255. The smaller the grayscale value, the darker the color and the more representative the image feature, otherwise the opposite is true.
In a preferred embodiment, whether the edge of the original image is a regular image or an irregular image, the image edge of the original image can be extracted in the following manner;
specifically, the present example employs a cable edge detection algorithm. The algorithm comprises two groups of 3x3 matrixes which respectively represent the transverse direction and the longitudinal direction, and the matrixes and the scaled images are subjected to plane convolution to obtain an approximate value of the brightness difference between the transverse direction and the longitudinal direction; based on the approximate values of the transverse gradient and the longitudinal gradient of each pixel of the processed (namely, planar convolution) image, the gradient size and the gradient direction of each pixel are obtained; if the pixel gradient is larger than a certain threshold value, the pixel is regarded as an edge point. The following is the algorithm's associated formula:
and calculating the brightness difference approximate values of the horizontal direction and the vertical direction of the scaled image through the formula. Wherein A represents a zoom image, GxAnd GyRespectively representing processed images.
By the above formula, the gradient magnitude of each pixel of the processed image is calculated.
By the above formula, the gradient direction of each pixel of the processed image is calculated. If the angle theta is equal to zero, it means that the image has a longitudinal edge there, and is darker to the left and to the right.
According to the method, the edge points of each image of the compressed original image can be identified, then any image edge point is selected as a starting point, all edge pixel points are connected pairwise by lines according to the sequence in a preset direction through a preset marking program, and therefore the image edge of the original image is extracted; the predetermined direction includes, but is not limited to, a clockwise or counterclockwise direction.
In addition, in a preferred embodiment, the original image can be processed, so that the original image has a circular image edge, and finally a circular winding picture can be generated, for the extraction of the edge of the circular image, the specific method is that the original image is marked with a rectangle through a marking program, taking the intersection point of diagonal lines of the rectangular frame as the center of a circle, taking the distance from the center of the circle to any one side of the rectangular frame as a radius, making a circle on the original image, then extracting all pixel points on the circle and in the circle to obtain a circular original image, then the circular original image is subjected to the gray scale processing in the above-described manner, and then the processed original image is subjected to the equal scale scaling, and storing the image in a grid with the same size as the drawing area of the drawing carrier so as to enable the processed original image and the drawing carrier to form a corresponding mapping relation.
And C, calculating the perimeter of the image edge specifically in the step B, equally dividing the perimeter of the image edge into a plurality of sub-line segments, and taking the division point of each sub-line segment as the division point.
The perimeter of the image edge is firstly calculated, then the number of segments needing to be divided is set, the number of the divided segments can be adjusted according to the complexity of the image, and the more the divided segments are, the more the final formed drawn work effect is accurate. Calculating the length of the sub-line segment of each segment according to the number and the perimeter of the segments to be divided, then dividing to obtain a plurality of division points, and taking the division points as the division points;
for example, if the perimeter of the image edge is 360cm and the number of the set division segments is 200, the length of each segment of the sub-line segment is equal toWherein, a sub-line segment consists of 2 dividing points, namely a starting point and an end point of the sub-line segment; if clockwise, the starting point of the sub-line segment is the terminal point of the adjacent previous sub-line segment, and the terminal point of the sub-line segment is the starting point of the adjacent next sub-line segment. Then any division point is taken as a starting point, and then the total drawing path is generated.
The following is a detailed description of how to generate the total drawing path:
in a preferred embodiment, the generation of the graphical total path comprises the steps of:
step S1, connecting the initial point with the other division points one by one to obtain a plurality of connecting line segments;
step S2, taking the connecting line segment containing the most image main pixel points as a drawing sub-path, and then adjusting the gray value of the image main pixel points in the drawing sub-path to 255; the image main pixel points are pixel points with the gray value not being 255;
and step S3, taking the end point of the drawing sub-path as a new starting point, and repeatedly executing the step S1 and the step S2 until all areas covered by the pairwise connecting lines among the division points are traversed, so as to obtain a plurality of drawing sub-paths.
Step S4, connecting all the drawing sub paths in sequence according to the sequence of path generation to obtain the total drawing path;
for step S1, an example is described below, assuming that there are 5 division points in an image, each of which is A, B, C, D, E, assuming that point a is taken as a starting point, the remaining division points are connected one by one, that is, a is connected to B, a is connected to C, a is connected to D, and a is connected to E; obtaining a plurality of connecting line segments, namely a line segment AB, a line segment AC, a line segment AD and a line segment AE;
for step S2, each connection line segment includes a plurality of pixels, and the connection line segment including the most image subject pixels is selected as a drawing sub-path, where the image subject pixels refer to pixels with a gray value of 255, that is, colored pixels, and then the gray values of all image pixels on the drawing sub-path are adjusted to 255; for example, if the line segment AB contains the most image subject pixel points, the line segment AB is used as a drawing sub-path, and then all image subject pixel points in the line segment AB are adjusted to 255, that is, the image subject pixel points become white.
For step S3, still taking the above as an example, assuming that the segment AB is a drawing sub-path generated in step S2, the point a is a starting point, the point B is an end point of the drawing sub-path, at this time, the point B is a new starting point, the division points are connected again according to the method of step S1, and then a plurality of connected segments, i.e., the segment BA, the segment BC, the segment BD, and the segment BE, can BE generated, because the gray values of all image subject pixel points in the segment AB are adjusted to 0 before, when the second determination is performed, the segment AB is equivalent to the absence of any image subject pixel point, and therefore, no image subject pixel point exists in the segment BA, and the segment BA cannot become the drawing sub-path again, assuming that the segment BE includes at most image subject pixel points, i.e., pixel points with gray values not equal to 255, then the segment BE serves as the second drawing sub-path, then, adjusting the gray values of all pixel points belonging to the image main body in the segment BE to 255, then taking the point E as a new starting point, and repeating the processes of the step S1 and the step S2 to obtain a third drawing sub-path and a fourth drawing sub-path … … in sequence; and finally, when all regions covered by the pairwise connecting lines among the division points are traversed completely (namely the image main pixel points of all the connecting line segments are adjusted to be 255.), stopping the circulating process to obtain the plurality of sub-paths.
It should be noted that in the actual wiring operation, there may be cases where there are 4 dividing points A, B, C, D; the connecting lines between every two of the four points are line segments AB respectively; line segment AC, line segment AD, line segment BC, line segment BD and line segment CD; when the drawing sub-path starts, dividing a point bit starting point by any one, such as a point A;
connecting the point A with other division points to obtain a plurality of connecting line segments, namely connecting line segments AB; a connecting line segment AC and a connecting line segment AD; assuming that the number of image main body pixels in the connecting line segment AB is the largest, taking the connecting line segment AB as a first drawing sub-path, and then adjusting all the image main body pixels in the connecting line segment AB to 255;
then, taking B as a starting point to make a connecting line segment with other division points, namely a connecting line segment BC, a connecting line segment BD and a connecting line segment BA (the same line segment as the connecting line segment AB); if the number of image main body pixels in the connecting line segment BC is the largest, taking the connecting line segment BC as a second drawing sub-path, and then adjusting the image main body pixels in the connecting line segment BC to 255;
then, taking C as a starting point to form a connecting line segment with other division points, namely a connecting line segment CD, a connecting line segment CA (the same as the connecting line segment AC) and a connecting line segment CB (the same as the connecting line segment BC); if the number of image main body pixel points in the connecting line segment CD is the largest, taking the connecting line segment CD as a third drawing sub-path, and then adjusting the image main body pixel points in the connecting line segment CD to be 255;
then, a connecting line segment with other division points is made by taking the D as a starting point, namely a connecting line segment DC (the same line segment as the connecting line segment CD), a connecting line segment DA (the same line segment as the connecting line segment AD) and a connecting line segment DB (the same line segment as the connecting line segment BD); if the image main pixel points in the connecting line segment DA are the most, taking the connecting line segment DC as a fourth drawing sub-path, and then adjusting the image main pixel points in the connecting line segment DA to 255;
then, taking A as a starting point to make a connecting line segment with other division points, namely a connecting line segment AB, a connecting line segment AC and a connecting line segment AD; if the image main body pixel points in the connecting line segment AC are the most, taking the connecting line segment AC as a fifth drawing sub-path, and then adjusting the image main body pixel points in the connecting line segment AC to be 255;
then, the starting point is changed back to point C, but at this time, in the step of extracting the sub-path, the gray values of the image main pixel points in the connecting line segments CA, CB, CD are all adjusted to 255 (the rule that the connecting line segment containing the most image main pixel points is used as the drawing sub-path is failed at this time), it is indicated that no image main pixel point exists in the three line segments at this time, but the cycle end condition is that "all traversal of the area covered by the two-to-two connecting lines between the dividing points is completed", and in the above step, the image main pixel point of one line segment BD is not adjusted to 255, i.e., no traversal exists, and then the starting point is directly converted into point B or point D at this time, and the line segment BD is extracted as the sixth sub-path.
It should be noted that in step S1, the starting points are connected with the remaining dividing points one by one to obtain a plurality of connecting line segments, where the connection may be understood as an actual connecting line generated by a calibration procedure for connection, or may be understood as a virtual connection, that is, a pre-connection has no actual connection, but stores a corresponding connection relationship.
And step S4, the drawing sub paths generated in the steps are sequentially connected according to the sequence of the generation of the drawing sub paths, and a total drawing path is obtained. For example, if the first drawing sub-path generated by the above steps is line segment AB, the second drawing sub-path is line segment BE, the third drawing sub-path is line segment ED, and the fourth drawing sub-path is line segment DC, the finally formed total drawing path is A-B-E-D-C, and thus the drawing path is a drawing path.
For step C, in a preferred embodiment, drawing each of the division points on the drawing carrier according to a mapping relationship between the original drawing and the drawing carrier to obtain a plurality of drawing points; and connecting the drawing points according to the total drawing path to obtain the drawing.
Specifically, in a preferred embodiment, according to the mapping relationship, each division point in the original image is drawn in the drawing area of the drawing carrier through a painting brush, then according to the total drawing path, the painting brush is controlled to replace the winding action to draw the original image on the drawing paper, the whole drawing process is uninterrupted, a stroke is generated, and finally a drawn work with the effect of winding the painting is generated; finished product effect diagrams of pictorial representations as shown in fig. 2 and 3, fig. 2 illustrates the effect of demonstrating a pictorial representation with irregular image edges, and fig. 3 illustrates the effect of demonstrating a pictorial representation with rounded image edges.
The method for generating a winding drawing according to any one of the above method embodiments may be packaged in a processor of an existing automatic drawing apparatus, for example, a processor of a drawing robot, so as to provide a function of drawing a drawing having a winding drawing effect.
Correspondingly, an embodiment of the apparatus item is provided on the basis of the embodiment of the method item;
as shown in fig. 4, another embodiment of the present invention provides an apparatus for generating a winding picture, including an image edge extracting module, a drawing path generating module, and a drawing module; the drawing path generation module includes: a connection line segment generating unit, a drawing sub path generating unit, a cycle executing unit and a total path generating unit;
the image edge extraction module is used for acquiring an original image and then extracting the image edge of the original image;
the drawing path generating module is used for setting a plurality of dividing points on the image edge, selecting any one of the dividing points as a starting point, and then generating a total drawing path according to a plurality of units;
the connecting line segment generating unit is used for connecting the starting point with the other dividing points one by one to obtain a plurality of connecting line segments;
the drawing sub-path generating unit is used for taking a connecting line segment containing the most image main pixel points as a drawing sub-path, and then adjusting the gray value of the image main pixel points in the drawing sub-path to 255; the image main pixel points are pixel points with the gray value not being 255;
the circular execution unit is used for taking the end point of the drawing sub-path as a new starting point, controlling the connecting line segment generation unit and the drawing sub-path generation unit to repeatedly execute respective functions until all areas covered by two connecting lines between the division points are traversed, and obtaining a plurality of drawing sub-paths;
the total path generating unit is used for sequentially connecting all the drawing sub-paths according to the sequence of path generation to obtain the total drawing path;
and the drawing module is used for drawing the painting works corresponding to the original images on a painting carrier according to the division points and the total painting path. It is to be understood that the above-mentioned embodiments of the apparatus correspond to the embodiments of the method of the present invention, and the method for generating the winding drawing provided by any one of the above-mentioned embodiments of the method of the present invention can be implemented.
It should be noted that the above-described device embodiments are merely illustrative, where the units/modules described as separate parts may or may not be physically separate, and the parts displayed as units/modules may or may not be physical units/modules, may be located in one place, or may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. In addition, in the drawings of the embodiment of the apparatus provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between them, and may be specifically implemented as one or more communication buses or signal lines. One of ordinary skill in the art can understand and implement it without inventive effort. The schematic diagram is merely an example of a device for generating a wire drawing and does not constitute a limitation of the device for generating a wire drawing, and may include more or less components than those shown, or some components in combination, or different components,
on the basis of the foregoing method item embodiments, correspondingly provided terminal device item embodiments are provided, and an embodiment of the present invention provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, where the processor, when executing the computer program, implements the method for generating a wire drawing according to any one of the foregoing method item embodiments of the present invention.
The terminal device can be a desktop computer, a notebook, a palm computer, a cloud server and other computing devices. The terminal device may include, but is not limited to, a processor, a memory. Those skilled in the art will appreciate that the end device may also include, for example, input output devices, network access devices, buses, and the like.
The Processor may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may be any conventional processor or the like, which is the control center of the terminal device and connects the various parts of the whole terminal device using various interfaces and lines.
The memory may be used for storing the computer programs and/or modules, and the processor may implement various functions of the terminal device by executing or executing the computer programs and/or modules stored in the memory and calling data stored in the memory. The memory may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the cellular phone, and the like. In addition, the memory may include high speed random access memory, and may also include non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), at least one magnetic disk storage device, a Flash memory device, or other volatile solid state storage device.
On the basis of the embodiment of the method item, the embodiment of the readable storage medium item is correspondingly provided;
an embodiment of the present invention provides a readable storage medium, which includes a stored computer program, where when the computer program runs, the apparatus on which the computer readable storage medium is located is controlled to execute the method for generating a winding drawing according to any one of the above method embodiments of the present invention.
(storage medium item) wherein the means/terminal device integrated module/unit for generating a wire drawing, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on such understanding, all or part of the flow of the method according to the embodiments of the present invention may also be implemented by a computer program, which may be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method embodiments may be implemented. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like.
The embodiment of the invention can generate the painting with the winding painting display effect, solves the problems that the prior art can only automatically draw the image with the same effect as the original image and the display effect of the painting is too single, and is a craft painting with yarns wound on nails. The winding painting in the market has the following defects: 1) the craft work is bulky and inconvenient to carry; 2) the manufacturing involves woolen yarns, picture frames, nails and the like, the tools are complex, and the cost is high; 3) the winding device has limited technology, and at present, only the winding picture with round image edges can be realized, the drawing category is restricted, and the product style is single. The embodiment of the invention combines the plane drawing and the winding drawing, not only integrates the advantages of the plane drawing and the winding drawing, but also solves the defects of the plane drawing and the winding drawing, realizes one stroke of the image as a bright point by using one uninterrupted line segment, is rich in originality, and achieves the effects of convenient carrying, simple manufacture, strong picture expressive force and diversified styles.
While the foregoing is directed to the preferred embodiment of the present invention, it will be understood by those skilled in the art that various changes and modifications may be made without departing from the spirit and scope of the invention.
Claims (8)
1. A method of generating a wire drawing, comprising:
acquiring an original image, and then extracting an image edge of the original image;
setting a plurality of dividing points on the image edge, selecting any one of the dividing points as a starting point, and then generating a total drawing path according to the following steps:
step S1, connecting the initial point with the other division points one by one to obtain a plurality of connecting line segments;
step S2, taking the connecting line segment containing the most image main pixel points as a drawing sub-path, and then adjusting the gray value of the image main pixel points in the drawing sub-path to 255; the image main pixel points are pixel points with the gray value not being 255;
and step S3, taking the end point of the drawing sub-path as a new starting point, and repeatedly executing the step S1 and the step S2 until all areas covered by the pairwise connecting lines among the division points are traversed, so as to obtain a plurality of drawing sub-paths.
Step S4, connecting all the drawing sub paths in sequence according to the sequence of path generation to obtain the total drawing path;
and drawing the painting works corresponding to the original images on a painting carrier according to the division points and the total painting path.
2. The method for generating the wire winding drawing as claimed in claim 1, wherein the extracting the image edge of the original image specifically comprises: and extracting the image edge of the original image through a Soble edge detection algorithm.
3. The method of generating a wire wrap according to claim 1, further comprising, prior to said extracting image edges of said original image: and carrying out gray level processing on the original image, then carrying out equal scaling on the processed original image, and storing the scaled original image in a grid with the same size as the drawing area of the drawing carrier so as to enable the original image and the drawing carrier to form a corresponding mapping relation.
4. The method for generating a wire winding according to claim 1, wherein the setting of the plurality of division points on the image edge specifically comprises:
and calculating the perimeter of the image edge, equally dividing the perimeter of the image edge into a plurality of sub-line segments, and taking the division point of each sub-line segment as the division point.
5. The method for generating the wire-wound picture according to claim 3, wherein the step of drawing the pictorial representation corresponding to the original image on the pictorial carrier according to the division points and the total drawing path comprises:
drawing each division point on the drawing carrier according to the mapping relation between the original drawing and the drawing carrier to obtain a plurality of drawing points;
and connecting the drawing points according to the total drawing path to obtain the drawing.
6. The device for generating the winding picture is characterized by comprising an image edge extraction module, a drawing path generation module and a drawing module; the drawing path generation module includes: a connection line segment generating unit, a drawing sub path generating unit, a cycle executing unit and a total path generating unit;
the image edge extraction module is used for acquiring an original image and then extracting the image edge of the original image;
the drawing path generating module is used for setting a plurality of dividing points on the image edge, selecting any one of the dividing points as a starting point, and then generating a total drawing path according to a plurality of units;
the connecting line segment generating unit is used for connecting the starting point with the other dividing points one by one to obtain a plurality of connecting line segments;
the drawing sub-path generating unit is used for taking a connecting line segment containing the most image main pixel points as a drawing sub-path, and then adjusting the gray value of the image main pixel points in the drawing sub-path to 255; the image main pixel points are pixel points with the gray value not being 255;
the circular execution unit is used for taking the end point of the drawing sub-path as a new starting point, controlling the connecting line segment generation unit and the drawing sub-path generation unit to repeatedly execute respective functions until all regions covered by pairwise connecting lines between the division points are traversed, and obtaining a plurality of drawing sub-paths;
the total path generating unit is used for sequentially connecting all the drawing sub-paths according to the sequence of path generation to obtain the total drawing path;
and the drawing module is used for drawing the painting works corresponding to the original images on a painting carrier according to the division points and the total painting path.
7. A terminal device comprising a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, the processor implementing the method of generating a wire drawing according to any one of claims 1 to 5 when executing the computer program.
8. A readable storage medium, comprising a stored computer program, wherein the computer program, when executed, controls an apparatus in which the computer readable storage medium is located to perform the method for generating a wire drawing according to any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911122307.8A CN110969674B (en) | 2019-11-15 | 2019-11-15 | Method and device for generating winding drawing, terminal equipment and readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911122307.8A CN110969674B (en) | 2019-11-15 | 2019-11-15 | Method and device for generating winding drawing, terminal equipment and readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110969674A true CN110969674A (en) | 2020-04-07 |
CN110969674B CN110969674B (en) | 2023-02-21 |
Family
ID=70030791
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911122307.8A Active CN110969674B (en) | 2019-11-15 | 2019-11-15 | Method and device for generating winding drawing, terminal equipment and readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110969674B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112258287A (en) * | 2020-10-28 | 2021-01-22 | 上海今井实业有限公司 | Line winding and drawing trading method, terminal and medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2004234278A (en) * | 2003-01-30 | 2004-08-19 | Nippon Telegr & Teleph Corp <Ntt> | Method, device and program for extracting contour line, and recording medium recorded with the program |
US20090202137A1 (en) * | 2007-12-26 | 2009-08-13 | Shinichi Shinoda | Method and apparatus for image generation |
US20160267675A1 (en) * | 2014-06-23 | 2016-09-15 | Boe Technology Group Co., Ltd. | Image edge detection method and apparatus thereof, image target identification method and apparatus thereof |
CN109741418A (en) * | 2018-11-20 | 2019-05-10 | 广东智媒云图科技股份有限公司 | A kind of low polygon style drawing acquisition methods and device |
CN109934896A (en) * | 2019-02-25 | 2019-06-25 | 广东智媒云图科技股份有限公司 | A kind of drawing method, device, terminal device and computer readable storage medium |
-
2019
- 2019-11-15 CN CN201911122307.8A patent/CN110969674B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2004234278A (en) * | 2003-01-30 | 2004-08-19 | Nippon Telegr & Teleph Corp <Ntt> | Method, device and program for extracting contour line, and recording medium recorded with the program |
US20090202137A1 (en) * | 2007-12-26 | 2009-08-13 | Shinichi Shinoda | Method and apparatus for image generation |
US20160267675A1 (en) * | 2014-06-23 | 2016-09-15 | Boe Technology Group Co., Ltd. | Image edge detection method and apparatus thereof, image target identification method and apparatus thereof |
CN109741418A (en) * | 2018-11-20 | 2019-05-10 | 广东智媒云图科技股份有限公司 | A kind of low polygon style drawing acquisition methods and device |
CN109934896A (en) * | 2019-02-25 | 2019-06-25 | 广东智媒云图科技股份有限公司 | A kind of drawing method, device, terminal device and computer readable storage medium |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112258287A (en) * | 2020-10-28 | 2021-01-22 | 上海今井实业有限公司 | Line winding and drawing trading method, terminal and medium |
Also Published As
Publication number | Publication date |
---|---|
CN110969674B (en) | 2023-02-21 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10924729B2 (en) | Method and device for calibration | |
CN107204034B (en) | A kind of image processing method and terminal | |
CN108830892B (en) | Face image processing method and device, electronic equipment and computer readable storage medium | |
CN108615253B (en) | Image generation method, device and computer readable storage medium | |
JP5811416B2 (en) | Image processing apparatus, image processing method, and program | |
CN110969046A (en) | Face recognition method, face recognition device and computer-readable storage medium | |
CN110751703B (en) | Winding picture generation method, device, equipment and storage medium | |
CN110363837B (en) | Method and device for processing texture image in game, electronic equipment and storage medium | |
CN109410295A (en) | Color setting method, device, equipment and computer readable storage medium | |
CN116362957B (en) | PCB card image alignment method, device, medium and electronic equipment | |
CN110969674B (en) | Method and device for generating winding drawing, terminal equipment and readable storage medium | |
CN108986181B (en) | Dot-based image processing method, device and computer readable storage medium | |
CN109492540B (en) | Face exchange method and device in image and electronic equipment | |
CN109145688A (en) | The processing method and processing device of video image | |
CN111160501A (en) | Construction method and device of two-dimensional code training data set | |
CN112149745B (en) | Method, device, equipment and storage medium for determining difficult example sample | |
CN112070854B (en) | Image generation method, device, equipment and storage medium | |
CN112580213A (en) | Method and apparatus for generating display image of electric field lines, and storage medium | |
JP6703679B1 (en) | Counting device, learning device manufacturing device, counting method, learning device manufacturing method, and program | |
CN109191539B (en) | Oil painting generation method and device based on image and computer readable storage medium | |
CN113808246B (en) | Method and device for generating map, computer equipment and computer readable storage medium | |
CN111292247A (en) | Image processing method and device | |
CN110969678B (en) | Drawing method, device, terminal equipment and storage medium for tiled circles | |
CN114663570A (en) | Map generation method and device, electronic device and readable storage medium | |
CN110991050B (en) | CAD (computer-aided design) image stacking method and related product |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |