Keywords: front-page

## Lab: Pixel Overflow

[Exercises] [Workspace]

Purpose: The purpose of this lab exercise is to demonstrate the effects of pixel overflow.

Activities:

1. Select and display an image with data type unsigned byte (for example, Floating Ball). Use these operators

   1. User defined and
   2. Glyphs:Visualization:Non-Interactive Display:Display Image

2. increase the level of all pixels by a desired constant, say 80. Use the operator:

   1. Glyphs:Arithmetic:Two Operand Arithmetic:Add
   2. Set the "Real Constant" in the Add pane to a value that will increase the level of all pixels by a desired constant
   3. connect the operators, and display the results using Display Image

3. Use a variable in cantata. The parameters in any cantata pane operator can accept any expression. You can put for instance 40 + 40. It is also possible to use a variable in cantata:

   1. Open the Workspace:Variables... pane
   2. In the pane define the variable K = 80 and hit return.
   3. Close the pane
   4. In the Add operator, put the created variable as the parameter.

4. Repeat the last step, but first convert the pixel data type of the original image to unsigned short. use the operator

   1. Glyphs:Data Manip:Data Conversion:Convert Type
   2. Connect the output of User defined to the input of Convert Type
   3. open the Convert Type pane and select "Short" from the "Select Output Data Type:" pull down list.
   4. Duplicate the Add and Display Image operators using the "duplicate" icon.
   5. Connect the rest of the network and run the workspace

Exercises

1. Add different constant values to gain a better understanding of the wraparound effect. Change only the variable K and rerun the workspace. Can we detect this effect with data types "short" "long" "integer" and "float"?

Khoros Workspace
Execute the visual program c1s4wrap-byte.wk