←Select platform

SignalToNoiseRatioCommand Class

Summary

Finds the signal to noise ratio (SNR) of an image.

Syntax
C#
VB
Objective-C
C++
Java
public class SignalToNoiseRatioCommand : RasterCommand, IInformationCommand 
Public Class SignalToNoiseRatioCommand  
   Inherits RasterCommand 
@interface LTKernelSignalToNoiseRatioCommand : LTRasterCommand 
public class SignalToNoiseRatioCommand extends RasterCommand 
public ref class SignalToNoiseRatioCommand : public RasterCommand 
Remarks
  • Calculates the SNR and returns the 10*log10 of the real ratio. This value gives an indication of the homogeneity of adjacent pixels in an image.
  • This command supports 12- and 16-bit grayscale and 48- and 64-bit color images. Support for 12- and 16-bit grayscale and 48- and 64-bit color images is available only in the Document/Medical toolkits.
  • This command supports unsigned data images, but not signed ones.
  • This command does not support 32-bit grayscale images.
  • This function can only process entire images. It does not support regions.

Note: All RasterCommands in this assembly modify the underlying properties of the input RasterImage, including but not limited to:

  • BitsPerPixel
  • Data
  • IsMirrored

If you wish to avoid RasterImage property fidelity loss, pass a clone of your RasterImage to all RasterCommands in this assembly.

Example
C#
VB
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Kernel; 
 
public void DetectGlareCommandExample() 
{ 
   using (RasterCodecs codecs = new RasterCodecs()) 
   { 
      // Load an image 
      using (RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Glare.jpg"))) 
      { 
         // SNR value 
         SignalToNoiseRatioCommand command = new SignalToNoiseRatioCommand(); 
         command.Run(image); 
 
         Console.WriteLine(string.Format("SNR: {0}", command.Ratio)); 
      } 
   } 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS21\Resources\Images"; 
} 
Imports Leadtools 
Imports Leadtools.Codecs 
Imports Leadtools.ImageProcessing.Kernel 
 
Public Sub DetectDocumentCommandExample() 
   Using codecs As RasterCodecs = New RasterCodecs() 
      Using image As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Glare.jpg")) 
         Dim command As SignalToNoiseRatioCommand = New SignalToNoiseRatioCommand() 
         command.Run(image) 
 
         Console.WriteLine(String.Format("SNR: {0}", command.Ratio)) 
 
      End Using 
   End Using 
End Sub 
 
Public NotInheritable Class LEAD_VARS 
   Public Const ImagesDir As String = "C:\LEADTOOLS21\Resources\Images" 
End Class 
Requirements

Target Platforms

Help Version 21.0.2021.6.30
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.ImageProcessing.Kernel Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.