Lab: Generation of Trapezoidal Data

[Exercises] [Workspace]

Purpose: Generation of synthetic data sets, 1D signals and 2D images, are essential for the creation of test patterns, color maps, filter kernels, etc. The purpose of this lab exercise is to create simple 1D signals and 2D images.

Activities:

  1. Impulses: Use the Impulse operator to generate both 1D and 2D data sets. Show the data sets using the "Plot" and Display Image operators.

    1. Generate a 1D Impulse sequence of length 26, with 4 impulses of amplitude 5, spaced 3 units apart, where the first impulse starts at 5. Select the following operators from the cantata menus:

      1. Glyphs:Input/Output:Generate Data: Impulse

      2. Glyphs:Visualization:Plot Display: Display 2D Plot

      3. Open the Impulse pane and set the following parameters:

        "Output object size" Width = 26 (all other dimensions = 1)

        "Number of Impulses" along Width = 4, (all other dimensions = 1)

        "Spacing between impulses" along Width = 3 (all other dimensions = 1)

        "Impulse offset" along Width = 5 (all other dimensions = 0)

        "Amplitude" (Real value of impulse) = 5

      4. Connect the Impulse operator to the Display 2D Plot operator. Run the workspace.
      5. To view the impulse sequence, select the options button on the Display 2D Plot, and change the "Plot Type" to "Discrete".

    2. Generate and view a 2D impulse image of size (Width=128, Height=100). In the width direction there will be 4 impulses, each separated by 32 pixels. In the height direction there will be 8 impulses, each separated by 10 pixels. The amplitude of each impulse is 255. The offset of the first impulse in both dimensions are 0. Select the following operators from the cantata menus:

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

      2. Duplicate the Impulse pane.
      3. Set the following parameters for the Impulse operator:

        "Output object size" Width = 128, Height = 100 (all other dimensions = 1)

        "Number of Impulses" along Width = 4, Height = 8 (all other dimensions = 1)

        "Spacing between impulses" along Width = 32, Height = 10 (all other dimensions = 1)

        "Impulse offset" along all dimensions = 0

        "Amplitude" (Real value of impulse) = 255

      4. Connect the Impulse to the Display Image operator. Run the workspace.

  2. Trapezoidal Pulses: Use the Piecewise Linear operator to generate trapezoidal 1D signals and images (ramp, triangle, and square waves). Specify the period, rise, width and fall durations parameters and display the results.

    1. Generate a 1D trapezoidal wave sequence of 26 points along the "Width" dimension. The sequence should have a "Minimum Value" of 0 and a "Maximum Value" of 10, with a rise time of 2, a fall time of 4, and a pulse width of 3. Use a "Sampling Frequency" of 1. Select the following operators from the cantata menus.

      1. Glyphs:Khoros 1:Generate Data: Piecewise Linear

      2. Glyphs:Visualization:Plot Display: Display 2D Plot

      3. Open the Piecewise Linear pane and set the parameters as described above. Note that "Width" = "Number of Cols", and X corresponds to the width dimension, Y corresponds to the height dimension.
      4. Connect the Piecewise Linear operator to the Display 2D Plot operator. Run the operators.
      5. To view the sequence, select the "Options" button on the 2D Plot window, and change the "Plot Type" to "Discrete".

    2. Generate a 2D ramp image (Number Cols = 512, Number Rows = 50), where the ramp function is applied horizontally such that the "Minimum Value" (0) is at the left edge of the image, and the "Maximum Value" (255) is at the right edge. (To make the ramp function span the width of the image, set the "Period" and "Rise Time" in the width direction to be equal to the width). Use a "Sampling Frequency" of 1.

      1. Duplicate the Piecewise Linear operator and set the parameters as described above.
      2. Connect the Piecewise Linear operator to a Display Image operator and run Display Image.

    3. Generate a 2D triangle wave image (Number Cols = 512, Number Rows = 50), where the wave function is applied horizontally such that the "Minimum Value" (0) is at the left and right edges of the image, and the "Maximum Value" (255) is at the center. Use a "Sampling Frequency" of 1.

      1. Open the Piecewise Linear operator and set the parameters as described above. To center the peak, the "Rise" and "Fall" times should be equal, and set to 1/2 the width of the image.
      2. Run the Piecewise Linear and Display Image operators to view the triangle wave function.

    4. Generate a 2D square wave image (Number Cols = 512, Number Rows = 50), where the wave function is applied horizontally. Use a "Pulse Width" of 10, a "Period" of 30, with a "Minimum Value" of 100, and a "Maximum Value" of 200. Use a "Sampling Frequency" of 1.

      1. Open the Piecewise Linear operator and set the parameters as described above. To create a square wave, the "Rise" and "Fall" times should be zero.
      2. Run the Piecewise Linear and Display Image operators to view the square wave function.


Exercises

  1. Perform the same experiment generating different patterns.

    1. Generate a 1D square wave sequence (Rise Time = Fall Time = 0).
    2. Generate a 1D square ramp sequence (Pulse Width = Fall Time = 0 & Rise Time = Pulse Period).
    3. Generate a 1D triangular wave sequence (Rise Time = Fall Time, & Pulse Width = 0).

  2. Perform the same 2D image generation experiments, but with two patterns, i.e. one in the horizontal direction and the other in the vertical direction.


Khoros Workspace
Execute the visual program c2s1piecewise.wk



Main DIP Menu
DIP Feedback Form
Copyright © 1997-1995 KRI, ISTEC, Ramiro Jordán, Roberto Lotufo. All Rights Reserved