Smart Scribbles for Sketch Segmentation

Information

  • Patent Application
  • 20130241934
  • Publication Number
    20130241934
  • Date Filed
    March 19, 2012
    12 years ago
  • Date Published
    September 19, 2013
    11 years ago
Abstract
A method is provided for sketch segmentation via smart scribbles, the results of which are especially suitable for interactive real-time graphics editing applications. A vector-based drawing may be segmented into labels based on input scribbles provided by a user. By organizing the labeling as an energy minimization problem, an approximate solution can be found using a sequence of binary graph cuts for an equivalent graph, providing an optimized implementation in a polynomial time suitable for real-time drawing applications. The energy function may include time, proximity, direction, and curvature between strokes as smoothness terms, and proximity, direction, and oriented curvature between strokes and scribbles as data terms. Additionally, the energy function may be modified to provide for user control over locality control, allowing the selection of appropriately sized labeling regions by scribble input speed or scribble input pressure. Once the drawing is labeled, a wide range of drawing applications are enabled.
Description
BACKGROUND

Sketched drawings can provide solid foundations for completed drawings and may even be used by themselves as stylized finished products. Since sketches can be completed in a relatively short time while providing a broad view of the most important visual elements, sketches are a valuable planning tool for artists, animators, modelers, engineers, draftsmen, and other professions that may produce paintings, figures, flowcharts, models, and other drawings and diagrams. Moreover, since sketching is a process that almost everyone is comfortable and familiar with, sketching may be advantageously employed by people at all artistic skill levels.


However, to transition from an initial rough sketch to an intermediate or finished drawing, it is essential to segment portions of the sketch into specific regions or layers. Once separated into layers, many tasks towards the completion of the drawing are readily solved or greatly assisted, including object occlusion, moving and deforming of parts, animation inbetweening or tweening, line or path stroking with color, and area shading with colors or patterns such as textures, hatching or screen tone. Conventionally, such layer segmentation is done manually by the user, often a time-consuming, tedious, and error-prone process, particularly for sketched drawings and for users unfamiliar with working with multiple drawing layers.


SUMMARY

The present disclosure is directed to smart scribbles for sketch segmentation, substantially as shown in and/or described in connection with at least one of the figures, as set forth more completely in the claims.





BRIEF DESCRIPTION OF THE DRAWINGS


FIG. 1 presents an exemplary diagram of a system utilizing smart scribbles for sketch segmentation;



FIG. 2A presents exemplary stroke segments and smart scribbles illustrating energy minimization terms for sketch segmentation;



FIG. 2B presents an exemplary graph for solving energy minimization to derive sketch segmentation using smart scribbles;



FIG. 3A presents exemplary results of sketch segmentation using smart scribbles with different levels of locality control;



FIG. 3B presents exemplary graphs of energy fall-off functions to provide locality control in sketch segmentation using smart scribbles;



FIG. 4A presents a table showing exemplary parameters for energy minimization to derive sketch segmentation using smart scribbles;



FIG. 4B presents an exemplary sketch having the same sketch segmentation results with various smart scribble sets;



FIG. 5 presents an exemplary flowchart illustrating a method for providing sketch segmentation via smart scribbles.





DETAILED DESCRIPTION

The following description contains specific information pertaining to implementations in the present disclosure. One skilled in the art will recognize that the present disclosure may be implemented in a manner different from that specifically discussed herein. The drawings in the present application and their accompanying detailed description are directed to merely exemplary implementations. Unless noted otherwise, like or corresponding elements among the figures may be indicated by like or corresponding reference numerals. Moreover, the drawings and illustrations in the present application are generally not to scale, and are not intended to correspond to actual relative dimensions.



FIG. 1 presents an exemplary diagram of a system utilizing smart scribbles for sketch segmentation. Diagram 100 of FIG. 1 includes computing device 110, input device 116, display 118, and user 130. Computing device 110 includes hardware processor 112 and memory 114. Memory 114, which is a non-transitory storage device, includes drawing application 120. Drawing application 120 includes smart scribble library 122, user sketch data 124, input scribbles 126, and sketch segmentation 128.



FIG. 1 may illustrate a typical setup for an interactive drawing application providing sketch segmentation using user sketch data and input scribbles as smart scribbles, as further described below. Computing device 110 may include a personal computer, laptop, tablet computer, video game console, portable game system, mobile phone, or another device. Computing device 110 may include drawing application 120 stored in memory 114, which may be any interactive drawing application allowing user 130 to provide user sketch data 124 in a vector graphic format via input device 116. Input device 116 may include a pen tablet, a mouse, a touch screen, and/or any other input device.


While computing device 110, input device 116, and display 118 are shown as separate elements in diagram 100, some implementations may combine the elements in diagram 100. For example, display 118 and input device 116 may be the same device for a pen display or touch screen, which may further be combined with computing device 110 for an integrated tablet computer.


User sketch data 124 may be generated while user 130 interacts with drawing application 120. Thus, user sketch data 124 may include lines, curves, and other geometric primitives as user 130 draws them using input device 116. Each geometric primitive may also include time stamps to indicate time of creation or modification, along with stroke characteristics such as speed, pressure, direction and curvature. User sketch data 124 may be rendered as raster data for outputting to display 118, allowing user 130 to view user sketch data 124.


After user sketch data 124 is completed, it is desirable to generate sketch segmentation 128 to organize user sketch data 124 into specific regions or layers. As previously discussed, once user sketch data 124 is separated into layers by sketch segmentation 128, many tasks towards the completion of the drawing are readily solved or greatly assisted. Accordingly, user 130 or another user may provide input scribbles 126 to interactively generate sketch segmentation 128 from user sketch data 124 via smart scribble library 122, which may be a built-in feature or external plug-in of drawing application 120. Smart scribble library 122 may generate sketch segmentation 128 by organizing the above inputs into an energy minimization problem to be solved by a high-speed graph-cut optimization, as further discussed below.


The problem of assigning labels L, or sketch segmentation 128, to stroke segments in S, or user sketch data 124, based on scribble segments in R, or input scribbles 126, can be formulated as an energy minimization problem, or equation (1) below:










E


(
φ
)


=





i
,

j

S










V

i
,
j




(


φ
i

,

φ
j


)



+

λ





i

S









D
i



(

φ
i

)









(
1
)







wherein the goal is to find a labeling or assignment φ of the labels in L to every stroke segment in S that minimizes the energy function E, where Vi, j is a smoothness term representing a cost with respect to a similarity between stroke segments i and j, where Di is a data term measuring the affinity between scribble segments and stroke segments, and where the parameter λ adjusts the relative weight of the smoothness and data terms.


The smoothness term of equation (1) may be defined more specifically as equation (2) below:











V

i
,
j




(


φ
i

,

φ
j


)


=




g

G








δ


(


g


(

i
,
j

)


,

σ
g


)







(
2
)









    • when φi≠φj, otherwise Vi, j=0.


      G as used in equation (2) is a set of similarity terms including a proximity term, a direction term, a curvature term, and a time term:








prox(i, j)=∥{right arrow over (p)}j−{right arrow over (p)}i





dir(, j)=1−|{right arrow over (d)}i·{right arrow over (d)}j|





curv(i, j)=1−min(ci, cj)/max(ci, cj)





time(i, j)=|tj−ti|


where i and j represent two segments to be compared, p represents position, d represents direction, c represents radius of curvature, and t represents time of creation. The fall-off function δ in equation (2) is defined as equation (3) below:










δ


(


g


(

i
,
j

)


,

σ
g


)


=

exp


(

-



g


(

i
,
j

)


2


σ
g
2



)






(
3
)







where σg represents an adjustment parameter for each similarity term, as discussed further in FIG. 4A below.


With regards to the similarity terms, the inclusion of proximity in the similarity terms leverages the intuitive idea that related strokes will be in close spatial proximity to each other. The inclusion of direction and curvature in the similarity terms effectively matches strokes with similar stroke direction and shape. The inclusion of time in the similarity terms takes advantage of temporal proximity during a typical sketch drawing process. For example, it is more likely that an artist will draw the details of each section separately and sequentially rather than jumping from section to section at random. Thus, strokes that are close in time may be more closely matched than those distant in time. The similarity terms provided above are only one example, and other implementations may also add or remove terms.


Moving to the data term of the energy function, the data term of equation (1) may be more specifically defined as equation (4) below:











