Initializes a new SubtractBackgroundCommand class object with explicit parameters.
public SubtractBackgroundCommand(
int rollingBall,
SubtractBackgroundCommandType shrinkingSize,
int brightnessFactor,
SubtractBackgroundCommandFlags flags
)
Public Function New( _
ByVal rollingBall As Integer, _
ByVal shrinkingSize As Leadtools.Imageprocessing.Core.SubtractBackgroundCommandType, _
ByVal brightnessFactor As Integer, _
ByVal flags As Leadtools.Imageprocessing.Core.SubtractBackgroundCommandFlags _
)
- (instancetype)initWithRollingBall:(NSUInteger)rollingBall
shrinkingSize:(LTSubtractBackgroundCommandType)shrinkingSize
brightnessFactor:(NSUInteger)brightnessFactor
flags:(LTSubtractBackgroundCommandFlags)flags
public SubtractBackgroundCommand(
int rollingBall,
SubtractBackgroundCommandType shrinkingSize,
int brightnessFactor,
int flags
)
public:
SubtractBackgroundCommand(
int rollingBall,
Leadtools.Imageprocessing.Core.SubtractBackgroundCommandType shrinkingSize,
int brightnessFactor,
Leadtools.Imageprocessing.Core.SubtractBackgroundCommandFlags flags
)
rollingBall
The radius (in pixels) of the ball that will roll over the entire image to determine the background. Recommended value is 50. This parameter accepts only positive values.
shrinkingSize
Shrink size ratio used to minimize the image internally in order to increase the speed with little loss of accuracy.
brightnessFactor
Brightness factor for increasing or decreasing the brightness of the image. Valid values range from 0 - 400. If you pass 100 the brightness remains unchanged. Lower values darken the image while higher values lighten the image.
flags
Flags that indicate whether the background is darker than the foreground, and whether to show the objects without the background. You must select one from each group.
Run the SubtractBackgroundCommand on an image.
using Leadtools;
using Leadtools.ImageProcessing;
using Leadtools.Codecs;
using Leadtools.ImageProcessing.Core;
public void SubtractBackgroundConstructorExample()
{
// Load an image
RasterCodecs codecs = new RasterCodecs();
codecs.ThrowExceptionsOnInvalidImages = true;
RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, @"ImageProcessingDemo\Image4.Tif"));
GrayscaleCommand grayScaleCommand = new GrayscaleCommand(8);
grayScaleCommand.Run(image);
// Prepare the command
SubtractBackgroundCommand command = new SubtractBackgroundCommand(799, SubtractBackgroundCommandType.DependOnRollingBallSize, 178, SubtractBackgroundCommandFlags.BackgroundIsDarker);
// Apply Subtract Background effect on the image.
command.Run(image);
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";
}
Imports Leadtools
Imports Leadtools.ImageProcessing
Imports Leadtools.Codecs
Imports Leadtools.ImageProcessing.Core
Leadtools.Examples.Support.SetLicense()
Public Sub SubtractBackgroundConstructorExample()
Dim codecs As New RasterCodecs()
codecs.ThrowExceptionsOnInvalidImages = True
Dim leadImage As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "ImageProcessingDemo\\Image4.Tif"))
Dim grayScaleCommand As GrayscaleCommand = New GrayscaleCommand(8)
grayScaleCommand.Run(leadImage)
' Prepare the command
Dim command As SubtractBackgroundCommand = New SubtractBackgroundCommand(799, SubtractBackgroundCommandType.DependOnRollingBallSize, 178, SubtractBackgroundCommandFlags.BackgroundIsDarker)
' Apply Subtract Background effect on the image.
command.Run(leadImage)
End Sub
Public NotInheritable Class LEAD_VARS
Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
using Leadtools;
using Leadtools.Examples;
using Leadtools.Codecs;
using Leadtools.ImageProcessing.Core;
public void SubtractBackgroundConstructorExample(RasterImage image, Stream outStream)
{
// Prepare the command
SubtractBackgroundCommand command = new SubtractBackgroundCommand(50, SubtractBackgroundCommandType.DependOnRollingBallSize, 100, SubtractBackgroundCommandFlags.BackgroundIsDarker);
// Apply Subtract Background effect on the image.
command.Run(image);
// Save result image
RasterCodecs codecs = new RasterCodecs();
codecs.Save(image, outStream, RasterImageFormat.Jpeg, 24);
image.Dispose();
}
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.ImageProcessing.Core
Public Sub SubtractBackgroundConstructorExample(ByVal image As RasterImage, ByVal outStream As Stream)
' Prepare the command
Dim command As SubtractBackgroundCommand = New SubtractBackgroundCommand(50, SubtractBackgroundCommandType.DependOnRollingBallSize, 100,
SubtractBackgroundCommandFlags.BackgroundIsDarker)
' Apply Subtract Background effect on the image.
command.Run(image)
' Save result image
Dim codecs As RasterCodecs = New RasterCodecs()
codecs.Save(image, outStream, RasterImageFormat.Jpeg, 24)
image.Dispose()
End Sub
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET