Chapter 4. Images and Textures

It is often insufficient to create rich visualizations using only basic geometric primitives. Images are the building blocks that help in adding decoration, style, and even photorealism to an interactive scene. In this chapter we will cover the basic operations that we can perform on images:

  • Loading and drawing an image
  • Rotating images
  • Color modulation
  • Transparency
  • Creating and modifying images
  • Using ofTexture for memory optimization
  • Image warping and video mapping

Raster and vector images

In computer graphics and computer vision, an image is a two-dimensional picture that is used for a wide range of purposes. There are two classes – raster and vector images.

Raster images are rectangular arrays of picture elements (called pixels) and they are natural for representing photos from digital cameras. Modern computer screens are physical arrays of pixels, hence the screens are natural devices for displaying raster images.

Vector images consist of a number of graphical primitives such as lines, circles, and curves, and they are natural for representing precise drawings such as cartoons and graphs. Vector images can be scaled up without any loss of quality and increase in the size of memory, hence they are used for parametrical drawings.

openFrameworks works with both raster and vector images. In this chapter, we will deal with raster images only. For working with vector images, the examples/addons/svgExample example.

Let's consider the two basic operations with an image – loading an image from a file and drawing it on the screen.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset