LogicalOperationWithImage
Performs a pointwise logical operation between two images.
Access to parameter description
The logical operators to apply between both input images $I1$ and $I2$ can be selected between:
See also
Access to parameter description
The logical operators to apply between both input images $I1$ and $I2$ can be selected between:
- The logical conjunction AND which corresponds to an intersection when applied on two binary images.
- The logical disconjunction OR which corresponds to an union when applied on two binary images.
- The negation of conjunction and disjunction NAND and NOR.
- The exclusive disjunction NOR and its negation NXOR.
- A logical difference operator.
See also
Function Syntax
This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > logicalOperationWithImage( std::shared_ptr< iolink::ImageView > inputImage1, std::shared_ptr< iolink::ImageView > inputImage2, LogicalOperationWithImage::LogicalOperator logicalOperator, std::shared_ptr< iolink::ImageView > outputImage = nullptr );
This function returns outputImage.
// Function prototype. logical_operation_with_image(input_image1: idt.ImageType, input_image2: idt.ImageType, logical_operator: LogicalOperationWithImage.LogicalOperator = LogicalOperationWithImage.LogicalOperator.AND, output_image: idt.ImageType = None) -> idt.ImageType
This function returns outputImage.
// Function prototype. public static IOLink.ImageView LogicalOperationWithImage( IOLink.ImageView inputImage1, IOLink.ImageView inputImage2, LogicalOperationWithImage.LogicalOperator logicalOperator = ImageDev.LogicalOperationWithImage.LogicalOperator.AND, IOLink.ImageView outputImage = null );
Class Syntax
Parameters
Parameter Name | Description | Type | Supported Values | Default Value | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
inputImage1 |
The first input image, must be integer, including grayscale, binary, label, and color. | Image | Binary, Label, Grayscale or Multispectral | nullptr | |||||||||||||||
inputImage2 |
The second input image, must have same dimensions and type as the first input. | Image | Binary, Label, Grayscale or Multispectral | nullptr | |||||||||||||||
logicalOperator |
The operator to apply.
|
Enumeration | AND | ||||||||||||||||
outputImage |
The output image, size and type are forced to the same values as the inputs. | Image | nullptr |
Parameter Name | Description | Type | Supported Values | Default Value | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
input_image1 |
The first input image, must be integer, including grayscale, binary, label, and color. | image | Binary, Label, Grayscale or Multispectral | None | |||||||||||||||
input_image2 |
The second input image, must have same dimensions and type as the first input. | image | Binary, Label, Grayscale or Multispectral | None | |||||||||||||||
logical_operator |
The operator to apply.
|
enumeration | AND | ||||||||||||||||
output_image |
The output image, size and type are forced to the same values as the inputs. | image | None |
Parameter Name | Description | Type | Supported Values | Default Value | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
inputImage1 |
The first input image, must be integer, including grayscale, binary, label, and color. | Image | Binary, Label, Grayscale or Multispectral | null | |||||||||||||||
inputImage2 |
The second input image, must have same dimensions and type as the first input. | Image | Binary, Label, Grayscale or Multispectral | null | |||||||||||||||
logicalOperator |
The operator to apply.
|
Enumeration | AND | ||||||||||||||||
outputImage |
The output image, size and type are forced to the same values as the inputs. | Image | null |
Object Examples
auto polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" ); LogicalOperationWithImage logicalOperationWithImageAlgo; logicalOperationWithImageAlgo.setInputImage1( polystyrene ); logicalOperationWithImageAlgo.setInputImage2( polystyrene ); logicalOperationWithImageAlgo.setLogicalOperator( LogicalOperationWithImage::LogicalOperator::AND ); logicalOperationWithImageAlgo.execute(); std::cout << "outputImage:" << logicalOperationWithImageAlgo.outputImage()->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif")) logical_operation_with_image_algo = imagedev.LogicalOperationWithImage() logical_operation_with_image_algo.input_image1 = polystyrene logical_operation_with_image_algo.input_image2 = polystyrene logical_operation_with_image_algo.logical_operator = imagedev.LogicalOperationWithImage.AND logical_operation_with_image_algo.execute() print("output_image:", str(logical_operation_with_image_algo.output_image))
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" ); LogicalOperationWithImage logicalOperationWithImageAlgo = new LogicalOperationWithImage { inputImage1 = polystyrene, inputImage2 = polystyrene, logicalOperator = LogicalOperationWithImage.LogicalOperator.AND }; logicalOperationWithImageAlgo.Execute(); Console.WriteLine( "outputImage:" + logicalOperationWithImageAlgo.outputImage.ToString() );
Function Examples
auto polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" ); auto result = logicalOperationWithImage( polystyrene, polystyrene, LogicalOperationWithImage::LogicalOperator::AND ); std::cout << "outputImage:" << result->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif")) result = imagedev.logical_operation_with_image(polystyrene, polystyrene, imagedev.LogicalOperationWithImage.AND) print("output_image:", str(result))
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" ); IOLink.ImageView result = Processing.LogicalOperationWithImage( polystyrene, polystyrene, LogicalOperationWithImage.LogicalOperator.AND ); Console.WriteLine( "outputImage:" + result.ToString() );