O'Reilly logo

Mastering openFrameworks: Creative Coding Demystified by Denis Perevalov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Processing a single video frame

Now we begin to learn the methods of processing video. Values of pixels in the current video frame can be read in a way similar to the one in ofImage, using access to its pixel array data:

unsigned char *getPixels()

Also, here is the getPixelRef() method, which returns a reference to a pixel array of the current frame, represented by a special class ofPixels.

Tip

Note that the ofImage class has getPixelRef() too and can be used in a similar way.

It is easy to get the pixel color using pixels.getColor( x, y ), which returns the ofColor value of pixel ( x,y ). Compared to directly working with pixels data using getPixels(), it is a relatively slow operation, but is more simple and convenient. Note, ofPixels has useful ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required