D
i



(

φ
i

)


=

1
-


max

r


R


(

φ
i

)






A


(

i
,
r

)








(
4
)







where R(φi) denotes a set of scribble segments r with label φi. Affinity A(i, r) between a stroke segment i and a scribble segment r is defined as equation (5) below:










A


(

i
,
r

)


=




g


G
data









χ


(

i
,
r
,
g
,

σ
g


)







(
5
)







As with the smoothness term, comparisons are between segments, rather than the original strokes or scribbles. However, since time information is not recorded for input scribbles 126, the set of similarity terms is reduced to Gdata={prox, dir, curv} ⊂ G. This is in line with user expectations, as the labeling result from an input scribble should be consistent regardless of the specific time when the user provides the input scribble. Additionally, curv may be redefined as an oriented curvature to differentiate between similar curve shapes with different orientations:





curv(i, j)=∥{right arrow over (c)}i−{right arrow over (c)}j


With regards to the data terms, the inclusion of proximity flows from the intuitive notion that the user will place the input scribble in close spatial proximity to the desired strokes to be labeled. The inclusion of direction and curvature matches input scribbles with strokes having similar stroke orientation and shape. However, as noted above, time is omitted from the data terms, as the inclusion of time would violate user expectations of consistent results regardless of input scribble creation time. Again, as with the similarity terms, the specific data terms may vary from the specific example provided above. FIG. 2A presents exemplary stroke segments and smart scribbles illustrating energy minimization terms for sketch segmentation. Diagram 200 of FIG. 2A shows stroke S, scribbles R associated with a set of labels L including l1 and l2, smoothness terms Vi, j between a stroke segment i and another stroke segment j, and data terms Di(l*) including Di(l1) and Di(l2). With regards to FIG. 2A, stroke S may correspond to user sketch data 124 from FIG. 1, and scribble R may correspond to input scribbles 126 from FIG. 1. While only one stroke S and two scribbles R are shown in diagram 200 for simplicity, it is understood that any number of strokes S and scribbles R may be supported. For example, Vi, j comparisons are not necessarily limited to the same stroke when multiple strokes S are available.


Each stroke S may form any arbitrarily complex path, and in some cases may overlap itself, cross over itself, or densely fill an area. Each scribble R may also be similarly complex. Accordingly, to keep processing manageable, each stroke S and scribble R may be resampled into smaller, approximately linear segments. For example, as shown in diagram 200, each scribble R is resampled into three (3) smaller scribble segments, and the stroke S is resampled into seven (7) smaller stroke segments including the middle segment i and the outer segments j. Locally defined properties of the larger scribbles or strokes may be readily transferred to the smaller segments during the resampling procedure.


With the energy minimization problem defined as above, a solution can be framed in terms of solving a multi-way cut on a specific graph, as described in the publication titled “Markov random fields with efficient approximations” (Boykov, et al. In Proceedings of IEEE Conference on Computer Vision and Pattern Recognition (1998), pp. 648-655), which is hereby incorporated fully into the present application by reference.


Thus, FIG. 2B presents an exemplary graph for solving energy minimization to derive sketch segmentation using smart scribbles. Diagram 210 of FIG. 2B represents a weighted graph G={V, E}, where V={S, L} is a set of vertices consisting of stroke segments S (s1, s2, s3, s4, s5, s6) and label terminals L (l1, l2), and E={Es, E1} is a set of edges. Es refers to each stroke segment i ∈ S being connected to all other stroke segments j ∈ S−{i} via edges Ei, j having weight wi, j equal to the smoothness term Vi, j. E1 refers to auxiliary edges, Ei, 1 connecting stroke segments i ∈ S to label terminals l ∈ L having weight wi, 1 equal to λ(1−Di(l)), representing the data term.


Since the graph G in diagram 210 only has two terminals l1 and l2, the multi-way cut problem simplifies to a single max-flow or min-cut problem, for which efficient solutions exist in polynomial time, as known in the art. However, for N-terminal graphs where N>2, which will be the case when the user requires more than two segmentation labels, the problem becomes NP-hard. While advanced techniques such as a expansion and α/β swap are known for solving such graphs, implementations are quite costly and are therefore less suitable for interactive applications.


