Class Toolbox
utilities functions for Emgu
public static class Toolbox
- Inheritance
-
Toolbox
- Inherited Members
Methods
AddDllDirectory(string)
Adds a directory to the search path used to locate DLLs for the application
public static extern bool AddDllDirectory(string path)
Parameters
path
stringThe directory to be searched for DLLs
Returns
- bool
True if success
ExecuteCmd(string, string)
Call a command from command line
public static string ExecuteCmd(string execFileName, string arguments)
Parameters
Returns
- string
The standard output
FindAssembly(string)
Find the loaded assembly with the specific assembly name
public static Assembly FindAssembly(string assembleName)
Parameters
assembleName
stringThe name of the assembly
Returns
- Assembly
The assembly.
GetBaseType(Type, string)
Use reflection to find the base type. If such type do not exist, null is returned
public static Type GetBaseType(Type currentType, string baseClassName)
Parameters
Returns
- Type
The base type
GetDllDirectory()
Get the search path used to locate DLLs for the application
public static string GetDllDirectory()
Returns
- string
If the function succeeds, the return value is the search path used to locate DLLs for the application If the function fails, the return value is null.To get extended error information, call GetLastError.
GetInterfaceImplementationFromAssembly<T>()
Get the interface implementation from assemblies
public static Type[] GetInterfaceImplementationFromAssembly<T>()
Returns
- Type[]
The types that implement the specific interface
Type Parameters
T
The interface
JoinInterpolatables<T>(params IEnumerable<T>[])
Joining multiple index ascending IInterpolatables together as a single index ascending IInterpolatable.
public static IEnumerable<T> JoinInterpolatables<T>(params IEnumerable<T>[] enums) where T : IInterpolatable<T>, new()
Parameters
enums
IEnumerable<T>[]The enumerables, each should be stored in index ascending order
Returns
- IEnumerable<T>
A single enumerable sorted in index ascending order
Type Parameters
T
The type of objects that will be joined
LinearInterpolate<T>(IEnumerable<T>, IEnumerable<double>)
Perform first degree interpolation give the sorted data src
and the interpolation indexes
public static IEnumerable<T> LinearInterpolate<T>(IEnumerable<T> src, IEnumerable<double> indexes) where T : IInterpolatable<T>, new()
Parameters
src
IEnumerable<T>The sorted data that will be interpolated from
indexes
IEnumerable<double>The indexes of the interpolate result
Returns
- IEnumerable<T>
The interpolated data
Type Parameters
T
The type of the data to be interpolated
LinearSubsample<T>(IEnumerable<T>, double)
Get subsamples with the specific rate
public static IEnumerable<T> LinearSubsample<T>(IEnumerable<T> src, double subsampleRate) where T : IInterpolatable<T>, new()
Parameters
src
IEnumerable<T>The source which the subsamples will be derived from
subsampleRate
doubleThe subsample rate
Returns
- IEnumerable<T>
src
subsampled with the specific rate
Type Parameters
T
The type of the object
LoadAllDependentAssemblies()
Load all the assemblies.
public static Assembly[] LoadAllDependentAssemblies()
Returns
- Assembly[]
All the assemblies loaded.
LoadLibrary(string)
Maps the specified executable module into the address space of the calling process.
public static nint LoadLibrary(string dllname)
Parameters
dllname
stringThe name of the dll
Returns
- nint
The handle to the library
MergeBytes(byte[], byte[])
Merges two byte vector into one
public static byte[] MergeBytes(byte[] a, byte[] b)
Parameters
Returns
- byte[]
The bytes that is a concatenation of a and b
SetDllDirectory(string)
Set the directory to the search path used to locate DLLs for the application
public static extern bool SetDllDirectory(string path)
Parameters
path
stringThe directory to be searched for DLLs
Returns
- bool
True if success
SizeOf<T>()
Similar to Marshal.SizeOf function
public static int SizeOf<T>()
Returns
- int
The size of T in bytes
Type Parameters
T
The type
ToBytes<TData>(TData[])
Convert some generic vector to vector of Bytes
public static byte[] ToBytes<TData>(TData[] data)
Parameters
data
TData[]array of data
Returns
- byte[]
the byte vector
Type Parameters
TData
type of the input vector
XmlDeserialize<T>(XDocument)
Convert an xml document to an object
public static T XmlDeserialize<T>(XDocument document)
Parameters
document
XDocumentThe xml document
Returns
- T
The object representation as a result of the deserialization of the xml document
Type Parameters
T
The type of the object to be converted to
XmlDeserialize<T>(XDocument, Type[])
Convert an xml document to an object
public static T XmlDeserialize<T>(XDocument xDoc, Type[] knownTypes)
Parameters
xDoc
XDocumentThe xml document
knownTypes
Type[]Other types that it must known ahead to deserialize the object
Returns
- T
The object representation as a result of the deserialization of the xml document
Type Parameters
T
The type of the object to be converted to
XmlSerialize<T>(T)
Convert an object to an xml document
public static XDocument XmlSerialize<T>(T sourceObject)
Parameters
sourceObject
TThe object to be serialized
Returns
- XDocument
An xml document that represents the object
Type Parameters
T
The type of the object to be converted
XmlSerialize<T>(T, Type[])
Convert an object to an xml document
public static XDocument XmlSerialize<T>(T sourceObject, Type[] knownTypes)
Parameters
sourceObject
TThe object to be serialized
knownTypes
Type[]Other types that it must known ahead to serialize the object
Returns
- XDocument
An xml document that represents the object
Type Parameters
T
The type of the object to be converted
XmlStringDeserialize<T>(string)
Convert an xml string to an object
public static T XmlStringDeserialize<T>(string xmlString)
Parameters
xmlString
stringThe xml document as a string
Returns
- T
The object representation as a result of the deserialization of the xml string
Type Parameters
T
The type of the object to be converted to