public int Offset { get; set; }
@property (nonatomic, assign) NSInteger offset;
public int getOffset();
public void setOffset(
int intValue
);
Offset # get and set (UserFilterCommand)
Value used to offset the final result of the output.
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing.Effects;
public void UserFilterCommandExample()
{
// Load an image
RasterCodecs codecs = new RasterCodecs();
codecs.ThrowExceptionsOnInvalidImages = true;
RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "IMAGE1.CMP"));
// Prepare the command
int i, j;
UserFilterCommand command = new UserFilterCommand();
command.CenterPoint = new LeadPoint(1, 1);
command.Divisor = 1;
command.Offset = 0;
command.Type = UserFilterCommandType.Sum;
command.FilterHeight = 3;
command.FilterWidth = 3;
command.Matrix = new int[9];
// Initialize the array with factor used to apply the high pass filter.
for (i = 0; i < 3; i++)
{
for (j = 0; j < 3; j++)
{
if (j == 1 || i == 1)
{
if (j == 1 && i == 1)
command.Matrix[i * 3 + j] = 5;
else
command.Matrix[i * 3 + j] = -1;
}
else
command.Matrix[i * 3 + j] = 0;
}
}
// Apply the high pass custom filter.
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 static org.junit.Assert.*;
import leadtools.*;
import leadtools.codecs.*;
import leadtools.imageprocessing.effects.UserFilterCommand;
import leadtools.imageprocessing.effects.UserFilterCommandType;
public void userFilterCommandExample() {
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, "IMAGE1.CMP"));
// Prepare the command
int i, j;
UserFilterCommand command = new UserFilterCommand();
command.setCenterPoint(new LeadPoint(1, 1));
command.setDivisor(1);
command.setOffset(0);
command.setType(UserFilterCommandType.SUM);
command.setFilterHeight(3);
command.setFilterWidth(3);
command.setMatrix(new int[9]);
// Initialize the array with factor used to apply the high pass filter.
for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++) {
if (j == 1 || i == 1) {
if (j == 1 && i == 1)
command.getMatrix()[i * 3 + j] = 5;
else
command.getMatrix()[i * 3 + j] = -1;
} else
command.getMatrix()[i * 3 + j] = 0;
}
}
// Apply the high pass custom filter.
int change = command.run(image);
assertTrue(change != RasterImageChangedFlags.NONE);
codecs.save(image, combine(LEAD_VARS_IMAGES_DIR, "Result.jpg"), RasterImageFormat.JPEG, 24);
System.out.println("Command run and 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