Class TLcdBinaryOp

java.lang.Object
com.luciad.imaging.operator.ALcdImageOperator
com.luciad.imaging.operator.TLcdBinaryOp

public final class TLcdBinaryOp extends ALcdImageOperator
Performs a binary operation on two input images. Supported operations are defined by TLcdBinaryOp.Operation.

Example


 // Using the static method:
 ALcdBasicImage inputImage = ...;
 ALcdBasicImage secondImage = ...;
 TLcdBinaryOp.Operation binaryOperation = TLcdBinaryOp.Operation.ADD;
 ALcdBasicImage outputImage = TLcdBinaryOp.binaryOp(inputImage, secondImage, binaryOperation);

 // Using a data object:
 ALcdBasicImage inputImage = ...;
 ALcdBasicImage secondImage = ...;
 TLcdBinaryOp op = new TLcdBinaryOp();
 ILcdDataObject params = op.getParameterDataType().newInstance();
 params.setValue(TLcdBinaryOp.INPUT_IMAGE, inputImage);
 params.setValue(TLcdBinaryOp.SECOND_IMAGE, secondImage);
 params.setValue(TLcdBinaryOp.OPERATION, binaryOperation);
 ALcdBasicImage outputImage = op.apply(params);
 
Convenience shortcut methods are also available for every supported operation:

   outputImage = TLcdBinaryOp.add(inputImage,secondImage);
   outputImage = TLcdBinaryOp.subtract(inputImage,secondImage);
   outputImage = TLcdBinaryOp.multiply(inputImage,secondImage);
   outputImage = TLcdBinaryOp.divide(inputImage,secondImage);
   outputImage = TLcdBinaryOp.max(inputImage,secondImage);
   outputImage = TLcdBinaryOp.min(inputImage,secondImage);
 
Input

+


Output
Since:
2014.0
  • Field Details

    • NAME

      public static final String NAME
      Name of the operator.
      See Also:
    • INPUT_IMAGE

      public static final TLcdDataProperty INPUT_IMAGE
      The input image.
    • SECOND_IMAGE

      public static final TLcdDataProperty SECOND_IMAGE
      The second image to use in the binary operation.
    • OPERATION

      public static final TLcdDataProperty OPERATION
      Binary operation to apply.
    • BINARY_FILTER_TYPE

      public static final TLcdDataType BINARY_FILTER_TYPE
      Input data type of the operator.
  • Constructor Details

    • TLcdBinaryOp

      public TLcdBinaryOp()
      Default constructor.
  • Method Details

    • apply

      public ALcdImage apply(ILcdDataObject aParameters)
      Description copied from class: ALcdImageOperator
      Applies this operator to the given input parameters. The parameters are stored in a data object which must be of the type given by ALcdImageOperator.getParameterDataType().
      Specified by:
      apply in class ALcdImageOperator
      Parameters:
      aParameters - the parameters for the operator
      Returns:
      the image produced by the operator
    • binaryOp

      public static ALcdBasicImage binaryOp(ALcdBasicImage aImage1, ALcdBasicImage aImage2, TLcdBinaryOp.Operation aOperation)
      Applies a binary operation to two input images.
      Parameters:
      aImage1 - first input image.
      aImage2 - second input image.
      aOperation - operation to apply to the images.
      Returns:
      the image resulting from applying the operation to the source images.
    • add

      public static ALcdBasicImage add(ALcdBasicImage aImage1, ALcdBasicImage aImage2)
      Add two images together.
      Parameters:
      aImage1 - first input image.
      aImage2 - second input image.
      Returns:
      an image where every pixel is the sum of the input pixels.
    • subtract

      public static ALcdBasicImage subtract(ALcdBasicImage aImage1, ALcdBasicImage aImage2)
      Subtract two images from each other.
      Parameters:
      aImage1 - first input image.
      aImage2 - second input image.
      Returns:
      an image where every pixel is the difference of the second and first input pixel.
    • multiply

      public static ALcdBasicImage multiply(ALcdBasicImage aImage1, ALcdBasicImage aImage2)
      Multiply two images.
      Parameters:
      aImage1 - first input image.
      aImage2 - second input image.
      Returns:
      an image where every pixel is the product of the input pixels.
    • divide

      public static ALcdBasicImage divide(ALcdBasicImage aImage1, ALcdBasicImage aImage2)
      Divide two images.
      Parameters:
      aImage1 - first input image.
      aImage2 - second input image.
      Returns:
      an image where every pixel is the quotient of the input pixels.
    • min

      public static ALcdBasicImage min(ALcdBasicImage aImage1, ALcdBasicImage aImage2)
      Take the minimum of two images.
      Parameters:
      aImage1 - first input image.
      aImage2 - second input image.
      Returns:
      an image where every pixel is minimum of the input pixels.
    • max

      public static ALcdBasicImage max(ALcdBasicImage aImage1, ALcdBasicImage aImage2)
      Take the maximum of two images.
      Parameters:
      aImage1 - first input image.
      aImage2 - second input image.
      Returns:
      an image where every pixel is maximum of the input pixels.