←Select platform

ApplyMathematicalLogicCommandFlags Enumeration

Summary

Enumeration flags that identify the channel that will be used, the treatment of the input pixel values, the mathematical operation, and the treatment of the output pixel values.

Syntax

C#
VB
Java
Objective-C
WinRT C#
C++
[FlagsAttribute()] 
public enum ApplyMathematicalLogicCommandFlags   
<FlagsAttribute()> 
Public Enum ApplyMathematicalLogicCommandFlags  
    
    
[FlagsAttribute()] 
public enum ApplyMathematicalLogicCommandFlags    
typedef NS_OPTIONS(NSUInteger, LTApplyMathematicalLogicCommandFlags) 
public enum ApplyMathematicalLogicCommandFlags 
Leadtools.ImageProcessing.Color.ApplyMathematicalLogicCommandFlags = function() { }; 
Leadtools.ImageProcessing.Color.ApplyMathematicalLogicCommandFlags.prototype = {<br/> 
  Master = 0x00000000, 
    ValueDoNothing = 0x00000000, 
    OperationAnd = 0x00000000, 
    ResultDoNothing = 0x00000000, 
    Red = 0x00000001, 
    Green = 0x00000002, 
    Blue = 0x00000003, 
    ValueNot = 0x00000010, 
    ValueZero = 0x00000020, 
    ValueOne = 0x00000030, 
    OperationOr = 0x00000100, 
    OperationXor = 0x00000200, 
    OperationAdd = 0x00000300, 
    OperationSubtractFactor = 0x00000400, 
    OperationSubtractValue = 0x00000500, 
    OperationAbsoluteDifference = 0x00000600, 
    OperationMultiply = 0x00000700, 
    OperationDivisionByFactor = 0x00000800, 
    OperationDivisionByValue = 0x00000900, 
    OperationAverage = 0x00000A00, 
    OperationMinimum = 0x00000B00, 
    OperationMaximum = 0x00000C00, 
    ResultNot = 0x00001000, 
    ResultZero = 0x00002000, 
    ResultOne = 0x00003000, 
     
 }; 
[FlagsAttribute()] 
public enum class ApplyMathematicalLogicCommandFlags   

Members

ValueMemberDescription
0x00000000Master All channels.
0x00000000ValueDoNothing No change.
0x00000000OperationAnd Combine each pixel component value and the Factor property using a bitwise AND (&). (pixel = pixel & Factor)
0x00000000ResultDoNothing No change.
0x00000001Red Red channel only.
0x00000002Green Green channel only.
0x00000003Blue Blue channel only.
0x00000010ValueNot Invert the color, resulting in its complement.
0x00000020ValueZero Change all bits to 0.
0x00000030ValueOne Change all bits to 1.
0x00000100OperationOr Combine each pixel component value and the Factor property using a bitwise OR ( ¦ ). (pixel = pixel | Factor)
0x00000200OperationXor Combine each pixel component value and the Factor property using a bitwise XOR (^). (pixel = pixel ^ Factor)
0x00000300OperationAdd Add pixel component value to the Factor property, clamping the result to the maximum allowed pixel value. (pixel = min(pixel + Factor, MaximumPixelValue) )
0x00000400OperationSubtractFactor Subtract each pixel component value from the Factor property, clamping the result to the allowed pixel range. (pixel = min(max(Factor - pixel, MinimumPixelValue), MaximumPixelValue) )
0x00000500OperationSubtractValue Subtract the Factor property from each pixel component value, clamping the result to the allowed pixel range. (pixel = min(max(pixel - Factor), MinimumPixelValue, MaximumPixelValue) )
0x00000600OperationAbsoluteDifference Calculate the Absolute difference between the Factor property and each pixel component value. (pixel = abs(pixel - Factor))
0x00000700OperationMultiply Multiply each pixel component value by Factor/100. (pixel = pixel * Factor / 100)
0x00000800OperationDivisionByFactor Divide each pixel component value by Factor/100. An error will be returned if Factor = 0. (pixel = pixel * 100 / Factor)
0x00000900OperationDivisionByValue Divide the Factor property by each pixel value. If the pixel value is 0, the result is set to the maximum allowed pixel value. (pixel = pixel ? min(Factor / pixel, MaximumPixelValue) : MaximumPixelValue)
0x00000A00OperationAverage Use the average of the each pixel component value and the Factor property. (pixel = (pixel+Factor) / 2).
0x00000B00OperationMinimum Use the lesser of the pixel component values and the Factor property. (pixel = min(pixel, Factor) )
0x00000C00OperationMaximum Use the greater of the pixel component values and the Factor property. (pixel = max(pixel, Factor) )
0x00001000ResultNot Invert the color, resulting in its complement.
0x00002000ResultZero Change all bits to 0.
0x00003000ResultOne Change all bits to 1.
Remarks

These flags have a FlagsAttribute attribute that allows a bitwise combination of its member values. You can use a bitwise OR ( ¦ ) to specify one flag from each group.

Group Flags
Flags that indicate the channel that will be used Master, Red, Green, Blue
Flags that indicate how to treat the color value ValueDoNothing, ValueNot, ValueZero, ValueOne
Flags that indicate the mathematical operation to use OperationAnd, ValueNot, ValueZero, ValueOne, OperationAnd, OperationOr, OperationXor, OperationAdd, OperationSubtractFactor, OperationSubtractValue, OperationAbsoluteDifference, OperationMultiply, OperationDivisionByFactor, OperationDivisionByValue, OperationAverage, OperationMinimum, OperationMaximum
Flags that indicate how to treat the output value ResultDoNothing, ResultNot, ResultZero, ResultOne
  • The way MinimumPixelValue and MaximumPixelValue are calculated depends on the bits per pixel and whether the image is signed or unsigned:
    • if the image is unsigned (most common):
      • MaximumPixelValue will be : 255 (8-bit), 4095 (12-bit) or 65535 (16-bit)
      • MinimumPixelValue = 0
    • if the image is signed (rare case):
      • MaximumPixelValue will be : 127 (8-bit), 2047 (12-bit) or 32767 (16-bit)
      • MinimumPixelValue will be -128 (8-bit), -2048 (12-bit) or -32768 (16-bit)
  • If the Flags property is set to OperationAnd, OperationOr, OperationXor, OperationAdd, OperationMultiply, OperationMaximum, OperationMinimum, OperationDivisionByValue, or OperationSubtractValue, the valid range of the Factor property is from MinimumPixelValue to MaximumPixelValue.
  • If the Flags property is set to OperationSubtract, OperationDifference, or OperationAverage, the valid range of the Factor property is from 2 * MinimumPixelValue to 2 * MaximumPixelValue.

*Calculating Master Channel Values

In order to speed up widely used image processing filters in LEADTOOLS, the grayscale value (master channel) of a colored image is calculated using the following formulas:

#define CalcGrayValue(r, g, b) ((L_UCHAR)(((L_UCHAR) (((2 * (L_UINT) (r)) + (5 * (L_UINT) (g)) + (L_UINT) (b) + 4) / 8)))) 
#define CalcGrayValue16(r, g, b) ((L_UINT16) (((2 * (L_UINT32) (r)) + (5 * (L_UINT32) (g)) + (L_UINT32) (b) + 4) / 8)) 
#define CalcGrayValue32(r, g, b) ((L_UINT32) (((2 * (L_UINT32) (r)) + (5 * (L_UINT32) (g)) + (L_UINT32) (b) + 4) / 8)) 

Requirements

Target Platforms

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.ImageProcessing.Color Assembly