public SubtractBackgroundCommand(
int rollingBall,
SubtractBackgroundCommandType shrinkingSize,
int brightnessFactor,
SubtractBackgroundCommandFlags flags
)
Public Function New( _
ByVal rollingBall As Integer, _
ByVal shrinkingSize As SubtractBackgroundCommandType, _
ByVal brightnessFactor As Integer, _
ByVal flags As 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,
SubtractBackgroundCommandType shrinkingSize,
int brightnessFactor,
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
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
c#[Silverlight C# Example]
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();
}
vb[Silverlight VB Example]
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
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.