Adjust image brightness, contrast and saturation

This patch demonstrates two ways to adjust the color balance in a video. One is the use the jit.brcosa object. The name "brcosa" is an abbreviation of three attributes of a video: brightness, contrast, and saturation. Definitions and explanations of those three terms can be found in Jitter Tutorial 7: Image Level Adjustment. The three terms are exactly the three attributes of the jit.brcosa object that one is expected to adjust to change the incoming video.

Alpha masking

A video matrix, such as comes out of jit.movie, has four planes of data, representing alpha, red, green, and blue. The alpha channel contains information about the opacity of the other three planes—a factor that can be used when mixing/compositing with another image. Normally the values in the alpha channel are all set to 1., meaning full opacity. However, if some values in the alpha channel are 0., the image will be transparent in those pixels, allowing another image to show through.

Delay a matrix

This patch demonstrates a way to create a video delay effect using jit.matrixset. The jit.matrixset object is essentially an array of Jitter matrices. One of the things you can do with such an array is store a set of past frames of a video to recall later. Here we use the array as a circular buffer of the most recent 30 video frames to come out of jit.qt.movie.

Replaceable white mask

If you have a video that you first want it masked by a white background, and uncover the video as lines are drawn into it, you can use a jit.lcd with a white background, draw into it with black lines, and add that to your video. All the pixels that are white (255 255 255) in your jit.lcd matrix will be white in the summed output, and all the pixels that are black (0 0 0) in the jit.lcd will not affect the video.

Adjust brightness and contrast on a 1-plane char matrix

Brightness and contrast are explained briefly in Jitter Tutorial 7: Image Level Adjustment. The common Jitter object for adjusting brightness, contrast, and saturation of an image is jit.brcosa. You might wonder, though, what math is used to adjust brightness and contrast. Brightness is just multiplication, so you could simply use the jit.op object with @op * as the argument (or the equivalent jit.*).

text to video

This example shows a simple way of putting text into video, with the lines of text stored in a coll object. After loading the video sending a read message to jit.qt.movie, you can load each line by clicking the button in the middle of the patch.

Color bit depth in Jitter

A Jitter matrix in which the cells represent colored pixels—such as a video—normally has four planes of 8-bit (char) data, representing the values of the alpha, red, green, and blue components of the color. If you wanted to reduce the bit depth of that color information to fewer than 8 bits, which would reduce the total number of colors in the image, a simple way to do that is to shift all the bits to the right (so that the least significant bits are lost), then shift them back.