Keywords: front-page

## Lab: Image Combining

[Exercises] [Workspace]

Purpose: This experiment illustrates the combination of two images by several ways: pixel averaging, gaussian weighting image and geometric blending.

Activities:

1. Choose the images to blend

   1. Select two images of the same size, for instance $DIP/data/lenina.kdf and $DIP/data/barcode.kdf and display them. Use the Data Object Info and File Viewer operators to determine the size of the input images.

      1. Glyphs:Input/Output:Data Files:User defined
      2. Glyphs:Visualization:Non-Interactive Display:Display Image
      3. Glyphs:Input/Output:Information:Data Object Info
      4. Glyphs:Input/Output:Information:File Viewer

2. Blend the images by averaging their pixels

   1. Use the Blend Data operator to combine both images.

      - Glyphs:Arithmetc:Two Operand Arithmetc:Blend Data

   2. Open the Blend Data operator pane and certify that the blending constant is 0.5. Connect the two first input to the images you want to blend.
   3. Display the results using the Display Image operator.

      - Glyphs:Visualization:Non-Interactive Display:Display Image

3. Blend the images using a gaussian blending image

   1. Now, create a gaussian image to be used as the blending factor of the operator Blend Data. Use the 2D Gaussian operator:

      1. Glyphs:Input/Output:Generate Data:2D Gaussian
      2. Open the 2D Gaussian glyph and set the parameters:

                 Width of Output  = 256
                 Height of Output = 256
                 Peak Location along Width  (X) = 128
                 Peak Location along Height (Y) = 128
                 Variance along Width  = 40 * 40
                 Variance along Height = 40 * 40
                 Correlation coefficient = 0
                 Peak Value = 1.0

   2. Duplicate the Blend Data glyph and use the output of the 2D Gaussian glyph as the third input of the Blend Data operator. Display the result using the Display Image operator.

4. Blend the images using a binary chessboard blending image

   1. Build and display a chessboard pattern image with the same dimensions as the images selected in Step 1. (Follow the instructions for Chess Board Generation given in the Patterns lab - Lab 1.)
   2. Duplicate the Blend Data glyph and use the chessboard image as the third input of the Blend Data operator. Display the result using the Display Image operator.

Exercises

1. Display a zoom of a portion of the resultant image in the average combination and in the geometric combination to see the difference between the methods. Use the Display Zoom Image glyph.
2. How can you create an image sequence where the first image is image A and the last is image B and the frames in between are interpolated turning image A into image B progressively?

Khoros Workspace
Execute the visual program c3s2combine-image-grid.wk