Image Types and Filters

Image Types and Filters

Image Types and Filters

Canvas X Draw supports 8-bit, 16-bit, and floating point (32-bit) images. All image filters are available for 8-bit images. For Binary filters, the 8-bit image must be grayscale. (See Binary Filters.)

Regarding 16-bit and floating point (32-bit) images, various image filters and adjustment commands are available. (See Available filters and adjustment commands.)

Image Modes

If you are working with various image types and need to determine or convert images, choose Image | Mode.

  • 8 Bits/Channel: Indicates an 8-bit image. If working with 16-bit or 32-bit images, select this option to convert to an 8-bit image.
  • 16 Bits/Channel: Indicates a 16-bit image. Select this option to convert to a 16-bit image if working with another image type.
  • FP-32 Bits/Channel: Indicates a floating point (32-bit) image. A floating point image refers to any array of data that is visualized. Select this option to convert to a 32-bit image if working with another image type.

You must convert an 8-bit or 16-bit image to grayscale to enable the FP-32 Bits/Channel option.

The following table indicates the filters that can be used with each type:

Image type

Available filters and adjustment commands

16-bit

Average blur, Gaussian blur, Add Noise, Despeckle, Dust & Scratches, Median, High Pass, Maximum, Minimum, Arithmetic, Binary Logic, Expression, Image Math, Colorize, Invert, Levels, Curves, Brightness/Contrast, Convolve, Hue/Saturation (RGB only), Color Balance (RGB only)

FP (32-bit)

Average blur, Median, Minimum, Maximum, Arithmetic, Expression, Image Math, Convolve, Colorize

Binary Filters

These commands can be applied to 8-bit grayscale images. For the Dilate, Erode, Open, and Close commands, you must specify the number of iterations in a dialog box. Iterations refer to the number of repetitions of a chosen filter.

Dilate

The Dilate command enlarges objects that are darker than the background adding pixels to the edges of black objects.



Original image

Image with Dilate filter applied

Erode

The Erode command reduces the size of objects that are darker than the background.



Original image

Image with Erode filter applied

Make Binary

The Make Binary command converts a grayscale image, or the current selection, to values of either 0 or 255 so that you can apply a binary command to the image.

Close

The Close command is a combination of the Dilate and Erode commands. When selected, the filter first performs a dilation and then the erosion. The goal of the filter is to smooth objects by filling in gaps in the image.



Original image

Image with Close filter applied

Open

The Open filter, a combination of the Erode and Dilate commands, is used to smooth objects and eliminate isolated pixels. When applied, the Erode filter is first performed, followed by the Dilate command.



Original image

Image with Open filter applied

Outline

Select this command and all black objects will be represented by a one-pixel wide outline.



Original image

Image with Outline filter applied

Skeletonize

When this command is applied to 8-bit grayscale images, pixels are removed from the edges of objects until the edges consist of single pixel-wide skeletons.



Original image

Image with Skeletonize filter applied

Distance Map

When applied, this filter creates an Euclidean distance map (EDM). The result of the command is that every black pixel is replaced with a gray value that is equivalent to the black pixel’s distance from the closest white pixel.



Original image

Image with Distance Map filter applied

Ultimate Points

This filter is used on images to which the Distance Map filter has been applied to find the Ultimate Eroded Points (UEPs) of the Distance Map.



Image with Distance Map filter applied

Image with Ultimate Point filter applied

Scientific filters

Canvas X Draw features scientific filters that can be used to analyze 8-bit, 16-bit, and floating point (32-bit) images. See Available filters and adjustment commands to verify which scientific filter is available for the various image types.

To Access the Scientific Filters:

Choose Image | Filter | Scientific.

Arithmetic

The Arithmetic Filter contains commands that add (subtract, multiply, etc.) a value to each pixel in the active image or selection. When the result value is above or below the legal range of the image's data type, the value is reset to the maximum/minimum value.

To Apply an Arithmetic Filter:

  1. Select the image object (or part of it with a Marquee or Lasso tool) or place it in Edit mode.
  2. Open the Operation menu to choose a command.
  3. Select the Preview checkbox so you can see the result before clicking OK.

  4. Enter a value in the Value numeric field.
  5. Click OK.

