Class MPSImageHistogramEqualization

  • All Implemented Interfaces:
    NSCoding, NSCopying, NSSecureCoding, NSObject

    public class MPSImageHistogramEqualization
    extends MPSUnaryImageKernel
    MPSImageHistogramEqualization The MPSImageHistogramEqualization performs equalizes the histogram of an image. The process is divided into three steps. -# Call -initWithDevice:histogramInfo: This creates a MPSImageHistogramEqualization object. It is done when the method returns. -# Call -encodeTransform:sourceTexture:histogram:histogramOffset: This creates a privately held image transform (i.e. a cumulative distribution function of the histogram) which will be used to equalize the distribution of the histogram of the source image. This process runs on a MTLCommandBuffer when it is committed to a MTLCommandQueue. It must complete before the next step can be run. It may be performed on the same MTLCommandBuffer. The histogram argument specifies the histogram buffer which contains the histogram values for sourceTexture. The sourceTexture argument is used by encodeTransform to determine the number of channels and therefore which histogram data in histogram buffer to use. The histogram for sourceTexture must have been computed either on the CPU or using the MPSImageHistogram kernel -# Call -encodeToCommandBuffer:sourceTexture:destinationTexture: to read data from sourceTexture, apply the equalization transform to it and write to destination texture. This step is also done on the GPU on a MTLCommandQueue. You can reuse the same equalization transform on other images to perform the same transform on those images. (Since their distribution is probably different, they will probably not be equalized by it.) This filter usually will not be able to work in place.
    • Constructor Detail

      • MPSImageHistogramEqualization

        protected MPSImageHistogramEqualization​(org.moe.natj.general.Pointer peer)
    • Method Detail

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • 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()
      • hash_static

        public static long hash_static()
      • 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)
      • keyPathsForValuesAffectingValueForKey

        public static NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey​(java.lang.String key)
      • new_objc

        public static java.lang.Object new_objc()
      • resolveClassMethod

        public static boolean resolveClassMethod​(org.moe.natj.objc.SEL sel)
      • resolveInstanceMethod

        public static boolean resolveInstanceMethod​(org.moe.natj.objc.SEL sel)
      • setVersion_static

        public static void setVersion_static​(long aVersion)
      • superclass_static

        public static org.moe.natj.objc.Class superclass_static()
      • version_static

        public static long version_static()
      • encodeTransformToCommandBufferSourceTextureHistogramHistogramOffset

        public void encodeTransformToCommandBufferSourceTextureHistogramHistogramOffset​(MTLCommandBuffer commandBuffer,
                                                                                        MTLTexture source,
                                                                                        MTLBuffer histogram,
                                                                                        long histogramOffset)
        Encode the transform function to a command buffer using a MTLComputeCommandEncoder. The transform function computes the equalization lookup table. The transform function will not begin to execute until after the command buffer has been enqueued and committed. This step will need to be repeated with the new MPSKernel if -copyWithZone:device or -copyWithZone: is called. The transform is stored as internal state to the object. You still need to call -encodeToCommandBuffer:sourceTexture:destinationTexture: afterward to apply the transform to produce a result texture.
        Parameters:
        commandBuffer - A valid MTLCommandBuffer.
        source - A valid MTLTexture containing the source image for the filter.
        histogram - A valid MTLBuffer containing the histogram results for an image. This filter will use these histogram results to generate the cumulative histogram for equalizing the image. The histogram results / channel are stored together. The number of channels for which histogram results are stored is determined by the number of channels in the image. If histogramInfo.histogramForAlpha is false and the source image is RGBA then only histogram results for RGB channels are stored.
        histogramOffset - A byte offset into the histogram MTLBuffer where the histogram starts. Must conform to alignment requirements for [MTLComputeCommandEncoder setBuffer:offset:atIndex:] offset parameter.
      • initWithDevice

        public MPSImageHistogramEqualization initWithDevice​(java.lang.Object device)
        Description copied from class: MPSUnaryImageKernel
        Standard init with default properties per filter type
        Overrides:
        initWithDevice in class MPSUnaryImageKernel
        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.
      • initWithDeviceHistogramInfo

        public MPSImageHistogramEqualization initWithDeviceHistogramInfo​(MTLDevice device,
                                                                         org.moe.natj.general.ptr.VoidPtr histogramInfo)
        Specifies information about the histogram for the channels of an image.
        Parameters:
        device - The device the filter will run on
        histogramInfo - Pointer to the MPSHistogramInfo struct
        Returns:
        A valid MPSImageHistogramEqualization object or nil, if failure.
      • initWithCoderDevice

        public MPSImageHistogramEqualization 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:
        initWithCoderDevice in class MPSUnaryImageKernel
        Parameters:
        aDecoder - The NSCoder subclass with your serialized MPSKernel
        device - The MTLDevice on which to make the MPSKernel
        Returns:
        A new MPSKernel object, or nil if failure.
      • supportsSecureCoding

        public static boolean supportsSecureCoding()
      • _supportsSecureCoding

        public boolean _supportsSecureCoding()
        Description copied from interface: NSSecureCoding
        This 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:
        _supportsSecureCoding in interface NSSecureCoding
        Overrides:
        _supportsSecureCoding in class MPSUnaryImageKernel