CN101430794B - Method and apparatus for implementing arbitrary clipping effect - Google Patents

Method and apparatus for implementing arbitrary clipping effect Download PDF

Info

Publication number
CN101430794B
CN101430794B CN2008102396686A CN200810239668A CN101430794B CN 101430794 B CN101430794 B CN 101430794B CN 2008102396686 A CN2008102396686 A CN 2008102396686A CN 200810239668 A CN200810239668 A CN 200810239668A CN 101430794 B CN101430794 B CN 101430794B
Authority
CN
China
Prior art keywords
path
image object
zone
scissors action
border
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.)
Expired - Fee Related
Application number
CN2008102396686A
Other languages
Chinese (zh)
Other versions
CN101430794A (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.)
Peking University Founder Group Co Ltd
Beijing Founder Electronics Co Ltd
Original Assignee
Peking University Founder Group Co Ltd
Beijing Founder Electronics 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 Peking University Founder Group Co Ltd, Beijing Founder Electronics Co Ltd filed Critical Peking University Founder Group Co Ltd
Priority to CN2008102396686A priority Critical patent/CN101430794B/en
Publication of CN101430794A publication Critical patent/CN101430794A/en
Application granted granted Critical
Publication of CN101430794B publication Critical patent/CN101430794B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Image Analysis (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The invention discloses an implementation method of a random tailoring effect by scissors and a device thereof, and belongs to the technical field of graphics and image processing, and solves the problems that a random tailoring path can not be supported and the actual scissors actions can not be stimulated when segmenting images in the prior art. The implementation method of the random tailoring effect by the scissors comprises the following steps: applying the scissors to an image object; acquiring a scissors action path and boundary data of the image object; computing a region formed by tailoring according to the scissors action path and the boundary data of the image object; and forming a new image object after tailoring according to the range of the region.

Description

The implementation method of arbitrary clipping effect and device
Technical field
The present invention relates to the graph and image processing technology, particularly a kind of implementation method of scissors effect and device.
Background technology
Along with the continuous development of graph image software engineering, the user no longer is satisfied with and draws lines, enters simple functions such as image, but needs specific functions such as cutting lines and image.These specific functions are exactly the scissors effect.
The object that scissors acted on has two kinds of closed border object and non-closed border objects, and wherein, closed border object is for the lines that do not have the head and the tail point or be the image of monoblock, shown in first width of cloth figure among Fig. 1; Non-closed border is the lines that the head and the tail point is arranged, shown in first width of cloth figure among Fig. 2.
The scissors effect roughly can be divided into two kinds: cut off and cut apart.Cut-out is similar in the life scissors and cuts single line, and it can only act on lines, and application point is a frontier point of object; After the cut-out, former closed border will be opened (as Fig. 1) at position of action point, and will break at position of action point in former non-closed border is two sections (as Fig. 2).Cut apart and be similar in the life scissors and cut a piece of paper, it can act on lines, can act on the monoblock image again, and application point is that whole piece is cut out the path; After cutting apart, according to the intersection point situation of cutting out path and object bounds, results's (as Fig. 3, this figure is sub-piece effect) such as slit, hole or sub-piece will appear in former closed border, will break at position of intersecting point and be multistage (as Fig. 4) in former non-closed border.
At present, the software that contains the scissors function can be realized the effect cut off still, wherein have only minority software can realize the effect of cutting apart, and the effect of split image being comparatively simple.The method that its realization is cut apart is: 2 of agreement start-stops realize the cut-out on border earlier all in image boundary on these 2, and then the use connecting line will be closed respectively by two zones of cutting, thereby realize cutting apart of entire image.
For above-mentioned dividing method, there are a plurality of intersection points if cut out path and image boundary, and cutting out path self has when intersection point, it just can not realize segmentation effect preferably, therefore, in realizing process of the present invention, the inventor finds that there are the following problems at least in the prior art: during split image, can not support to cut out arbitrarily the path, really the scissor action in the simulating reality.
Summary of the invention
Embodiments of the invention provide a kind of implementation method and device of arbitrary clipping effect, and it can support to cut out arbitrarily the path when split image.
For achieving the above object, embodiments of the invention adopt following technical scheme:
A kind of implementation method of arbitrary clipping effect comprises:
Utilize scissors action in image object;
Obtain the data boundary of scissors action path and described image object;
According to the data boundary of described scissors action path and image object, calculate the zone of cutting out formation;
According to the scope in described zone, form the new image object after cutting out;
Wherein, the described calculating zone of cutting out formation comprises:
Calculate the formed zone of the part in the image object bounds, described scissors action path;
Calculate the part of described scissors action path in the image object bounds and described image object border the common zone that forms;
The formed zone of the part in the image object bounds, the described scissors action of described calculating path comprises:
For the part of described scissors action path in the image object bounds, disconnect from the intersection point place at it;
Collect scissors action path each section in the image object bounds after disconnecting;
Calculate each section of described scissors action path and surround Minimum Area in the zone;
Wherein, described Minimum Area is zone that the wall scroll closed path surrounds in the enclosed region, not subdivisible;
The part of the described scissors action of described calculating path in the image object bounds and described image object border the common zone that forms, comprising:
Obtain the intersection point quantity on described scissors action path and image object border;
According to described intersection point quantity, calculate the part of described scissors action path in the image object bounds and described image object border the common zone that forms.
A kind of implement device of arbitrary clipping effect comprises:
Cut out the unit: be used to utilize scissors action in image object;
Data boundary acquiring unit: the data boundary that is used to obtain scissors action path and described image object;
First computing unit: be used for data boundary, calculate the zone of cutting out formation according to described scissors action path and image object;
Form the unit: be used for scope, form the new image object after cutting out according to described zone;
Wherein, described first computing unit comprises:
Internal compute unit: be used to calculate the formed zone of the part in the image object bounds, described scissors action path;
Periphery computing unit: the zone that is used to calculate the part of described scissors action path in the image object bounds and the common formation of described image object border institute;
Described internal compute unit comprises:
Switching units: be used for disconnecting from the intersection point place at it for the part of described scissors action path in the image object bounds;
Collector unit: be used to collect scissors action path each section in the image object bounds after the disconnection;
Second computing unit: the Minimum Area that is used for calculating zone that each section surrounds, described scissors action path;
Wherein, described Minimum Area is zone that the wall scroll closed path surrounds in the enclosed region, not subdivisible;
Described peripheral computing unit comprises:
Intersection point quantity obtains the unit: the intersection point quantity that is used to obtain described scissors action path and image object border;
The 3rd computing unit: be used for according to described intersection point quantity, calculate the part of described scissors action path in the image object bounds and described image object border the common zone that forms.
In the embodiment of the invention, at first utilize scissors action in image object, obtain the data boundary of scissors action path and described image object then, again according to the data boundary of described scissors action path and image object, the zone of formation is cut out in calculating, according to the scope in described zone, form the new image object after cutting out at last.The present invention calculates the zone of cutting out formation according to cutting out action path, is not therefore cut out the restriction of action path, can support to cut out arbitrarily the path.
Description of drawings
Fig. 1 is the effect synoptic diagram that closed border object cuts off;
Fig. 2 is the effect synoptic diagram that non-closed border object cuts off;
The effect synoptic diagram that Fig. 3 is cut apart for closed border object;
The effect synoptic diagram that Fig. 4 is cut apart for non-closed border object;
Fig. 5 is the schematic flow sheet of the inventive method;
Fig. 6 is the schematic flow sheet of step 503 in the method shown in Figure 5;
Fig. 7 is the schematic flow sheet of step 601 in the method shown in Figure 6;
Fig. 8 is 0 o'clock segmentation effect synoptic diagram for scissors action path in the inventive method and image object border intersection point quantity;
Fig. 9 is 1 o'clock segmentation effect synoptic diagram for scissors action path in the inventive method and image object border intersection point quantity;
Figure 10 is 2 o'clock segmentation effect synoptic diagram for scissors action path in the inventive method and image object border intersection point quantity;
Figure 11 is 3 o'clock segmentation effect synoptic diagram for scissors action path in the inventive method and image object border intersection point quantity;
Figure 12 is a design sketch of handling the picture attribute in the inventive method;
Figure 13 is a design sketch of handling the gradual change shading in the inventive method;
Figure 14 handles the linear design sketch of gradual change in the inventive method;
Figure 15 is a kind of implementation result figure in scissors action path among the present invention;
Figure 16 is the another kind of implementation result figure in scissors action path among the present invention;
Figure 17 is the structural representation of apparatus of the present invention;
Figure 18 is the structural representation of internal compute unit in the device shown in Figure 17;
Figure 19 is the structural representation of peripheral computing unit in the device shown in Figure 17.
Embodiment
Embodiments of the invention provide a kind of implementation method and device of arbitrary clipping effect, and it can support to cut out arbitrarily the path when split image.Below in conjunction with accompanying drawing the embodiment of the invention is described in detail.
On the one hand, the embodiment of the invention provides a kind of implementation method of arbitrary clipping effect, and as shown in Figure 5, it comprises:
Step 501: utilize scissors action in image object;
Step 502: the data boundary that obtains scissors action path and described image object;
Step 503:, calculate the zone of cutting out formation according to the data boundary of described scissors action path and image object;
Step 504:, form the new image object after cutting out according to the scope in described zone.
In the embodiment of the invention, at first utilize scissors action in image object, obtain the data boundary of scissors action path and described image object then, again according to the data boundary of described scissors action path and image object, the zone of formation is cut out in calculating, according to the scope in described zone, form the new image object after cutting out at last.The present invention calculates the zone of cutting out formation according to cutting out action path, is not therefore cut out the restriction of action path, can support to cut out arbitrarily the path.
Technical scheme is for a better understanding of the present invention introduced earlier in this area at this, the describing method of image object, and support to cut out arbitrarily the key problem in technology point in path.
When describing image object, need to determine its border, to show its scope.After the zone is cut apart, referring to Fig. 8 to Figure 11, the object that produces has: common enclosed region is (as the zone among Fig. 81, a peripheral boundary is only arranged), have the annular region (, inside and outside two borders being arranged) in hole or have the zone (as the zone among Fig. 9 2) in slit and hole etc. as the zone among Fig. 82.Common enclosed region only needs its peripheral border can be described, and it is described that annular region then needs the border of its inside and outside both sides, and the zone that has the slit then also needs to know the position in its slit.
And the border of image object also has directivity.As object among Fig. 93 and object 4, because they are the zone that has the hole, therefore need directivity by its border, express the existence in this hole.
In order to support to cut out arbitrarily the path, key problem in technology point of the present invention is: realize Region Segmentation.No matter how complicated cut out the path, even there are a plurality of intersection points in it, self have a plurality of situations from intersection point again with image boundary, cut out the effect that is produced and all be and determine uniquely, be exactly regional cutting apart and produce this essence of cutting out effect.Region Segmentation among the present invention need be determined to cut out and produced which type of zone, and what the border in the zone of generation is, and what the direction on border is.Then, according to the border and the direction thereof in the zone that calculates, just can form smoothly and cut out the new image object that the back produces, thereby finally realize the effect of cutting out of scissors.
Among the present invention, step 503 has calculated the zone of cutting out formation according to scissors action path and image object data boundary, border and boundary direction have just been comprised in this zone, therefore, just can form the new image object after cutting out in the step 504 according to the scope in described zone.
As shown in Figure 6, for comparatively rationally, calculate the zone of cutting out formation easily, calculate the zone of cutting out formation in the above-mentioned steps 503, further comprise:
Step 601: calculate the formed zone of the part in the image object bounds, described scissors action path;
Step 602: calculate the part of described scissors action path in the image object bounds and described image object border the common zone that forms.
Scissors action is when image object, if the part in scissors action path is not in the bounds of image object, then the scissors action of this part is exactly invalid, therefore, only used the effective part in scissors action path in the above-mentioned steps 601,602, i.e. the part of scissors action path in the image object bounds.And, in the above-mentioned steps, calculated the zone (its interior zone) that the scissors action path forms separately before this, and then calculate it and image object border the common zone (neighboring area) that forms, therefore, it is the entire image subject area to be divided into two parts calculate respectively, makes to cut out to form regional computation process rationally, conveniently.
In the present embodiment, calculate interior zone, promptly above-mentioned steps 601: calculate the formed zone of the part in the image object bounds, described scissors action path, as shown in Figure 7, it further is:
Step 701:, disconnect from the intersection point place at it for the part of described scissors action path in the image object bounds;
The scissors action path may more complicated, has from intersection point, cuts out the border in the zone of formation for the ease of subsequent calculations, disconnection is pointed out in selfing in the scissors action path herein, makes it to become simple path.
Step 702: collect scissors action path each section in the image object bounds after disconnecting;
, collect the simple path that surrounds the zone earlier herein, so that subsequent calculations is cut out the border that forms the zone.
Step 703: calculate each section of described scissors action path and surround Minimum Area in the zone; Wherein, described Minimum Area is zone that the wall scroll closed path surrounds in the enclosed region, not subdivisible.
In conjunction with the experience that realizes that scissors is cut out in the life, the zone of cutting out formation as can be known all is not subdivisible zones, and when interior zone is cut out, the a plurality of zones that produce all are common enclosed region (having only a peripheral boundary), as long as obtain its peripheral boundary, can obtain the object that interior zone is cut out formation.Therefore, in the process of aforementioned calculation interior zone,, just can access corresponding object bounds, and then obtain cutting out the object of formation through after the calculating of above-mentioned Minimum Area.
Above-mentioned steps 701 to 703 has realized the calculating of scissors action path interior zone.According to this step, referring to Fig. 8 to Figure 11, correspondence obtains zone 1, zone 1, zone 1 and 2, zone 1 and 2 and 3 respectively.This zone that obtains promptly can be used in subsequent step 504, forms the new image object after cutting out.
In addition, in the present embodiment, calculate the neighboring area, be above-mentioned steps 602: calculate the part of described scissors action path in the image object bounds and described image object border the common zone that forms, further be: the intersection point quantity that obtains described scissors action path and image object border; According to described intersection point quantity, calculate the part of described scissors action path in the image object bounds and described image object border the common zone that forms.Referring to Fig. 8 to Figure 11, when the intersection point quantity on scissors action path and image object border was different as can be known, it was inequality cutting out formed zone, therefore just need correspondingly make different disposal.The processing mode that the present invention adopts is specific as follows:
If a scissors action path and image object border intersection point quantity are 0, as shown in Figure 8, explanation scissors on image object cuts a hole, the neighboring area only produces an annular region, as long as after obtaining the border in this hole, with the border and the image object boundary combinations in this hole, the annular region of periphery can be described.At this moment, treatment step is:
Calculate each section of described scissors action path and surround maximum region in the zone;
Utilize the border of described maximum region to become a zone with the boundary combinations of image object; Wherein, described maximum region is the no selfing zone that the wall scroll closed path surrounds in the enclosed region, comprise all Minimum Areas.
As from the foregoing, above-mentioned maximum region is the hole of cutting out generation, behind the border and image object boundary combinations with maximum region in the above-mentioned steps, can obtain the annular region that the neighboring area produces.By this step, in Fig. 8, can obtain zone 2.
Under this kind situation, what scissors cut also may be a slit, and be considered as a zone with the slit this moment, utilizes said method can realize segmentation effect equally.
If the border intersection point quantity of two described scissors action paths and image object is 1, as shown in Figure 9, explanation cuts the hole that has seam on image object, the neighboring area produces an annular region that has the slit, therefore, the peripheral annular region that has the slit can be described in the image object border that obtains disconnecting, the slit of forward, the border of maximum region and reverse slit.At this moment, treatment step then is:
At described position of intersecting point, with the border disconnection of described image object;
Find out one section that on image object, forms the slit in each section of described scissors action path;
Calculate in each section of described scissors action path except that forming a section of slit the maximum region in the zone of surrounding;
Utilize the border of described image object, the slit section of forward, the border of maximum region, reverse slit section to be combined into a zone.
By this step, in Fig. 9, can obtain zone 2.
Under this kind situation, what scissors cut may only be a slit also, and does not have the hole, but utilizes said method can realize segmentation effect equally.
If the border intersection point quantity of three described scissors action paths and image object is 2, as shown in figure 10, illustrate in the neighboring area to have produced 2 sub-pieces, because sub-piece is common enclosed region,, the sub-piece that this neighboring area produces can be described as long as obtain its border.And owing to must comprise the image object border in the sub-piece, therefore, treatment step is:
At described position of intersecting point, being broken in described image object border is two sections;
Calculate each section of described scissors action path and every section image object border surround the Minimum Area that comprises the image object border segment in the zone jointly.
By this step, in Figure 10, can obtain zone 3 and zone 4.
If the border intersection point quantity of four described scissors action paths and image object is greater than 2, as shown in figure 11, illustrate in the neighboring area to have produced a plurality of sub-pieces, because sub-piece is common enclosed region, as long as obtain its border, the sub-piece that this neighboring area produces can be described.And owing to must comprise the image object border in the sub-piece, therefore, treatment step is:
At described position of intersecting point, with the border disconnection of described image object;
In the image object bounds, find out can be end to end with the image object border segment the scissors action path;
Calculate described scissors action path and corresponding image object border segment surround the Minimum Area that comprises the image object border segment in the zone jointly.
By this step, in Figure 11, can obtain zone 4 and zone 5.
Simultaneously, in such cases,, might there be the image object border segment of failing to find end to end scissors action path, then owing to cut out the path more complicated
Find out with it and can form not image object border segment of usefulness of end to end scissors action path and other, calculate they surround the Minimum Area that comprises the image object border segment in the zone jointly.By this step, in Figure 11, can obtain zone 6.
Through after the above-mentioned computation process to interior zone, neighboring area, can access the All Ranges of cutting out formation, thereby can carry out subsequent step 504:, form the new image object after cutting out, and then finally realize fully cutting apart to image object according to the scope in described zone.
Cut out effect, step 504 in order to realize preferably: according to the scope in described zone, form the new image object after cutting out, comprising: the attribute of handling the new image object after described the cutting out.Attribute comprises that picture attribute, gradual change shading, gradual change are linear etc., wherein,
1, handles the picture attribute
In order to keep the style of original image object as far as possible, according to the position of image at former object, computed image is in the position in new object behind the scissors action, referring to Figure 12.
2, handle the gradual change shading
In order to keep the style of former object as far as possible,, calculate the gradual change shading in the position in new object behind the scissors action, referring to Figure 13 according to gradual change center, gradual change angle, the gradual change radius of gradual change shading in former object.
3, the processing gradual change is linear
In order to keep the style of former object as far as possible,, calculate the linear gradual change rule that behind scissors action, is implemented in the new object of gradual change, referring to Figure 14 according to the linear gradual change rule in former object of gradual change.
Introduce the reason of Minimum Area and maximum region below among supplementary notes the present invention.
Among the present invention, Minimum Area is zone that the wall scroll closed path surrounds in the enclosed region, not subdivisible; Maximum region is the no selfing zone that the wall scroll closed path surrounds in the enclosed region, comprise all Minimum Areas.
In the process of Region Segmentation, can produce zone (common enclosed region) that an outer boundary is only arranged and zone (annular region), introduce Minimum Area and maximum region among the present invention, be used for calculating respectively this two kinds of zones with inside and outside two borders.For the zone of an outer boundary is only arranged in the zone that obtains cutting out formation, only calculate Minimum Area and get final product; And, just need to use earlier maximum region calculate interior boundary in order to have the zone on inside and outside two borders in the zone that obtains cutting out formation, and the outer boundary in recombination region territory, thus draw this annular region.Accordingly, when calculating interior zone among the present invention, only need to calculate Minimum Area and get final product; And when calculating the neighboring area, if annular region, just need to calculate maximum region.
The definition of above-mentioned Minimum Area and maximum region just in time with to cut out effect consistent in the actual life, therefore, after the present invention introduces above-mentioned notion and processing mode, can realize supporting to cut out arbitrarily the purpose in path preferably.
Simultaneously, introduce the computing method of Minimum Area and maximum region among the present invention.Calculate minimum or maximum region, border that need this is regional disconnects in all positions from intersection point, forms one group of continuous simple path, on the basis of simple path, calculates corresponding minimum or maximum region then.
The method of the described calculating Minimum Area in the zone that surrounds comprises:
Find out all simple paths that comprise in the zone that surround;
Calculate the Minimum Area that comprises described every simple path successively;
Wherein, calculate the method for the Minimum Area that comprises certain bar simple path, specifically comprise:
Judge that described simple path is whether closed, if then described simple path institute area surrounded is exactly a Minimum Area;
Whether the head and the tail point of judging described simple path overlaps, if institute's area surrounded is exactly a Minimum Area after the then described simple path closure;
Along described simple path search, find an end to end no selfing zone, and the simple path that uses is pressed into storehouse;
At the bottom of stack, search with non-storehouse that the tail point of simple path in the storehouse overlaps in simple path; If the simple path that finds is in the regional extent that is surrounded by the simple path in the storehouse, then continuing search along the described simple path that finds down, up to finding a simple path, the head and the tail point of arbitrary simple path in its tail point and the storehouse overlaps, and does not have selfing in the entire path that searches; Utilize this entire path that searches to cover original storehouse then, to form a littler than before no selfing zone; Repeat this process, up to can not find a simple path in the regional extent that surrounds by the simple path in the storehouse till;
Simple path in the storehouse is joined end to end, form an enclosed region, this zone is exactly a Minimum Area.
Through after the calculating of this Minimum Area, may obtain a plurality of Minimum Areas.Illustrate the computation process of Minimum Area, as shown in figure 15, look for comprising 1 Minimum Area:
(1) finds a no selfing zone: 5,3,1.
What (2) link to each other with 1 tail point has 2, because 2 in the zone at 5,3,1 place, gives up 2.
What (3) link to each other with 3 tail point has 4, because 4 in the zone at 5,3,1 place, rebulids storehouse: 5,4,3,1.
(4) continue to search each limit, can not find the smaller area territory, then Minimum Area is: 5,4,3,1.Simultaneously, the direction of this Minimum Area has following two kinds of possibilities: a kind of is clockwise direction, and at this moment, 5 direction is from right to left, the 4th, counterclockwise, the 3rd, from left to right, the 1st, from top to bottom; Another kind is that counterclockwise at this moment, 5 direction is from left to right, the 4th, clockwise, the 3rd, from right to left, the 1st, from top to bottom.These two kinds of situations all can be used to describe this zone, and during application, unified a certain direction (clockwise or counterclockwise) the description zone of selecting gets final product.
The method of the described calculating maximum region in the zone that surrounds comprises:
Find out any simple path that comprises in the zone that surrounds;
From described any simple path,, find an end to end no selfing zone, and the simple path that uses is pressed into storehouse along this simple path search;
At the bottom of stack, search with non-storehouse that the tail point of simple path in the storehouse overlaps in simple path; If the simple path that finds is outside the regional extent that is surrounded by the simple path in the storehouse, then continuing search along the described simple path that finds down, up to finding a simple path, the head and the tail point of arbitrary simple path in its tail point and the storehouse overlaps, and the entire path that searches does not have selfing; The entire path that this is searched is added relevant position in the storehouse to then, to form a bigger than before no selfing zone; Repeat this process, up to can not find a simple path outside the regional extent that surrounds by the simple path in the storehouse till;
Simple path in the storehouse is joined end to end, form an enclosed region, this zone is exactly a maximum region.
Through after the calculating of this maximum region, only can obtain a maximum region.Illustrate the computation process of maximum region,, look for comprising 1 maximum region as Figure 16:
(1) finds no selfing zone: 7,1.
What (2) link to each other with 1 tail point has 2 and 6.Here use 2 of sequence number minimum.Searching route is at present: 2.
(3) can select 3,5 and 6 along 2.Select 3 of sequence number minimum.Searching route is 3,2 at present.
(4) can select 4 and 5 along 3.Because 4 selfings are given up.Because 5 have with searching route and to intersect, and give up.Because 4 and 5 all do not have selectedly, select 3 pop-up a stack, present searching route becomes: 2.
What (5) link to each other with 23 is rejected, and to be selected also has 5 and 6.Select 5 of sequence number minimum.Present searching route becomes: 5,2.
(6) can select 3 and 4 along 5.Because 3 have with searching route and to intersect, and give up.Because 4 selfings are given up.Because 3 and 4 all do not have selectedly, select 5 pop-up a stack, present searching route becomes: 2.
(7) the also surplus feasible path that has is 6.6 just in time satisfy condition, enlarged area extremely: 7,2,6,1.
(8) continue, can obtain maximum region: 7,2,5,4,3,6,1 according to rule searching.Simultaneously, the direction of this maximum region also has two kinds of situations, and this sentences counterclockwise and is illustrated for example: 7 direction is for from left to right, and 2 for from left to right, and 5 for from left to right, and 4 is counterclockwise, and 3 for from right to left, and 6 for from right to left, and 1 for from right to left.
In addition, calculate in the above in the process of Minimum Area and maximum region, used the notion in no selfing zone, no selfing zone is the border less than the zone from intersection point., also introduce the method for calculating the no selfing zone that comprises certain bar simple path herein, it comprises:
Judge that described simple path is whether closed, if then described simple path institute area surrounded is exactly a no selfing zone;
Whether the head and the tail point of judging described simple path overlaps, if institute's area surrounded is exactly a no selfing zone after the then described simple path closure;
Described simple path is pressed into storehouse;
Use the tail point of the simple path of stack top, search the simple path in the non-storehouse that annexation is arranged with it; If another end points of the simple path that finds overlaps with the first point of simple path at the bottom of the stack, then this simple path is pressed into storehouse, and enters next step; If the head and the tail point of the simple path in another end points of the simple path that finds and the stack overlaps, then this simple path is invalid and continue to search the simple path that all the other find, otherwise this simple path is pressed into storehouse, and re-executes this step; If all simple paths that find are all invalid, then eject the simple path of stack top, and re-execute this step;
Simple path in the storehouse is joined end to end, form an enclosed region, this zone is exactly a no selfing zone.
Illustrate the computation process of not having the selfing zone,, look for comprising 1 no selfing zone as Figure 15:
(1) at first is pressed into storehouse, current stack states: 1 with 1.
What (2) link to each other with 1 tail point has 2 and 3.Because 2 self-closings, so get rid of 2.Be pressed into storehouse, current stack states with 3: 3,1.
What (3) link to each other with 3 tail point has 4 and 5.Because 4 self-closings, so get rid of 4.Because 5 the other end overlaps with 1 starting point at the bottom of the stack, has then found no selfing enclosed region: 5,3,1.Simultaneously, the direction in this no selfing zone also has two kinds of situations, is illustrated for example in a clockwise direction herein: 5 direction is from right to left, the 3rd, from left to right, the 1st, from top to bottom.
In the inventive method, scissors action obtains earlier scissors action path and image object border behind image object, then in the process of follow-up Region Segmentation, rationally, easily with its minute in order to calculate two steps of interior zone and neighboring area; And introduced Minimum Area and maximum region and corresponding calculation method, thereby realized Region Segmentation preferably; Last basis is cut apart the zone of generation, just can very easily form the new image object after cutting out, thereby the present invention can support to cut out arbitrarily the path preferably, realizes cutting apart of image object.
On the other hand, corresponding with said method, the embodiment of the invention provides a kind of implement device of arbitrary clipping effect, and as shown in figure 17, it comprises:
Cut out unit 201: be used to utilize scissors action in image object;
Acquiring unit 202: the data boundary that is used to obtain scissors action path and described image object;
First computing unit 203: be used for data boundary, calculate the zone of cutting out formation according to described scissors action path and image object;
Form unit 204: be used for scope, form the new image object after cutting out according to described zone.
And described first computing unit 203 further comprises:
Internal compute unit 2031: be used to calculate the formed zone of the part in the image object bounds, described scissors action path;
Periphery computing unit 2032: the zone that is used to calculate the part of described scissors action path in the image object bounds and the common formation of described image object border institute.
Simultaneously, described internal compute unit 2031 as shown in figure 18, comprising:
Switching units 311: be used for disconnecting from the intersection point place at it for the part of described scissors action path in the image object bounds;
Collector unit 312: be used for collecting disconnection scissors action path, back each section in the image object bounds;
Second computing unit 313: the Minimum Area that is used for calculating zone that each section surrounds, described scissors action path;
Wherein, described Minimum Area is zone that the wall scroll closed path surrounds in the enclosed region, not subdivisible.
Described peripheral computing unit 2032 as shown in figure 19, comprising:
Obtain unit 321: the intersection point quantity that is used to obtain described scissors action path and image object border;
The 3rd computing unit 322: be used for according to described intersection point quantity, calculate the part of described scissors action path in the image object bounds and described image object border the common zone that forms.
In the embodiment of the invention, at first utilize scissors action in image object, obtain the data boundary of scissors action path and described image object then, again according to the data boundary of described scissors action path and image object, the zone of formation is cut out in calculating, according to the scope in described zone, form the new image object after cutting out at last.The present invention calculates the zone of cutting out formation according to cutting out action path, is not therefore cut out the restriction of action path, can support to cut out arbitrarily the path.
The above; only be the specific embodiment of the present invention, but protection scope of the present invention is not limited thereto, anyly is familiar with those skilled in the art in the technical scope that the present invention discloses; can expect easily changing or replacing, all should be encompassed within protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion with the protection domain of described claim.

Claims (11)

1. the implementation method of an arbitrary clipping effect is characterized in that, comprising:
Utilize scissors action in image object;
Obtain the data boundary of scissors action path and described image object;
According to the data boundary of described scissors action path and image object, calculate the zone of cutting out formation;
According to the scope in described zone, form the new image object after cutting out;
Wherein, the described calculating zone of cutting out formation comprises:
Calculate the formed zone of the part in the image object bounds, described scissors action path;
Calculate the part of described scissors action path in the image object bounds and described image object border the common zone that forms;
The formed zone of the part in the image object bounds, the described scissors action of described calculating path comprises:
For the part of described scissors action path in the image object bounds, disconnect from the intersection point place at it;
Collect scissors action path each section in the image object bounds after disconnecting;
Calculate each section of described scissors action path and surround Minimum Area in the zone;
Wherein, described Minimum Area is zone that the wall scroll closed path surrounds in the enclosed region, not subdivisible;
The part of the described scissors action of described calculating path in the image object bounds and described image object border the common zone that forms, comprising:
Obtain the intersection point quantity on described scissors action path and image object border;
According to described intersection point quantity, calculate the part of described scissors action path in the image object bounds and described image object border the common zone that forms.
2. method according to claim 1 is characterized in that, and is described according to described intersection point quantity, calculate the part of described scissors action path in the image object bounds and described image object border the common zone that forms, be specially:
If described intersection point quantity is 0, then
Calculate each section of described scissors action path and surround maximum region in the zone;
Utilize the border of described maximum region to become a zone with the boundary combinations of image object;
Wherein, described maximum region is the no selfing zone that the wall scroll closed path surrounds in the enclosed region, comprise all Minimum Areas.
3. method according to claim 1 is characterized in that, and is described according to described intersection point quantity, calculate the part of described scissors action path in the image object bounds and described image object border the common zone that forms, be specially:
If described intersection point quantity is 1, then
At described position of intersecting point, with the border disconnection of described image object;
Find out one section that on image object, forms the slit in each section of described scissors action path;
Calculate in each section of described scissors action path except that forming a section of slit the maximum region in the zone of surrounding;
Utilize the border of described image object, the slit section of forward, the border of maximum region, reverse slit section to be combined into a zone.
4. method according to claim 1 is characterized in that, and is described according to described intersection point quantity, calculate the part of described scissors action path in the image object bounds and described image object border the common zone that forms, be specially:
If described intersection point quantity is 2, then
At described position of intersecting point, being broken in described image object border is two sections;
Calculate each section of described scissors action path and every section image object border surround the Minimum Area that comprises the image object border segment in the zone jointly.
5. method according to claim 1 is characterized in that, and is described according to described intersection point quantity, calculate the part of described scissors action path in the image object bounds and described image object border the common zone that forms, be specially:
If described intersection point quantity is greater than 2, then
At described position of intersecting point, with the border disconnection of described image object;
In the image object bounds, find out can be end to end with the image object border segment the scissors action path;
Calculate described scissors action path and corresponding image object border segment surround the Minimum Area that comprises the image object border segment in the zone jointly.
6. method according to claim 5 is characterized in that, described method further comprises:
If have the image object border segment of failing to find end to end scissors action path, then
Find out with it and can form not image object border segment of usefulness of end to end scissors action path and other, calculate they surround the Minimum Area that comprises the image object border segment in the zone jointly.
7. according to claim 2 or 3 described methods, it is characterized in that the method for the described calculating Minimum Area in the zone that surrounds specifically comprises:
Find out all simple paths that comprise in the zone that surround;
Calculate the Minimum Area that comprises described every simple path successively;
Wherein, calculate the method for the Minimum Area that comprises certain bar simple path, comprising:
Judge that described simple path is whether closed, if then described simple path institute area surrounded is exactly a Minimum Area; If not, then
Whether the head and the tail point of judging described simple path overlaps, if institute's area surrounded is exactly a Minimum Area after the then described simple path closure; If not, then
Along described simple path search, find an end to end no selfing zone, and the simple path that uses is pressed into storehouse;
At the bottom of stack, search with non-storehouse that the tail point of simple path in the storehouse overlaps in simple path; If the simple path that finds is in the regional extent that is surrounded by the simple path in the storehouse, then continuing search along the described simple path that finds down, up to finding a simple path, the head and the tail point of arbitrary simple path in its tail point and the storehouse overlaps, and does not have selfing in the entire path that searches; Utilize this entire path that searches to cover original storehouse then, to form a littler than before no selfing zone; Repeat this process, up to can not find a simple path in the regional extent that surrounds by the simple path in the storehouse till;
Simple path in the storehouse is joined end to end, form an enclosed region, this zone is exactly a Minimum Area.
8. method according to claim 7 is characterized in that, the method for the described calculating maximum region in the zone that surrounds comprises:
Find out any simple path that comprises in the zone that surrounds;
From described any simple path,, find an end to end no selfing zone, and the simple path that uses is pressed into storehouse along this simple path search;
At the bottom of stack, search with non-storehouse that the tail point of simple path in the storehouse overlaps in simple path; If the simple path that finds is outside the regional extent that is surrounded by the simple path in the storehouse, then continuing search along the described simple path that finds down, up to finding a simple path, the head and the tail point of arbitrary simple path in its tail point and the storehouse overlaps, and the entire path that searches does not have selfing; The entire path that this is searched is added relevant position in the storehouse to then, to form a bigger than before no selfing zone; Repeat this process, up to can not find a simple path outside the regional extent that surrounds by the simple path in the storehouse till;
Simple path in the storehouse is joined end to end, form an enclosed region, this zone is exactly a maximum region.
9. method according to claim 8 is characterized in that, in the above-mentioned steps, calculates the method in the no selfing zone that comprises certain bar simple path, comprising:
Judge that described simple path is whether closed, if then described simple path institute area surrounded is exactly a no selfing zone; If not, then
Whether the head and the tail point of judging described simple path overlaps, if institute's area surrounded is exactly a no selfing zone after the then described simple path closure; If not, then
Described simple path is pressed into storehouse;
Use the tail point of the simple path of stack top, search the simple path in the non-storehouse that annexation is arranged with it; If another end points of the simple path that finds overlaps with the first point of simple path at the bottom of the stack, then this simple path is pressed into storehouse, and enters next step; If the head and the tail point of the simple path in another end points of the simple path that finds and the stack overlaps, then this simple path is invalid and continue to search the simple path that all the other find, otherwise this simple path is pressed into storehouse, and re-executes this step; If all simple paths that find are all invalid, then eject the simple path of stack top, and re-execute this step;
Simple path in the storehouse is joined end to end, form an enclosed region, this zone is exactly a no selfing zone.
10. according to the described method of arbitrary claim in the claim 1 to 6, it is characterized in that described scope according to described zone forms the new image object after cutting out, and comprising:
Handle the attribute of the new image object after described the cutting out.
11. the implement device of an arbitrary clipping effect is characterized in that, comprising:
Cut out the unit: be used to utilize scissors action in image object;
Data boundary acquiring unit: the data boundary that is used to obtain scissors action path and described image object;
First computing unit: be used for data boundary, calculate the zone of cutting out formation according to described scissors action path and image object;
Form the unit: be used for scope, form the new image object after cutting out according to described zone;
Wherein, described first computing unit comprises:
Internal compute unit: be used to calculate the formed zone of the part in the image object bounds, described scissors action path;
Periphery computing unit: the zone that is used to calculate the part of described scissors action path in the image object bounds and the common formation of described image object border institute;
Described internal compute unit comprises:
Switching units: be used for disconnecting from the intersection point place at it for the part of described scissors action path in the image object bounds;
Collector unit: be used to collect scissors action path each section in the image object bounds after the disconnection;
Second computing unit: the Minimum Area that is used for calculating zone that each section surrounds, described scissors action path;
Wherein, described Minimum Area is zone that the wall scroll closed path surrounds in the enclosed region, not subdivisible;
Described peripheral computing unit comprises:
Intersection point quantity obtains the unit: the intersection point quantity that is used to obtain described scissors action path and image object border;
The 3rd computing unit: be used for according to described intersection point quantity, calculate the part of described scissors action path in the image object bounds and described image object border the common zone that forms.
CN2008102396686A 2008-12-15 2008-12-15 Method and apparatus for implementing arbitrary clipping effect Expired - Fee Related CN101430794B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2008102396686A CN101430794B (en) 2008-12-15 2008-12-15 Method and apparatus for implementing arbitrary clipping effect

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2008102396686A CN101430794B (en) 2008-12-15 2008-12-15 Method and apparatus for implementing arbitrary clipping effect

Publications (2)

Publication Number Publication Date
CN101430794A CN101430794A (en) 2009-05-13
CN101430794B true CN101430794B (en) 2011-06-15

Family

ID=40646175

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2008102396686A Expired - Fee Related CN101430794B (en) 2008-12-15 2008-12-15 Method and apparatus for implementing arbitrary clipping effect

Country Status (1)

Country Link
CN (1) CN101430794B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6313824B1 (en) * 1998-04-10 2001-11-06 Adobe Systems Incorporated Image preview system
CN101149838A (en) * 2007-11-09 2008-03-26 北大方正集团有限公司 Layout image frame generation method and device

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6313824B1 (en) * 1998-04-10 2001-11-06 Adobe Systems Incorporated Image preview system
CN101149838A (en) * 2007-11-09 2008-03-26 北大方正集团有限公司 Layout image frame generation method and device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
严涛,吴恩华.基于多幅图象的树木造型方法.《系统仿真学报》.2000,第12卷(第5期),565-571. *
梁友栋,汪国昭.多边形裁剪的蜿蜒边界和分块输出问题.《计算机学报》.1987,(第3期),182-185. *

Also Published As

Publication number Publication date
CN101430794A (en) 2009-05-13

Similar Documents

Publication Publication Date Title
Dewil et al. An improvement heuristic framework for the laser cutting tool path problem
CN103793135B (en) User interface tree-structure display method and system
CN103777866B (en) Data editing method and device for magnifying glass
WO2015077188A1 (en) Visualizing large graphs
Macmillan Redistricting in a GIS environment: An optimisation algorithm using switching-points
CN104951219A (en) Text input method for mobile terminal and mobile terminal
Sato et al. A pairwise exact placement algorithm for the irregular nesting problem
Bekos et al. Area-feature boundary labeling
Mahjoub et al. Hop‐level flow formulation for the survivable network design with hop constraints problem
De Berg et al. On rectilinear duals for vertex-weighted plane graphs
CN101430794B (en) Method and apparatus for implementing arbitrary clipping effect
CA2919051C (en) Global grid building in reverse faulted areas by an optimized unfaulting method
CN103886118B (en) Re-synthesis method for integrated circuit heterogeneous logic unit
Arge et al. Multiway simple cycle separators and I/O-efficient algorithms for planar graphs
Papadopoulos et al. Drawing graphs using modular decomposition
CN104899908A (en) Method and device for generating evolution diagram of event group
Kammer et al. Identifying and exploiting commonalities for the job-shop scheduling problem
CN1936957B (en) Optimization and view dependency reduction for processing slice-based volumes
Chen The merge phase of parallel divide-and-conquer scheme for 3D Delaunay triangulation
CN103324606A (en) Typesetting method and typesetting device
CN110750556B (en) Method and device for thinning and filling joints of geographic data and storage medium
Wu et al. Fast and improved seam carving with strip partition and neighboring probability constraints
CN101996092A (en) On-line two-dimensional region management and task setting method of dynamically reconfigurable field programmable gate array (FPGA)
CN112001987A (en) Polygon clipping method and device, electronic device and storage medium
Fan et al. On some proximity problems of colored sets

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20110615

Termination date: 20191215