The Operation menu contains the following commands:

Operation

Explanation

Add

Adds a value to the image. With 8-bit images, results greater than 255 are set to 255.

Subtract

Subtracts a value from the image. With 8-bit and 16-bit images, results less than 0 are set to 0.

Multiply

Multiplies the image by the specified real value. With 8-bit images, results greater than 255 are set to 255. With 16-bit signed images, results greater than 65,535 are set to 65,535.

Divide

Divides the image by the specified real value. Attempts to divide by zero will be ignored.

Minimum

Pixels in the image with a value less than the specified value are replaced by the value.

Maximum

Pixels in the image with a value greater than the specified constant are replaced by the value.

Square root

Destination pixel is equal to the square root of source pixel.

Square

Destination pixel is equal to the square of source pixel.

Gamma

Applies the function f(p) = (p/255)^gamma*255 to each pixel (p) in the image or selection, where 0.1 <= gamma <= 5.0. For RGB images, this function is applied to all three color channels. For 16-bit images, the minimum and maximum are used for scaling instead of 255.

Log

Applies the function f(p) = log(p) * 255/log(255) to each pixel (p) in the image or selection. For RGB images, this function is applied to all three color channels. For 16-bit images, the minimum and maximum are used for scaling instead of 255.

Binary Logic

The Binary Logic Filter contains commands that perform bitwise operations or shift bits accordingly within a pixel.

The Operation menu contains the following commands:

Operation

Explanation

Or

Performs a bitwise OR operation on a source pixel and an argument.

And

Performs a bitwise AND operation on a source pixel and an argument.

Xor

Performs a bitwise XOR operation on a source pixel and an argument.

Left Shift/Right Shift

Performs a logical shift; it shifts all the bits in the pixel left or right according to the value specified in edit box and inserts 0.

Colorize

The Colorize filter is used to assign colors or gradients to a chosen range of values. Depending on the image type, 8-bit, 16-bit, or floating point (32-bit), you can use either absolute values or percentages.

For floating point (32-bit) images, the Absolute values checkbox is automatically selected so you will use Absolute values.



Using the Colorize Filter

New filter

Click on this icon to start a new filter. The default values are 0 to 100.

Value range

Enter the minimum and maximum in the scroll boxes. Deselect the Absolute values checkbox to use percentages for the range. Select it for actual values (floating point 32 images).

Color palette

Assign a color to the value range. Select the Gradient option to access both color palettes and view the distribution of the minimum/maximum range.

Edit box

All defined filters are stored in this area.

Preview

Select the Preview checkbox if you want to see the results before clicking OK.

To Modify a Filter:

  1. Select the filter in the Edit box.
  2. Make any necessary changes.

To Delete a Filter:

  1. Select the filter in the Edit box.
  2. Click the trash can icon.

To Save a Setting:

  1. Define the filters as indicated previously.
  2. Click on the menu icon.
  3. Select Save settings.
  4. In the dialog box, enter a name for the setting.

You can save an unlimited number of settings.

To Load a Setting:

  1. Click on the menu icon.
  2. Select Load settings.
  3. Choose a setting.

Image Math

This filter performs an arithmetic and logical operation between two color channels and applies the result to another color channel.

The Operation menu contains the following commands:

Operation

Explanation

Add

Adds a value to the image. With 8-bit images, results greater than 255 are set to 255.

Subtract

Subtracts a value from the image. With 8-bit and 16-bit images, results less than 0 are set to 0.

Multiply

Multiplies the image by the specified real value. With 8-bit images, results greater than 255 are set to 255. With 16-bit signed images, results greater than 65,535 are set to 65,535.

Divide

Divides the image by the specified real value. Attempts to divide by zero will be ignored.

Minimum

Pixels in the image with a value less than the specified value are replaced by the value.

Maximum

Pixels in the image with a value greater than the specified constant are replaced by the value.

Or

Performs a bitwise OR operation on a source pixel and an argument.

And

Performs a bitwise AND operation on a source pixel and an argument.

Xor

Performs a bitwise XOR operation on a source pixel and an argument.

Average

Applies the function Result = (img1+img2)/2 to each pixel in the image or selection.

Difference