To provide an efficient solution suitable for real-time or near real-time interactive applications, N-terminal graphs can be simplified using a divide-and-conquer heuristic into a sequence of N−1 binary graph cut (max-flow or min-cut) problems, as described in the publication titled “LazyBrush: Flexible painting tool for hand-drawn cartoons” (Sykora, et al. Computer Graphics Forum 28, 2 (2009), 599-608), which is hereby incorporated fully into the present application by reference. The greedy multi-way cut algorithm utilized in LazyBrush provides an efficient optimization of the energy minimization problem in polynomial time, suitable for interactive applications such as graphics editing software. Thus, each of the stroke segments in S may be assigned a label in L within polynomial time, even when the number of terminals N is greater than 2.


Next, FIG. 3A presents exemplary results of sketch segmentation using smart scribbles with different levels of locality control. The term “locality control” refers to a parameter η for controlling sketch data selection locality of a corresponding user input scribble, as described in further detail below. In FIG. 3A, a user provides a completed user sketch data 324, and then desires to segment only the arm portion of the body. Accordingly, the user provides an input scribble 326 approximately where the arm is located in user sketch data 324, as shown. With a locality control of η=0.0, the result is sketch segmentation 328a where the entire body is labeled as selected, which is not the intention of the user. On the other hand, with a locality control of η=1.5, the result is sketch segmentation 328b, where only the arm portion is labeled as selected, as intended by the user. For visual clarity, unselected or background portions of user sketch data 324 are omitted from sketch segmentation 328b; however, such unselected portions may still be shown to user 130 on display 118 of FIG. 1.


To provide an artist-friendly user interface consistent with user expectations, it is thus desirable to provide a user defined level of locality control, thereby allowing the user to select only a smaller portion of the user sketch data, for example only the head area of a character sketch, or only a particular element of a diagram. If the fall-off function in equation (3) is used as-is without modifications, locality control η is equivalent to 0.0, resulting in sketch segmentation 328a for any first input scribble 326. Thus, a new fall-off function may be defined as equation (6) below:





χ(i, r, g, σg)=max(0, γ·δ*(r, g, σg))   (6)

    • where γ=1 if φr≠b (i.e. the label of r is not b), else γ=−1.


      Fall-off function χ regulates the transfer of energy to a new background label b ∈ L, which represents unselected or background sketch segments. For each scribble segment r Å R a copy rb is also created, having the same properties of r but with a label b.


The function δ* of equation (6) is defined in equation (7) below:





δ*(r, g, σg)=(1+η(r))·δ(g, σg)−η(r)·δ(g, σg)ω  (7)


where ω is a parameter to adjust the energy transfer curve.


Moving to FIG. 3B, FIG. 3B presents exemplary graphs of energy fall-off functions to provide locality control in sketch segmentation using smart scribbles. With a locality control of η=0.0 in equation (7), the regular δ function in graph 310a is obtained. However, with a positive locality control, for example η=1.5 in equation (7), the negative component of δ* grows, as shown in graph 310b. Thus, using the new fall-off function χ in equation (6), some strokes are transferred to the user-defined label (φr≠b) in graph 310c, whereas a portion of strokes are transferred to the background label (φr=b) in graph 310d, resulting in the desired labeling of sketch segmentation 328b in FIG. 3A.


To provide the user control of the locality control, the recorded input speed or input pressure of the associated input scribble 326 may be utilized to calculate η(r) in equation (8) below:










η


(
r
)


=


3
2



(

1
-




speed


(
r
)


-

s
min




s
max

-

s
min





)






(
8
)









    • where speed(r) corresponds to the speed and/or pressure of the scribble segment, and smin and smax and are set to comfortable user operating ranges.


      Thus, a faster speed or harder pressure for input scribble 326 results in decreased locality and a larger user label selection, whereas a slower speed or a lighter pressure for input scribble 326 results in increased locality and a smaller user label selection. Note that equation (8) is only provided as one working example for user control of locality control; any effective algorithm where η(r) depends on speed(r) may also be utilized.





