Imports Leadtools.Services
Imports Leadtools.Services.datacontracts._2009._01
Imports Leadtools.Services.raster.datacontracts._2009._01
Imports Leadtools.Services.ImageProcessing.datacontracts._2009._01
Public Sub StatisticsInformationExample()
Dim client As ImageProcessingServiceClient = New ImageProcessingServiceClient()
Dim imageService As IImageProcessingService = TryCast(client, IImageProcessingService)
Dim sourceBinaryData As RawBinaryData = New RawBinaryData()
sourceBinaryData.Data = File.ReadAllBytes(Path.Combine(LEAD_VARS.ImagesDir, "image1.cmp"))
Dim convertOptions As RasterConvertOptions = New RasterConvertOptions()
convertOptions.Source = sourceBinaryData
convertOptions.Destination = Nothing
convertOptions.Format = RasterImageFormat.Bmp
convertOptions.FirstPage = 1
convertOptions.LastPage = 1
convertOptions.BitsPerPixel = 24
convertOptions.QualityFactor = 2
Dim request As StatisticsInformationRequest = New StatisticsInformationRequest()
request.ConvertOptions = convertOptions
request.Channel = RasterColorChannel.Master
request.Start = 0
request.End = 255
Dim response As StatisticsInformationResponse = imageService.StatisticsInformation(request)
Console.WriteLine(String.Format("Minimum = : {0}", response.Minimum))
Console.WriteLine(String.Format("Maximum = {0}", response.Maximum))
Console.WriteLine(String.Format("Mean = {0}", response.Mean))
Console.WriteLine(String.Format("Median = {0}", response.Median))
Console.WriteLine(String.Format("Percent = {0}", response.Percent))
Console.WriteLine(String.Format("StandardDeviation = {0}", response.StandardDeviation))
Console.WriteLine(String.Format("TotalPixelCount = {0}", response.TotalPixelCount))
client.Close()
End Sub
Public NotInheritable Class LEAD_VARS
Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
using Leadtools.Services;
using leadtools.services.datacontracts._2009._01;
using leadtools.services.raster.datacontracts._2009._01;
using leadtools.services.imageprocessing.datacontracts._2009._01;
public void StatisticsInformationExample()
{
ImageProcessingServiceClient client = new ImageProcessingServiceClient();
IImageProcessingService imageService = client as IImageProcessingService;
RawBinaryData sourceBinaryData = new RawBinaryData();
sourceBinaryData.Data = File.ReadAllBytes(Path.Combine(LEAD_VARS.ImagesDir, "image1.cmp"));
RasterConvertOptions convertOptions = new RasterConvertOptions();
convertOptions.Source = sourceBinaryData;
convertOptions.Destination = null;
convertOptions.Format = RasterImageFormat.Bmp;
convertOptions.FirstPage = 1;
convertOptions.LastPage = 1;
convertOptions.BitsPerPixel = 24;
convertOptions.QualityFactor = 2;
StatisticsInformationRequest request = new StatisticsInformationRequest();
request.ConvertOptions = convertOptions;
request.Channel = RasterColorChannel.Master;
request.Start = 0;
request.End = 255;
StatisticsInformationResponse response = imageService.StatisticsInformation(request);
Console.WriteLine(string.Format("Minimum = : {0}", response.Minimum));
Console.WriteLine(string.Format("Maximum = {0}", response.Maximum));
Console.WriteLine(string.Format("Mean = {0}", response.Mean));
Console.WriteLine(string.Format("Median = {0}", response.Median));
Console.WriteLine(string.Format("Percent = {0}", response.Percent));
Console.WriteLine(string.Format("StandardDeviation = {0}", response.StandardDeviation));
Console.WriteLine(string.Format("TotalPixelCount = {0}", response.TotalPixelCount));
client.Close();
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";
}