Applies the function Result = |img1-img2| to each pixel in the image or selection.

The chosen operation is performed, and the result is multiplied by the Scale factor. The Offset value is then added. The final result is applied to the color channel selected from the Result menu.



Original image

1st operand: Green

Operation: Xor

2nd operand: Red

Scale: 2.0

Offset: 0.0

Result: Green

To Apply the Image Math Filter to Multiple Images:

  1. Select the images.
  2. Apply the filter by choosing Image | Filter | Scientific | Image Math.
  3. In the Filter operation mode dialog box, select the options you want to use.
  4. Click OK.

Expression

The Math Expression filter can be used to perform mathematical equations on a color channel.

To Use the Math Expression Filter:

  1. Select the color channel from the Target menu. The available color channels depend on the image mode; i.e., CMYK, RGB, etc.
  2. Define the mathematical equation using the Categories scroll box and their related items.
  3. Double-click on an item to make it appear in the Expression field.
  4. The lower portion of the dialog box indicates the correct syntax and shows an example of the expression.

  5. Click Apply to see the effect. Clicking Revert stops the effect on the color channel.
  6. Click OK to permanently apply the effect to the channel.

To Apply the Math Expression Filter to Multiple Images:

  1. Select the images.
  2. Apply the filter by choosing Image | Filter | Scientific | Expression.
  3. In the Filter operation mode dialog box, select the options you want to use.
  4. Click OK.

Convolve

The Convolve filter can be used to apply a spatial convolution on an image or selected image area. The convolution is performed according to a kernel, which is basically a matrix whose size you define in terms of width and height in pixels. Note that only odd numbers can be used to define the size of the kernel. The maximum is 11 pixels and the minimum, 3 pixels.


The Convolve filter is applied to every pixel in an image. The center of the matrix matches the source pixel and the other matrix components relate to the surrounding pixels.

The resulting pixel is calculated by multiplying the value of each source pixel by the corresponding value in the kernel and then adding the results.

To Preserve Image Brightness:

  1. Select the Normalize kernel checkbox. This option causes each matrix value to be divided by the sum of the values.
  2. Click Apply to see the filter effect on the image. If the convolution is not appropriate, click Revert and try another one.
  3. Click OK to apply the filter and close the dialog box.

To Save a Kernel:

  1. Define the kernel.
  2. Click on the menu icon and select Save kernel as.
  3. In the Save kernel as dialog box, enter a name for the kernel and click OK.

Saved kernels appear at the bottom of the menu when you click the menu icon.

To Delete a Kernel:

  1. Click on the menu icon and select Delete kernel.
  2. In the Delete kernel preset dialog box, select the kernel to be deleted and then click OK.

To load a kernel:

  1. Click on the menu icon.
  2. Select the kernel that you want to apply.

To Paste a Kernel:

Before pasting a kernel, ensure there is a space between the values.

  1. Copy the kernel from its source (e.g., Notepad).
  2. Click the Paste icon.



Original image

Image with Convolve filter applied

    • Related Articles

    • Image Types and Filters

      Image Types and Filters Canvas X Draw supports 8-bit and 16-bit images. All image filters are available for 8-bit images. For Binary filters, the 8-bit image must be grayscale. (See Binary Filters.) Regarding 16-bit images, various image filters and ...
    • Image Types and Filters

      Image Types and Filters Canvas X Draw supports 8-bit and 16-bit images. All image filters are available for 8-bit images. For Binary filters, the 8-bit image must be grayscale. (See Binary Filters.) Regarding 16-bit images, various image filters and ...
    • Creating Custom Image Filters

      Creating Custom Image Filters You can create your own special-effect and image-correcting filters using the Custom command. You can also save custom filters and use them in future Canvas X Draw documents. Filters work with an image one pixel at a ...
    • Creating Custom Image Filters

      Creating Custom Image Filters You can create your own special effect and image-correcting filters using the Custom command. You can also save custom filters and use them in future Canvas X Draw documents. Filters work with an image one pixel at a ...
    • Creating Custom Image Filters

      Creating Custom Image Filters You can create your own special effect and image-correcting filters using the Custom command. You can also save custom filters and use them in future Canvas X Draw documents. Filters work with an image one pixel at a ...