Moving to FIG. 4A, FIG. 4A presents a table showing exemplary parameters for energy minimization to derive sketch segmentation using smart scribbles. Table 1 in FIG. 4A shows various example parameters for the equations discussed above and also utilized to obtain the example segmentation results shown in FIGS. 3A and 4B. The parameters in Table 1 may be adjusted according to the requirements and specifications of drawing application 120, user 130, display 118, input device 116, or for any other consideration.


Next, FIG. 4B presents an exemplary sketch having the same sketch segmentation results with various smart scribble sets. User sketch data 424 is subjected to three different sets of smart scribbles, which all result in the same sketch segmentation 428a, 428b, and 428c, corresponding to three user defined labels. For ease of visibility, sketch segmentations 428a, 428b, and 428c are shown staggered horizontally. The first set of input scribbles 426a, 426b, and 426c show scribbles that follow the sketch strokes quite closely. As expected, a correct segmentation into three distinct shapes is provided by sketch segmentations 428a, 428b, and 428c, respectively. The second set of input scribbles 426d, 426e, and 426f show scribbles that only approximate the general region of the desired sketch strokes by oval shapes. However, the smart scribble library 122 is resilient to such deviations due to the definition of the energy function in equation (3) including several factors besides just spatial proximity. Finally, the third set of input scribbles 426g, 426h, and 426i only indicate the desired labeling by very short scribbles.


Assuming that the shapes of user sketch 424 are each drawn at distinct time periods, the temporal proximity of the associated strokes may be utilized in equation (3) to help determine the correct labeling. Even if an incorrect labeling is provided, for example too small or too large, the user can simply provide additional input scribbles to refine the labeling by broadening or narrowing the selection as necessary.



FIG. 4B provides some examples of the flexibility of the smart scribbles, but only with a simple user sketch data 424. However, the smart scribbles can also provide excellent labeling results for more complicated drawings as well. Such results may be dependent on carefully selected parameters for Table 1 of FIG. 4A. While the selection of good parameters for Table 1 of FIG. 4A may take some effort to manually adjust, a labeling database of ground truth data may potentially be utilized to automatically tune the parameters of Table 1.



FIG. 5 presents an exemplary flowchart illustrating a method for providing sketch segmentation via smart scribbles. Flowchart 500 begins when processor 112 of computing device 110 retrieves user sketch data 124 comprising a plurality of strokes (510). User sketch data 124 may be generated while user 130 uses input device 116 to create a sketch drawing. As previously discussed, user sketch data 124 may be stored in a vector format and may include lines, curves, and other geometric primitives along with time stamps and stroke characteristics.


Next, processor 112 of computing device 110 receives input scribbles 126 for segmenting user sketch data 124 (520). Thus, user 130 may provide one or more input scribbles 126 through input device 116 to guide the sketch segmentation process. Input scribbles 126 may be stored in a similar format as user sketch data 124, with the exception that time stamps may be omitted from input scribbles 126 as previously discussed. Further, as previously discussed, both user sketch data 124 and input scribbles 126 may be resampled into smaller segments for simplified processing. Note that it may not be the same user 130 that provides both user sketch data 124 and input scribbles 126. For example, user sketch data 124 may be recorded and provided by a different user from user 130.


Next, processor 112 of computing device 110 minimizes an energy function to assign a plurality of labels to the plurality of strokes (530). The energy function corresponds to equation (1) as described above, with a smoothness term and a data term described in equations (2) and (4) respectively. Further, the energy function may be modified to provide user controlled locality control, as described in FIGS. 3A and 3B. To minimize the energy function, the problem may be structured into a specific graph, as shown in FIG. 2B, which may be solved using the greedy multi-way cut algorithm of LazyBrush within polynomial time.


Next, processor 112 of computing device 110 shows, on display 118, the assigning of the plurality of labels to the plurality of strokes (540). For example, the strokes may be placed in layers according to their assigned label, colored or shaded according to their assigned label, or otherwise visually segmented within a user interface of drawing application 120 shown on display 118. From this point, user 130 may use the labeling indicated on display 118 to attain various goals using drawing application 120, including object occlusion, moving and deforming of parts, animation inbetweening or tweening, line or path stroking with color, area shading with colors or patterns such as textures, hatching or screen tone, and many other application goals.


