CN105447901A - Image processing method and image processing device - Google Patents

Image processing method and image processing device Download PDF

Info

Publication number
CN105447901A
CN105447901A CN201410505493.4A CN201410505493A CN105447901A CN 105447901 A CN105447901 A CN 105447901A CN 201410505493 A CN201410505493 A CN 201410505493A CN 105447901 A CN105447901 A CN 105447901A
Authority
CN
China
Prior art keywords
stroke
line segment
trunk
edge line
represent
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
Application number
CN201410505493.4A
Other languages
Chinese (zh)
Other versions
CN105447901B (en
Inventor
唐帆
余宗桥
黄飞跃
李季檩
李科
吴永坚
董未名
孟一平
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201410505493.4A priority Critical patent/CN105447901B/en
Publication of CN105447901A publication Critical patent/CN105447901A/en
Application granted granted Critical
Publication of CN105447901B publication Critical patent/CN105447901B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Image Analysis (AREA)

Abstract

The present invention discloses an image processing method and an image processing device, belonging to the field of image processing. The image processing method comprises: acquiring an image which includes a plurality of strokes of a Chinese ink-wash painting; acquiring a plurality of backbone strokes; acquiring a plurality of angular points of each backbone stroke according to the backbone strokes; determining the endpoints of the backbone strokes according to the relative position relation among the plurality of the angular points; establishing the topological structure of the Chinese ink-wash painting according to the endpoint of each backbone stroke, the topological structure consisting of edge line segments with respect to each backbone stroke; calculating the weight of each edge line segment according to the position of each edge line segment; determining the drawing order of the backbone strokes in the image according to the position and the weight of each edge line segment in the topological structure. The present invention provides a method for acquiring the stroke drawing order of a Chinese ink-wash painting. Through the method for acquiring the stroke drawing order of a Chinese ink-wash painting, the drawing order of strokes may be automatically obtained according to a drawn Chinese ink-wash painting.

Description

Image processing method and device
Technical field
The present invention relates to image processing field, particularly a kind of image processing method and device.
Background technology
Ink and wash is a kind of art form of uniqueness, and in research ink and wash, the development of drawing order to ink and wash of stroke has important directive function.
In order to know the drawing order of ink and wash, can draw in the process of ink and wash artist, using the lower drawing process of camera shooting, according to photo or the video of shooting, determining the drawing order of each stroke.
Realizing in process of the present invention, inventor finds that prior art at least exists following defect:
Must take in the process of drawing ink and wash, just can obtain the drawing order of stroke, and for the ink and wash of having completed, this ink and wash be static, and only according to the ink and wash of static state, the drawing order of stroke cannot be known.
Summary of the invention
In order to solve the problem of prior art, embodiments provide a kind of image processing method and device.Described technical scheme is as follows:
First aspect, provides a kind of image processing method, and described method comprises:
Obtain image to be analyzed, described image comprises multiple strokes of picture;
From described multiple stroke, obtain multiple trunk stroke;
For each trunk stroke, obtain multiple angle points of described trunk stroke;
According to the relative position relation between described multiple angle point, determine the end points of described trunk stroke;
According to the end points of each trunk stroke, build the topological structure of described picture, described topological structure comprises edge line segment corresponding to each trunk stroke;
According to the position of line segment in described image, each edge, calculate the weight of each edge line segment;
According to position and the weight of each edge line segment in described topological structure, determine the drawing order of each trunk stroke in described image.
Second aspect, provides a kind of image processing apparatus, and described device comprises:
Image collection module, for obtaining image to be analyzed, described image comprises multiple strokes of picture;
Stroke classification module, for from described multiple stroke, obtains multiple trunk stroke;
Angle point acquisition module, for for each trunk stroke, obtains multiple angle points of described trunk stroke;
End points determination module, for according to the relative position relation between described multiple angle point, determines the end points of described trunk stroke;
Topological structure builds module, and for the end points according to each trunk stroke, build the topological structure of described picture, described topological structure comprises edge line segment corresponding to each trunk stroke;
Weight computation module, for according to the position of line segment in described image, each edge, calculates the weight of each edge line segment;
Drawing order determination module, for according to the position of each edge line segment in described topological structure and weight, determines the drawing order of each trunk stroke in described image.
The beneficial effect that the technical scheme that the embodiment of the present invention provides is brought is:
The method and apparatus that the embodiment of the present invention provides, when multiple stroke of known picture, by obtaining the end points of each trunk stroke in image, build the topological structure of this picture, according to each edge line segment in this topological structure, determine each trunk stroke drawing order in the images, provide a kind of method obtaining the stroke drawing order of picture, according to the picture of having completed, can automatically obtain the drawing order of stroke.
Accompanying drawing explanation
In order to be illustrated more clearly in the technical scheme in the embodiment of the present invention, below the accompanying drawing used required in describing embodiment is briefly described, apparently, accompanying drawing in the following describes is only some embodiments of the present invention, for those of ordinary skill in the art, under the prerequisite not paying creative work, other accompanying drawing can also be obtained according to these accompanying drawings.
Fig. 1 is the process flow diagram of a kind of image processing method that the embodiment of the present invention provides;
Fig. 2 is the process flow diagram of a kind of image processing method that the embodiment of the present invention provides;
Fig. 3 is the schematic diagram choosing end points of the trunk stroke that the embodiment of the present invention provides;
Fig. 4 is the schematic diagram of the structure topological structure that the embodiment of the present invention provides;
Fig. 5 is a kind of image processing apparatus structural representation that the embodiment of the present invention provides.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, be clearly and completely described the technical scheme in the embodiment of the present invention, obviously, described embodiment is the present invention's part embodiment, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, belong to the scope of protection of the invention.
Fig. 1 is the process flow diagram of a kind of image processing method that the embodiment of the present invention provides, and see Fig. 1, the method comprises:
101, obtain image to be analyzed, this image comprises multiple strokes of picture.
102, from the plurality of stroke, multiple trunk stroke is obtained.
103, for each trunk stroke, multiple angle points of this trunk stroke are obtained.
104, according to the relative position relation between the plurality of angle point, the end points of this trunk stroke is determined.
105, according to the end points of each trunk stroke, build the topological structure of this picture, this topological structure comprises edge line segment corresponding to each trunk stroke.
106, according to line segment position in the images, each edge, the weight of each edge line segment is calculated.
107, according to position and the weight of each edge line segment in this topological structure, each trunk stroke drawing order is in the images determined.
The method that the embodiment of the present invention provides, when multiple stroke of known picture, by obtaining the end points of each trunk stroke in image, build the topological structure of picture, according to each edge line segment in this topological structure, determine each trunk stroke drawing order in the images, provide a kind of method obtaining the stroke drawing order of picture, according to the picture of having completed, can automatically obtain the drawing order of stroke.
Alternatively, from the plurality of stroke, multiple trunk stroke should be obtained and comprises:
According to the stroke area of stroke each in the plurality of stroke, cluster is carried out to the plurality of stroke, obtain multiple trunk stroke.
Alternatively, should for each trunk stroke, the multiple angle points obtaining this trunk stroke comprise:
Adopt morphological gradient, computing is carried out to this trunk stroke, obtains multiple angle points of this trunk stroke.
Alternatively, this is according to the relative position relation between the plurality of angle point, determines that the end points of this trunk stroke comprises:
According to the relative position relation between the plurality of angle point, calculate the distance between every two angle points in the plurality of angle point;
Using the end points of two maximum for the plurality of angle point middle distance angle points as this trunk stroke.
Alternatively, this is according to the end points of each trunk stroke, and the topological structure building this picture comprises:
For each trunk stroke, two of this trunk stroke end points are connected, obtain edge line segment;
The edge line segment corresponding according to each trunk stroke, obtains the topological structure of this picture.
Alternatively, this is according to line segment position in the images, each edge, and the weight calculating each edge line segment comprises:
For each edge line segment, obtain the stroke length of trunk stroke corresponding to this edge line segment, stroke area and stroke;
According to this edge line segment position in the images, calculate the position significance of this edge line segment;
According to this stroke length, this stroke area, this position significance and this stroke, calculate the weight of this edge line segment.
Alternatively, this is according to this edge line segment position in the images, and the position significance calculating this edge line segment comprises:
According to this edge line segment position in the images, apply following formula, calculate the position significance of this edge line segment:
D i = 1 1 + | | P i - O | | = 1 1 + ( x i - x 0 ) 2 + ( y i - y 0 ) 2 ;
Wherein, i represents the sequence number of the trunk stroke that this edge line segment is corresponding, D irepresent the position significance of this edge line segment, P i(x i, y i) represent the middle point coordinate of this edge line segment, O (x 0, y 0) represent the centre coordinate of this image.
Alternatively, this is according to this stroke length, this stroke area, this position significance and this stroke, and the weight calculating this edge line segment comprises:
Obtain the stroke length maximal value of the plurality of trunk stroke, stroke area maximal value, position significance maximal value and stroke maximal value;
According to the stroke length of this trunk stroke, stroke area, position significance and stroke, and the stroke length maximal value got, stroke area maximal value, position significance maximal value and stroke maximal value, apply following formula, calculate the weight of this edge line segment:
W i = α 1 L i L max + α 2 S i S max + α 3 D i D max + α 4 T i T max ;
Wherein, i represents the sequence number of the trunk stroke that this edge line segment is corresponding, W irepresent the weight of this edge line segment, L irepresent the stroke length of this trunk stroke, L maxrepresent this stroke length maximal value, S irepresent the stroke area of this trunk stroke, S maxrepresent this stroke area maximal value, D irepresent the position significance of this trunk stroke, D maxrepresent this position significance maximal value, T irepresent the stroke of this trunk stroke, T maxrepresent this stroke maximal value, α 1represent the characteristic parameter of stroke length, α 2represent the characteristic parameter of stroke area, α 3represent the characteristic parameter of position significance, α 4represent the characteristic parameter of stroke.
Alternatively, this is according to the position of each edge line segment in this topological structure and weight, determines that each trunk stroke drawing order in the images comprises:
Using edge line segment maximum for weight in this topological structure as first edge line segment;
According to the position of each edge line segment in this topological structure, multiple edges line segment that to obtain with this first edge line segment be starting point;
Using edge line segment maximum for weight in multiple edges line segment of getting as second edge line segment;
Based on this second edge line segment, continue from this topological structure, obtain next edge line segment, until determine the order of each edge line segment;
According to the order of each edge line segment, determine each trunk stroke drawing order in the images.
Alternatively, the method also comprises:
According to the stroke area of stroke each in the plurality of stroke, cluster is carried out to the plurality of stroke, obtain multiple details stroke.
Alternatively, this, according to the stroke area of stroke each in the plurality of stroke, carries out cluster to the plurality of stroke, and after obtaining multiple details stroke, the method also comprises:
For each trunk stroke, obtain the multiple details strokes in the preset range of this trunk stroke;
In accordance with the order from top to bottom, the plurality of details stroke is sorted, obtain the drawing order of the plurality of details stroke.
Alternatively, this picture is ink and wash.
Above-mentioned all alternatives, can adopt and combine arbitrarily formation optional embodiment of the present invention, this is no longer going to repeat them.
Fig. 2 is the process flow diagram of a kind of image processing method that the embodiment of the present invention provides, and the executive agent of the embodiment of the present invention is image processing apparatus, and see Fig. 2, the method comprises:
201, this image processing apparatus obtains image to be analyzed, and this image comprises multiple strokes of ink and wash, from the plurality of stroke, obtains multiple trunk stroke.
The embodiment of the present invention is this image processing apparatus for executive agent, and this image processing apparatus can be terminal, server or the functional module etc. that can realize image processing function, and the embodiment of the present invention does not limit this.This image processing apparatus can be analyzed the image comprising picture, to determine the drawing order of multiple stroke in this picture.This picture can be ink and wash, watercolor or simple picture etc., and the embodiment of the present invention is only depicted as example with ink and is described, and does not in fact limit this picture.
In embodiments of the present invention, this image comprises the ink and wash that a width has been completed, this image processing apparatus by this ink and wash of shooting or can scan the modes such as this ink and wash, obtain this image, can also the image uploaded of receiving terminal or download this image from server, the embodiment of the present invention does not limit the mode that this image processing apparatus obtains this image.
This image comprises multiple strokes of this ink and wash, trunk stroke and details stroke may be comprised in the plurality of stroke, wherein, trunk stroke refers to the stroke larger to the influence degree of this ink and wash, and details stroke refers to the stroke less to the influence degree of this ink and wash.Because each stroke is relevant with the stroke area of this stroke to the influence degree of this ink and wash, then can think: when stroke area is larger, this stroke may be more trunk stroke, and more hour, this stroke may be more details stroke to stroke area.
Based on above-mentioned characteristic, this image processing apparatus can set area threshold, for each stroke, when the stroke area of this stroke is greater than this area threshold, this image processing apparatus can determine that this stroke is trunk stroke, when the stroke area of this stroke is less than this area threshold, this image processing apparatus can determine that this stroke is details stroke.Further, this image processing apparatus according to the stroke area of stroke each in the plurality of stroke, can also carry out cluster to the plurality of stroke, obtains multiple trunk stroke and multiple details stroke.Alternatively, this image processing apparatus for feature with the stroke area of each stroke, adopts Unsupervised clustering algorithm, carries out cluster, obtain multiple trunk stroke and multiple details stroke to the plurality of stroke.
202, for each trunk stroke, this image processing apparatus obtains multiple angle points of this trunk stroke, according to the relative position relation between the plurality of angle point, determines the end points of this trunk stroke.
When this image processing apparatus is from the plurality of stroke, when getting multiple trunk stroke and multiple details stroke, the drawing order of the plurality of trunk stroke first can be determined.
For each trunk stroke, this image processing apparatus first obtains multiple angle points of this trunk stroke, and this angle point refers to the extreme point in this trunk stroke.Particularly, this image processing apparatus adopts morphological gradient, carries out computing, obtains the edge of this trunk stroke, from the edge of this trunk stroke, extract multiple angle point to this trunk stroke.Further, this image processing apparatus first can also adopt edge detection operator, as Canny operator etc., computing is carried out to this trunk stroke, obtains the first edge of this trunk stroke, then adopt morphological gradient, computing is carried out to the first edge of this trunk stroke, obtain the second edge of this trunk stroke, from the second edge of this trunk stroke, extract multiple angle point.
This image processing apparatus is when extracting the angle point of this trunk stroke, and the angle point extracted is more, and the follow-up end points obtained will get over precision, but computation complexity also can be higher.The number extracting angle point can be determined according to the size of this image and accuracy requirements, and the embodiment of the present invention does not limit this.
See Fig. 3, by emulation experiment, determine the edge of a trunk stroke, as shown in Figure 3 a, shadow region represents the inking region of this trunk stroke, and other white spaces represent the canvas area of ink and wash.When this image processing apparatus according to the edge extracting of this trunk stroke to 10 angle points time, determine two end points of two end points as dotted line in Fig. 3 b of this trunk stroke, when this image processing apparatus according to the edge extracting of this trunk stroke to 20 angle points time, determine two end points of two end points as dotted line in Fig. 3 c of this trunk stroke, when this image processing apparatus according to the edge extracting of this trunk stroke to 50 angle points time, determine two end points of two end points as dotted line in Fig. 3 d of this trunk stroke.Then can find out, when the angle point that this image processing apparatus extracts is more, the end points determined is more accurate.
This trunk stroke comprises multiple angle point, can think that this trunk stroke middle distance two angle points are farthest end points of this trunk stroke, then according to the relative position relation in this trunk stroke between multiple angle point, calculate the distance between every two angle points in the plurality of angle point, using the end points of two maximum for the plurality of angle point middle distance angle points as this trunk stroke.
203, this image processing apparatus is according to the end points of each trunk stroke, builds the topological structure of this ink and wash, and this topological structure comprises edge line segment corresponding to each trunk stroke.
For each trunk stroke, when this image processing apparatus gets two end points of this trunk stroke, these two end points are connected, using the line segment that obtains as edge line segment corresponding to this trunk stroke.When this image processing apparatus obtains the edge line segment of each trunk stroke, all edges line segment obtained is formed this topological structure.Alternatively, this image processing apparatus connects each edge line segment with designated identification, obtains this topological structure, and this designated identification can be circular indicia, triangle mark etc., and the embodiment of the present invention does not limit this.
See Fig. 4, obtain 5 edge line segments as shown in fig. 4 a, when this image processing apparatus obtains the edge line segment of each trunk stroke, connect with circular indicia, obtain netted topological structure, as shown in Figure 4 b by 5 trunk strokes in this image.
204, this image processing apparatus is according to line segment position in the images, each edge, calculates the weight of each edge line segment.
For each edge line segment, when can think that the stroke length of this trunk stroke corresponding to edge line segment is larger, stroke area is larger, stroke is larger, the position significance of this edge line segment is larger, the drawing order of this trunk stroke is more forward.
Based on above-mentioned characteristic, this image processing apparatus can detect this image, obtain the stroke length of each trunk stroke, stroke area and stroke, and for each edge line segment, obtain the stroke length of trunk stroke corresponding to this edge line segment, stroke area and stroke, according to this edge line segment position in the images, calculate the position significance of this edge line segment, according to this stroke length, this stroke area, this position significance and this stroke, calculate the weight of this edge line segment.Wherein, this stroke length, this stroke area, this position significance and this stroke respectively with this weight positive correlation.
For the position significance of this edge line segment, this position significance can represent the influence degree of position to this image of this edge line segment, then can think this edge line segment from this image center more close to, the position significance of this edge line segment is higher.Then alternatively, this image processing apparatus, according to this edge line segment position in the images, applies following formula, calculates the position significance of this edge line segment:
D i = 1 1 + | | P i - O | | = 1 1 + ( x i - x 0 ) 2 + ( y i - y 0 ) 2 ;
Wherein, i represents the sequence number of the trunk stroke that this edge line segment is corresponding, D irepresent the position significance of this edge line segment, P i(x i, y i) represent the middle point coordinate of this edge line segment, O (x 0, y 0) represent the centre coordinate of this image.
Further, this image processing apparatus according to this stroke length, this stroke area, this position significance and this stroke, can be applied following formula, calculates the weight of this edge line segment:
W i=α 1L i2S i3D i4T i
Wherein, i represents the sequence number of the trunk stroke that this edge line segment is corresponding, W irepresent the weight of this edge line segment, L irepresent the stroke length of this trunk stroke, S irepresent the stroke area of this trunk stroke, D irepresent the position significance of this trunk stroke, T irepresent the stroke of this trunk stroke, α 1represent the characteristic parameter of stroke length, α 2represent the characteristic parameter of stroke area, α 3represent the characteristic parameter of position significance, α 4represent the characteristic parameter of stroke.Above-mentioned PARAMETER ALPHA 1, α 2, α 3and α 4can respectively according to determining the accuracy requirements of stroke length, stroke area, position significance and stroke, the embodiment of the present invention does not limit this.Alternatively, α 1234=0.25.
Further, in order to avoid this stroke length, this stroke area, any one numerical value in this position significance and this stroke is excessive and cause weight calculation inaccurate, this image processing apparatus can also obtain the stroke length maximal value of the plurality of trunk stroke, stroke area maximal value, position significance maximal value and stroke maximal value, according to the stroke length of this trunk stroke, stroke area, position significance and stroke, and the stroke length maximal value got, stroke area maximal value, position significance maximal value and stroke maximal value, apply following formula, calculate the weight of this edge line segment:
W i = α 1 L i L max + α 2 S i S max + α 3 D i D max + α 4 T i T max ;
Wherein, L maxrepresent this stroke length maximal value, S maxrepresent this stroke area maximal value, D maxrepresent this position significance maximal value, T maxrepresent this stroke maximal value.
205, this image processing apparatus is according to the position of each edge line segment in this topological structure and weight, determines each trunk stroke drawing order in the images.
When this image processing apparatus has calculated the weight of each edge line segment, using edge line segment maximum for weight in this topological structure as first edge line segment, according to the position of each edge line segment in this topological structure, obtain the multiple edges line segment being starting point with this first edge line segment, using edge line segment maximum for weight in multiple edges line segment of getting as second edge line segment, based on this second edge line segment, continue from this topological structure, obtain next edge line segment, until determine the order of each edge line segment, according to the order of each edge line segment, determine each trunk stroke drawing order in the images.
Wherein, edge line segment adjacent in this topological structure connects with this designated identification, when determining first edge line segment, the edge line segment being connected same designated identification with this first edge line segment can be obtained, as the multiple edges line segment being starting point with this first edge line segment, then the edge line segment selecting weight maximum from the plurality of edge line segment is as second edge line segment.When determining this first edge line segment and this second edge line segment, determine the designated identification that this second edge line segment connects, determine except this first edge line segment and this second edge line segment, to be connected this designated identification multiple edges line segment, from the heavy maximum edge line segment of the plurality of edge line segment right to choose as the 3rd edge line segment, by that analogy, thus determine the order of each edge line segment.
Alternatively, when this image processing apparatus determines this first edge line segment, with this first edge line segment for starting point, breadth first traversal is carried out to the weight of other edge line segments in this topological structure, determines the drawing order of each edge line segment.
It should be noted that, when getting the end points of trunk stroke in step 202., this image processing apparatus can't be distinguished the initial end points of this trunk stroke and stop end points, but when this image processing apparatus determines the next trunk stroke of this trunk stroke, can according to the position of this trunk stroke and this next trunk stroke, determine initial end points and the end caps of this trunk stroke, namely determine the drafting direction of this trunk stroke, thus can know what how this trunk stroke was specifically drawn.
206, for each trunk stroke, this image processing apparatus obtains the multiple details strokes in the preset range of this trunk stroke, in accordance with the order from top to bottom, sorts to the plurality of details stroke, obtains the drawing order of the plurality of details stroke.
Wherein, the region determined of this preset range can centered by one of them end points of this edge line segment, also can centered by the mid point of this edge line segment, or centered by other shops on this edge line segment, the region determined of this preset range can be the shape such as circular or oval, the size of this preset range can be determined according to the size of this image with to the accuracy requirements of details stroke, and the embodiment of the present invention does not all limit this.
The embodiment of the present invention performs after step 205 with this step 206, and in actual application, when this image processing apparatus determines the drawing order of a trunk stroke, directly can perform this step 206, determine the drawing order of the multiple details strokes in this trunk stroke preset range, then determine the drawing order of next trunk stroke.
When the drawing order of all trunk strokes and details stroke is determined all, this image processing apparatus can determine the drawing order of each stroke in this ink and wash.This image processing apparatus can determine that multiple details stroke is all drawn after the plurality of trunk stroke.In addition, because artist is when drawing ink and wash, when getting used to having drawn a trunk stroke, just draw the details stroke near this trunk stroke, therefore, for each trunk stroke, this image processing apparatus can also determine that the drawing order of multiple details strokes of this trunk stroke is after this trunk stroke, before this next trunk stroke.
In the embodiment of the present invention, under the prerequisite of the multiple strokes in known ink and wash, multiple stroke is divided into trunk stroke and details stroke, by analyzing the shape and structure of trunk stroke, find out the end points of each trunk stroke, thus get the topological structure of this image, relative position relation between the multiple trunk stroke of comprehensive analysis, determine the drawing order of the plurality of trunk stroke, details stroke is filled afterwards on each trunk stroke, obtain the drawing order of view picture ink and wash, automatically can produce rational stroke drawing order.
The embodiment of the present invention can also be applied to the drawing process of simulation ink and wash, when this image processing apparatus determines the drawing order of the drawing order of each trunk stroke in this ink and wash and each details stroke, can according to visual informations such as the shape of each stroke, colors, and according to determined drawing order, successively animation effect displaying is carried out to each stroke, to simulate the drawing process of this ink and wash.The drawing process of simulation can also be recorded as video by this image processing apparatus, and other users by this video of viewing, can carry out the multiple application such as the research of ink and wash or teaching.
The method that the embodiment of the present invention provides, when multiple stroke of known ink and wash, by obtaining the end points of each trunk stroke in image, build the topological structure of ink and wash, according to each edge line segment in this topological structure, determine each trunk stroke drawing order in the images, provide a kind of method obtaining the stroke drawing order of ink and wash, according to the ink and wash of having completed, can automatically obtain the drawing order of stroke.
Fig. 5 is a kind of image processing apparatus structural representation that the embodiment of the present invention provides, and see Fig. 5, this device comprises:
Image collection module 501, for obtaining image to be analyzed, this image comprises multiple strokes of picture;
Stroke classification module 502, for from the plurality of stroke, obtains multiple trunk stroke;
Angle point acquisition module 503, for for each trunk stroke, obtains multiple angle points of this trunk stroke;
End points determination module 504, for according to the relative position relation between the plurality of angle point, determines the end points of this trunk stroke;
Topological structure builds module 505, and for the end points according to each trunk stroke, build the topological structure of this picture, this topological structure comprises edge line segment corresponding to each trunk stroke;
Weight computation module 506, for according to line segment position in the images, each edge, calculates the weight of each edge line segment;
Drawing order determination module 507, for according to the position of each edge line segment in this topological structure and weight, determines each trunk stroke drawing order in the images.
The device that the embodiment of the present invention provides, when multiple stroke of known picture, by obtaining the end points of each trunk stroke in image, build the topological structure of picture, according to each edge line segment in this topological structure, determine each trunk stroke drawing order in the images, provide a kind of method obtaining the stroke drawing order of picture, according to the picture of having completed, can automatically obtain the drawing order of stroke.
Alternatively, this stroke classification module 502 also for the stroke area according to stroke each in the plurality of stroke, carries out cluster to the plurality of stroke, obtains multiple trunk stroke.
Alternatively, this angle point acquisition module 503, for adopting morphological gradient, carries out computing to this trunk stroke, obtains multiple angle points of this trunk stroke.
Alternatively, this end points determination module 504 comprises:
Metrics calculation unit, for according to the relative position relation between the plurality of angle point, calculates the distance between every two angle points in the plurality of angle point;
End points chooses unit, for using the end points of two maximum for the plurality of angle point middle distance angle points as this trunk stroke.
Alternatively, this topological structure structure module 505 comprises:
Two of this trunk stroke end points, for for each trunk stroke, are connected, obtain edge line segment by end points linkage unit;
Topological structure construction unit, for the edge line segment corresponding according to each trunk stroke, obtains the topological structure of this picture.
Alternatively, this weight computation module 506 comprises:
Stroke information acquiring unit, for for each edge line segment, obtains the stroke length of trunk stroke corresponding to this edge line segment, stroke area and stroke;
Position significance computing unit, for according to this edge line segment position in the images, calculates the position significance of this edge line segment;
Weight calculation unit, for according to this stroke length, this stroke area, this position significance and this stroke, calculates the weight of this edge line segment.
Alternatively, this position significance computing unit is used for according to this edge line segment position in the images, applies following formula, calculates the position significance of this edge line segment:
D i = 1 1 + | | P i - O | | = 1 1 + ( x i - x 0 ) 2 + ( y i - y 0 ) 2 ;
Wherein, i represents the sequence number of the trunk stroke that this edge line segment is corresponding, D irepresent the position significance of this edge line segment, P i(x i, y i) represent the middle point coordinate of this edge line segment, O (x 0, y 0) represent the centre coordinate of this image.
Alternatively, this weight calculation unit is for obtaining the stroke length maximal value of the plurality of trunk stroke, stroke area maximal value, position significance maximal value and stroke maximal value; According to the stroke length of this trunk stroke, stroke area, position significance and stroke, and the stroke length maximal value got, stroke area maximal value, position significance maximal value and stroke maximal value, apply following formula, calculate the weight of this edge line segment:
W i = α 1 L i L max + α 2 S i S max + α 3 D i D max + α 4 T i T max ;
Wherein, i represents the sequence number of the trunk stroke that this edge line segment is corresponding, W irepresent the weight of this edge line segment, L irepresent the stroke length of this trunk stroke, L maxrepresent this stroke length maximal value, S irepresent the stroke area of this trunk stroke, S maxrepresent this stroke area maximal value, D irepresent the position significance of this trunk stroke, D maxrepresent this position significance maximal value, T irepresent the stroke of this trunk stroke, T maxrepresent this stroke maximal value, α 1represent the characteristic parameter of stroke length, α 2represent the characteristic parameter of stroke area, α 3represent the characteristic parameter of position significance, α 4represent the characteristic parameter of stroke.
Alternatively, this drawing order determination module 507 for using edge line segment maximum for weight in this topological structure as first edge line segment; According to the position of each edge line segment in this topological structure, multiple edges line segment that to obtain with this first edge line segment be starting point; Using edge line segment maximum for weight in multiple edges line segment of getting as second edge line segment; Based on this second edge line segment, continue from this topological structure, obtain next edge line segment, until determine the order of each edge line segment; According to the order of each edge line segment, determine each trunk stroke drawing order in the images.
Alternatively, this stroke classification module 502 also for the stroke area according to stroke each in the plurality of stroke, carries out cluster to the plurality of stroke, obtains multiple details stroke.
Alternatively, this device also comprises:
Details stroke acquisition module, for for each trunk stroke, obtains the multiple details strokes in the preset range of this trunk stroke;
Details stroke sorting module, in accordance with the order from top to bottom, sorts to the plurality of details stroke, obtains the drawing order of the plurality of details stroke.
Alternatively, this picture is ink and wash.
Above-mentioned all alternatives, can adopt and combine arbitrarily formation optional embodiment of the present invention, this is no longer going to repeat them.
It should be noted that: the image processing apparatus that above-described embodiment provides is when processing image, only be illustrated with the division of above-mentioned each functional module, in practical application, can distribute as required and by above-mentioned functions and be completed by different functional modules, inner structure by equipment is divided into different functional modules, to complete all or part of function described above.In addition, the image processing apparatus that above-described embodiment provides and image processing method embodiment belong to same design, and its specific implementation process refers to embodiment of the method, repeats no more here.
One of ordinary skill in the art will appreciate that all or part of step realizing above-described embodiment can have been come by hardware, the hardware that also can carry out instruction relevant by program completes, described program can be stored in a kind of computer-readable recording medium, the above-mentioned storage medium mentioned can be ROM (read-only memory), disk or CD etc.
The foregoing is only preferred embodiment of the present invention, not in order to limit the present invention, within the spirit and principles in the present invention all, any amendment done, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.

Claims (20)

1. an image processing method, is characterized in that, described method comprises:
Obtain image to be analyzed, described image comprises multiple strokes of picture;
From described multiple stroke, obtain multiple trunk stroke;
For each trunk stroke, obtain multiple angle points of described trunk stroke;
According to the relative position relation between described multiple angle point, determine the end points of described trunk stroke;
According to the end points of each trunk stroke, build the topological structure of described picture, described topological structure comprises edge line segment corresponding to each trunk stroke;
According to the position of line segment in described image, each edge, calculate the weight of each edge line segment;
According to position and the weight of each edge line segment in described topological structure, determine the drawing order of each trunk stroke in described image.
2. method according to claim 1, is characterized in that, described from described multiple stroke, obtains multiple trunk stroke and comprises:
According to the stroke area of each stroke in described multiple stroke, cluster is carried out to described multiple stroke, obtain multiple trunk stroke.
3. method according to claim 1, is characterized in that, described for each trunk stroke, the multiple angle points obtaining described trunk stroke comprise:
Adopt morphological gradient, computing is carried out to described trunk stroke, obtains multiple angle points of described trunk stroke.
4. method according to claim 1, is characterized in that, described according to the relative position relation between described multiple angle point, determines that the end points of described trunk stroke comprises:
According to the relative position relation between described multiple angle point, calculate the distance between every two angle points in described multiple angle point;
Using the end points of two maximum for described multiple angle point middle distance angle points as described trunk stroke.
5. method according to claim 1, is characterized in that, the described end points according to each trunk stroke, and the topological structure building described picture comprises:
For each trunk stroke, two end points of described trunk stroke are connected, obtain edge line segment;
The edge line segment corresponding according to each trunk stroke, obtains the topological structure of described picture.
6. method according to claim 1, is characterized in that, described according to the position of line segment in described image, each edge, the weight calculating each edge line segment comprises:
For each edge line segment, obtain the stroke length of trunk stroke corresponding to described edge line segment, stroke area and stroke;
According to the position of line segment in described image, described edge, calculate the position significance of described edge line segment;
According to described stroke length, described stroke area, described position significance and described stroke, calculate the weight of described edge line segment.
7. method according to claim 6, is characterized in that, described according to the position of line segment in described image, described edge, the position significance calculating described edge line segment comprises:
According to the position of line segment in described image, described edge, apply following formula, calculate the position significance of described edge line segment:
D i = 1 1 + | | P i - O | | = 1 1 + ( x i - x 0 ) 2 + ( y i - y 0 ) 2 ;
Wherein, i represents the sequence number of the trunk stroke that described edge line segment is corresponding, D irepresent the position significance of described edge line segment, P i(x i, y i) represent the middle point coordinate of described edge line segment, O (x 0, y 0) represent the centre coordinate of described image.
8. method according to claim 6, is characterized in that, described according to described stroke length, described stroke area, described position significance and described stroke, the weight calculating described edge line segment comprises:
Obtain the stroke length maximal value of described multiple trunk stroke, stroke area maximal value, position significance maximal value and stroke maximal value;
According to the stroke length of described trunk stroke, stroke area, position significance and stroke, and the stroke length maximal value got, stroke area maximal value, position significance maximal value and stroke maximal value, apply following formula, calculate the weight of described edge line segment:
W i = α 1 L i L max + α 2 S i S max + α 3 D i D max + α 4 T i T max ;
Wherein, i represents the sequence number of the trunk stroke that described edge line segment is corresponding, W irepresent the weight of described edge line segment, L irepresent the stroke length of described trunk stroke, L maxrepresent described stroke length maximal value, S irepresent the stroke area of described trunk stroke, S maxrepresent described stroke area maximal value, D irepresent the position significance of described trunk stroke, D maxrepresent described position significance maximal value, T irepresent the stroke of described trunk stroke, T maxrepresent described stroke maximal value, α 1represent the characteristic parameter of stroke length, α 2represent the characteristic parameter of stroke area, α 3represent the characteristic parameter of position significance, α 4represent the characteristic parameter of stroke.
9. method according to claim 1, is characterized in that, the described position according to each edge line segment in described topological structure and weight, determines that the drawing order of each trunk stroke in described image comprises:
Using edge line segment maximum for weight in described topological structure as first edge line segment;
According to the position of each edge line segment in described topological structure, multiple edges line segment that to obtain with described first edge line segment be starting point;
Using edge line segment maximum for weight in multiple edges line segment of getting as second edge line segment;
Based on described second edge line segment, continue from described topological structure, obtain next edge line segment, until determine the order of each edge line segment;
According to the order of each edge line segment, determine the drawing order of each trunk stroke in described image.
10. method according to claim 1, is characterized in that, described method also comprises:
According to the stroke area of each stroke in described multiple stroke, cluster is carried out to described multiple stroke, obtain multiple details stroke.
11. methods according to claim 10, is characterized in that, the described stroke area according to each stroke in described multiple stroke, and carry out cluster to described multiple stroke, after obtaining multiple details stroke, described method also comprises:
For each trunk stroke, obtain the multiple details strokes in the preset range of described trunk stroke;
In accordance with the order from top to bottom, described multiple details stroke is sorted, obtain the drawing order of described multiple details stroke.
12. methods according to any one of claim 1-11, it is characterized in that, described picture is ink and wash.
13. 1 kinds of image processing apparatus, is characterized in that, described device comprises:
Image collection module, for obtaining image to be analyzed, described image comprises multiple strokes of picture;
Stroke classification module, for from described multiple stroke, obtains multiple trunk stroke;
Angle point acquisition module, for for each trunk stroke, obtains multiple angle points of described trunk stroke;
End points determination module, for according to the relative position relation between described multiple angle point, determines the end points of described trunk stroke;
Topological structure builds module, and for the end points according to each trunk stroke, build the topological structure of described picture, described topological structure comprises edge line segment corresponding to each trunk stroke;
Weight computation module, for according to the position of line segment in described image, each edge, calculates the weight of each edge line segment;
Drawing order determination module, for according to the position of each edge line segment in described topological structure and weight, determines the drawing order of each trunk stroke in described image.
14. devices according to claim 13, is characterized in that, described stroke classification module also for the stroke area according to each stroke in described multiple stroke, carries out cluster to described multiple stroke, obtains multiple trunk stroke.
15. devices according to claim 13, is characterized in that, described end points determination module comprises:
Metrics calculation unit, for according to the relative position relation between described multiple angle point, calculates the distance between every two angle points in described multiple angle point;
End points chooses unit, for using the end points of two maximum for described multiple angle point middle distance angle points as described trunk stroke.
16. devices according to claim 13, is characterized in that, described topological structure builds module and comprises:
Two end points of described trunk stroke, for for each trunk stroke, are connected, obtain edge line segment by end points linkage unit;
Topological structure construction unit, for the edge line segment corresponding according to each trunk stroke, obtains the topological structure of described picture.
17. devices according to claim 13, is characterized in that, described weight computation module comprises:
Stroke information acquiring unit, for for each edge line segment, obtains the stroke length of trunk stroke corresponding to described edge line segment, stroke area and stroke;
Position significance computing unit, for according to the position of line segment in described image, described edge, calculates the position significance of described edge line segment;
Weight calculation unit, for according to described stroke length, described stroke area, described position significance and described stroke, calculates the weight of described edge line segment.
18. devices according to claim 17, is characterized in that, described position significance computing unit is used for according to the position of line segment in described image, described edge, applies following formula, calculates the position significance of described edge line segment:
D i = 1 1 + | | P i - O | | = 1 1 + ( x i - x 0 ) 2 + ( y i - y 0 ) 2 ;
Wherein, i represents the sequence number of the trunk stroke that described edge line segment is corresponding, D irepresent the position significance of described edge line segment, P i(x i, y i) represent the middle point coordinate of described edge line segment, O (x 0, y 0) represent the centre coordinate of described image.
19. devices according to claim 17, is characterized in that, described weight calculation unit is for obtaining the stroke length maximal value of described multiple trunk stroke, stroke area maximal value, position significance maximal value and stroke maximal value; According to the stroke length of described trunk stroke, stroke area, position significance and stroke, and the stroke length maximal value got, stroke area maximal value, position significance maximal value and stroke maximal value, apply following formula, calculate the weight of described edge line segment:
W i = α 1 L i L max + α 2 S i S max + α 3 D i D max + α 4 T i T max ;
Wherein, i represents the sequence number of the trunk stroke that described edge line segment is corresponding, W irepresent the weight of described edge line segment, L irepresent the stroke length of described trunk stroke, L maxrepresent described stroke length maximal value, S irepresent the stroke area of described trunk stroke, S maxrepresent described stroke area maximal value, D irepresent the position significance of described trunk stroke, D maxrepresent described position significance maximal value, T irepresent the stroke of described trunk stroke, T maxrepresent described stroke maximal value, α 1represent the characteristic parameter of stroke length, α 2represent the characteristic parameter of stroke area, α 3represent the characteristic parameter of position significance, α 4represent the characteristic parameter of stroke.
20. devices according to claim 12, is characterized in that, described drawing order determination module is used for edge line segment maximum for weight in described topological structure as first edge line segment; According to the position of each edge line segment in described topological structure, multiple edges line segment that to obtain with described first edge line segment be starting point; Using edge line segment maximum for weight in multiple edges line segment of getting as second edge line segment; Based on described second edge line segment, continue from described topological structure, obtain next edge line segment, until determine the order of each edge line segment; According to the order of each edge line segment, determine the drawing order of each trunk stroke in described image.
CN201410505493.4A 2014-09-26 2014-09-26 Image processing method and device Active CN105447901B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410505493.4A CN105447901B (en) 2014-09-26 2014-09-26 Image processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410505493.4A CN105447901B (en) 2014-09-26 2014-09-26 Image processing method and device

Publications (2)

Publication Number Publication Date
CN105447901A true CN105447901A (en) 2016-03-30
CN105447901B CN105447901B (en) 2019-08-27

Family

ID=55558032

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410505493.4A Active CN105447901B (en) 2014-09-26 2014-09-26 Image processing method and device

Country Status (1)

Country Link
CN (1) CN105447901B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107705346A (en) * 2017-11-07 2018-02-16 中国石油大学(华东) A kind of hand-drawing image sequential adding method based on stroke length and spatial information
CN108038890A (en) * 2017-12-06 2018-05-15 广州视源电子科技股份有限公司 Vector diagram demonstration method, device, equipment and computer storage medium
CN109118505A (en) * 2018-08-08 2019-01-01 福建天泉教育科技有限公司 The method of font trajectory calculation, storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7340689B2 (en) * 1999-12-08 2008-03-04 International Business Machines Corporation Method, system and program product for automatically modifying a display view during presentation of a web page
CN102496177A (en) * 2011-12-05 2012-06-13 中国科学院自动化研究所 Method for producing three-dimensional water-and-ink animation
CN103136515A (en) * 2013-02-06 2013-06-05 浙江大学 Creative inflection point identification method based on draft action sequence and system using the same
CN103455816A (en) * 2012-05-28 2013-12-18 阿里巴巴集团控股有限公司 Stroke width extraction method and device and character recognition method and system
US9715356B2 (en) * 2012-11-30 2017-07-25 Canon Kabushiki Kaisha Method, apparatus and system for determining a merged intermediate representation of a page

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7340689B2 (en) * 1999-12-08 2008-03-04 International Business Machines Corporation Method, system and program product for automatically modifying a display view during presentation of a web page
CN102496177A (en) * 2011-12-05 2012-06-13 中国科学院自动化研究所 Method for producing three-dimensional water-and-ink animation
CN103455816A (en) * 2012-05-28 2013-12-18 阿里巴巴集团控股有限公司 Stroke width extraction method and device and character recognition method and system
US9715356B2 (en) * 2012-11-30 2017-07-25 Canon Kabushiki Kaisha Method, apparatus and system for determining a merged intermediate representation of a page
CN103136515A (en) * 2013-02-06 2013-06-05 浙江大学 Creative inflection point identification method based on draft action sequence and system using the same

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
HONGBO FU等: "《Animated Construction of Line Drawings》", 《ACM TRANSACTIONS ON GRAPHICS》 *
马燕: "《细节增强的水墨扩散模拟》", 《计算机辅助设计与图形学学报》 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107705346A (en) * 2017-11-07 2018-02-16 中国石油大学(华东) A kind of hand-drawing image sequential adding method based on stroke length and spatial information
CN108038890A (en) * 2017-12-06 2018-05-15 广州视源电子科技股份有限公司 Vector diagram demonstration method, device, equipment and computer storage medium
CN109118505A (en) * 2018-08-08 2019-01-01 福建天泉教育科技有限公司 The method of font trajectory calculation, storage medium

Also Published As

Publication number Publication date
CN105447901B (en) 2019-08-27

Similar Documents

Publication Publication Date Title
JP6259928B2 (en) Lane data processing method, apparatus, storage medium and equipment
CN104484643B (en) The intelligent identification Method and system of a kind of handwriting table
CN105893925A (en) Human hand detection method based on complexion and device
CN108463823B (en) Reconstruction method and device of user hair model and terminal
CN105787522B (en) Handwriting-based writing attitude evaluation method and system
CN112614062B (en) Colony counting method, colony counting device and computer storage medium
JP2018514024A5 (en)
CN107766861A (en) The recognition methods of character image clothing color, device and electronic equipment
CN106446952A (en) Method and apparatus for recognizing score image
CN109902541B (en) Image recognition method and system
CN104794479B (en) This Chinese detection method of natural scene picture based on the transformation of local stroke width
CN106845321A (en) The treating method and apparatus of pavement markers information
CN109871829B (en) Detection model training method and device based on deep learning
CN103383731A (en) Projection interactive method and system based on fingertip positioning and computing device
CN106326860A (en) Gesture recognition method based on vision
CN111598175B (en) Detector training optimization method based on online difficult case mining mode
CN105426863A (en) Method and device for detecting lane line
CN106384355A (en) Automatic calibration method applied to projection interactive system
CN104851089A (en) Static scene foreground segmentation method and device based on three-dimensional light field
CN106295645A (en) A kind of license plate character recognition method and device
CN109670517A (en) Object detection method, device, electronic equipment and target detection model
CN106023271A (en) Method and device for extracting center coordinates of target
CN105447901A (en) Image processing method and image processing device
CN103699876A (en) Method and device for identifying vehicle number based on linear array CCD (Charge Coupled Device) images
CN108171229A (en) A kind of recognition methods of hollow adhesion identifying code and system

Legal Events

Date Code Title Description
C06 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