Keywords: front-page

## Lab: Comparing Images Visually

[Exercises] [Workspace]

Purpose: Compare images visually putting them together in a single image, in the form of mosaic image or frames in a sequence.

Activities:

1. Create a single image for comparison using mosaic image.

   1. Use the User defined operator to access the images: $DIP/data/retina.kdf and $DIP/data/mpicchu.kdf. Put them together side by side using the Inset operator. Set the parameter "Width Coordinate" of the Inset operator to 256, which is the width of the first image, such that the second image is placed at coordinate w=256 in the first image. Visualize with Display Image operator. Use the following operators:

      1. Glyphs:Input/Output:Data Files:User defined
      2. Glyphs:Data Manip:Size & Region Operators:Inset
      3. Glyphs:Visualization:Non-Interactive Display:Display Image

2. Making this process more general.

   If the width of the first image changes, you have to change the parameter accordantly. You can use the operators Print Stats to set a cantata variable to the width of the image. You can find the Print Stats operator in:

   1. Glyphs:Data Manip:Analysis & Information:Print Stats

   1. Use the input of the Print Stats operator connected to the first image which you want to get the width. Set the parameter in the Print Stats operator to output only the "size attribute width". The variable associated with it is "width_size. This variable will be set to the input image width when the glyph is executed.
   2. Open the Inset operator and use "width_size" as its parameter "width coordinate".
   3. To make sure that the Inset operator will only executed when the variable "width_size" is updated, connect the "output control connection" of the Print Stats gluph to the "input control connection" of the Inset glyph.
   4. Run the workspace

3. Create a single image for comparison using a frames in a sequence.

   1. Use the previous User defined operator accessing the previous two images: $DIP/data/retina.kdf and $DIP/data/mpicchu.kdf and use two new User defined operators to access the images $DIP/data/ball.kdf and $DIP/data/gull.kdf. Use the Inset operator, two by two, setting the attribute "Element Coordinate" to 1 on both operators, and with these results use another Inset operator setting the attribute to 2, and visualize the result with the Animate operator putting the output of the Inset operator in "Input File".

      1. Glyphs:Data Manip:Size & Region Operators:Inset
      2. Glyphs:Visualization:Interactive Display:Animate

Exercises

1. Repeat the same experiments using a simpler operator which appends one image to the other. You can select the dimension you want to append the image. To put the images side-by-side you append in the "width" dimension and to append in an animation fashion you select append in the "element" dimension. The Append operator can be found in:

   1. Glyphs:Data Manip:Size & Region Operators:Append

Khoros Workspace
Execute the visual program c2s4compare-visual.wk