From the above description it is manifest that various techniques can be used for implementing the concepts described in the present application without departing from the scope of those concepts. Moreover, while the concepts have been described with specific reference to certain implementations, a person of ordinary skill in the art would recognize that changes can be made in form and detail without departing from the spirit and the scope of those concepts. As such, the described implementations are to be considered in all respects as illustrative and not restrictive. It should also be understood that the present application is not limited to the particular implementations described herein, but many rearrangements, modifications, and substitutions are possible without departing from the scope of the present disclosure.

Claims
  • 1. A method for providing sketch segmentation via smart scribbles, the method comprising: retrieving user sketch data comprising a plurality of strokes;receiving at least one input scribble for segmenting the user sketch data;minimizing an energy function to assign a plurality of labels to the plurality of strokes, the energy function having: a data term measuring an affinity between the plurality of strokes and the at least one input scribble; anda smoothness term measuring a cost of selecting a label with respect to a similarity between two strokes within the plurality of strokes;showing, on a display, the assigning of the plurality of labels to the plurality of strokes.
  • 2. The method of claim 1, wherein the minimizing of the energy function assigns a portion of the plurality of strokes to a background label based on an input speed or an input pressure of the at least one input scribble.
  • 3. The method of claim 1, wherein the minimizing is by a plurality of binary graph cuts.
  • 4. The method of claim 1, wherein the user sketch data and the at least one input scribble are resampled into smaller segments prior to the minimizing.
  • 5. The method of claim 1, wherein the smoothness term includes a time term between the two strokes.
  • 6. The method of claim 1, wherein the smoothness term includes a proximity term between the two strokes.
  • 7. The method of claim 1, wherein the smoothness term includes a direction term and a curvature term between the two strokes.
  • 8. The method of claim 1, wherein the data term includes a proximity term between the plurality of strokes and the at least one input scribble.
  • 9. The method of claim 1, wherein the data term includes a direction term between the plurality of strokes and the at least one input scribble.
  • 10. The method of claim 1, wherein the data term includes an oriented curvature term between the plurality of strokes and the at least one input scribble.
  • 11. A computing device providing sketch segmentation via smart scribbles, the computing device including a processor configured to: retrieve user sketch data comprising a plurality of strokes;receive at least one input scribble for segmenting the user sketch data;minimize an energy function to assign a plurality of labels to the plurality of strokes, the energy function having: a data term measuring an affinity between the plurality of strokes and the at least one input scribble; anda smoothness term measuring a cost of selecting a label with respect to a similarity between two strokes within the plurality of strokes;show, on a display, the assigning of the plurality of labels to the plurality of strokes.
  • 12. The computing device of claim 11, wherein the processor is configured to minimize the energy function to assign a portion of the plurality of strokes to a background label based on an input speed or an input pressure of the at least one input scribble.
  • 13. The computing device of claim 11, wherein the processor is configured to minimize by a plurality of binary graph cuts.
  • 14. The computing device of claim 11, wherein prior to the minimizing the processor is configured to resample the user sketch data and the at least one input scribble into smaller segments.
  • 15. The computing device of claim 11, wherein the smoothness term includes a time term, a proximity term, a direction term, and a curvature term between the two strokes.
  • 16. The computing device of claim 11, wherein the data term includes a proximity term, a direction term, and an oriented curvature term between the plurality of strokes and the at least one input scribble.
  • 17. A system for providing sketch segmentation via smart scribbles, the system comprising: a display;an input device;a computing device having a processor configured to: retrieve, from the input device, user sketch data comprising a plurality of strokes;receive, from the input device, at least one input scribble for segmenting the user sketch data;minimize an energy function to assign a plurality of labels to the plurality of strokes, the energy function having:a data term measuring an affinity between the plurality of strokes and the at least one input scribble; anda smoothness term measuring a cost of selecting a label with respect to a similarity between two strokes within the plurality of strokes;show, on the display, the assigning of the plurality of labels to the plurality of strokes.
  • 18. The system of claim 17, wherein the input device is a pen tablet.
  • 19. The system of claim 17, wherein the smoothness term includes a time term, a proximity term, a direction term, and a curvature term between the two strokes.
  • 20. The system of claim 17, wherein the data term includes a proximity term, a direction term, and an oriented curvature term between the plurality of strokes and the at least one input scribble.