Package apple.metalperformanceshaders
Class MPSImageGuidedFilter
- java.lang.Object
-
- org.moe.natj.general.NativeObject
-
- org.moe.natj.objc.ObjCObject
-
- apple.NSObject
-
- apple.metalperformanceshaders.MPSKernel
-
- apple.metalperformanceshaders.MPSImageGuidedFilter
-
- All Implemented Interfaces:
NSCoding,NSCopying,NSSecureCoding,NSObject
public class MPSImageGuidedFilter extends MPSKernel
MPSImageGuidedFilter Perform Guided Filter to produce a coefficients image The filter is broken into two stages: - Regression - Reconstruction The regression stage learns a 4-channel "coefficient" texture (typically at a very low resolution), and represents the per-pixel linear regression of the source texture to the guidance texture. The reconstruction stage upsamples the coefficeints to the same size as the final output and then at each pixel computes the inner product to produce the output. The filter is broken into two stages to allow coefficients to be filtered (such as for example - temporally filtering for video to prevent flicker). There is also support for an optional weight texture that can be used to discard values in the source data. Guided Filter is described at https://arxiv.org/pdf/1505.00996.pdf.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class apple.NSObject
NSObject.Function_instanceMethodForSelector_ret, NSObject.Function_methodForSelector_ret
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedMPSImageGuidedFilter(org.moe.natj.general.Pointer peer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean_supportsSecureCoding()This property must return YES on all classes that allow secure coding.static booleanaccessInstanceVariablesDirectly()static MPSImageGuidedFilteralloc()static java.lang.ObjectallocWithZone(org.moe.natj.general.ptr.VoidPtr zone)static booleanautomaticallyNotifiesObserversForKey(java.lang.String key)static voidcancelPreviousPerformRequestsWithTarget(java.lang.Object aTarget)static voidcancelPreviousPerformRequestsWithTargetSelectorObject(java.lang.Object aTarget, org.moe.natj.objc.SEL aSelector, java.lang.Object anArgument)static NSArray<java.lang.String>classFallbacksForKeyedArchiver()static org.moe.natj.objc.ClassclassForKeyedUnarchiver()static java.lang.StringdebugDescription_static()static java.lang.Stringdescription_static()voidencodeReconstructionToCommandBufferGuidanceTextureCoefficientsTextureACoefficientsTextureBDestinationTexture(MTLCommandBuffer commandBuffer, MTLTexture guidanceTexture, MTLTexture coefficientsTextureA, MTLTexture coefficientsTextureB, MTLTexture destinationTexture)Perform Guided Filter Reconstruction (inference) to produce the filtered output The filter will not begin to execute until after the command buffer has been enqueued and committed.voidencodeReconstructionToCommandBufferGuidanceTextureCoefficientsTextureDestinationTexture(MTLCommandBuffer commandBuffer, MTLTexture guidanceTexture, MTLTexture coefficientsTexture, MTLTexture destinationTexture)Perform Guided Filter Reconstruction (inference) to produce the filtered output The filter will not begin to execute until after the command buffer has been enqueued and committed.voidencodeRegressionToCommandBufferSourceTextureGuidanceTextureWeightsTextureDestinationCoefficientsTexture(MTLCommandBuffer commandBuffer, MTLTexture sourceTexture, MTLTexture guidanceTexture, MTLTexture weightsTexture, MTLTexture destinationCoefficientsTexture)Perform Guided Filter Regression (correlation) to produce a coefficients texture The filter will not begin to execute until after the command buffer has been enqueued and committed.voidencodeRegressionToCommandBufferSourceTextureGuidanceTextureWeightsTextureDestinationCoefficientsTextureADestinationCoefficientsTextureB(MTLCommandBuffer commandBuffer, MTLTexture sourceTexture, MTLTexture guidanceTexture, MTLTexture weightsTexture, MTLTexture destinationCoefficientsTextureA, MTLTexture destinationCoefficientsTextureB)Perform per-channel (non-color correlated) Guided Filter Regression (correlation) to produce a coefficients texture The filter will not begin to execute until after the command buffer has been enqueued and committed.floatepsilon()[@property] epsilon The regularization parameter The parameter used when computing the linear coefficients a and b.static longhash_static()MPSImageGuidedFilterinit()MPSImageGuidedFilterinitWithCoder(NSCoder aDecoder)NS_DESIGNATED_INITIALIZERMPSImageGuidedFilterinitWithCoderDevice(NSCoder aDecoder, java.lang.Object device)NSSecureCoding 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.MPSImageGuidedFilterinitWithDevice(java.lang.Object device)Standard init with default properties per filter typeMPSImageGuidedFilterinitWithDeviceKernelDiameter(MTLDevice device, long kernelDiameter)Specifies information to apply the guided filter regression.static NSObject.Function_instanceMethodForSelector_retinstanceMethodForSelector(org.moe.natj.objc.SEL aSelector)static NSMethodSignatureinstanceMethodSignatureForSelector(org.moe.natj.objc.SEL aSelector)static booleaninstancesRespondToSelector(org.moe.natj.objc.SEL aSelector)static booleanisSubclassOfClass(org.moe.natj.objc.Class aClass)longkernelDiameter()[@property] kernelDiameter The local window size The local window size.static NSSet<java.lang.String>keyPathsForValuesAffectingValueForKey(java.lang.String key)static java.lang.Objectnew_objc()floatreconstructOffset()[@property] reconstructOffset The offset parameter The offset parameter added to the result of the scaled reconstructed value.floatreconstructScale()[@property] reconstructScale The scale parameter The parameter used to scale the result of the reconstruction operation.static booleanresolveClassMethod(org.moe.natj.objc.SEL sel)static booleanresolveInstanceMethod(org.moe.natj.objc.SEL sel)voidsetEpsilon(float value)[@property] epsilon The regularization parameter The parameter used when computing the linear coefficients a and b.voidsetReconstructOffset(float value)[@property] reconstructOffset The offset parameter The offset parameter added to the result of the scaled reconstructed value.voidsetReconstructScale(float value)[@property] reconstructScale The scale parameter The parameter used to scale the result of the reconstruction operation.static voidsetVersion_static(long aVersion)static org.moe.natj.objc.Classsuperclass_static()static booleansupportsSecureCoding()static longversion_static()-
Methods inherited from class apple.metalperformanceshaders.MPSKernel
copyWithZone, copyWithZoneDevice, device, encodeWithCoder, label, options, setLabel, setOptions
-
Methods inherited from class apple.NSObject
accessibilityActivate, accessibilityActivationPoint, accessibilityAssistiveTechnologyFocusedIdentifiers, accessibilityAttributedHint, accessibilityAttributedLabel, accessibilityAttributedUserInputLabels, accessibilityAttributedValue, accessibilityContainerType, accessibilityCustomActions, accessibilityCustomRotors, accessibilityDecrement, accessibilityDragSourceDescriptors, accessibilityDropPointDescriptors, accessibilityElementAtIndex, accessibilityElementCount, accessibilityElementDidBecomeFocused, accessibilityElementDidLoseFocus, accessibilityElementIsFocused, accessibilityElements, accessibilityElementsHidden, accessibilityFrame, accessibilityHint, accessibilityIncrement, accessibilityLabel, accessibilityLanguage, accessibilityNavigationStyle, accessibilityPath, accessibilityPerformEscape, accessibilityPerformMagicTap, accessibilityRespondsToUserInteraction, accessibilityScroll, accessibilityTextualContext, accessibilityTraits, accessibilityUserInputLabels, accessibilityValue, accessibilityViewIsModal, addObserverForKeyPathOptionsContext, attemptRecoveryFromErrorOptionIndex, attemptRecoveryFromErrorOptionIndexDelegateDidRecoverSelectorContextInfo, autoContentAccessingProxy, awakeAfterUsingCoder, awakeFromNib, class_objc, classForCoder, classForKeyedArchiver, copy, dealloc, debugDescription, description, dictionaryWithValuesForKeys, didChangeValueForKey, didChangeValueForKeyWithSetMutationUsingObjects, didChangeValuesAtIndexesForKey, doesNotRecognizeSelector, fileManagerShouldProceedAfterError, fileManagerWillProcessPath, finalize_objc, forwardingTargetForSelector, forwardInvocation, hash, indexOfAccessibilityElement, isAccessibilityElement, isEqual, isKindOfClass, isMemberOfClass, isProxy, methodForSelector, methodSignatureForSelector, mutableArrayValueForKey, mutableArrayValueForKeyPath, mutableCopy, mutableOrderedSetValueForKey, mutableOrderedSetValueForKeyPath, mutableSetValueForKey, mutableSetValueForKeyPath, observationInfo, observeValueForKeyPathOfObjectChangeContext, performSelector, performSelectorInBackgroundWithObject, performSelectorOnMainThreadWithObjectWaitUntilDone, performSelectorOnMainThreadWithObjectWaitUntilDoneModes, performSelectorOnThreadWithObjectWaitUntilDone, performSelectorOnThreadWithObjectWaitUntilDoneModes, performSelectorWithObject, performSelectorWithObjectAfterDelay, performSelectorWithObjectAfterDelayInModes, performSelectorWithObjectWithObject, prepareForInterfaceBuilder, provideImageDataBytesPerRowOrigin_Size_UserInfo, removeObserverForKeyPath, removeObserverForKeyPathContext, replacementObjectForCoder, replacementObjectForKeyedArchiver, respondsToSelector, self, setAccessibilityActivationPoint, setAccessibilityAttributedHint, setAccessibilityAttributedLabel, setAccessibilityAttributedUserInputLabels, setAccessibilityAttributedValue, setAccessibilityContainerType, setAccessibilityCustomActions, setAccessibilityCustomRotors, setAccessibilityDragSourceDescriptors, setAccessibilityDropPointDescriptors, setAccessibilityElements, setAccessibilityElementsHidden, setAccessibilityFrame, setAccessibilityHint, setAccessibilityLabel, setAccessibilityLanguage, setAccessibilityNavigationStyle, setAccessibilityPath, setAccessibilityRespondsToUserInteraction, setAccessibilityTextualContext, setAccessibilityTraits, setAccessibilityUserInputLabels, setAccessibilityValue, setAccessibilityViewIsModal, setIsAccessibilityElement, setNilValueForKey, setObservationInfo, setShouldGroupAccessibilityChildren, setValueForKey, setValueForKeyPath, setValueForUndefinedKey, setValuesForKeysWithDictionary, shouldGroupAccessibilityChildren, superclass, validateValueForKeyError, validateValueForKeyPathError, valueForKey, valueForKeyPath, valueForUndefinedKey, willChangeValueForKey, willChangeValueForKeyWithSetMutationUsingObjects, willChangeValuesAtIndexesForKey
-
-
-
-
Method Detail
-
accessInstanceVariablesDirectly
public static boolean accessInstanceVariablesDirectly()
-
alloc
public static MPSImageGuidedFilter alloc()
-
allocWithZone
public static java.lang.Object allocWithZone(org.moe.natj.general.ptr.VoidPtr zone)
-
automaticallyNotifiesObserversForKey
public static boolean automaticallyNotifiesObserversForKey(java.lang.String key)
-
cancelPreviousPerformRequestsWithTarget
public static void cancelPreviousPerformRequestsWithTarget(java.lang.Object aTarget)
-
cancelPreviousPerformRequestsWithTargetSelectorObject
public static void cancelPreviousPerformRequestsWithTargetSelectorObject(java.lang.Object aTarget, org.moe.natj.objc.SEL aSelector, java.lang.Object anArgument)
-
classFallbacksForKeyedArchiver
public static NSArray<java.lang.String> classFallbacksForKeyedArchiver()
-
classForKeyedUnarchiver
public static org.moe.natj.objc.Class classForKeyedUnarchiver()
-
debugDescription_static
public static java.lang.String debugDescription_static()
-
description_static
public static java.lang.String description_static()
-
encodeReconstructionToCommandBufferGuidanceTextureCoefficientsTextureDestinationTexture
public void encodeReconstructionToCommandBufferGuidanceTextureCoefficientsTextureDestinationTexture(MTLCommandBuffer commandBuffer, MTLTexture guidanceTexture, MTLTexture coefficientsTexture, MTLTexture destinationTexture)
Perform Guided Filter Reconstruction (inference) to produce the filtered output The filter will not begin to execute until after the command buffer has been enqueued and committed. [@pparam] sourceGuidanceTexture Input guidance pixel buffer. This should be a color (RGB) image. [@pparam] coefficientsTexture Input coefficients texture generated generated by a previous encodeRegressionToCommandBuffer- Parameters:
destinationTexture- Output texture Note: The coefficients are upsampled at the reconstruction of the filtered data. Reconstruct(guidance RGB) = a.r * R + a.g * G + a.b * B + b, where a and b are the coefficients learnt using encodeRegressionToCommandBuffer. Final reconstructed value = value * reconstructScale + reconstructOffset
-
encodeRegressionToCommandBufferSourceTextureGuidanceTextureWeightsTextureDestinationCoefficientsTexture
public void encodeRegressionToCommandBufferSourceTextureGuidanceTextureWeightsTextureDestinationCoefficientsTexture(MTLCommandBuffer commandBuffer, MTLTexture sourceTexture, MTLTexture guidanceTexture, MTLTexture weightsTexture, MTLTexture destinationCoefficientsTexture)
Perform Guided Filter Regression (correlation) to produce a coefficients texture The filter will not begin to execute until after the command buffer has been enqueued and committed.- Parameters:
commandBuffer- A valid MTLCommandBuffer.sourceTexture- Input source texture to be filtered (typically a mask). This should be a single channel image.guidanceTexture- Input guidance texture. This should be a color (RGB) image.weightsTexture- Optional input confidence texture. This should also a single channel image.destinationCoefficientsTexture- Output texture with four coefficients that minimize the mean squared error between the source and an affine function of guidance R, G, B. Note: The destinationCoefficientsTexture computes the linear cofficients "a" and "b". The "a" coefficient is stored in the RGB channels of destinationCoefficientsTexture and the "b" coefficient in the alpha chnanel. Set the MPSKernelOptionsAllowReducedPrecision in the "options" property for this kernel to peform the computations using half-precision arithmetic. This can potentially improve performance and/or power usage.
-
epsilon
public float epsilon()
[@property] epsilon The regularization parameter The parameter used when computing the linear coefficients a and b.
-
hash_static
public static long hash_static()
-
init
public MPSImageGuidedFilter init()
-
initWithCoder
public MPSImageGuidedFilter initWithCoder(NSCoder aDecoder)
Description copied from interface:NSCodingNS_DESIGNATED_INITIALIZER- Specified by:
initWithCoderin interfaceNSCoding- Overrides:
initWithCoderin classMPSKernel
-
initWithCoderDevice
public MPSImageGuidedFilter initWithCoderDevice(NSCoder aDecoder, java.lang.Object device)
NSSecureCoding 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.- Overrides:
initWithCoderDevicein classMPSKernel- Parameters:
aDecoder- The NSCoder subclass with your serialized MPSKerneldevice- The MTLDevice on which to make the MPSKernel- Returns:
- A new MPSKernel object, or nil if failure.
-
initWithDevice
public MPSImageGuidedFilter initWithDevice(java.lang.Object device)
Description copied from class:MPSKernelStandard init with default properties per filter type- Overrides:
initWithDevicein classMPSKernel- Parameters:
device- The device that the filter will be used on. May not be NULL.- Returns:
- a 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.
-
initWithDeviceKernelDiameter
public MPSImageGuidedFilter initWithDeviceKernelDiameter(MTLDevice device, long kernelDiameter)
Specifies information to apply the guided filter regression.- Parameters:
device- The device the filter will run onkernelDiameter- The local window size- Returns:
- A valid MPSImageGuidedFilterRegression object or nil, if failure.
-
instanceMethodForSelector
public static NSObject.Function_instanceMethodForSelector_ret instanceMethodForSelector(org.moe.natj.objc.SEL aSelector)
-
instanceMethodSignatureForSelector
public static NSMethodSignature instanceMethodSignatureForSelector(org.moe.natj.objc.SEL aSelector)
-
instancesRespondToSelector
public static boolean instancesRespondToSelector(org.moe.natj.objc.SEL aSelector)
-
isSubclassOfClass
public static boolean isSubclassOfClass(org.moe.natj.objc.Class aClass)
-
kernelDiameter
public long kernelDiameter()
[@property] kernelDiameter The local window size The local window size.
-
keyPathsForValuesAffectingValueForKey
public static NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey(java.lang.String key)
-
new_objc
public static java.lang.Object new_objc()
-
reconstructOffset
public float reconstructOffset()
[@property] reconstructOffset The offset parameter The offset parameter added to the result of the scaled reconstructed value. The default value is 0.0f.
-
reconstructScale
public float reconstructScale()
[@property] reconstructScale The scale parameter The parameter used to scale the result of the reconstruction operation. The default value is 1.0f.
-
resolveClassMethod
public static boolean resolveClassMethod(org.moe.natj.objc.SEL sel)
-
resolveInstanceMethod
public static boolean resolveInstanceMethod(org.moe.natj.objc.SEL sel)
-
setEpsilon
public void setEpsilon(float value)
[@property] epsilon The regularization parameter The parameter used when computing the linear coefficients a and b.
-
setReconstructOffset
public void setReconstructOffset(float value)
[@property] reconstructOffset The offset parameter The offset parameter added to the result of the scaled reconstructed value. The default value is 0.0f.
-
setReconstructScale
public void setReconstructScale(float value)
[@property] reconstructScale The scale parameter The parameter used to scale the result of the reconstruction operation. The default value is 1.0f.
-
setVersion_static
public static void setVersion_static(long aVersion)
-
superclass_static
public static org.moe.natj.objc.Class superclass_static()
-
supportsSecureCoding
public static boolean supportsSecureCoding()
-
_supportsSecureCoding
public boolean _supportsSecureCoding()
Description copied from interface:NSSecureCodingThis property must return YES on all classes that allow secure coding. Subclasses of classes that adopt NSSecureCoding and override initWithCoder: must also override this method and return YES. The Secure Coding Guide should be consulted when writing methods that decode data.- Specified by:
_supportsSecureCodingin interfaceNSSecureCoding- Overrides:
_supportsSecureCodingin classMPSKernel
-
version_static
public static long version_static()
-
encodeReconstructionToCommandBufferGuidanceTextureCoefficientsTextureACoefficientsTextureBDestinationTexture
public void encodeReconstructionToCommandBufferGuidanceTextureCoefficientsTextureACoefficientsTextureBDestinationTexture(MTLCommandBuffer commandBuffer, MTLTexture guidanceTexture, MTLTexture coefficientsTextureA, MTLTexture coefficientsTextureB, MTLTexture destinationTexture)
Perform Guided Filter Reconstruction (inference) to produce the filtered output The filter will not begin to execute until after the command buffer has been enqueued and committed.- Parameters:
commandBuffer- A valid MTLCommandBuffer.guidanceTexture- Input guidance pixel buffer.coefficientsTextureA- Input coefficients A texture generated generated by a previous encodeRegressionToCommandBuffer.coefficientsTextureB- Input coefficients B texture generated generated by a previous encodeRegressionToCommandBuffer.destinationTexture- Output texture
-
encodeRegressionToCommandBufferSourceTextureGuidanceTextureWeightsTextureDestinationCoefficientsTextureADestinationCoefficientsTextureB
public void encodeRegressionToCommandBufferSourceTextureGuidanceTextureWeightsTextureDestinationCoefficientsTextureADestinationCoefficientsTextureB(MTLCommandBuffer commandBuffer, MTLTexture sourceTexture, MTLTexture guidanceTexture, MTLTexture weightsTexture, MTLTexture destinationCoefficientsTextureA, MTLTexture destinationCoefficientsTextureB)
Perform per-channel (non-color correlated) Guided Filter Regression (correlation) to produce a coefficients texture The filter will not begin to execute until after the command buffer has been enqueued and committed. This encode call differs from the one above in that the correlations are not computed across channels and therefore this filter computes two coefficient textures: ai and bi.- Parameters:
commandBuffer- A valid MTLCommandBuffer.sourceTexture- Input source texture to be filtered.guidanceTexture- Input guidance texture. This should be a color (RGB) image.weightsTexture- Optional input confidence texture. This should be a single channel image.destinationCoefficientsTextureA- Output texture with four coefficients A that minimize the mean squared error between the source channels and an affine function of guidance channels.destinationCoefficientsTextureB- Output texture with four coefficients B that minimize the mean squared error between the source channels and an affine function of guidance channels. Set the MPSKernelOptionsAllowReducedPrecision in the "options" property for this kernel to peform the computations using half-precision arithmetic. This can potentially improve performance and/or power usage.
-
-