Filters the image based on a user-defined filter / mask. This command is similar to the spatial and binary filter commands.
public class UserFilterCommand : Leadtools.Imageprocessing.Leadtools.ImageProcessing.RasterCommand, Leadtools.Imageprocessing.Leadtools.ImageProcessing.IRasterCommandPublic Class UserFilterCommandInherits Leadtools.Imageprocessing.Leadtools.ImageProcessing.RasterCommandImplements Leadtools.Imageprocessing.Leadtools.ImageProcessing.IRasterCommand
public sealed class UserFilterCommand : Leadtools.Imageprocessing.Leadtools.ImageProcessing.IRasterCommand@interface LTUserFilterCommand : LTRasterCommandpublic class UserFilterCommand extends RasterCommandfunction Leadtools.ImageProcessing.Effects.UserFilterCommand()public ref class UserFilterCommand : public Leadtools.Imageprocessing.Leadtools.ImageProcessing.RasterCommand, Leadtools.Imageprocessing.Leadtools.ImageProcessing.IRasterCommandRun the UserFilterCommand on an image, In this example the high pass.filter will be applied using user defined matrix.
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.ImageProcessing.EffectsPublic Sub UserFilterCommandExample()Dim codecs As New RasterCodecs()codecs.ThrowExceptionsOnInvalidImages = TrueDim leadImage As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "IMAGE1.CMP"))' Prepare the commandDim i As IntegerDim j As IntegerDim matrix() As IntegerReDim matrix(8)Dim command As UserFilterCommand = New UserFilterCommandcommand.CenterPoint = New LeadPoint(1, 1)command.Divisor = 1command.Offset = 0command.Type = UserFilterCommandType.Sumcommand.FilterHeight = 3command.FilterWidth = 3command.Matrix = matrix' Initialize the array with factor used to apply the high pass filter.For i = 0 To 2For j = 0 To 2If (j = 1 Or i = 1) ThenIf (j = 1 And i = 1) Thencommand.Matrix(i * 3 + j) = 5Elsecommand.Matrix(i * 3 + j) = -1End IfElsecommand.Matrix(i * 3 + j) = 0End IfNextNext' Apply the high pass custom filter.command.Run(leadImage)codecs.Save(leadImage, Path.Combine(LEAD_VARS.ImagesDir, "Result.jpg"), RasterImageFormat.Jpeg, 24)End SubPublic NotInheritable Class LEAD_VARSPublic Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"End Class
using Leadtools;using Leadtools.Codecs;using Leadtools.ImageProcessing.Effects;public void UserFilterCommandExample(){// Load an imageRasterCodecs codecs = new RasterCodecs();codecs.ThrowExceptionsOnInvalidImages = true;RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "IMAGE1.CMP"));// Prepare the commandint 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;elsecommand.Matrix[i * 3 + j] = -1;}elsecommand.Matrix[i * 3 + j] = 0;}}// Apply the high pass custom filter.command.Run(image);}static class LEAD_VARS{public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";}
using Leadtools;using Leadtools.Codecs;using Leadtools.ImageProcessing.Effects;using Leadtools.ImageProcessing;public async Task UserFilterCommandExample(){// Load an imageRasterCodecs codecs = new RasterCodecs();codecs.ThrowExceptionsOnInvalidImages = true;// Load the imagestring srcFileName = @"Assets\Image1.cmp";StorageFile loadFile = await Tools.AppInstallFolder.GetFileAsync(srcFileName);RasterImage image = await codecs.LoadAsync(LeadStreamFactory.Create(loadFile));// Prepare the commandint i, j;UserFilterCommand command = new UserFilterCommand();command.CenterPoint = LeadPointHelper.Create(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;elsecommand.Matrix[i * 3 + j] = -1;}elsecommand.Matrix[i * 3 + j] = 0;}}// Apply the high pass custom filter.command.Run(image);}
using Leadtools;using Leadtools.Codecs;using Leadtools.ImageProcessing.Effects;using Leadtools.Examples;public void UserFilterCommandExample(RasterImage image, Stream outStream){// Prepare the commandint 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;elsecommand.Matrix[i * 3 + j] = -1;}elsecommand.Matrix[i * 3 + j] = 0;}}// Apply the high pass custom filter.command.Run(image);// Save result imageRasterCodecs codecs = new RasterCodecs();codecs.Save(image, outStream, RasterImageFormat.Jpeg, 24);image.Dispose();}
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.ImageProcessing.EffectsPublic Sub UserFilterCommandExample(ByVal image As RasterImage, ByVal outStream As Stream)' Prepare the commandDim i, j As IntegerDim command As UserFilterCommand = New UserFilterCommand()command.CenterPoint = New LeadPoint(1, 1)command.Divisor = 1command.Offset = 0command.Type = UserFilterCommandType.Sumcommand.FilterHeight = 3command.FilterWidth = 3command.Matrix = New Integer(8){}' Initialize the array with factor used to apply the high pass filter.For i = 0 To 2For j = 0 To 2If j = 1 OrElse i = 1 ThenIf j = 1 AndAlso i = 1 Thencommand.Matrix(i * 3 + j) = 5Elsecommand.Matrix(i * 3 + j) = -1End IfElsecommand.Matrix(i * 3 + j) = 0End IfNext jNext i' Apply the high pass custom filter.command.Run(image)' Save result imageDim codecs As RasterCodecs = New RasterCodecs()codecs.Save(image, outStream, RasterImageFormat.Jpeg, 24)image.Dispose()End Sub
Leadtools.ImageProcessing.Effects Namespace
Leadtools.ImageProcessing.Core.MinimumCommand
Leadtools.ImageProcessing.Core.MaximumCommand
Leadtools.ImageProcessing.Color.PosterizeCommand
Leadtools.ImageProcessing.Core.MedianCommand
Leadtools.ImageProcessing.Color.IntensityDetectCommand
Leadtools.ImageProcessing.Color.SolarizeCommand
Leadtools.ImageProcessing.Core.WindowLevelCommand
Leadtools.ImageProcessing.SpecialEffects.ShadowCommand
Leadtools.ImageProcessing.Color.ChangeHueSaturationIntensityCommand
Leadtools.ImageProcessing.Color.ColorReplaceCommand
Leadtools.ImageProcessing.Color.ColorThresholdCommand
Leadtools.ImageProcessing.Core.DiscreteFourierTransformCommand
DirectionEdgeStatisticalCommand Class
Leadtools.ImageProcessing.Core.FastFourierTransformCommand
Leadtools.ImageProcessing.Core.FrequencyFilterCommand
Leadtools.ImageProcessing.Core.FrequencyFilterMaskCommand
Leadtools.ImageProcessing.Core.FourierTransformDisplayCommand
StatisticsInformationCommand Class
ObjectInformationCommand Class
RegionContourPointsCommand Class
GetRegionPerimeterLength Method
Leadtools.ImageProcessing.Color.MathematicalFunctionCommand
Leadtools.ImageProcessing.SpecialEffects.RevEffectCommand
Leadtools.ImageProcessing.Color.SegmentCommand
|
Products |
Support |
Feedback: UserFilterCommand Class - Leadtools.ImageProcessing.Effects |
Introduction |
Help Version 19.0.2017.3.21
|

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
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.