.TH "MPSCNNLocalContrastNormalization" 3 "Mon Jul 9 2018" "Version MetalPerformanceShaders-119.3" "MetalPerformanceShaders.framework" \" -*- nroff -*- .ad l .nh .SH NAME MPSCNNLocalContrastNormalization .SH SYNOPSIS .br .PP .PP \fC#import \fP .PP Inherits \fBMPSCNNKernel\fP\&. .SS "Instance Methods" .in +1c .ti -1c .RI "(nonnull instancetype) \- \fBinitWithDevice:kernelWidth:kernelHeight:\fP" .br .ti -1c .RI "(nullable instancetype) \- \fBinitWithCoder:device:\fP" .br .ti -1c .RI "(nonnull instancetype) \- \fBinitWithDevice:\fP" .br .in -1c .SS "Properties" .in +1c .ti -1c .RI "float \fBalpha\fP" .br .ti -1c .RI "float \fBbeta\fP" .br .ti -1c .RI "float \fBdelta\fP" .br .ti -1c .RI "float \fBp0\fP" .br .ti -1c .RI "float \fBpm\fP" .br .ti -1c .RI "float \fBps\fP" .br .in -1c .SS "Additional Inherited Members" .SH "Detailed Description" .PP This depends on Metal\&.framework Specifies the local contrast normalization filter\&. The local contrast normalization is quite similar to spatial normalization (see \fBMPSCNNSpatialNormalization\fP) in that it applies the filter over local regions which extend spatially, but are in separate feature channels (i\&.e\&., they have shape 1 x kernelWidth x kernelHeight), but instead of dividing by the local 'energy' of the feature, the denominator uses the local variance of the feature - effectively the mean value of the feature is subtracted from the signal\&. For each feature channel, the function computes the variance VAR(i,j) and mean M(i,j) of X(i,j) inside each rectangle around the spatial point (i,j)\&. .PP Then the result is computed for each element of X as follows: .PP .nf Y(i,j) = pm + ps * ( X(i,j) - p0 * M(i,j)) / (delta + alpha * VAR(i,j))^beta, .fi .PP .PP where kw and kh are the kernelWidth and the kernelHeight and pm, ps and p0 are parameters that can be used to offset and scale the result in various ways\&. For example setting pm=0, ps=1, p0=1, delta=0, alpha=1\&.0 and beta=0\&.5 scales input data so that the result has unit variance and zero mean, provided that input variance is positive\&. It is the end-users responsibility to ensure that the combination of the parameters delta and alpha does not result in a situation where the denominator becomes zero - in such situations the resulting pixel-value is undefined\&. \fBA\fP good way to guard against tiny variances is to regulate the expression with a small value for delta, for example delta = 1/1024 = 0\&.0009765625\&. .SH "Method Documentation" .PP .SS "\- (nullable instancetype) \fBinitWithCoder:\fP (NSCoder *__nonnull) aDecoder(nonnull id< MTLDevice >) device" \fBNSSecureCoding\fP compatability While the standard NSSecureCoding/NSCoding method -initWithCoder: should work, since the file can't know which device your data is allocated on, we have to guess and may guess incorrectly\&. To avoid that problem, use initWithCoder:device instead\&. .PP \fBParameters:\fP .RS 4 \fIaDecoder\fP The NSCoder subclass with your serialized \fBMPSKernel\fP .br \fIdevice\fP The MTLDevice on which to make the \fBMPSKernel\fP .RE .PP \fBReturns:\fP .RS 4 \fBA\fP new \fBMPSKernel\fP object, or nil if failure\&. .RE .PP .PP Reimplemented from \fBMPSCNNKernel\fP\&. .SS "\- (nonnull instancetype) initWithDevice: (nonnull id< MTLDevice >) device" Standard init with default properties per filter type .PP \fBParameters:\fP .RS 4 \fIdevice\fP The device that the filter will be used on\&. May not be NULL\&. .RE .PP \fBReturns:\fP .RS 4 \fBA\fP pointer to the newly initialized object\&. This will fail, returning nil if the device is not supported\&. Devices must be MTLFeatureSet_iOS_GPUFamily2_v1 or later\&. .RE .PP .PP Reimplemented from \fBMPSCNNKernel\fP\&. .SS "\- (nonnull instancetype) \fBinitWithDevice:\fP (nonnull id< MTLDevice >) device(NSUInteger) kernelWidth(NSUInteger) kernelHeight" Initialize a local contrast normalization filter .PP \fBParameters:\fP .RS 4 \fIdevice\fP The device the filter will run on .br \fIkernelWidth\fP The width of the kernel .br \fIkernelHeight\fP The height of the kernel .RE .PP \fBReturns:\fP .RS 4 \fBA\fP valid \fBMPSCNNLocalContrastNormalization\fP object or nil, if failure\&. .RE .PP NOTE: For now, kernelWidth must be equal to kernelHeight .SH "Property Documentation" .PP .SS "\- alpha\fC [read]\fP, \fC [write]\fP, \fC [nonatomic]\fP, \fC [assign]\fP" The value of alpha\&. Default is 0\&.0 The default value 0\&.0 is not recommended and is preserved for backwards compatibility\&. With alpha 0, it performs a local mean subtraction\&. The \fBMPSCNNLocalContrastNormalizationNode\fP used with the \fBMPSNNGraph\fP uses 1\&.0 as a default\&. .SS "\- beta\fC [read]\fP, \fC [write]\fP, \fC [nonatomic]\fP, \fC [assign]\fP" The value of beta\&. Default is 0\&.5 .SS "\- delta\fC [read]\fP, \fC [write]\fP, \fC [nonatomic]\fP, \fC [assign]\fP" The value of delta\&. Default is 1/1024 .SS "\- p0\fC [read]\fP, \fC [write]\fP, \fC [nonatomic]\fP, \fC [assign]\fP" The value of p0\&. Default is 1\&.0 .SS "\- pm\fC [read]\fP, \fC [write]\fP, \fC [nonatomic]\fP, \fC [assign]\fP" The value of pm\&. Default is 0\&.0 .SS "\- ps\fC [read]\fP, \fC [write]\fP, \fC [nonatomic]\fP, \fC [assign]\fP" The value of ps\&. Default is 1\&.0 .SH "Author" .PP Generated automatically by Doxygen for MetalPerformanceShaders\&.framework from the source code\&.