Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Drawing

The SimpleCV framework includes tools to draw several basic shapes such as lines, bezier curves, circles, ellipses, squares, and polygons. To demonstrate the true power of the drawing engine, Figure 7-6 is a rendering of a lollipop (there is a reason we did not go to art school):

from SimpleCV import Image, Color

img = Image((300,300))  1

img.dl().circle((150, 75), 50, Color.RED, filled = True)  2

img.dl().line((150, 125), (150, 275), Color.WHITE, width = 5)  3

img.show()
1

This creates a blank 300×300 image.

2

Fetches the drawing layer and draws a filled red circle on it.

3

Fetches the drawing layer and draws a white line on it that is 5 pixels wide.

An example lollipop using the circle and line commands

Figure 7-6. An example lollipop using the circle and line commands


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint