A kind of method and system that from digital picture, takes destination object
Technical field
The present invention relates to Flame Image Process and human-computer interaction technique field, particularly with computer mouse, or the touch-screen of electronic equipments such as mobile phone, IPad is as human-computer interaction device, to some interested object in the digital picture, after determining as the boundary profile of some privileged site (as head) region of personage or personage, only keep objects in this picture and remove remainder.
Background technology
People can have a large amount of digital pictures that comprises objects in daily life.Interested object can be some part, animal, fresh flower of personage, personage etc.For convenience of description, to be referred to as these interested objects be destination object for following part.Destination object in these pictures is taken out, obtain to be transparent digital picture around the destination object, it can be applied to many subsequent image processing occasions, includes but not limited to that computing machine cartoon image generates, several colour pictures are superimposed, the personage incorporates application such as generating animated video.
Take destination object from the original figure picture, a lot of image processing softwares all provide this type of function.But, the method that these image processing softwares of having deposited at present provide, or complex operation, general user is heavy in hand; The destination object boundary alignment is accurate, smooth when being difficult to accomplish to take, thereby also just is difficult to obtain the smooth end product of neat in edge.These methods can be divided into two big classifications:
A kind of is by pixel in the human-computer interaction device designation number picture, is set to transparent color according to the pixel in the certain limit around the specific criterion specified point.Described criterion mainly contains: (a) be the center of circle with the specified point, and all pixels in the border circular areas of given radius; (b) with all pixels of specified point color similarity.These class methods user operates succinctly, but but can't express and orient the border between the destination object and background in the image accurately, glossily, thereby makes that the destination object edge convex-concave that takes out is uneven, and pixel more or less.We can be referred to as these class methods and be " wiping method ".
Another kind is by human-computer interaction device, specifies the zone of a closure, then with within this enclosed region or outside be filled to transparent color, that is remove part outside the destination object.The key of this method is exactly how to utilize human-computer interaction device to determine enclosed region: (a) the simplest mode is exactly repeatedly to click on the border of destination object and background, and the some position (being node) that connects these clicks with straight line forms the closed polygon zone at last successively.Because this polygon is all by rectilinear(-al), therefore in order accurately to express the border of destination object and background, the line segment of some straight line just needs very short, so not only the operation element amount is big, and some human-computer interaction device probably can't differentiate overstocked click, and making can't complete operation; (b) other method becomes the straight line between 2 in (a) curve and further this curve shape of control exactly, makes it more accurately meet the border between destination object and background.The method of control curve shape mainly is the tangent line line segment (being called handle) of drawing the curve that links to each other with this node on each node at present, thereby by the slope and the length control curve shape of specifying this tangent line line segment, can be with reference to the operation of " pen " among the famous image processing software Photoshop.
As shown in figure 28, in Photoshop, select " pen tool " after, a mouse click left button on image, just can a newly-built node (also can be called anchor point), and then click in other place, will set up another new node, and connect with line segment (straight line) between them.If press left mouse button when setting up new node, do not unclamp mouse and drag mouse simultaneously, will generate handle, and with a last node of setting up before between be connected with curve.So-called handle is the outward extending straight line line segment of starting point exactly with the node, and this straight line line segment is the tangent line that is connected to the curve of this node, so the slope of handle and length are being controlled form parameter---the curvature and the trend of the curve that passes through this node.By dragging handle, change the slope of handle line segment and curvature and the trend that length just can be controlled curve.If a node is connecting two curves, two curve intersections just, this node will be outward extended with two handles so, and it can control the curve between this node and a last node and next node respectively.Any some a mouse click left buttons on two internodal straight lines or curve can increase new node, and a mouse click left button can be deleted this node on already present certain node.
In Photoshop, select " node edit tool " after, on already present node, press left mouse button and do not unclamp, drag and just can move this node and adjust the curve shape that links to each other with this node simultaneously.
In Photoshop, after the selection " convert point tool ", on already present node, press left mouse button and do not unclamp, just drag and can extend outward handle from this node.And on already present node a mouse click left button, can delete the handle at this node place, also can be described as the length of setting handle is zero.
From top explanation as can be seen, Photoshop is in destination object boundary profile deterministic process, and the required operation commonly used (comprise change straight line or curve shape, augment node, deletion of node, mobile node) of controlled target curve is to distinguish by the switching of mouse action mode.In the actual use of Photoshop, need three kinds of mouse action modes " pen tool ", " node edit tool " and " convert point tool " to switch back and forth at least; And the control curve shape is finished by handle among the Photoshop.Understanding and operating these all is very difficult for domestic consumer.
It is worthy of note, no matter use (a) or (b) which kind of method specify enclosed region, how also all exist another problem that need solve and be exactly after specifying enclosed region, insert new node and how to delete already present node.The answer that provides at present at this problem is: be to add nodal operation pattern, deletion of node operator scheme or change the curve shape pattern (i) by switching human-computer interaction device operator scheme specified device current, and can be with reference to the top related description of switching about mouse action mode among the Photoshop; (ii) using the double-click mouse to represent on computers is that new point of increase or deletion are had a few.Obviously, these two methods all make and are difficult for the working rule complexity understanding; Double-clicking action is difficult to grasp especially more difficult realization on the touch-screen of electronic equipments such as mobile phone to some user especially.
Summary of the invention
Purpose of the present invention is exactly at the method that the takes complicated operation of the destination object of prior art existence, is difficult for understanding and the relatively poor technical matters of effect, provide convenient, concisely, the method that takes of destination object in the digital picture image intuitively, make and not only can finish this Flame Image Process demand on computers, and on electronic equipments such as mobile phone, also can finish equally.
Another object of the present invention is to use the image processing system of said method.
Purpose of the present invention is achieved through the following technical solutions:
According to an aspect of the present invention, a kind of method that from digital picture, takes destination object, this method comprises:
Step 1, obtain the digital picture image that includes destination object;
Step 2, determine the destination object boundary profile, wherein, human-computer interaction device is set some nodes at described image object object bounds, connects described node by straight line or curve;
Part described in step 3, the removing digital picture outside the boundary profile;
Step 4, the image of the destination object in the described boundary profile is exported separately;
Wherein:
In the step 2, in the predetermined amount of time of setting,, and, make described straight line or curve form aim curve, to obtain the boundary profile of described destination object according to the final position that described human-computer interaction device moves by mobile described human-computer interaction device.
The further improved plan of the present invention is;
The aforesaid method that takes destination object, wherein, described human-computer interaction device is pressing more arbitrarily and dragging on straight line between two nodes of human-computer interaction device in the destination object border or the curve, away from described straight line or the certain distance of curve; When needing, human-computer interaction device is pressed and is dragged at already present node, moves this node and adjusts the shape of the line segment that links to each other with this node.
According to an aspect of the present invention, a kind of method that from digital picture, takes destination object, this method comprises:
Step 1, obtain the digital picture image that includes destination object;
Step 2, determine the destination object boundary profile, wherein, comprise step by step (1): human-computer interaction device destination object border in described image is provided with some nodes, connects these nodes by straight line or curve;
Part in step 3, the removing digital picture outside the destination object profile makes image only keep the destination object part that hope is obtained;
Step 4, the image that will only comprise destination object are exported separately;
Wherein: in the step 2, also comprise:
(2) step by step, human-computer interaction device directly acts in the predetermined amount of time of setting that straight line makes this straight line become aim curve between node, and/or in the predetermined amount of time of setting, directly act on its curvature of node half interval contour change itself, make this curve become aim curve, and/or keep straight line between node and constant;
(3) step by step judge whether the rectilinear form of aim curve shape and/or maintenance meets the destination object border, if do not meet the destination object border, then carry out (4) step by step; If meet the destination object border, still do not obtain the profile on the whole border of destination object as yet, then carry out (1) step by step again, if meet the destination object border, and the profile on the whole border of acquisition destination object, step 2 end;
(4) step by step, in the predetermined amount of time of setting, whether move realization according to this human-computer interaction device and augment node, original two internodal line segments are divided into two, and/or deletion of node, if this node is connected with two line segments, then they merge becomes straight line or curve, has only a line segment if this node links to each other, then delete this line segment, thereby and/or adjust the shape that already present node location is adjusted the line segment that links to each other with this node, execution (2) step by step more afterwards.
The further improved plan of the present invention is;
The aforesaid method that takes destination object, wherein, step by step in (2), move described human-computer interaction device, straight line between two nodes in the direct drag target object of human-computer interaction device or the arbitrfary point on the curve, away from described straight line or the certain distance of curve, form the curve of the curvature before being different from thus.
The present invention's step improved plan again is;
The aforesaid method that takes destination object, wherein, in (4), human-computer interaction device keeps motionless in the predetermined amount of time of a bit pressing arbitrarily and setting in the middle of straight line between two nodes or the curve, then insert new node in the position of pressing a little step by step; Human-computer interaction device keeps motionless in the predetermined amount of time of pressing on the already present node and setting, then delete this node; In the predetermined amount of time of setting, human-computer interaction device is pressed and is dragged at already present node, realizes the position adjustment of this node.
According to an aspect of the present invention, a kind of method that from digital picture, takes destination object, this method comprises:
Step 1, obtain the digital picture image that includes destination object;
Step 2, determine the profile on the whole border of destination object, comprising:
(1) step by step, human-computer interaction device destination object border in described image is provided with some nodes, connects these nodes by straight line or curve;
Part in step 3, the removing digital picture outside the profile on the whole border of destination object makes image only keep the destination object part;
Step 4, the image that will only comprise destination object are exported separately;
It is characterized in that: step 2 also comprises:
(2) step by step carry out following any one operation, in the hope of obtaining to meet more the profile on the whole border of destination object:
(a) at the additional new node of sequence node afterbody, with straight line or curve connect should newly-increased node and before
One node;
(b) straight line becomes and is aim curve between node;
(c) the node half interval contour changes self curvature, it is become be aim curve;
(d) on straight line between node or curve, insert new node, break it into two;
(e) move already present node, adjust straight line or curve shape that this node links to each other simultaneously;
(f) delete already present node, connect the node of these node both sides simultaneously with straight line;
(g) the borderline sequence node of closed destination object becomes the profile on the whole border of destination object;
This step by step in, press and depressed position by human-computer interaction device according to 1. this human-computer interaction device, 2. whether this human-computer interaction device moves in the predetermined amount of time of setting, and 3. whether the borderline sequence node of destination object is closed, carries out an operation among (a) and (b), (c), (d), (e), (f), (g) respectively;
Step by step (3), judge the destination object border obtained: if obtained to meet fully the profile on the whole border of destination object, then step 2 is finished; If there is not to obtain to meet fully the profile on the whole border of destination object, then carry out again (2) step by step, until the profile that obtains to meet fully the whole border of destination object.
The further improved plan of the present invention is;
The aforesaid method that takes destination object, wherein,
Step by step (2) (a) in, do not have under the closed situation at the borderline sequence node of destination object, existing between node and node the position outside the line segment to press human-computer interaction device, increase described new node;
Step by step (2) (b) in, shift position in the predetermined amount of time that human-computer interaction device is being set after impact point is pressed arbitrarily on the internodal straight line, human-computer interaction device directly drags straight line makes this impact point leave the certain distance of original straight line, thus this straight line is become aim curve;
Step by step (2) (c) in, shift position in the predetermined amount of time that human-computer interaction device is being set after impact point is pressed arbitrarily on the internodal curve, human-computer interaction device directly drags curve makes this impact point leave the certain distance of original curve, forms the aim curve of the curvature before being different from thus;
Step by step (2) (d) in, human-computer interaction device keeps motionless in the predetermined amount of time that arbitrarily impact point is pressed and set on straight line between two nodes or the curve, then insert described new node in the position of the impact point of pressing;
Step by step (2) (e) in, human-computer interaction device is being pressed on the already present node and is being moved in the predetermined amount of time of setting, the impact point after moving according to human-computer interaction device is adjusted the position of described node;
Step by step (2) (f) in, human-computer interaction device is carried out the operation of described deletion of node pressing on the already present node and keep motionless in the predetermined amount of time of setting;
Step by step (2) (g) in, do not have under the closed situation at the borderline sequence node of destination object, press human-computer interaction device existing on the first node of sequence node,, carry out described closed procedure with last node and the first node of straight line or curve connected node sequence.
According to another aspect of the present invention, a kind of image processing system is used for taking destination object from the digital picture image, and this system comprises:
Document input apparatus is used to import the original figure picture file that includes destination object;
The graph image display, it shows the digital picture of input, and can express the process status of carrying out Flame Image Process with this by the display graphics element;
Human-computer interaction device, it can represent the position of indication point on the digital picture of input, can carry out to press and unclamp two actions, indication point position and action message are gathered, and are converted into electric signal input center processor; In the predetermined amount of time of setting, on straight line between two nodes on the direct drag target object bounds of human-computer interaction device or the curve more arbitrarily, away from described straight line or the certain distance of curve, form the aim curve of the curvature before being different from thus;
Center processor, the signal of the human-computer interaction device that receives by processing carries out destination object and extracts operation on described digital picture;
This center processor comprises human-computer interaction device indication point position calculation unit and human-computer interaction device action receiving element, two actions are pressed, unclamped to the indication point current location situation and the perception human-computer interaction device that are used to calculate human-computer interaction device, comes definite process of controlled target object bounds profile by these information; This center processor also comprises timer unit, is used to calculate the time length that pressing of human-computer interaction device do not put, definite process of coming controlled target object bounds profile by the timing of this timer;
File outputting mean is used for the digital image file of the destination object that output processor extracts.
Further improved technical scheme of the present invention is:
Aforesaid image processing system, wherein, human-computer interaction device can be in the middle of the line segment between two nodes presses on a bit arbitrarily and keep motionless in the predetermined amount of time of setting, and this time period is controlled by described timer; Insert new node in the position of pressing a little, original two internodal line segments are divided into two; In addition, human-computer interaction device can also keep motionless in the predetermined amount of time of pressing on the already present node and setting, and this time period is controlled by described timer; Then delete this node, if this node is connected with two line segments, they merge so becomes straight line; Have only a line segment if this node links to each other, delete this line segment so.
The present invention's improved technical scheme of a step again is:
Aforesaid image processing system, wherein, human-computer interaction device can pressed and drag in the predetermined amount of time of setting on the already present node, moves this node and adjusts the shape of the line segment that links to each other with this node.
As can be seen, compare with prior art from such scheme, the present invention has following advantage:
1. the user is simple to operate, directly perceived, can obtain good effect simultaneously.
A. human-computer interaction device is directly controlled curve shape, has higher naturality, is convenient to the user and understands;
B. whether move in the predetermined amount of time of setting by human-computer interaction device and distinguish different operator schemes, avoided the frequent switching of mode of operation in the existing method, thereby improved the efficient of whole operation process;
C. the same with the method for intended target object bounds profile enclosed region in the existing technologies, compare " wiping method " and make that all the destination object edges of regions that keeps is neat, smooth and accurate, guaranteed the preferable effect that takes.
2. the method among the present invention does not require human-computer interaction device support double-click.Make this demand being met in the electronic equipment widely like this, such as the mobile phone that has touch-screen.
Description of drawings
Fig. 1 is the block diagram of image processing system basic structure;
Fig. 2 takes the basic procedure block diagram of target to picture;
Fig. 3 is that human-computer interaction device is arbitrarily a bit pressed to drag on straight line between node and made this straight line become the synoptic diagram of curve;
Fig. 4 is the synoptic diagram that increases node on straight line between node;
Fig. 5 is the synoptic diagram that is become straight line behind the deletion of node by curve;
Fig. 6 is the process flow diagram that takes the concrete processing procedure of destination object, and the RJ device is meant human-computer interaction device among the figure;
Fig. 7 is that human-computer interaction device is pressed the back and the sub-process figure of timer compounding practice among Fig. 6, i.e. the specific implementation block diagram of S41, S42, S43, S44, S45, S46 among Fig. 6, and the RJ device is meant human-computer interaction device among the figure;
Fig. 8 is an original figure picture of preparing to take little girl's face and hair (being called head portrait);
Fig. 9 is two node A and the B and the line segment AB between them of initial appointment;
Figure 10 is that the C on line segment AB drags, and makes line segment become curve;
Figure 11 is that the C ' on line segment AB drags, and adjusts its shape;
Figure 12 specifies the D node
Figure 13 is that the E on line segment BD drags, and makes line segment become curve;
Figure 14 is that the F point on line segment BD adds new node, and partition BD is BF and FD;
Figure 15 drags node F
Figure 16 is that certain point on line segment BF drags, and adjusts its shape;
Figure 17 adds a plurality of nodes successively and connects line segment around the head portrait edge;
Figure 18 drags on above-mentioned line segment successively, makes line segment become curve and adjusts its shape;
Figure 19 is deletion of node I
Figure 20 is that certain point on line segment HJ drags, and adjusts its shape;
Figure 21 is that line segment is connected to first node, obtains enclosed region;
Figure 22 is that certain point on line segment NA drags, and makes line segment become curve, thereby adjusts the enclosed region shape;
Figure 23 drags the K node, thereby adjusts the enclosed region shape;
Figure 24 is that the filling enclosed region is transparent (black is represented);
Figure 25 is to egress W, X, Y, Z;
Figure 26 is that Z is connected to W acquisition enclosed region and adjusts the enclosed region shape;
Figure 27 is that the filling enclosed region is transparent, obtains final process result;
Figure 28 is the method for controlled target object bounds contour curve among the Photoshop.
Embodiment
Core concept of the present invention is: provide some nodes on the border by human-computer interaction device destination object in the digital picture image and connect adjacent node with straight line; Thereby the shape of adjusting this straight line or curve is being pressed and moved to human-computer interaction device on any arbitrarily on straight line between the node or the curve in the predetermined amount of time of setting; Human-computer interaction device is pressed and is dragged in the predetermined amount of time of setting at already present node, moves this node and adjusts the shape of link to each other with this node straight line or curve.Inserting new node on straight line or the curve and deleting the node that has existed all is to press the back by human-computer interaction device and keep motionless the realization in the predetermined amount of time of setting, abandon that the human-computer interaction device operator scheme is switched or common mode at present such as double-click, make this determine that the process of destination object boundary profile can link up, intuitively more.
Following description is to be used to make those of ordinary skills can realize and use the present invention.Therefore, below explanation is provided and has described for the instructions of embodiment according to the invention, rather than exhaustive or limit the present invention to disclosed precise forms.To those skilled in the art, the various modifications of disclosed embodiment all are conspicuous, and the principle of following elaboration can be applied to other embodiment and application program.For example, although reference flow sheet has been described a series of actions, when the execution of an action did not rely on finishing of another action, this action can directly be finished.In addition, separate action can be carried out side by side.And in the description of embodiment, the item that does not add the quantity modification comprises one or more, for example " deletion of node " refers to that promptly the node of deleting comprises one or more situations, " straight line or curved segments ", promptly refer to comprise the situation of one or more straight line or curved segments, or the like.Under the situation that an item is only arranged, can use " one " or similar language.Therefore, the embodiment shown in the present invention is not limited to.
The following noun of using among the present invention, concrete implication is defined as:
(1) human-computer interaction device: include but not limited to computer mouse, or the touch-screen of electronic equipments such as mobile phone, notebook computer.
(2) destination object: show in the fixed digital picture image, the area part that wish to keep is such as the personage or only be personage's the occupied area part of some privileged site (as head);
(3) background area: refer in same given digital picture image, remove described in (2)
Destination objectOther area part;
(4) take: refer in same given digital picture image, will
The background areaPixel is filled to transparent color, and keeps simultaneously
Destination objectThe constant operating process of pixel.
(5) on XXX, press: when the indication point that refers to human-computer interaction device is positioned on the XXX, press human-computer interaction device.Such as, computer mouse is promptly put down mouse button, and touch-screen promptly touches touch-screen with finger; XXX is arbitrary target point or the already present node on straight line line segment or the curved segments, down together.
(6) click: refer to after pressing human-computer interaction device on the digital picture image, unclamp in a short period of time.Such as, the computer mouse key of promptly clicking the mouse
(specifically using which mousebutton to preestablish),Touch-screen promptly touches certain a bit with finger;
(7) on XXX, click: when the indication point that refers to human-computer interaction device is positioned on the XXX, carry out
ClickOperation.
(8) pin: refer to after pressing human-computer interaction device on the digital picture image, in the long time, not unclamp all the time.Such as, computer mouse is promptly put down behind the mouse button and is pinned, and touch-screen promptly touches with finger and rests on the touch-screen all the time;
(9) drag: refer to that pressing human-computer interaction device on the digital picture image does not unclamp, the indication point of mobile human-computer interaction device unclamps human-computer interaction device after mobile the finishing simultaneously.Promptly put down behind the mouse button and pin rolling mouse simultaneously such as, computer mouse, touch-screen promptly touches with finger and keeps touching the while moveable finger.
For making the purpose, technical solutions and advantages of the present invention clearer, the present invention is described in more detail below in conjunction with embodiment.
Fig. 1 has illustrated the block diagram of image processing system basic structure of the present invention, has embodied image processing system of the present invention.Among this figure, document input apparatus 2 is used to import the file that comprises destination object original figure picture, center processor 4 is used for the control of entire process process, its inside comprises timer unit, human-computer interaction device indication point position calculation unit and action receiving element, human-computer interaction device 6 is to center processor 4 inputting user commands, the topmost position that to represent indication point that is characterised in that of this device, can carry out and press and unclamp two actions, dynamic storage 10 is storeies of temporarily storing data in order to carry out various processing in center processor 4 or storing the document image that is read in by document input apparatus 2, graph image display 12, it is showed by human-computer interaction device 6 inputs, the process that center processor 4 control takes destination object, file outputting mean 14 are to be used to export the image that takes behind the destination object.Using method of the present invention in this system can extract destination object from digital picture.
Fig. 2-Fig. 6 has described the embodiment of the method for the invention.With reference to Fig. 2, the basic procedure block diagram that takes target to picture of the present invention is described.At step R71, input needs the picture of processing, and the form of picture can be typical number word image file layouts such as JPEG, PNG, GIF, BMP.Determine interested contours of objects in the picture at step R72.In this step, main consideration utilizes human-computer interaction device " to delineate " boundary profile that goes out object.Wherein, the boundary profile of object is located by a plurality of nodes.The location of these a plurality of nodes can freely be set, and the initial number of node is unimportant at this because node can be neatly by additional, deletion with insert, but and repeated multiple times, in the description of back, will further launch explanation to this.At step R73, the part outside the profile is removed, only keep the destination object that hope obtains.At step R74, the image that only comprises destination object is exported separately, save as target image, the form of image can be PNG, PSD etc.This target image can further be used to other purposes.
With reference to figure 3, determine in the process of object bounds profile, further comprise change and control to straight line between node and curve shape.Shown in Fig. 3 (a), node A initially is connected with straight line with Node B.Curvature between needs change point A, B, when it is become curve and makes it more to meet the destination object border, human-computer interaction device (position is shown in thick the arrow icon) is pressed on any impact point on the straight line, some C as Fig. 3 (a), the mode of wherein pressing has different implications according to different concrete devices, for example can be defined as any one button of mouse.In the predetermined amount of time thresTime that sets, drag then and leave the certain distance of straight line AB, as moving along direction M among the figure.Can see that some C drive straight line AB becomes curve and follows thick arrow all the time and move together, when unclamping human-computer interaction device, straight line AB has been changed to a curve A CB (shown in Fig. 3 (b)).Can certainly sharp on the basis of curve, continue to change its curvature in the same way, become big or dwindle with certain curvature.The information that the human-computer interaction device indication point moves sends center processor to, center processor follow the tracks of at any time, calculate the coordinate that can obtain indication point C (Xc, Yc), together with the A point coordinate (Xa, Ya) and the B point coordinate (Xb, Yb), just can pass through following formula:
XControl=Xc*2-(Xa+Xb)/2
YControl=Yc*2-(Ya+Yb)/2
The reference mark coordinate of calculating second order Bei Saier curve (XControl, YControl).Afterwards, center processor is promptly drawn A (Xa, Ya) point, a B (Xb on the graph image display, Yb) be end points, (XControl YControl) is the Bei Saier curve at reference mark to point, and this curve promptly is identified as the boundary profile of the destination object between the node AB.
If human-computer interaction device selects an already present node as impact point, human-computer interaction device is pressed and is dragged in the predetermined amount of time thresTime that sets, and adjusts shape with moving this node and driving the straight line or the curved segments that link to each other with this node.
Determine further to comprise control in the process of object bounds profile, can add node and deletion of node arbitrarily number of nodes.
With reference to figure 4 (a), if add node, human-computer interaction device any impact point on the internodal straight line of AB is pressed, and the mode of pressing has different implications according to different concrete devices.Human-computer interaction device is pressed action and is received by processor, and this moment, timer picked up counting, and calculated the time that does not put of pinning.Simultaneously, the position signalling of human-computer interaction device is also received by processor.The human-computer interaction device indication point never has the shift position in the predetermined amount of time thresTime that sets, then add new node in the impact point position of pressing, as Fig. 4 (b); What Fig. 4 represented is the situation that increases node between the node on the straight line, and in fact this straight line also can be a curve, can increase node on curve between the node.
If the human-computer interaction device indication point has moved the position in the predetermined amount of time thresTime that sets, then stop the timer timing, enter the operating process of top change node half interval contour shape shown in Figure 3.
With reference to figure 5 (a), if delete already present node C, human-computer interaction device is pressed on already present node C; Human-computer interaction device is pressed actuating signal and is received by processor, and this moment, timer picked up counting, and calculated the time that does not put of pinning; Simultaneously, the position signalling of human-computer interaction device is also received by processor.The human-computer interaction device indication point never has the shift position in the predetermined amount of time thresTime that sets, then can delete the node of being pinned; If this node is connected with two line segments, their merge so becomes the straight line line segment, as Fig. 5 (b), if this node link to each other have only a line segment, delete this line segment so; Fig. 5 represents is situations that this node is deleted when being curve in deleted node both sides, and in fact these node both sides can be curves, also can be straight lines.
If human-computer interaction device indication point (node of being pinned) has moved the position in the predetermined amount of time thresTime that sets, promptly stop the timer timing, the straight line or the curve that begin to drag this node and drive the node both sides are adjusted shape.
From top explanation as can be seen, add in this patent and deletion of node is by judging that human-computer interaction device presses and keep the static predetermined amount of time that whether reaches setting to finish, so do not need as Photoshop, to carry out the switching of operator scheme; In addition, straight line or curve shape are directly pinned straight line or curve and are dragged by human-computer interaction device and realize between Control Node, and therefore operation is directly perceived and easy more.
With reference to figure 6, be the process flow diagram that takes the concrete processing procedure of destination object.It should be noted that wherein the specific implementation of step S41, S42, S43, S44, S45, S46 all sees Fig. 7 for details, Fig. 7 is the sub-process figure that human-computer interaction device is pressed back and timer compounding practice.
In Fig. 6, import original digital picture image file after, on the border of destination object, set some nodes.Except first node, in the time of node of every increase, connect this newly-increased node and the node of setting before with straight line or curve.Concrete operations are exactly to exist between node and node the position outside the line segment to press human-computer interaction device, carry out the S43 operation, and with reference to figure 7, T10 → T41 → T42 → T43 → T50 execution route is promptly represented the concrete operations of additional node among the S43.Perhaps, have some nodes, but the destination object border does not have under the closed situation, on already present first node, press human-computer interaction device, carry out the S43 operation, with reference to figure 7, T10 → T41 → T44 → T45 → T50 execution route is promptly represented the concrete operations on closed border among the S43, carrying out this operation, with last node and the first node of straight line or curve connected node sequence, is profile with destination object border closure then.
As mentioned above, if straight line that connects between already present some nodes or curve can not meet the destination object border closely, then need to make it meet the border of destination object more these straight line or curve change shape formation aim curve.Concrete operations be exactly on straight line or curve arbitrary impact point press the operation that human-computer interaction device carries out S41 or S42, with reference to figure 7, T10 → T41 → T44 → T11 → T12 → T16 → T18 → T20 → T22 → T50 execution route is promptly represented the concrete operations of S41 or S42.T16 → T18 → T20 → T22 represents that human-computer interaction device has moved the position in the predetermined amount of time thresTime that sets, changing straight line according to Fig. 3 (a) shown in (b) is aim curve, perhaps original curve is changed into aim curve, certainly can also continue repeatedly to change the curvature (shape) of aim curve, till making this curve ratio meet the destination object border preferably.If it is all undesirable to adjust the aim curve shape in any case, then need this section curve is divided into two, promptly carrying out the S44 operation according to the previously described method of on the node half interval contour, inserting new node on this section curve.With reference to figure 7, T10 → T41 → T44 → T11 → T12 → T16 → T26 → T28 → T30 → T32 → T50 execution route is promptly represented the concrete operations of S44.T26 → T28 → T30 → T32 represents that human-computer interaction device never has the shift position in the predetermined amount of time thresTime that sets, insert new node and split original straight line or curve in the impact point position of pressing.Afterwards, if the border that new straight line that splits or curve can not meet destination object then needs to repeat operation S41, the S42 that changes rectilinear form or curve shape.
If in the node that has existed, certain node does not have the value of existence, then needs to delete this node.Concrete operations are exactly to press the operation that human-computer interaction device carries out S45 on this node, and with reference to figure 7, T10 → T41 → T44 → T11 → T12 → T16 → T26 → T28 → T30 → T34 → T50 execution route is promptly represented the concrete operations of S45.T26 → T28 → T30 → T34 represents that human-computer interaction device never has the shift position in the predetermined amount of time thresTime that sets, delete this node and connect the node of these node both sides with straight line or curve, afterwards, if the border (most situations all are such) that new straight line that connects or curve can not meet destination object then needs to repeat operation S41 or the S42 that changes straight line or curve shape.If deleted node has only a side to have node, then delete this line segment that links to each other with deleted node simultaneously.
If in the node that has existed, certain node accurately is not set on the destination object border, then need to move this node, concrete operations are to press the operation that human-computer interaction device carries out S46 on this node, with reference to figure 7, T10 → T41 → T44 → T11 → T12 → T16 → T18 → T20 → T24 → T50 execution route is promptly represented the concrete operations of S46.T16 → T18 → T20 → T24 represents that human-computer interaction device has moved the position in the predetermined amount of time thresTime that sets, according to the shape of this node location of mobile adjustment of human-computer interaction device and the line segment that is connected with this node.
Afterwards, judge whether the rectilinear form of aim curve shape and/or maintenance meets the destination object border,, then carry out S41 and/or S42 if do not meet the destination object border; If meet the destination object border, but do not obtain the profile on the whole border of destination object as yet, then carry out S43 again, if meet the destination object border, and obtain the profile on the whole border of destination object, then use in the Flame Image Process conventional filling algorithm to remove pixel outside the boundary profile, obtain to export after the digital picture of surplus destination object only.
Above-described method is to have comprised several situations: (1) finishes one by one when one by one node being set that straight line makes this curve closely meet the border of destination object to the change of curve between node; (2) straight-line segment or segment of curve are finished the unified again change of finishing curve shape after the sealing; (3) above-mentioned two kinds of modes uses with.
Utilize an embodiment that above-mentioned embodiment is further detailed below.Among this embodiment, the mouse that uses a computer is as human-computer interaction device, and it is pressed and unclamp action and all is defined as the operation of carrying out at left mouse button; Its indication point is mouse and is presented at mouse pointer point on the computer screen.By the mutual process of person of good sense's machine concerning the sequential operation of piece image, taking the destination object in the digital picture image (as shown in Figure 8)---personage's head portrait part comprises girl's face and hair.
Below provided the user and carried out the concrete steps that the personage takes operation according to the method that illustrates among the present invention:
1. the left button of in the digital picture image, clicking the mouse on the arbitrfary point at head portrait edge, thus determine first node A, as shown in Figure 9;
2. in the digital picture image on the head portrait edge, the bottom-right B point that A is ordered is clicked the mouse and is formed straight line line segment AB behind the left button, as shown in Figure 9;
3. certain on line segment AB point C presses left mouse button and drags immediately, line segment AB can be dragged the curve that becomes through 3 of ACB, as shown in figure 10.This curve is the second order Bei Saier curve through 3, and concrete computing formula front illustrates, does not repeat them here.Pin and drag the back and decontrol left mouse button;
4. certain on line segment AB point C ' (may overlap with the C point in the preceding step, also may not overlap) presses left mouse button and drags immediately, line segment AB can be dragged the curve that becomes through 3 of AC ' B, as shown in figure 11.
5. in the digital picture image on the head portrait edge, the D of the lower left that B is ordered point is clicked the mouse and is formed straight line line segment BD behind the left button, as shown in figure 12;
6. certain on line segment BD point E presses left mouse button and drags immediately, line segment BD can be dragged the curve that becomes through 3 of BED, as shown in figure 13.Pin and drag the back and decontrol left mouse button;
7. certain on line segment BD point F (may overlap with the E point in the preceding step, also may not overlap) presses left mouse button and keeps motionless a period of time (being defined as thresTime), line segment BD can be divided into BF and two curved segments of FD, as shown in figure 14;
8. press left mouse button and drag on a F, transfer point F has changed line segment BF and FD simultaneously, as shown in figure 15;
9. the point of certain on line segment BF is pressed left mouse button and is dragged immediately, and line segment BF can be dragged becomes back relieving left mouse button as shown in figure 16;
10. in the digital picture image, on the head portrait edge, click G, H, I, J, K, L, M1, M2...M21, N point successively, form line segment DG, GH, HI, IJ, JK, KL, LM1, M1M2...M21N as Figure 17;
11. line segment DG, GH, HI, IJ, JK, KL, LM1, M1M2...M21N are dragged into curve with the method for step 3, as shown in figure 18;
12. on an I, press left mouse button and keep motionless a period of time (being thresTime equally), can and form straight line line segment HJ with an I deletion, as shown in figure 19;
13. line segment HJ is dragged into curve with the method for step 3, as shown in figure 20;
The left button 14. click the mouse on an A forms line segment NA, so line segment AB, BF, FD, DG, GH, HI, IJ, JK, KL, LM1, M1M2...M21N, NA crowd around into a zone.In the present embodiment, the reference picture image center, if central point in the zone of crowding around, enclosed region is just chosen the part except crowding around the zone in the digital picture image so; If central point is outside the zone of crowding around, enclosed region is just chosen the part of crowding around within the zone so.As shown in figure 21;
15. the method with step 3 drags line segment NA one-tenth curve, thereby changes the enclosed region shape, as shown in figure 22;
16. press left mouse button and drag on a K, transfer point K has changed line segment JK and KL simultaneously, thereby changes the enclosed region shape, as shown in figure 23;
17. filling enclosed region is transparent color, in the present embodiment, Transparent color is represented with black.As shown in figure 24.The method of filling enclosed region is the known technology of this area, such as sweep trace region-filling algorithm, the water law seed region filling algorithm that overflows, does not repeat them here.
18. if personage's head portrait that take acquisition this moment is as shown in figure 27, the border is neatly accurate, finish so to take process, jump to step 22, output finally takes the result; If there is unnecessary non-head portrait part in some position, border,, then carry out the 19-21 step as arrow indication among Figure 24.
The left button 19. click the mouse successively on the digital picture image is determined some W, X, Y, Z, forms line segment WX, XY, YZ.As shown in figure 25;
The left button 20. click the mouse on a W forms line segment ZW, so line segment WX, XY, YZ, ZW crowd around into a zone, and be defined as enclosed region.Use the method for step 3 then, adjust the curve that line segment WX becomes coincidence boundary, as shown in figure 26;
21. filling enclosed region is transparent color, personage's head portrait that acquisition takes, as shown in figure 27.Transfer to step 18.
22. personage's head portrait that output finally takes.
Need illustrate that determine that in the end line segment surrounds regional relation (crowding around intra-zone or outside in other words) between enclosed region and all nodes, the central point of reference number picture head portrait only is a best illustration of the present invention, is not restriction.
When application is of the present invention, can be according to different actual conditions, different thresTime parameters is set whether determines click at certain node that has existed, perhaps whether on certain line segment that has existed, specifically be set in the present embodiment with different standards:
A) setting thresTime is 0.5 second;
B) distance between left mouse button clicking point and the judging point represents promptly that smaller or equal to 3 pixels click is on this judging point;
C) minimum distance represents promptly that smaller or equal to 3 pixels click is on this line segment between left mouse button clicking point and the judgement line segment.
Description by the foregoing description, the method of determining node half interval contour line segment shape among the present invention is simple relatively, thereby the operation that has promoted common user is effectively experienced in real time, can make things convenient for, finish the operation that takes destination object efficiently, and the present invention can be used for multiple electronic installations such as computing machine, mobile phone.
Each step of the present invention, those of ordinary skill in the art can both be by the realization that programs.
The above only is preferred embodiment of the present invention; not in order to restriction the present invention; except that portrait; fresh flower, vehicle, animal and all have the extraction of the destination object of shape all can use this method; within the spirit and principles in the present invention all; any modification of being done, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.