public SubtractBackgroundCommand(
int rollingBall,
SubtractBackgroundCommandType shrinkingSize,
int brightnessFactor,
SubtractBackgroundCommandFlags flags
)
- (instancetype)initWithRollingBall:(NSUInteger)rollingBall shrinkingSize:(LTSubtractBackgroundCommandType)shrinkingSize brightnessFactor:(NSUInteger)brightnessFactor flags:(LTSubtractBackgroundCommandFlags)flags NS_DESIGNATED_INITIALIZER;
public SubtractBackgroundCommand(
int rollingBall,
SubtractBackgroundCommandType shrinkingSize,
int brightnessFactor,
int flags
)
public:
SubtractBackgroundCommand(
int rollingBall,
SubtractBackgroundCommandType shrinkingSize,
int brightnessFactor,
SubtractBackgroundCommandFlags flags
)
__init__(self,rollingBall,shrinkingSize,brightnessFactor,flags) # Overloaded constructor
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:\LEADTOOLS23\Resources\Images";
}
import java.io.File;
import java.io.IOException;
import org.junit.*;
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
import org.junit.runner.notification.Failure;
import leadtools.RasterImage;
import leadtools.RasterImageFormat;
import leadtools.codecs.*;
import leadtools.imageprocessing.*;
import leadtools.imageprocessing.core.*;
public void subtractBackgroundConstructorExample() {
final String LEAD_VARS_IMAGES_DIR = "C:\\LEADTOOLS23\\Resources\\Images";
// Load an image
RasterCodecs codecs = new RasterCodecs();
codecs.setThrowExceptionsOnInvalidImages(true);
RasterImage image = codecs.load(combine(LEAD_VARS_IMAGES_DIR, "Image4.tif"));
GrayscaleCommand grayScaleCommand = new GrayscaleCommand(8);
grayScaleCommand.run(image);
// Prepare the command
SubtractBackgroundCommand command = new SubtractBackgroundCommand(799,
SubtractBackgroundCommandType.DEPEND_ON_ROLLING_BALL_SIZE, 178,
SubtractBackgroundCommandFlags.BACKGROUND_IS_DARKER.getValue());
// Apply Subtract Background effect on the image
command.run(image);
codecs.save(image, combine(LEAD_VARS_IMAGES_DIR, "Result.jpg"), RasterImageFormat.JPEG, 24);
System.out.println("Command run and output image saved to " + combine(LEAD_VARS_IMAGES_DIR, "Result.jpg"));
}
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