peachsim 0.1.1692 → 0.1.1700
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/bridge-flow-runner.ts +61 -39
- package/cli/commands/agent-wrapper.ts +21 -10
- package/cli/commands/control.ts +27 -7
- package/cli/commands/coverage.ts +1 -1
- package/cli/commands/detect.ts +17 -4
- package/cli/commands/maestro-compare.ts +25 -99
- package/cli/help-core.ts +3 -4
- package/cli/maestro-compare.ts +172 -4
- package/cli/outbound-endpoints.ts +2 -10
- package/detox/index.ts +15 -0
- package/detox/launch-permissions.ts +169 -0
- package/dist-lib/agent-daemon-client.cjs +2 -2
- package/dist-lib/agent-events.cjs +2 -2
- package/dist-lib/attached-projects.cjs +2 -2
- package/dist-lib/auth/shared-session.cjs +2 -2
- package/dist-lib/backend-origin.cjs +2 -2
- package/dist-lib/beta.cjs +2 -2
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +2 -2
- package/dist-lib/bridge-contract-input.cjs +2 -2
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +2 -2
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/bundle-channel.cjs +18273 -15925
- package/dist-lib/capture-contract.cjs +2 -2
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cloud-contract.cjs +2 -2
- package/dist-lib/cloud-contract.mjs +1 -1
- package/dist-lib/cloud-test-args.cjs +2 -2
- package/dist-lib/cloud-test-args.mjs +1 -1
- package/dist-lib/cloud.cjs +2 -2
- package/dist-lib/cloud.mjs +1 -1
- package/dist-lib/config.cjs +2 -2
- package/dist-lib/config.mjs +1 -1
- package/dist-lib/detox/index.cjs +104 -3
- package/dist-lib/dev-bundle-resolution.cjs +208 -44
- package/dist-lib/expo-swift-bundle.cjs +2349 -1778
- package/dist-lib/expo-swift-metadata.cjs +2 -2
- package/dist-lib/expo-swift-metadata.mjs +1 -1
- package/dist-lib/home-paths.cjs +2 -2
- package/dist-lib/host/bridge-host.cjs +7885 -3334
- package/dist-lib/host/fetch-proxy-handler.cjs +331 -39
- package/dist-lib/host/fetch-proxy-overrides.cjs +2 -2
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/replacement-module-handler.cjs +2 -2
- package/dist-lib/host/websocket-proxy.cjs +2 -2
- package/dist-lib/index.cjs +297 -77
- package/dist-lib/jump-to-source-babel.cjs +2 -2
- package/dist-lib/jump-to-source-native.cjs +2 -2
- package/dist-lib/kotlin-host.cjs +2 -2
- package/dist-lib/menu.cjs +2 -2
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-fingerprint-registry.cjs +2 -2
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +2 -2
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +294 -74
- package/dist-lib/native-app-identity-project.cjs +48 -37
- package/dist-lib/native-app-identity-project.mjs +47 -36
- package/dist-lib/native-app-identity.cjs +2 -2
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +2 -2
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/plist.cjs +2 -2
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +2 -2
- package/dist-lib/public-brand.cjs +2 -2
- package/dist-lib/public-origins-lib-esm.json +24 -23
- package/dist-lib/public-origins-lib.json +199 -79
- package/dist-lib/react-native-host-modules.cjs +2 -2
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/reap-browser.cjs +2 -2
- package/dist-lib/scripts/dev-server-scanner.cjs +206 -31
- package/dist-lib/sdk.cjs +2 -2
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +19600 -15992
- package/dist-lib/swift-compile.cjs +640 -402
- package/dist-lib/swift-compile.mjs +595 -357
- package/dist-lib/swift-package.cjs +24 -20
- package/dist-lib/swift-package.mjs +23 -19
- package/dist-lib/swift-submit.cjs +2 -2
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +31 -4
- package/dist-lib/swift.cjs +2 -2
- package/dist-lib/vite-swift.cjs +1559 -1208
- package/dist-lib/vite.cjs +251 -42
- package/dist-lib/worklet-executable.cjs +2 -2
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-engine/src/engine/font-config.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/engine/node.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/scroll-pan-contacts.d.ts +3 -1
- package/dist-types/packages/peach-engine/src/engine/scroll.d.ts +7 -0
- package/dist-types/packages/peach-engine/src/engine/types.d.ts +2 -1
- package/dist-types/packages/peach-engine/src/remote-stream/cloud-display.d.ts +2 -2
- package/dist-types/packages/peach-engine/src/render-worker/host-service-protocol.d.ts +3 -0
- package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/render-worker/scroll-mirror.d.ts +17 -0
- package/dist-types/packages/peach-engine/src/render-worker/worker-input-runtime.d.ts +2 -1
- package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +3 -0
- package/dist-types/packages/peach-globals/src/cameraBridgeContract.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/replayBridgeContract.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/shellHostBridgeContract.d.ts +3 -0
- package/dist-types/packages/peach-kit/src/materials/types.d.ts +1 -0
- package/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/scripts/dev-server-scanner.ts +4 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Alpha.h +2282 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/BasicImageTypes.h +55 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Conversion.h +10551 -6
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Convolution.h +4236 -3
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Geometry.h +827 -8
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Histogram.h +1369 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Morphology.h +1243 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Transform.h +1747 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage.h +291 -2
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_CVUtilities.h +1283 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_Types.h +811 -91
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_Utilities.h +1342 -25
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns.h +2738 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns_constants.h +1685 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns_graph.h +913 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns_structures.h +1917 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/LinearAlgebra.h +23 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/arithmetic.h +209 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/base.h +104 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/linear_systems.h +77 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/matrix.h +554 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/norms.h +58 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/object.h +186 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/splat.h +86 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/vector.h +364 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Quadrature/Integration.h +195 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Quadrature/Quadrature.h +44 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/BLAS/BLAS.h +2330 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/BLAS/Types.h +123 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/Solve.h +8339 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/SolveImplementation.h +520 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/SolveImplementationTyped.h +1893 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/Sparse.h +10 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/blas_new.h +1098 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/cblas.h +859 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/cblas_new.h +1134 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/clapack.h +10555 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/fortran_blas.h +695 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/lapack.h +38526 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/lapack_types.h +60 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/lapack_version.h +20 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/thread_api.h +50 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vBasicOps.h +1218 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vBigNum.h +1458 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vDSP.h +10377 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vDSP_translate.h +167 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vForce.h +1243 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vecLib.h +114 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vecLibTypes.h +146 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vectorOps.h +1106 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vfp.h +294 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.h +25 -1
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFArray.h +673 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFAvailability.h +232 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h +827 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFCalendar.h +121 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFCharacterSet.h +387 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFData.h +79 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFDate.h +122 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFDictionary.h +674 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFError.h +182 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFLocale.h +213 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFNotificationCenter.h +82 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFNumber.h +129 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFSet.h +491 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFString.h +883 -2
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFTimeZone.h +98 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h +11 -229
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h +2 -6
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +2 -1
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.h +1 -0
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecBase.h +906 -3
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecCertificate.h +613 -0
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecItem.h +1284 -29
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecPolicy.h +441 -0
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecTrust.h +845 -0
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/Security.h +4 -0
- package/sdk/ios/usr/include/AvailabilityMacros.h +3985 -0
- package/sdk/ios/usr/include/copyfile.h +143 -0
- package/sdk/ios/usr/include/malloc/_malloc.h +143 -0
- package/sdk/ios/usr/include/malloc/_malloc_type.h +153 -0
- package/sdk/ios/usr/include/malloc/_platform.h +80 -0
- package/sdk/ios/usr/include/malloc/_ptrcheck.h +43 -0
- package/sdk/ios/usr/include/malloc/malloc.h +768 -0
- package/sdk/ios/usr/include/os/availability.h +168 -6
- package/sdk/ios/usr/include/os/base.h +351 -0
- package/sdk/ios/usr/include/os/clock.h +18 -0
- package/sdk/ios/usr/include/os/lock.h +232 -10
- package/sdk/ios/usr/include/os/log.h +521 -38
- package/sdk/ios/usr/include/os/object.h +320 -3
- package/sdk/ios/usr/include/os/trace.h +492 -0
- package/sdk/ios/usr/include/os/trace_base.h +167 -0
- package/sdk/ios/usr/include/os/workgroup.h +37 -0
- package/sdk/ios/usr/include/os/workgroup_base.h +91 -0
- package/sdk/ios/usr/include/os/workgroup_interval.h +156 -0
- package/sdk/ios/usr/include/os/workgroup_object.h +359 -0
- package/sdk/ios/usr/include/os/workgroup_parallel.h +76 -0
- package/sdk/ios/usr/include/sys/cdefs.h +38 -0
- package/sdk/ios/wasm/include/unistd.h +3 -0
- package/skills/contrast/SKILL.md +3 -0
- package/src/codex-client.ts +11 -6
- package/src/dev-bundle-resolution.ts +124 -48
- package/src/expo-native-workspace.ts +176 -0
- package/src/expo-swift-host.ts +161 -26
- package/src/expo-swift-ready.ts +14 -28
- package/src/expoSwiftContract.ts +4 -1
- package/src/generated/swift-c-predefines.json +68 -12
- package/src/host/bridge-host.ts +5 -0
- package/src/installed-package-versions.ts +14 -1
- package/src/metro-project-root.ts +44 -33
- package/src/native-app-identity-project.ts +1 -0
- package/src/nitro-adapter.lock.json +916 -10
- package/src/nitro-adapter.ts +33 -24
- package/src/nitro-bundle.ts +108 -22
- package/src/nitro-compile.ts +32 -5
- package/src/nitro-source.ts +13 -3
- package/src/nitroAdapterContract.ts +100 -20
- package/src/node-http-fetch.ts +116 -0
- package/src/packageVersionsContract.ts +46 -0
- package/src/serverDiscoveryContract.ts +1 -0
- package/src/settingsContract.ts +0 -30
- package/src/swift-binary-modules.ts +20 -5
- package/src/swift-compile.ts +168 -48
- package/src/swift-coverage/xcode-assets.ts +4 -3
- package/src/swift-host.ts +14 -3
- package/src/swift-objc-compile.ts +32 -5
- package/src/swift-objc-metadata.ts +2 -2
- package/src/swift-objc-platform.ts +2 -2
- package/src/swift-objc-standin.ts +43 -13
- package/src/swift-package.ts +33 -26
- package/src/swift-source-pods.ts +126 -41
- package/src/swift-standin-digest.ts +77 -0
- package/src/swift-standin-emit.ts +40 -4
- package/src/swift-standins.ts +68 -19
- package/src/swift-toolchain.ts +38 -0
- package/src/swiftContract.ts +8 -0
- package/src/vite-plugin.ts +0 -10
- package/src/xcode-project.ts +62 -42
- package/src/settings-flags.ts +0 -107
|
@@ -0,0 +1,1243 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @header Morphology.h
|
|
3
|
+
* vImage_Framework
|
|
4
|
+
*
|
|
5
|
+
* See vImage/vImage.h for more on how to view the headerdoc documentation for functions declared herein.
|
|
6
|
+
*
|
|
7
|
+
* @copyright Copyright (c) 2002-2016 by Apple Inc. All rights reserved.
|
|
8
|
+
*
|
|
9
|
+
* @discussion Morphology functions modify the shape of dark and light elements in an image. They can enlarge
|
|
10
|
+
* light structural elements (Dilate) or make them smaller by making the darker regions larger (Erode).
|
|
11
|
+
* The filters can be used in combination fill in holes (Dilate then Erode) or remove fine structure
|
|
12
|
+
* (Erode then Dilate). The Erode and Dilate filters can themselves have structure. For example, you
|
|
13
|
+
* can Dilate in the shape of a star, in which case single pixel bright signal (such as stars in a night
|
|
14
|
+
* sky) assume a star shape. Larger structure elements assume something of a star-like shape, but generally will
|
|
15
|
+
* not become fully recognizable as such until the size of the filter exceeds the size of the image
|
|
16
|
+
* structure element. A small circular filter can turn a rectangle into a larger rectangle with round corners.
|
|
17
|
+
* Many other examples abound.
|
|
18
|
+
*
|
|
19
|
+
* Min is a special case for an Erode function with a rectangular kernel that contains all the same value.
|
|
20
|
+
* Max is a special case for a Dilate function with a rectangular kernel that contains all the same value.
|
|
21
|
+
* Min and Max make use of a faster algorithm that can operate at much reduced cost.
|
|
22
|
+
*
|
|
23
|
+
* @ignorefuncmacro VIMAGE_NON_NULL
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
#ifndef VIMAGE_MORPHOLOGY_H
|
|
27
|
+
#define VIMAGE_MORPHOLOGY_H
|
|
28
|
+
|
|
29
|
+
#include <vImage/vImage_Types.h>
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
#ifdef __cplusplus
|
|
33
|
+
extern "C" {
|
|
34
|
+
#endif
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
/*!
|
|
38
|
+
* @functiongroup Dilate
|
|
39
|
+
* @discussion A dilate filter uses a shaped probe to trace a 3D surface. Imagine the kernel to define a 2D surface with
|
|
40
|
+
* the third dimension the values in the kernel. This is then lowered down over the image, itself treated
|
|
41
|
+
* as a 3D surface. The result image is the height at which the surface makes contact with the image for
|
|
42
|
+
* each pixel in the image. In this respect it operates like a scanning electron microscope with an adjustable
|
|
43
|
+
* probe shape. In code:
|
|
44
|
+
* <pre> @textblock
|
|
45
|
+
* for each pixel result[i][j] in the image{
|
|
46
|
+
* int r = 0;
|
|
47
|
+
* for( y = 0; y < kernel_height; y++ ){
|
|
48
|
+
* for( x = 0; x < kernel_width; x++ ){
|
|
49
|
+
* r = MAX( r, src[i+y-kernel_height/2][j+x-kernel_width/2] - k[y*kernel_width+x] )
|
|
50
|
+
* }
|
|
51
|
+
* }
|
|
52
|
+
*
|
|
53
|
+
* // normalize for kernel center not 0
|
|
54
|
+
* r += k[y * (kernel_height/2) * kernel_width + kernel_width/2 ];
|
|
55
|
+
*
|
|
56
|
+
* // saturate overflow to representable range
|
|
57
|
+
* result[i][j] = CLIP( r );
|
|
58
|
+
* }
|
|
59
|
+
* @/textblock </pre>
|
|
60
|
+
* The ARGB variants apply the filter to the four channels in parallel. It should be noted that the application
|
|
61
|
+
* of the filter to the image causes the structure elements in the filter to be reflected into the image, reversed
|
|
62
|
+
* top to bottom and left to right. Also, if the center of the kernel is not 0, a general lightening of the image
|
|
63
|
+
* will occur. Some functions will run much faster if the center of the kernel is 0.
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
/*!
|
|
67
|
+
* @function vImageDilate_Planar8
|
|
68
|
+
* @abstract Apply a dilate filter to a Planar8 image
|
|
69
|
+
* @discussion This is a general purpose dilate filter for Planar8 data. It is optimized to handle the special cases that occur
|
|
70
|
+
* in image masks -- large contiguous regions of all 0xff or 0x0. If your filter is all 0's, you should use vImageMax_Planar8
|
|
71
|
+
* instead.
|
|
72
|
+
*
|
|
73
|
+
* <pre> @textblock
|
|
74
|
+
* for each pixel result[i][j] in the image{
|
|
75
|
+
* int r = 0;
|
|
76
|
+
* for( y = 0; y < kernel_height; y++ ){
|
|
77
|
+
* for( x = 0; x < kernel_width; x++ ){
|
|
78
|
+
* r = MAX( r, src[i+y-kernel_height/2][j+x-kernel_width/2] - k[y*kernel_width+x] )
|
|
79
|
+
* }
|
|
80
|
+
* }
|
|
81
|
+
*
|
|
82
|
+
* // normalize for kernel center not 0
|
|
83
|
+
* r += k[y * (kernel_height/2) * kernel_width + kernel_width/2 ];
|
|
84
|
+
*
|
|
85
|
+
* // saturate overflow to representable range
|
|
86
|
+
* result[i][j] = CLIP( r );
|
|
87
|
+
* }
|
|
88
|
+
* @/textblock </pre>
|
|
89
|
+
*
|
|
90
|
+
* If only part of the dilate filter of the entire image is desired, use srcOffsetToROI_X/Y to set the positioning
|
|
91
|
+
* of the result tile relative to the src image.
|
|
92
|
+
*
|
|
93
|
+
* Does not work in place.
|
|
94
|
+
*
|
|
95
|
+
* @param src The input image
|
|
96
|
+
* @param dest A preallocated buffer to contain the result image
|
|
97
|
+
* @param srcOffsetToROI_X An offset added to the horizontal position in the src image when calculating the dilate filter.
|
|
98
|
+
* It allows the dilate filter to operate in a tiled fashion for tiles that do not start on the
|
|
99
|
+
* left edge of the source image.
|
|
100
|
+
* @param srcOffsetToROI_Y An offset added to the vertical position in the src image when calculating the dilate filter.
|
|
101
|
+
* It allows the dilate filter to operate in a tiled fashion for tiles that do not start on the
|
|
102
|
+
* top edge of the source image.
|
|
103
|
+
* @param kernel A pointer to a array of filter values of dimension kernel_height x kernel_width.
|
|
104
|
+
* @param kernel_height The height of the rectangular kernel. Must be an odd number.
|
|
105
|
+
* @param kernel_width The width of the rectangular kernel. Must be an odd number.
|
|
106
|
+
* @param flags The following flags values are allowed:
|
|
107
|
+
* <pre> @textblock
|
|
108
|
+
* kvImageNoFlags Default operation
|
|
109
|
+
*
|
|
110
|
+
* kvImageDoNotTile Turn off internal multithreading. Useful if, for example, you are doing your own
|
|
111
|
+
* multithreading and just want the filter to run local to the current thread.
|
|
112
|
+
*
|
|
113
|
+
* kvImageGetTempBufferSize Return 0. Do no work.
|
|
114
|
+
* @/textblock </pre>
|
|
115
|
+
* @return The following error codes may result:
|
|
116
|
+
* <pre> @textblock
|
|
117
|
+
* kvImageNoError Success.
|
|
118
|
+
* 0 If kvImageGetTempBufferSize was among the flags, then no work was done.
|
|
119
|
+
*
|
|
120
|
+
* kvImageRoiLargerThanInputBuffer dest->width and dest->height must be less than or equal to the corresponding
|
|
121
|
+
* dimensions in the src image
|
|
122
|
+
*
|
|
123
|
+
* kvImageInvalidKernelSize The kernel_height and kernel_width must not be evenly divisible by 2.
|
|
124
|
+
* @/textblock </pre>
|
|
125
|
+
*/
|
|
126
|
+
VIMAGE_PF vImage_Error vImageDilate_Planar8( const vImage_Buffer *src, const vImage_Buffer *dest, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const unsigned char *kernel, vImagePixelCount kernel_height, vImagePixelCount kernel_width, vImage_Flags flags ) VIMAGE_NON_NULL(1,2,5) API_AVAILABLE(macos(10.3), ios(5.0), watchos(1.0), tvos(5.0));
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
/*!
|
|
131
|
+
* @function vImageDilate_PlanarF
|
|
132
|
+
* @abstract Apply a dilate filter to a PlanarF image
|
|
133
|
+
* @discussion This is a general purpose dilate filter for Planar8 data. If your filter is all 0's, you should use vImageMax_PlanarF
|
|
134
|
+
* instead.
|
|
135
|
+
*
|
|
136
|
+
* <pre> @textblock
|
|
137
|
+
* for each pixel result[i][j] in the image{
|
|
138
|
+
* float r = -INFINITY;
|
|
139
|
+
* for( y = 0; y < kernel_height; y++ ){
|
|
140
|
+
* for( x = 0; x < kernel_width; x++ ){
|
|
141
|
+
* r = MAX( r, src[i+y-kernel_height/2][j+x-kernel_width/2] - k[y*kernel_width+x] )
|
|
142
|
+
* }
|
|
143
|
+
* }
|
|
144
|
+
*
|
|
145
|
+
* // normalize for kernel center not 0
|
|
146
|
+
* r += k[y * (kernel_height/2) * kernel_width + kernel_width/2 ];
|
|
147
|
+
*
|
|
148
|
+
* // saturate overflow to representable range
|
|
149
|
+
* result[i][j] = r;
|
|
150
|
+
* }
|
|
151
|
+
* @/textblock </pre>
|
|
152
|
+
*
|
|
153
|
+
* If only part of the dilate filter of the entire image is desired, use srcOffsetToROI_X/Y to set the positioning
|
|
154
|
+
* of the result tile relative to the src image.
|
|
155
|
+
*
|
|
156
|
+
* Does not work in place. Floating-point values have host endianness.
|
|
157
|
+
*
|
|
158
|
+
* @param src The input image
|
|
159
|
+
* @param dest A preallocated buffer to contain the result image
|
|
160
|
+
* @param srcOffsetToROI_X An offset added to the horizontal position in the src image when calculating the dilate filter.
|
|
161
|
+
* It allows the dilate filter to operate in a tiled fashion for tiles that do not start on the
|
|
162
|
+
* left edge of the source image.
|
|
163
|
+
* @param srcOffsetToROI_Y An offset added to the vertical position in the src image when calculating the dilate filter.
|
|
164
|
+
* It allows the dilate filter to operate in a tiled fashion for tiles that do not start on the
|
|
165
|
+
* top edge of the source image.
|
|
166
|
+
* @param kernel A pointer to a array of filter values of dimension kernel_height x kernel_width.
|
|
167
|
+
* @param kernel_height The height of the rectangular kernel. Must be an odd number.
|
|
168
|
+
* @param kernel_width The width of the rectangular kernel. Must be an odd number.
|
|
169
|
+
* @param flags The following flags values are allowed:
|
|
170
|
+
* <pre> @textblock
|
|
171
|
+
* kvImageNoFlags Default operation
|
|
172
|
+
*
|
|
173
|
+
* kvImageDoNotTile Turn off internal multithreading. Useful if, for example, you are doing your own
|
|
174
|
+
* multithreading and just want the filter to run local to the current thread.
|
|
175
|
+
*
|
|
176
|
+
* kvImageGetTempBufferSize Return 0. Do no work.
|
|
177
|
+
* @/textblock </pre>
|
|
178
|
+
* @return The following error codes may result:
|
|
179
|
+
* <pre> @textblock
|
|
180
|
+
* kvImageNoError Success.
|
|
181
|
+
* 0 If kvImageGetTempBufferSize was among the flags, then no work was done.
|
|
182
|
+
*
|
|
183
|
+
* kvImageRoiLargerThanInputBuffer dest->width and dest->height must be less than or equal to the corresponding
|
|
184
|
+
* dimensions in the src image
|
|
185
|
+
*
|
|
186
|
+
* kvImageInvalidKernelSize The kernel_height and kernel_width must not be evenly divisible by 2.
|
|
187
|
+
* @/textblock </pre>
|
|
188
|
+
*/
|
|
189
|
+
VIMAGE_PF vImage_Error vImageDilate_PlanarF( const vImage_Buffer *src, const vImage_Buffer *dest, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const float *kernel, vImagePixelCount kernel_height, vImagePixelCount kernel_width, vImage_Flags flags ) VIMAGE_NON_NULL(1,2,5) API_AVAILABLE(macos(10.3), ios(5.0), watchos(1.0), tvos(5.0));
|
|
190
|
+
|
|
191
|
+
/*!
|
|
192
|
+
* @function vImageDilate_ARGB8888
|
|
193
|
+
* @abstract Apply a dilate filter to a ARGB8888 image
|
|
194
|
+
* @discussion This is a general purpose dilate filter for ARGB8888 data. If your filter is all 0's, you should use vImageMax_ARGB8888
|
|
195
|
+
* instead.
|
|
196
|
+
*
|
|
197
|
+
* <pre> @textblock
|
|
198
|
+
* for each pixel result[i][j] in the image{
|
|
199
|
+
* int a = 0;
|
|
200
|
+
* int r = 0;
|
|
201
|
+
* int g = 0;
|
|
202
|
+
* int b = 0;
|
|
203
|
+
* for( y = 0; y < kernel_height; y++ ){
|
|
204
|
+
* for( x = 0; x < kernel_width; x++ ){
|
|
205
|
+
* a = MAX( a, src[i+y-kernel_height/2][j+x-kernel_width/2][0] - k[y*kernel_width+x] )
|
|
206
|
+
* r = MAX( r, src[i+y-kernel_height/2][j+x-kernel_width/2][1] - k[y*kernel_width+x] )
|
|
207
|
+
* g = MAX( g, src[i+y-kernel_height/2][j+x-kernel_width/2][2] - k[y*kernel_width+x] )
|
|
208
|
+
* b = MAX( b, src[i+y-kernel_height/2][j+x-kernel_width/2][3] - k[y*kernel_width+x] )
|
|
209
|
+
* }
|
|
210
|
+
* }
|
|
211
|
+
*
|
|
212
|
+
* // normalize for kernel center not 0
|
|
213
|
+
* a += k[y * (kernel_height/2) * kernel_width + kernel_width/2 ];
|
|
214
|
+
* r += k[y * (kernel_height/2) * kernel_width + kernel_width/2 ];
|
|
215
|
+
* g += k[y * (kernel_height/2) * kernel_width + kernel_width/2 ];
|
|
216
|
+
* b += k[y * (kernel_height/2) * kernel_width + kernel_width/2 ];
|
|
217
|
+
*
|
|
218
|
+
* // saturate overflow to representable range
|
|
219
|
+
* result[i][j][0] = (flags & kvImageLeaveAlphaUnchanged) ? src[i][j] : CLIP( a );
|
|
220
|
+
* result[i][j][1] = CLIP( r );
|
|
221
|
+
* result[i][j][2] = CLIP( g );
|
|
222
|
+
* result[i][j][3] = CLIP( b );
|
|
223
|
+
* }
|
|
224
|
+
* @/textblock </pre>
|
|
225
|
+
*
|
|
226
|
+
* If only part of the dilate filter of the entire image is desired, use srcOffsetToROI_X/Y to set the positioning
|
|
227
|
+
* of the result tile relative to the src image.
|
|
228
|
+
*
|
|
229
|
+
* Does not work in place. If kvImageLeaveAlphaUnchanged is not used, it works for any channel order.
|
|
230
|
+
* If kvImageLeaveAlphaUnchanged is used, then the alpha must be first.
|
|
231
|
+
*
|
|
232
|
+
* @param src The input image
|
|
233
|
+
* @param dest A preallocated buffer to contain the result image
|
|
234
|
+
* @param srcOffsetToROI_X An offset added to the horizontal position in the src image when calculating the dilate filter.
|
|
235
|
+
* It allows the dilate filter to operate in a tiled fashion for tiles that do not start on the
|
|
236
|
+
* left edge of the source image.
|
|
237
|
+
* @param srcOffsetToROI_Y An offset added to the vertical position in the src image when calculating the dilate filter.
|
|
238
|
+
* It allows the dilate filter to operate in a tiled fashion for tiles that do not start on the
|
|
239
|
+
* top edge of the source image.
|
|
240
|
+
* @param kernel A pointer to a array of filter values of dimension kernel_height x kernel_width.
|
|
241
|
+
* @param kernel_height The height of the rectangular kernel. Must be an odd number.
|
|
242
|
+
* @param kernel_width The width of the rectangular kernel. Must be an odd number.
|
|
243
|
+
* @param flags The following flags values are allowed:
|
|
244
|
+
* <pre> @textblock
|
|
245
|
+
* kvImageNoFlags Default operation
|
|
246
|
+
*
|
|
247
|
+
* kvImageDoNotTile Turn off internal multithreading. Useful if, for example, you are doing your own
|
|
248
|
+
* multithreading and just want the filter to run local to the current thread.
|
|
249
|
+
*
|
|
250
|
+
* kvImageGetTempBufferSize Return 0. Do no work.
|
|
251
|
+
*
|
|
252
|
+
* kvImageLeaveAlphaUnchanged The alpha channel (first byte of pixel in memory) is copied to the destination
|
|
253
|
+
* without modification, instead of having a dilate filter applied to it.
|
|
254
|
+
* @/textblock </pre>
|
|
255
|
+
* @return The following error codes may result:
|
|
256
|
+
* <pre> @textblock
|
|
257
|
+
* kvImageNoError Success.
|
|
258
|
+
* 0 If kvImageGetTempBufferSize was among the flags, then no work was done.
|
|
259
|
+
*
|
|
260
|
+
* kvImageRoiLargerThanInputBuffer dest->width and dest->height must be less than or equal to the corresponding
|
|
261
|
+
* dimensions in the src image
|
|
262
|
+
*
|
|
263
|
+
* kvImageInvalidKernelSize The kernel_height and kernel_width must not be evenly divisible by 2.
|
|
264
|
+
* @/textblock </pre>
|
|
265
|
+
*/
|
|
266
|
+
VIMAGE_PF vImage_Error vImageDilate_ARGB8888( const vImage_Buffer *src, const vImage_Buffer *dest, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const unsigned char *kernel, vImagePixelCount kernel_height, vImagePixelCount kernel_width, vImage_Flags flags ) VIMAGE_NON_NULL(1,2,5) API_AVAILABLE(macos(10.3), ios(5.0), watchos(1.0), tvos(5.0));
|
|
267
|
+
|
|
268
|
+
/*!
|
|
269
|
+
* @function vImageDilate_ARGBFFFF
|
|
270
|
+
* @abstract Apply a dilate filter to a ARGBFFFF image
|
|
271
|
+
* @discussion This is a general purpose dilate filter for ARGBFFFF data. If your filter is all 0's, you should use vImageMax_ARGBFFFF
|
|
272
|
+
* instead.
|
|
273
|
+
*
|
|
274
|
+
* <pre> @textblock
|
|
275
|
+
* for each pixel result[i][j] in the image{
|
|
276
|
+
* float a = -INFINITY;
|
|
277
|
+
* float r = -INFINITY;
|
|
278
|
+
* float g = -INFINITY;
|
|
279
|
+
* float b = -INFINITY;
|
|
280
|
+
* for( y = 0; y < kernel_height; y++ ){
|
|
281
|
+
* for( x = 0; x < kernel_width; x++ ){
|
|
282
|
+
* a = MAX( a, src[i+y-kernel_height/2][j+x-kernel_width/2][0] - k[y*kernel_width+x] )
|
|
283
|
+
* r = MAX( r, src[i+y-kernel_height/2][j+x-kernel_width/2][1] - k[y*kernel_width+x] )
|
|
284
|
+
* g = MAX( g, src[i+y-kernel_height/2][j+x-kernel_width/2][2] - k[y*kernel_width+x] )
|
|
285
|
+
* b = MAX( b, src[i+y-kernel_height/2][j+x-kernel_width/2][3] - k[y*kernel_width+x] )
|
|
286
|
+
* }
|
|
287
|
+
* }
|
|
288
|
+
*
|
|
289
|
+
* // normalize for kernel center not 0
|
|
290
|
+
* a += k[y * (kernel_height/2) * kernel_width + kernel_width/2 ];
|
|
291
|
+
* r += k[y * (kernel_height/2) * kernel_width + kernel_width/2 ];
|
|
292
|
+
* g += k[y * (kernel_height/2) * kernel_width + kernel_width/2 ];
|
|
293
|
+
* b += k[y * (kernel_height/2) * kernel_width + kernel_width/2 ];
|
|
294
|
+
*
|
|
295
|
+
* // saturate overflow to representable range
|
|
296
|
+
* result[i][j][0] = (flags & kvImageLeaveAlphaUnchanged) ? src[i][j] : a;
|
|
297
|
+
* result[i][j][1] = r;
|
|
298
|
+
* result[i][j][2] = g;
|
|
299
|
+
* result[i][j][3] = b;
|
|
300
|
+
* }
|
|
301
|
+
* @/textblock </pre>
|
|
302
|
+
*
|
|
303
|
+
* If only part of the dilate filter of the entire image is desired, use srcOffsetToROI_X/Y to set the positioning
|
|
304
|
+
* of the result tile relative to the src image.
|
|
305
|
+
*
|
|
306
|
+
* Does not work in place. If kvImageLeaveAlphaUnchanged is not used, it works for any channel order.
|
|
307
|
+
* If kvImageLeaveAlphaUnchanged is used, then the alpha must be first. Floating-point values have host
|
|
308
|
+
* endianness.
|
|
309
|
+
*
|
|
310
|
+
* @param src The input image
|
|
311
|
+
* @param dest A preallocated buffer to contain the result image
|
|
312
|
+
* @param srcOffsetToROI_X An offset added to the horizontal position in the src image when calculating the dilate filter.
|
|
313
|
+
* It allows the dilate filter to operate in a tiled fashion for tiles that do not start on the
|
|
314
|
+
* left edge of the source image.
|
|
315
|
+
* @param srcOffsetToROI_Y An offset added to the vertical position in the src image when calculating the dilate filter.
|
|
316
|
+
* It allows the dilate filter to operate in a tiled fashion for tiles that do not start on the
|
|
317
|
+
* top edge of the source image.
|
|
318
|
+
* @param kernel A pointer to a array of filter values of dimension kernel_height x kernel_width.
|
|
319
|
+
* @param kernel_height The height of the rectangular kernel. Must be an odd number.
|
|
320
|
+
* @param kernel_width The width of the rectangular kernel. Must be an odd number.
|
|
321
|
+
* @param flags The following flags values are allowed:
|
|
322
|
+
* <pre> @textblock
|
|
323
|
+
* kvImageNoFlags Default operation
|
|
324
|
+
*
|
|
325
|
+
* kvImageDoNotTile Turn off internal multithreading. Useful if, for example, you are doing your own
|
|
326
|
+
* multithreading and just want the filter to run local to the current thread.
|
|
327
|
+
*
|
|
328
|
+
* kvImageGetTempBufferSize Return 0. Do no work.
|
|
329
|
+
*
|
|
330
|
+
* kvImageLeaveAlphaUnchanged The alpha channel (first float in pixel in memory) is copied to the destination
|
|
331
|
+
* without modification, instead of having a dilate filter applied to it.
|
|
332
|
+
* @/textblock </pre>
|
|
333
|
+
* @return The following error codes may result:
|
|
334
|
+
* <pre> @textblock
|
|
335
|
+
* kvImageNoError Success.
|
|
336
|
+
* 0 If kvImageGetTempBufferSize was among the flags, then no work was done.
|
|
337
|
+
*
|
|
338
|
+
* kvImageRoiLargerThanInputBuffer dest->width and dest->height must be less than or equal to the corresponding
|
|
339
|
+
* dimensions in the src image
|
|
340
|
+
*
|
|
341
|
+
* kvImageInvalidKernelSize The kernel_height and kernel_width must not be evenly divisible by 2.
|
|
342
|
+
* @/textblock </pre>
|
|
343
|
+
*/
|
|
344
|
+
VIMAGE_PF vImage_Error vImageDilate_ARGBFFFF( const vImage_Buffer *src, const vImage_Buffer *dest, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const float *kernel, vImagePixelCount kernel_height, vImagePixelCount kernel_width, vImage_Flags flags ) VIMAGE_NON_NULL(1,2,5) API_AVAILABLE(macos(10.3), ios(5.0), watchos(1.0), tvos(5.0));
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
/*!
|
|
348
|
+
* @functiongroup Erode
|
|
349
|
+
* @discussion An erode filter uses a shaped probe to trace a 3D surface. Imagine the kernel to define a 2D surface with
|
|
350
|
+
* the third dimension the values in the kernel. This is then elevated from underneath the image, itself treated
|
|
351
|
+
* as a 3D surface. The result image is the height at which the surface makes contact with the image for
|
|
352
|
+
* each pixel in the image.
|
|
353
|
+
*
|
|
354
|
+
* In code:
|
|
355
|
+
* <pre> @textblock
|
|
356
|
+
* for each pixel result[i][j] in the image{
|
|
357
|
+
* int r = MAX_CHANNEL_VALUE;
|
|
358
|
+
* for( y = 0; y < kernel_height; y++ ){
|
|
359
|
+
* for( x = 0; x < kernel_width; x++ ){
|
|
360
|
+
* r = MIN( r, src[i+y-kernel_height/2][j+x-kernel_width/2] - k[y*kernel_width+x] )
|
|
361
|
+
* }
|
|
362
|
+
* }
|
|
363
|
+
*
|
|
364
|
+
* // normalize for kernel center not 0
|
|
365
|
+
* r += k[y * (kernel_height/2) * kernel_width + kernel_width/2 ];
|
|
366
|
+
*
|
|
367
|
+
* // saturate overflow to representable range
|
|
368
|
+
* result[i][j] = CLIP( r );
|
|
369
|
+
* }
|
|
370
|
+
* @/textblock </pre>
|
|
371
|
+
* The ARGB variants apply the filter to the four channels in parallel. It should be noted that the application
|
|
372
|
+
* of the filter to the image causes the structure elements in the filter to be reflected into the image, reversed
|
|
373
|
+
* top to bottom and left to right. Also, if the center of the kernel is not 0, a general lightening of the image
|
|
374
|
+
* will occur. Some functions will run much faster if the center of the kernel is 0.
|
|
375
|
+
*/
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
/*!
|
|
379
|
+
* @function vImageErode_Planar8
|
|
380
|
+
* @abstract Apply a erode filter to a Planar8 image
|
|
381
|
+
* @discussion This is a general purpose erode filter for Planar8 data. If your filter is all 0's, you should use vImageMin_Planar8
|
|
382
|
+
* instead.
|
|
383
|
+
*
|
|
384
|
+
* <pre> @textblock
|
|
385
|
+
* for each pixel result[i][j] in the image{
|
|
386
|
+
* int r = MAX_CHANNEL_VALUE;
|
|
387
|
+
* for( y = 0; y < kernel_height; y++ ){
|
|
388
|
+
* for( x = 0; x < kernel_width; x++ ){
|
|
389
|
+
* r = MIN( r, src[i+y-kernel_height/2][j+x-kernel_width/2] - k[y*kernel_width+x] )
|
|
390
|
+
* }
|
|
391
|
+
* }
|
|
392
|
+
*
|
|
393
|
+
* // normalize for kernel center not 0
|
|
394
|
+
* r += k[y * (kernel_height/2) * kernel_width + kernel_width/2 ];
|
|
395
|
+
*
|
|
396
|
+
* // saturate overflow to representable range
|
|
397
|
+
* result[i][j] = CLIP( r );
|
|
398
|
+
* }
|
|
399
|
+
* @/textblock </pre>
|
|
400
|
+
*
|
|
401
|
+
* If only part of the erode filter of the entire image is desired, use srcOffsetToROI_X/Y to set the positioning
|
|
402
|
+
* of the result tile relative to the src image.
|
|
403
|
+
*
|
|
404
|
+
* Does not work in place.
|
|
405
|
+
*
|
|
406
|
+
* @param src The input image
|
|
407
|
+
* @param dest A preallocated buffer to contain the result image
|
|
408
|
+
* @param srcOffsetToROI_X An offset added to the horizontal position in the src image when calculating the erode filter.
|
|
409
|
+
* It allows the erode filter to operate in a tiled fashion for tiles that do not start on the
|
|
410
|
+
* left edge of the source image.
|
|
411
|
+
* @param srcOffsetToROI_Y An offset added to the vertical position in the src image when calculating the erode filter.
|
|
412
|
+
* It allows the erode filter to operate in a tiled fashion for tiles that do not start on the
|
|
413
|
+
* top edge of the source image.
|
|
414
|
+
* @param kernel A pointer to a array of filter values of dimension kernel_height x kernel_width.
|
|
415
|
+
* @param kernel_height The height of the rectangular kernel. Must be an odd number.
|
|
416
|
+
* @param kernel_width The width of the rectangular kernel. Must be an odd number.
|
|
417
|
+
* @param flags The following flags values are allowed:
|
|
418
|
+
* <pre> @textblock
|
|
419
|
+
* kvImageNoFlags Default operation
|
|
420
|
+
*
|
|
421
|
+
* kvImageDoNotTile Turn off internal multithreading. Useful if, for example, you are doing your own
|
|
422
|
+
* multithreading and just want the filter to run local to the current thread.
|
|
423
|
+
*
|
|
424
|
+
* kvImageGetTempBufferSize Return 0. Do no work.
|
|
425
|
+
* @/textblock </pre>
|
|
426
|
+
* @return The following error codes may result:
|
|
427
|
+
* <pre> @textblock
|
|
428
|
+
* kvImageNoError Success.
|
|
429
|
+
* 0 If kvImageGetTempBufferSize was among the flags, then no work was done.
|
|
430
|
+
*
|
|
431
|
+
* kvImageRoiLargerThanInputBuffer dest->width and dest->height must be less than or equal to the corresponding
|
|
432
|
+
* dimensions in the src image
|
|
433
|
+
*
|
|
434
|
+
* kvImageInvalidKernelSize The kernel_height and kernel_width must not be evenly divisible by 2.
|
|
435
|
+
* @/textblock </pre>
|
|
436
|
+
*/
|
|
437
|
+
VIMAGE_PF vImage_Error vImageErode_Planar8( const vImage_Buffer *src, const vImage_Buffer *dest, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const unsigned char *kernel, vImagePixelCount kernel_height, vImagePixelCount kernel_width, vImage_Flags flags ) VIMAGE_NON_NULL(1,2,5) API_AVAILABLE(macos(10.3), ios(5.0), watchos(1.0), tvos(5.0));
|
|
438
|
+
|
|
439
|
+
/*!
|
|
440
|
+
* @function vImageErode_PlanarF
|
|
441
|
+
* @abstract Apply a erode filter to a PlanarF image
|
|
442
|
+
* @discussion This is a general purpose erode filter for Planar8 data. If your filter is all 0's, you should use vImageMin_PlanarF
|
|
443
|
+
* instead.
|
|
444
|
+
*
|
|
445
|
+
* <pre> @textblock
|
|
446
|
+
* for each pixel result[i][j] in the image{
|
|
447
|
+
* float r = INFINITY;
|
|
448
|
+
* for( y = 0; y < kernel_height; y++ ){
|
|
449
|
+
* for( x = 0; x < kernel_width; x++ ){
|
|
450
|
+
* r = MIN( r, src[i+y-kernel_height/2][j+x-kernel_width/2] - k[y*kernel_width+x] )
|
|
451
|
+
* }
|
|
452
|
+
* }
|
|
453
|
+
*
|
|
454
|
+
* // normalize for kernel center not 0
|
|
455
|
+
* r += k[y * (kernel_height/2) * kernel_width + kernel_width/2 ];
|
|
456
|
+
*
|
|
457
|
+
* // saturate overflow to representable range
|
|
458
|
+
* result[i][j] = r;
|
|
459
|
+
* }
|
|
460
|
+
* @/textblock </pre>
|
|
461
|
+
*
|
|
462
|
+
* If only part of the erode filter of the entire image is desired, use srcOffsetToROI_X/Y to set the positioning
|
|
463
|
+
* of the result tile relative to the src image.
|
|
464
|
+
*
|
|
465
|
+
* Does not work in place. Floating-point values have host endianness.
|
|
466
|
+
*
|
|
467
|
+
* @param src The input image
|
|
468
|
+
* @param dest A preallocated buffer to contain the result image
|
|
469
|
+
* @param srcOffsetToROI_X An offset added to the horizontal position in the src image when calculating the erode filter.
|
|
470
|
+
* It allows the erode filter to operate in a tiled fashion for tiles that do not start on the
|
|
471
|
+
* left edge of the source image.
|
|
472
|
+
* @param srcOffsetToROI_Y An offset added to the vertical position in the src image when calculating the erode filter.
|
|
473
|
+
* It allows the erode filter to operate in a tiled fashion for tiles that do not start on the
|
|
474
|
+
* top edge of the source image.
|
|
475
|
+
* @param kernel A pointer to a array of filter values of dimension kernel_height x kernel_width.
|
|
476
|
+
* @param kernel_height The height of the rectangular kernel. Must be an odd number.
|
|
477
|
+
* @param kernel_width The width of the rectangular kernel. Must be an odd number.
|
|
478
|
+
* @param flags The following flags values are allowed:
|
|
479
|
+
* <pre> @textblock
|
|
480
|
+
* kvImageNoFlags Default operation
|
|
481
|
+
*
|
|
482
|
+
* kvImageDoNotTile Turn off internal multithreading. Useful if, for example, you are doing your own
|
|
483
|
+
* multithreading and just want the filter to run local to the current thread.
|
|
484
|
+
*
|
|
485
|
+
* kvImageGetTempBufferSize Return 0. Do no work.
|
|
486
|
+
* @/textblock </pre>
|
|
487
|
+
* @return The following error codes may result:
|
|
488
|
+
* <pre> @textblock
|
|
489
|
+
* kvImageNoError Success.
|
|
490
|
+
* 0 If kvImageGetTempBufferSize was among the flags, then no work was done.
|
|
491
|
+
*
|
|
492
|
+
* kvImageRoiLargerThanInputBuffer dest->width and dest->height must be less than or equal to the corresponding
|
|
493
|
+
* dimensions in the src image
|
|
494
|
+
*
|
|
495
|
+
* kvImageInvalidKernelSize The kernel_height and kernel_width must not be evenly divisible by 2.
|
|
496
|
+
* @/textblock </pre>
|
|
497
|
+
*/
|
|
498
|
+
VIMAGE_PF vImage_Error vImageErode_PlanarF( const vImage_Buffer *src, const vImage_Buffer *dest, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const float *kernel, vImagePixelCount kernel_height, vImagePixelCount kernel_width, vImage_Flags flags ) VIMAGE_NON_NULL(1,2,5) API_AVAILABLE(macos(10.3), ios(5.0), watchos(1.0), tvos(5.0));
|
|
499
|
+
|
|
500
|
+
|
|
501
|
+
/*!
|
|
502
|
+
* @function vImageErode_ARGB8888
|
|
503
|
+
* @abstract Apply a erode filter to a ARGB8888 image
|
|
504
|
+
* @discussion This is a general purpose erode filter for ARGB8888 data. If your filter is all 0's, you should use vImageMin_ARGB8888
|
|
505
|
+
* instead.
|
|
506
|
+
*
|
|
507
|
+
* <pre> @textblock
|
|
508
|
+
* for each pixel result[i][j] in the image{
|
|
509
|
+
* int a = 255;
|
|
510
|
+
* int r = 255;
|
|
511
|
+
* int g = 255;
|
|
512
|
+
* int b = 255;
|
|
513
|
+
* for( y = 0; y < kernel_height; y++ ){
|
|
514
|
+
* for( x = 0; x < kernel_width; x++ ){
|
|
515
|
+
* a = MIN( a, src[i+y-kernel_height/2][j+x-kernel_width/2][0] - k[y*kernel_width+x] )
|
|
516
|
+
* r = MIN( r, src[i+y-kernel_height/2][j+x-kernel_width/2][1] - k[y*kernel_width+x] )
|
|
517
|
+
* g = MIN( g, src[i+y-kernel_height/2][j+x-kernel_width/2][2] - k[y*kernel_width+x] )
|
|
518
|
+
* b = MIN( b, src[i+y-kernel_height/2][j+x-kernel_width/2][3] - k[y*kernel_width+x] )
|
|
519
|
+
* }
|
|
520
|
+
* }
|
|
521
|
+
*
|
|
522
|
+
* // normalize for kernel center not 0
|
|
523
|
+
* a += k[y * (kernel_height/2) * kernel_width + kernel_width/2 ];
|
|
524
|
+
* r += k[y * (kernel_height/2) * kernel_width + kernel_width/2 ];
|
|
525
|
+
* g += k[y * (kernel_height/2) * kernel_width + kernel_width/2 ];
|
|
526
|
+
* b += k[y * (kernel_height/2) * kernel_width + kernel_width/2 ];
|
|
527
|
+
*
|
|
528
|
+
* // saturate overflow to representable range
|
|
529
|
+
* result[i][j][0] = (flags & kvImageLeaveAlphaUnchanged) ? src[i][j] : CLIP( a );
|
|
530
|
+
* result[i][j][1] = CLIP( r );
|
|
531
|
+
* result[i][j][2] = CLIP( g );
|
|
532
|
+
* result[i][j][3] = CLIP( b );
|
|
533
|
+
* }
|
|
534
|
+
* @/textblock </pre>
|
|
535
|
+
*
|
|
536
|
+
* If only part of the erode filter of the entire image is desired, use srcOffsetToROI_X/Y to set the positioning
|
|
537
|
+
* of the result tile relative to the src image.
|
|
538
|
+
*
|
|
539
|
+
* Does not work in place. If kvImageLeaveAlphaUnchanged is not used, it works for any channel order.
|
|
540
|
+
* If kvImageLeaveAlphaUnchanged is used, then the alpha must be first.
|
|
541
|
+
*
|
|
542
|
+
* @param src The input image
|
|
543
|
+
* @param dest A preallocated buffer to contain the result image
|
|
544
|
+
* @param srcOffsetToROI_X An offset added to the horizontal position in the src image when calculating the erode filter.
|
|
545
|
+
* It allows the erode filter to operate in a tiled fashion for tiles that do not start on the
|
|
546
|
+
* left edge of the source image.
|
|
547
|
+
* @param srcOffsetToROI_Y An offset added to the vertical position in the src image when calculating the erode filter.
|
|
548
|
+
* It allows the erode filter to operate in a tiled fashion for tiles that do not start on the
|
|
549
|
+
* top edge of the source image.
|
|
550
|
+
* @param kernel A pointer to a array of filter values of dimension kernel_height x kernel_width.
|
|
551
|
+
* @param kernel_height The height of the rectangular kernel. Must be an odd number.
|
|
552
|
+
* @param kernel_width The width of the rectangular kernel. Must be an odd number.
|
|
553
|
+
* @param flags The following flags values are allowed:
|
|
554
|
+
* <pre> @textblock
|
|
555
|
+
* kvImageNoFlags Default operation
|
|
556
|
+
*
|
|
557
|
+
* kvImageDoNotTile Turn off internal multithreading. Useful if, for example, you are doing your own
|
|
558
|
+
* multithreading and just want the filter to run local to the current thread.
|
|
559
|
+
*
|
|
560
|
+
* kvImageGetTempBufferSize Return 0. Do no work.
|
|
561
|
+
*
|
|
562
|
+
* kvImageLeaveAlphaUnchanged The alpha channel (first byte of pixel in memory) is copied to the destination
|
|
563
|
+
* without modification, instead of having a erode filter applied to it.
|
|
564
|
+
* @/textblock </pre>
|
|
565
|
+
* @return The following error codes may result:
|
|
566
|
+
* <pre> @textblock
|
|
567
|
+
* kvImageNoError Success.
|
|
568
|
+
* 0 If kvImageGetTempBufferSize was among the flags, then no work was done.
|
|
569
|
+
*
|
|
570
|
+
* kvImageRoiLargerThanInputBuffer dest->width and dest->height must be less than or equal to the corresponding
|
|
571
|
+
* dimensions in the src image
|
|
572
|
+
*
|
|
573
|
+
* kvImageInvalidKernelSize The kernel_height and kernel_width must not be evenly divisible by 2.
|
|
574
|
+
* @/textblock </pre>
|
|
575
|
+
*/
|
|
576
|
+
VIMAGE_PF vImage_Error vImageErode_ARGB8888( const vImage_Buffer *src, const vImage_Buffer *dest, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const unsigned char *kernel, vImagePixelCount kernel_height, vImagePixelCount kernel_width, vImage_Flags flags ) VIMAGE_NON_NULL(1,2,5) API_AVAILABLE(macos(10.3), ios(5.0), watchos(1.0), tvos(5.0));
|
|
577
|
+
|
|
578
|
+
|
|
579
|
+
/*!
|
|
580
|
+
* @function vImageErode_ARGBFFFF
|
|
581
|
+
* @abstract Apply a erode filter to a ARGBFFFF image
|
|
582
|
+
* @discussion This is a general purpose erode filter for ARGBFFFF data. If your filter is all 0's, you should use vImageMin_ARGBFFFF
|
|
583
|
+
* instead.
|
|
584
|
+
*
|
|
585
|
+
* <pre> @textblock
|
|
586
|
+
* for each pixel result[i][j] in the image{
|
|
587
|
+
* float a = INFINITY;
|
|
588
|
+
* float r = INFINITY;
|
|
589
|
+
* float g = INFINITY;
|
|
590
|
+
* float b = INFINITY;
|
|
591
|
+
* for( y = 0; y < kernel_height; y++ ){
|
|
592
|
+
* for( x = 0; x < kernel_width; x++ ){
|
|
593
|
+
* a = MIN( a, src[i+y-kernel_height/2][j+x-kernel_width/2][0] - k[y*kernel_width+x] )
|
|
594
|
+
* r = MIN( r, src[i+y-kernel_height/2][j+x-kernel_width/2][1] - k[y*kernel_width+x] )
|
|
595
|
+
* g = MIN( g, src[i+y-kernel_height/2][j+x-kernel_width/2][2] - k[y*kernel_width+x] )
|
|
596
|
+
* b = MIN( b, src[i+y-kernel_height/2][j+x-kernel_width/2][3] - k[y*kernel_width+x] )
|
|
597
|
+
* }
|
|
598
|
+
* }
|
|
599
|
+
*
|
|
600
|
+
* // normalize for kernel center not 0
|
|
601
|
+
* a += k[y * (kernel_height/2) * kernel_width + kernel_width/2 ];
|
|
602
|
+
* r += k[y * (kernel_height/2) * kernel_width + kernel_width/2 ];
|
|
603
|
+
* g += k[y * (kernel_height/2) * kernel_width + kernel_width/2 ];
|
|
604
|
+
* b += k[y * (kernel_height/2) * kernel_width + kernel_width/2 ];
|
|
605
|
+
*
|
|
606
|
+
* // saturate overflow to representable range
|
|
607
|
+
* result[i][j][0] = (flags & kvImageLeaveAlphaUnchanged) ? src[i][j] : a;
|
|
608
|
+
* result[i][j][1] = r;
|
|
609
|
+
* result[i][j][2] = g;
|
|
610
|
+
* result[i][j][3] = b;
|
|
611
|
+
* }
|
|
612
|
+
* @/textblock </pre>
|
|
613
|
+
*
|
|
614
|
+
* If only part of the erode filter of the entire image is desired, use srcOffsetToROI_X/Y to set the positioning
|
|
615
|
+
* of the result tile relative to the src image.
|
|
616
|
+
*
|
|
617
|
+
* Does not work in place. If kvImageLeaveAlphaUnchanged is not used, it works for any channel order.
|
|
618
|
+
* If kvImageLeaveAlphaUnchanged is used, then the alpha must be first. Floating-point values have host
|
|
619
|
+
* endianness.
|
|
620
|
+
*
|
|
621
|
+
* @param src The input image
|
|
622
|
+
* @param dest A preallocated buffer to contain the result image
|
|
623
|
+
* @param srcOffsetToROI_X An offset added to the horizontal position in the src image when calculating the erode filter.
|
|
624
|
+
* It allows the erode filter to operate in a tiled fashion for tiles that do not start on the
|
|
625
|
+
* left edge of the source image.
|
|
626
|
+
* @param srcOffsetToROI_Y An offset added to the vertical position in the src image when calculating the erode filter.
|
|
627
|
+
* It allows the erode filter to operate in a tiled fashion for tiles that do not start on the
|
|
628
|
+
* top edge of the source image.
|
|
629
|
+
* @param kernel A pointer to a array of filter values of dimension kernel_height x kernel_width.
|
|
630
|
+
* @param kernel_height The height of the rectangular kernel. Must be an odd number.
|
|
631
|
+
* @param kernel_width The width of the rectangular kernel. Must be an odd number.
|
|
632
|
+
* @param flags The following flags values are allowed:
|
|
633
|
+
* <pre> @textblock
|
|
634
|
+
* kvImageNoFlags Default operation
|
|
635
|
+
*
|
|
636
|
+
* kvImageDoNotTile Turn off internal multithreading. Useful if, for example, you are doing your own
|
|
637
|
+
* multithreading and just want the filter to run local to the current thread.
|
|
638
|
+
*
|
|
639
|
+
* kvImageGetTempBufferSize Return 0. Do no work.
|
|
640
|
+
*
|
|
641
|
+
* kvImageLeaveAlphaUnchanged The alpha channel (first float in pixel in memory) is copied to the destination
|
|
642
|
+
* without modification, instead of having a erode filter applied to it.
|
|
643
|
+
* @/textblock </pre>
|
|
644
|
+
* @return The following error codes may result:
|
|
645
|
+
* <pre> @textblock
|
|
646
|
+
* kvImageNoError Success.
|
|
647
|
+
* 0 If kvImageGetTempBufferSize was among the flags, then no work was done.
|
|
648
|
+
*
|
|
649
|
+
* kvImageRoiLargerThanInputBuffer dest->width and dest->height must be less than or equal to the corresponding
|
|
650
|
+
* dimensions in the src image
|
|
651
|
+
*
|
|
652
|
+
* kvImageInvalidKernelSize The kernel_height and kernel_width must not be evenly divisible by 2.
|
|
653
|
+
* @/textblock </pre>
|
|
654
|
+
*/
|
|
655
|
+
VIMAGE_PF vImage_Error vImageErode_ARGBFFFF( const vImage_Buffer *src, const vImage_Buffer *dest, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const float *kernel, vImagePixelCount kernel_height, vImagePixelCount kernel_width, vImage_Flags flags ) VIMAGE_NON_NULL(1,2,5) API_AVAILABLE(macos(10.3), ios(5.0), watchos(1.0), tvos(5.0));
|
|
656
|
+
|
|
657
|
+
|
|
658
|
+
/*!
|
|
659
|
+
* @functiongroup Max
|
|
660
|
+
* @discussion A max filter is a special case of a dilate filter, in which the filter elements are all 0.
|
|
661
|
+
* This allows a much, much faster algorithm to be used.
|
|
662
|
+
*/
|
|
663
|
+
|
|
664
|
+
/*!
|
|
665
|
+
* @function vImageMax_Planar8
|
|
666
|
+
* @abstract Apply a max filter to a Planar8 image.
|
|
667
|
+
* @discussion A max filter is a special case dilate filter, in which the filter elements are all 0. It is much faster than the normal dilate.
|
|
668
|
+
* <pre> @textblock
|
|
669
|
+
* for each pixel result[i][j] in the image{
|
|
670
|
+
* int r = 0;
|
|
671
|
+
* for( y = 0; y < kernel_height; y++ ){
|
|
672
|
+
* for( x = 0; x < kernel_width; x++ ){
|
|
673
|
+
* r = MAX( r, src[i+y-kernel_height/2][j+x-kernel_width/2] )
|
|
674
|
+
* }
|
|
675
|
+
* }
|
|
676
|
+
*
|
|
677
|
+
* // saturate overflow to representable range
|
|
678
|
+
* result[i][j] = r;
|
|
679
|
+
* }
|
|
680
|
+
* @/textblock </pre>
|
|
681
|
+
* If only part of the max filter of the entire image is desired, use srcOffsetToROI_X/Y to set the positioning
|
|
682
|
+
* of the result tile relative to the src image.
|
|
683
|
+
*
|
|
684
|
+
* Does not work in place, unless the kvImageDoNotTile flag is used.
|
|
685
|
+
*
|
|
686
|
+
* @param src The input image
|
|
687
|
+
* @param dest A preallocated buffer to contain the result image
|
|
688
|
+
* @param tempBuffer May be NULL. An optional temp buffer in which to store temporary computation. To find the size
|
|
689
|
+
* of the temp buffer, call the function with the desired parameters and pass the kvImageGetTempBufferSize
|
|
690
|
+
* flag. The size of the temp buffer will be returned from the left hand side of the function in
|
|
691
|
+
* place of an error code, and no work will be done on the image data. A temp buffer can provide a speed
|
|
692
|
+
* improvement, if it can be allocated once and reused. This saves a bunch of VM faults on first use of
|
|
693
|
+
* the newly allocated temp buffer.
|
|
694
|
+
* @param srcOffsetToROI_X An offset added to the horizontal position in the src image when calculating the max filter.
|
|
695
|
+
* It allows the max filter to operate in a tiled fashion for tiles that do not start on the
|
|
696
|
+
* left edge of the source image.
|
|
697
|
+
* @param srcOffsetToROI_Y An offset added to the vertical position in the src image when calculating the max filter.
|
|
698
|
+
* It allows the max filter to operate in a tiled fashion for tiles that do not start on the
|
|
699
|
+
* top edge of the source image.
|
|
700
|
+
* @param kernel_height The height of the rectangular kernel. Must be an odd number.
|
|
701
|
+
* @param kernel_width The width of the rectangular kernel. Must be an odd number.
|
|
702
|
+
* @param flags The following flags values are allowed:
|
|
703
|
+
* <pre> @textblock
|
|
704
|
+
* kvImageNoFlags Default operation
|
|
705
|
+
*
|
|
706
|
+
* kvImageDoNotTile Turn off internal multithreading. Useful if, for example, you are doing your own
|
|
707
|
+
* multithreading and just want the filter to run local to the current thread. It also
|
|
708
|
+
* allows the function to work in place, though more slowly.
|
|
709
|
+
*
|
|
710
|
+
* kvImageGetTempBufferSize Return 0. Do no work.
|
|
711
|
+
* @/textblock </pre>
|
|
712
|
+
* @return The following error codes may result:
|
|
713
|
+
* <pre> @textblock
|
|
714
|
+
* kvImageNoError Success.
|
|
715
|
+
* >=0 If kvImageGetTempBufferSize was among the flags, then no work was done.
|
|
716
|
+
* Instead, the size of the temp buffer needed is returned.
|
|
717
|
+
*
|
|
718
|
+
* kvImageRoiLargerThanInputBuffer dest->width and dest->height must be less than or equal to the corresponding
|
|
719
|
+
* dimensions in the src image
|
|
720
|
+
*
|
|
721
|
+
* kvImageInvalidKernelSize The kernel_height and kernel_width must not be evenly divisible by 2.
|
|
722
|
+
* @/textblock </pre>
|
|
723
|
+
*/
|
|
724
|
+
VIMAGE_PF vImage_Error vImageMax_Planar8( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, vImagePixelCount kernel_height, vImagePixelCount kernel_width, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.3), ios(5.0), watchos(1.0), tvos(5.0));
|
|
725
|
+
|
|
726
|
+
/*!
|
|
727
|
+
* @function vImageMax_PlanarF
|
|
728
|
+
* @abstract Apply a max filter to a PlanarF image.
|
|
729
|
+
* @discussion A max filter is a special case dilate filter, in which the filter elements are all 0. It is much faster than the normal dilate.
|
|
730
|
+
* <pre> @textblock
|
|
731
|
+
* for each pixel result[i][j] in the image{
|
|
732
|
+
* float r = -INFINITY;
|
|
733
|
+
* for( y = 0; y < kernel_height; y++ ){
|
|
734
|
+
* for( x = 0; x < kernel_width; x++ ){
|
|
735
|
+
* r = MAX( r, src[i+y-kernel_height/2][j+x-kernel_width/2] )
|
|
736
|
+
* }
|
|
737
|
+
* }
|
|
738
|
+
*
|
|
739
|
+
* // saturate overflow to representable range
|
|
740
|
+
* result[i][j] = r;
|
|
741
|
+
* }
|
|
742
|
+
* @/textblock </pre>
|
|
743
|
+
* If only part of the max filter of the entire image is desired, use srcOffsetToROI_X/Y to set the positioning
|
|
744
|
+
* of the result tile relative to the src image.
|
|
745
|
+
*
|
|
746
|
+
* Does not work in place, unless the kvImageDoNotTile flag is used.
|
|
747
|
+
*
|
|
748
|
+
* @param src The input image
|
|
749
|
+
* @param dest A preallocated buffer to contain the result image
|
|
750
|
+
* @param tempBuffer May be NULL. An optional temp buffer in which to store temporary computation. To find the size
|
|
751
|
+
* of the temp buffer, call the function with the desired parameters and pass the kvImageGetTempBufferSize
|
|
752
|
+
* flag. The size of the temp buffer will be returned from the left hand side of the function in
|
|
753
|
+
* place of an error code, and no work will be done on the image data. A temp buffer can provide a speed
|
|
754
|
+
* improvement, if it can be allocated once and reused. This saves a bunch of VM faults on first use of
|
|
755
|
+
* the newly allocated temp buffer.
|
|
756
|
+
* @param srcOffsetToROI_X An offset added to the horizontal position in the src image when calculating the max filter.
|
|
757
|
+
* It allows the max filter to operate in a tiled fashion for tiles that do not start on the
|
|
758
|
+
* left edge of the source image.
|
|
759
|
+
* @param srcOffsetToROI_Y An offset added to the vertical position in the src image when calculating the max filter.
|
|
760
|
+
* It allows the max filter to operate in a tiled fashion for tiles that do not start on the
|
|
761
|
+
* top edge of the source image.
|
|
762
|
+
* @param kernel_height The height of the rectangular kernel. Must be an odd number.
|
|
763
|
+
* @param kernel_width The width of the rectangular kernel. Must be an odd number.
|
|
764
|
+
* @param flags The following flags values are allowed:
|
|
765
|
+
* <pre> @textblock
|
|
766
|
+
* kvImageNoFlags Default operation
|
|
767
|
+
*
|
|
768
|
+
* kvImageDoNotTile Turn off internal multithreading. Useful if, for example, you are doing your own
|
|
769
|
+
* multithreading and just want the filter to run local to the current thread. It also
|
|
770
|
+
* allows the function to work in place, though more slowly.
|
|
771
|
+
*
|
|
772
|
+
* kvImageGetTempBufferSize Return the size of the temp buffer needed. Do no work.
|
|
773
|
+
* @/textblock </pre>
|
|
774
|
+
* @return The following error codes may result:
|
|
775
|
+
* <pre> @textblock
|
|
776
|
+
* kvImageNoError Success.
|
|
777
|
+
* >=0 If kvImageGetTempBufferSize was among the flags, then no work was done.
|
|
778
|
+
* Instead, the size of the temp buffer needed is returned.
|
|
779
|
+
*
|
|
780
|
+
* kvImageRoiLargerThanInputBuffer dest->width and dest->height must be less than or equal to the corresponding
|
|
781
|
+
* dimensions in the src image
|
|
782
|
+
*
|
|
783
|
+
* kvImageInvalidKernelSize The kernel_height and kernel_width must not be evenly divisible by 2.
|
|
784
|
+
* @/textblock </pre>
|
|
785
|
+
*/
|
|
786
|
+
VIMAGE_PF vImage_Error vImageMax_PlanarF( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, vImagePixelCount kernel_height, vImagePixelCount kernel_width, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.3), ios(5.0), watchos(1.0), tvos(5.0));
|
|
787
|
+
|
|
788
|
+
/*!
|
|
789
|
+
* @function vImageMax_ARGB8888
|
|
790
|
+
* @abstract Apply a max filter to a ARGB8888 image
|
|
791
|
+
* @discussion This is a special purpose dilate filter for ARGB8888 data, for rectangular kernels with value 0. It is much faster than the normal dilate.
|
|
792
|
+
*
|
|
793
|
+
* <pre> @textblock
|
|
794
|
+
* for each pixel result[i][j] in the image{
|
|
795
|
+
* int a = 0;
|
|
796
|
+
* int r = 0;
|
|
797
|
+
* int g = 0;
|
|
798
|
+
* int b = 0;
|
|
799
|
+
* for( y = 0; y < kernel_height; y++ ){
|
|
800
|
+
* for( x = 0; x < kernel_width; x++ ){
|
|
801
|
+
* a = MAX( a, src[i+y-kernel_height/2][j+x-kernel_width/2][0] )
|
|
802
|
+
* r = MAX( r, src[i+y-kernel_height/2][j+x-kernel_width/2][1] )
|
|
803
|
+
* g = MAX( g, src[i+y-kernel_height/2][j+x-kernel_width/2][2] )
|
|
804
|
+
* b = MAX( b, src[i+y-kernel_height/2][j+x-kernel_width/2][3] )
|
|
805
|
+
* }
|
|
806
|
+
* }
|
|
807
|
+
*
|
|
808
|
+
* // saturate overflow to representable range
|
|
809
|
+
* result[i][j][0] = (flags & kvImageLeaveAlphaUnchanged) ? src[i][j] : a;
|
|
810
|
+
* result[i][j][1] = r;
|
|
811
|
+
* result[i][j][2] = g;
|
|
812
|
+
* result[i][j][3] = b;
|
|
813
|
+
* }
|
|
814
|
+
* @/textblock </pre>
|
|
815
|
+
*
|
|
816
|
+
* If only part of the max filter of the entire image is desired, use srcOffsetToROI_X/Y to set the positioning
|
|
817
|
+
* of the result tile relative to the src image.
|
|
818
|
+
*
|
|
819
|
+
* If kvImageLeaveAlphaUnchanged is not used, it works for any channel order.
|
|
820
|
+
* If kvImageLeaveAlphaUnchanged is used, then the alpha must be first.
|
|
821
|
+
* Does not work in place, unless the kvImageDoNotTile flag is used, in which case it will probably
|
|
822
|
+
* run more slowly.
|
|
823
|
+
*
|
|
824
|
+
* @param src The input image
|
|
825
|
+
* @param dest A preallocated buffer to contain the result image
|
|
826
|
+
* @param tempBuffer May be NULL. An optional temp buffer in which to store temporary computation. To find the size
|
|
827
|
+
* of the temp buffer, call the function with the desired parameters and pass the kvImageGetTempBufferSize
|
|
828
|
+
* flag. The size of the temp buffer will be returned from the left hand side of the function in
|
|
829
|
+
* place of an error code, and no work will be done on the image data. A temp buffer can provide a speed
|
|
830
|
+
* improvement, if it can be allocated once and reused. This saves a bunch of VM faults on first use of
|
|
831
|
+
* the newly allocated temp buffer.
|
|
832
|
+
* @param srcOffsetToROI_X An offset added to the horizontal position in the src image when calculating the max filter.
|
|
833
|
+
* It allows the max filter to operate in a tiled fashion for tiles that do not start on the
|
|
834
|
+
* left edge of the source image.
|
|
835
|
+
* @param srcOffsetToROI_Y An offset added to the vertical position in the src image when calculating the max filter.
|
|
836
|
+
* It allows the max filter to operate in a tiled fashion for tiles that do not start on the
|
|
837
|
+
* top edge of the source image.
|
|
838
|
+
* @param kernel_height The height of the rectangular kernel. Must be an odd number.
|
|
839
|
+
* @param kernel_width The width of the rectangular kernel. Must be an odd number.
|
|
840
|
+
* @param flags The following flags values are allowed:
|
|
841
|
+
* <pre> @textblock
|
|
842
|
+
* kvImageNoFlags Default operation
|
|
843
|
+
*
|
|
844
|
+
* kvImageDoNotTile Turn off internal multithreading. Useful if, for example, you are doing your own
|
|
845
|
+
* multithreading and just want the filter to run local to the current thread.
|
|
846
|
+
* kvImageDoNotTile will also allow the filter to run in place, though more slowly.
|
|
847
|
+
*
|
|
848
|
+
* kvImageGetTempBufferSize Return 0. Do no work.
|
|
849
|
+
*
|
|
850
|
+
* kvImageLeaveAlphaUnchanged The alpha channel (first byte of pixel in memory) is copied to the destination
|
|
851
|
+
* without modification, instead of having a max filter applied to it.
|
|
852
|
+
* @/textblock </pre>
|
|
853
|
+
* @return The following error codes may result:
|
|
854
|
+
* <pre> @textblock
|
|
855
|
+
* kvImageNoError Success.
|
|
856
|
+
* >=0 If kvImageGetTempBufferSize was among the flags, then no work was done.
|
|
857
|
+
* Instead, the size of the temp buffer needed is returned.
|
|
858
|
+
*
|
|
859
|
+
* kvImageRoiLargerThanInputBuffer dest->width and dest->height must be less than or equal to the corresponding
|
|
860
|
+
* dimensions in the src image
|
|
861
|
+
*
|
|
862
|
+
* kvImageInvalidKernelSize The kernel_height and kernel_width must not be evenly divisible by 2.
|
|
863
|
+
* @/textblock </pre>
|
|
864
|
+
*/
|
|
865
|
+
VIMAGE_PF vImage_Error vImageMax_ARGB8888( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, vImagePixelCount kernel_height, vImagePixelCount kernel_width, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.3), ios(5.0), watchos(1.0), tvos(5.0));
|
|
866
|
+
|
|
867
|
+
|
|
868
|
+
/*!
|
|
869
|
+
* @function vImageMax_ARGBFFFF
|
|
870
|
+
* @abstract Apply a max filter to a ARGBFFFF image
|
|
871
|
+
* @discussion This is a special purpose dilate filter for ARGBFFFF data, for rectangular kernels with value 0. It is much faster than the normal dilate.
|
|
872
|
+
*
|
|
873
|
+
* <pre> @textblock
|
|
874
|
+
* for each pixel result[i][j] in the image{
|
|
875
|
+
* float a = -INFINITY;
|
|
876
|
+
* float r = -INFINITY;
|
|
877
|
+
* float g = -INFINITY;
|
|
878
|
+
* float b = -INFINITY;
|
|
879
|
+
* for( y = 0; y < kernel_height; y++ ){
|
|
880
|
+
* for( x = 0; x < kernel_width; x++ ){
|
|
881
|
+
* a = MAX( a, src[i+y-kernel_height/2][j+x-kernel_width/2][0] )
|
|
882
|
+
* r = MAX( r, src[i+y-kernel_height/2][j+x-kernel_width/2][1] )
|
|
883
|
+
* g = MAX( g, src[i+y-kernel_height/2][j+x-kernel_width/2][2] )
|
|
884
|
+
* b = MAX( b, src[i+y-kernel_height/2][j+x-kernel_width/2][3] )
|
|
885
|
+
* }
|
|
886
|
+
* }
|
|
887
|
+
*
|
|
888
|
+
* // saturate overflow to representable range
|
|
889
|
+
* result[i][j][0] = (flags & kvImageLeaveAlphaUnchanged) ? src[i][j] : a;
|
|
890
|
+
* result[i][j][1] = r;
|
|
891
|
+
* result[i][j][2] = g;
|
|
892
|
+
* result[i][j][3] = b;
|
|
893
|
+
* }
|
|
894
|
+
* @/textblock </pre>
|
|
895
|
+
*
|
|
896
|
+
* If only part of the max filter of the entire image is desired, use srcOffsetToROI_X/Y to set the positioning
|
|
897
|
+
* of the result tile relative to the src image.
|
|
898
|
+
*
|
|
899
|
+
* If kvImageLeaveAlphaUnchanged is not used, it works for any channel order.
|
|
900
|
+
* If kvImageLeaveAlphaUnchanged is used, then the alpha must be first.
|
|
901
|
+
* Does not work in place, unless the kvImageDoNotTile flag is used, in which case it will probably
|
|
902
|
+
* run more slowly.
|
|
903
|
+
*
|
|
904
|
+
* @param src The input image
|
|
905
|
+
* @param dest A preallocated buffer to contain the result image
|
|
906
|
+
* @param tempBuffer May be NULL. An optional temp buffer in which to store temporary computation. To find the size
|
|
907
|
+
* of the temp buffer, call the function with the desired parameters and pass the kvImageGetTempBufferSize
|
|
908
|
+
* flag. The size of the temp buffer will be returned from the left hand side of the function in
|
|
909
|
+
* place of an error code, and no work will be done on the image data. A temp buffer can provide a speed
|
|
910
|
+
* improvement, if it can be allocated once and reused. This saves a bunch of VM faults on first use of
|
|
911
|
+
* the newly allocated temp buffer.
|
|
912
|
+
* @param srcOffsetToROI_X An offset added to the horizontal position in the src image when calculating the max filter.
|
|
913
|
+
* It allows the max filter to operate in a tiled fashion for tiles that do not start on the
|
|
914
|
+
* left edge of the source image.
|
|
915
|
+
* @param srcOffsetToROI_Y An offset added to the vertical position in the src image when calculating the max filter.
|
|
916
|
+
* It allows the max filter to operate in a tiled fashion for tiles that do not start on the
|
|
917
|
+
* top edge of the source image.
|
|
918
|
+
* @param kernel_height The height of the rectangular kernel. Must be an odd number.
|
|
919
|
+
* @param kernel_width The width of the rectangular kernel. Must be an odd number.
|
|
920
|
+
* @param flags The following flags values are allowed:
|
|
921
|
+
* <pre> @textblock
|
|
922
|
+
* kvImageNoFlags Default operation
|
|
923
|
+
*
|
|
924
|
+
* kvImageDoNotTile Turn off internal multithreading. Useful if, for example, you are doing your own
|
|
925
|
+
* multithreading and just want the filter to run local to the current thread.
|
|
926
|
+
* kvImageDoNotTile will also allow the filter to run in place, though more slowly.
|
|
927
|
+
*
|
|
928
|
+
* kvImageGetTempBufferSize Return 0. Do no work.
|
|
929
|
+
*
|
|
930
|
+
* kvImageLeaveAlphaUnchanged The alpha channel (first byte of pixel in memory) is copied to the destination
|
|
931
|
+
* without modification, instead of having a max filter applied to it.
|
|
932
|
+
* @/textblock </pre>
|
|
933
|
+
* @return The following error codes may result:
|
|
934
|
+
* <pre> @textblock
|
|
935
|
+
* kvImageNoError Success.
|
|
936
|
+
* >=0 If kvImageGetTempBufferSize was among the flags, then no work was done.
|
|
937
|
+
* Instead, the size of the temp buffer needed is returned.
|
|
938
|
+
*
|
|
939
|
+
* kvImageRoiLargerThanInputBuffer dest->width and dest->height must be less than or equal to the corresponding
|
|
940
|
+
* dimensions in the src image
|
|
941
|
+
*
|
|
942
|
+
* kvImageInvalidKernelSize The kernel_height and kernel_width must not be evenly divisible by 2.
|
|
943
|
+
* @/textblock </pre>
|
|
944
|
+
*/
|
|
945
|
+
VIMAGE_PF vImage_Error vImageMax_ARGBFFFF( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, vImagePixelCount kernel_height, vImagePixelCount kernel_width, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.3), ios(5.0), watchos(1.0), tvos(5.0));
|
|
946
|
+
|
|
947
|
+
/*!
|
|
948
|
+
* @functiongroup Min
|
|
949
|
+
* @discussion A min filter is a special case of an erode filter, in which the filter elements are all 0.
|
|
950
|
+
* This allows a much, much faster algorithm to be used.
|
|
951
|
+
*/
|
|
952
|
+
|
|
953
|
+
/*!
|
|
954
|
+
* @function vImageMin_Planar8
|
|
955
|
+
* @abstract Apply a min filter to a Planar8 image.
|
|
956
|
+
* @discussion A min filter is a special case erode filter, in which the filter elements are all 0. It is much faster than the normal erode.
|
|
957
|
+
* <pre> @textblock
|
|
958
|
+
* for each pixel result[i][j] in the image{
|
|
959
|
+
* int r = MAX_CHANNEL_VALUE;
|
|
960
|
+
* for( y = 0; y < kernel_height; y++ ){
|
|
961
|
+
* for( x = 0; x < kernel_width; x++ ){
|
|
962
|
+
* r = MIN( r, src[i+y-kernel_height/2][j+x-kernel_width/2] )
|
|
963
|
+
* }
|
|
964
|
+
* }
|
|
965
|
+
*
|
|
966
|
+
* // saturate overflow to representable range
|
|
967
|
+
* result[i][j] = r;
|
|
968
|
+
* }
|
|
969
|
+
* @/textblock </pre>
|
|
970
|
+
* If only part of the min filter of the entire image is desired, use srcOffsetToROI_X/Y to set the positioning
|
|
971
|
+
* of the result tile relative to the src image.
|
|
972
|
+
*
|
|
973
|
+
* Does not work in place, unless the kvImageDoNotTile flag is used.
|
|
974
|
+
*
|
|
975
|
+
* @param src The input image
|
|
976
|
+
* @param dest A preallocated buffer to contain the result image
|
|
977
|
+
* @param tempBuffer May be NULL. An optional temp buffer in which to store temporary computation. To find the size
|
|
978
|
+
* of the temp buffer, call the function with the desired parameters and pass the kvImageGetTempBufferSize
|
|
979
|
+
* flag. The size of the temp buffer will be returned from the left hand side of the function in
|
|
980
|
+
* place of an error code, and no work will be done on the image data. A temp buffer can provide a speed
|
|
981
|
+
* improvement, if it can be allocated once and reused. This saves a bunch of VM faults on first use of
|
|
982
|
+
* the newly allocated temp buffer.
|
|
983
|
+
* @param srcOffsetToROI_X An offset added to the horizontal position in the src image when calculating the min filter.
|
|
984
|
+
* It allows the min filter to operate in a tiled fashion for tiles that do not start on the
|
|
985
|
+
* left edge of the source image.
|
|
986
|
+
* @param srcOffsetToROI_Y An offset added to the vertical position in the src image when calculating the min filter.
|
|
987
|
+
* It allows the min filter to operate in a tiled fashion for tiles that do not start on the
|
|
988
|
+
* top edge of the source image.
|
|
989
|
+
* @param kernel_height The height of the rectangular kernel. Must be an odd number.
|
|
990
|
+
* @param kernel_width The width of the rectangular kernel. Must be an odd number.
|
|
991
|
+
* @param flags The following flags values are allowed:
|
|
992
|
+
* <pre> @textblock
|
|
993
|
+
* kvImageNoFlags Default operation
|
|
994
|
+
*
|
|
995
|
+
* kvImageDoNotTile Turn off internal multithreading. Useful if, for example, you are doing your own
|
|
996
|
+
* multithreading and just want the filter to run local to the current thread. It also
|
|
997
|
+
* allows the function to work in place, though more slowly.
|
|
998
|
+
*
|
|
999
|
+
* kvImageGetTempBufferSize Return 0. Do no work.
|
|
1000
|
+
* @/textblock </pre>
|
|
1001
|
+
* @return The following error codes may result:
|
|
1002
|
+
* <pre> @textblock
|
|
1003
|
+
* kvImageNoError Success.
|
|
1004
|
+
* >=0 If kvImageGetTempBufferSize was among the flags, then no work was done.
|
|
1005
|
+
* Instead, the size of the temp buffer needed is returned.
|
|
1006
|
+
*
|
|
1007
|
+
* kvImageRoiLargerThanInputBuffer dest->width and dest->height must be less than or equal to the corresponding
|
|
1008
|
+
* dimensions in the src image
|
|
1009
|
+
*
|
|
1010
|
+
* kvImageInvalidKernelSize The kernel_height and kernel_width must not be evenly divisible by 2.
|
|
1011
|
+
* @/textblock </pre>
|
|
1012
|
+
*/
|
|
1013
|
+
VIMAGE_PF vImage_Error vImageMin_Planar8( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, vImagePixelCount kernel_height, vImagePixelCount kernel_width, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.3), ios(5.0), watchos(1.0), tvos(5.0));
|
|
1014
|
+
|
|
1015
|
+
/*!
|
|
1016
|
+
* @function vImageMin_PlanarF
|
|
1017
|
+
* @abstract Apply a min filter to a PlanarF image.
|
|
1018
|
+
* @discussion A min filter is a special case erode filter, in which the filter elements are all 0. It is much faster than the normal erode.
|
|
1019
|
+
* <pre> @textblock
|
|
1020
|
+
* for each pixel result[i][j] in the image{
|
|
1021
|
+
* float r = INFINITY;
|
|
1022
|
+
* for( y = 0; y < kernel_height; y++ ){
|
|
1023
|
+
* for( x = 0; x < kernel_width; x++ ){
|
|
1024
|
+
* r = MIN( r, src[i+y-kernel_height/2][j+x-kernel_width/2] )
|
|
1025
|
+
* }
|
|
1026
|
+
* }
|
|
1027
|
+
*
|
|
1028
|
+
* // saturate overflow to representable range
|
|
1029
|
+
* result[i][j] = r;
|
|
1030
|
+
* }
|
|
1031
|
+
* @/textblock </pre>
|
|
1032
|
+
* If only part of the min filter of the entire image is desired, use srcOffsetToROI_X/Y to set the positioning
|
|
1033
|
+
* of the result tile relative to the src image.
|
|
1034
|
+
*
|
|
1035
|
+
* Does not work in place, unless the kvImageDoNotTile flag is used.
|
|
1036
|
+
*
|
|
1037
|
+
* @param src The input image
|
|
1038
|
+
* @param dest A preallocated buffer to contain the result image
|
|
1039
|
+
* @param tempBuffer May be NULL. An optional temp buffer in which to store temporary computation. To find the size
|
|
1040
|
+
* of the temp buffer, call the function with the desired parameters and pass the kvImageGetTempBufferSize
|
|
1041
|
+
* flag. The size of the temp buffer will be returned from the left hand side of the function in
|
|
1042
|
+
* place of an error code, and no work will be done on the image data. A temp buffer can provide a speed
|
|
1043
|
+
* improvement, if it can be allocated once and reused. This saves a bunch of VM faults on first use of
|
|
1044
|
+
* the newly allocated temp buffer.
|
|
1045
|
+
* @param srcOffsetToROI_X An offset added to the horizontal position in the src image when calculating the min filter.
|
|
1046
|
+
* It allows the min filter to operate in a tiled fashion for tiles that do not start on the
|
|
1047
|
+
* left edge of the source image.
|
|
1048
|
+
* @param srcOffsetToROI_Y An offset added to the vertical position in the src image when calculating the min filter.
|
|
1049
|
+
* It allows the min filter to operate in a tiled fashion for tiles that do not start on the
|
|
1050
|
+
* top edge of the source image.
|
|
1051
|
+
* @param kernel_height The height of the rectangular kernel. Must be an odd number.
|
|
1052
|
+
* @param kernel_width The width of the rectangular kernel. Must be an odd number.
|
|
1053
|
+
* @param flags The following flags values are allowed:
|
|
1054
|
+
* <pre> @textblock
|
|
1055
|
+
* kvImageNoFlags Default operation
|
|
1056
|
+
*
|
|
1057
|
+
* kvImageDoNotTile Turn off internal multithreading. Useful if, for example, you are doing your own
|
|
1058
|
+
* multithreading and just want the filter to run local to the current thread. It also
|
|
1059
|
+
* allows the function to work in place, though more slowly.
|
|
1060
|
+
*
|
|
1061
|
+
* kvImageGetTempBufferSize Return 0. Do no work.
|
|
1062
|
+
* @/textblock </pre>
|
|
1063
|
+
* @return The following error codes may result:
|
|
1064
|
+
* <pre> @textblock
|
|
1065
|
+
* kvImageNoError Success.
|
|
1066
|
+
* >=0 If kvImageGetTempBufferSize was among the flags, then no work was done.
|
|
1067
|
+
* Instead, the size of the temp buffer needed is returned.
|
|
1068
|
+
*
|
|
1069
|
+
* kvImageRoiLargerThanInputBuffer dest->width and dest->height must be less than or equal to the corresponding
|
|
1070
|
+
* dimensions in the src image
|
|
1071
|
+
*
|
|
1072
|
+
* kvImageInvalidKernelSize The kernel_height and kernel_width must not be evenly divisible by 2.
|
|
1073
|
+
* @/textblock </pre>
|
|
1074
|
+
*/
|
|
1075
|
+
VIMAGE_PF vImage_Error vImageMin_PlanarF( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, vImagePixelCount kernel_height, vImagePixelCount kernel_width, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.3), ios(5.0), watchos(1.0), tvos(5.0));
|
|
1076
|
+
|
|
1077
|
+
/*!
|
|
1078
|
+
* @function vImageMin_ARGB8888
|
|
1079
|
+
* @abstract Apply a min filter to a ARGB8888 image
|
|
1080
|
+
* @discussion This is a special purpose erode filter for ARGB8888 data, for rectangular kernels with value 0. It is much faster than the normal erode.
|
|
1081
|
+
*
|
|
1082
|
+
* <pre> @textblock
|
|
1083
|
+
* for each pixel result[i][j] in the image{
|
|
1084
|
+
* int a = MAX_CHANNEL_VALUE;
|
|
1085
|
+
* int r = MAX_CHANNEL_VALUE;
|
|
1086
|
+
* int g = MAX_CHANNEL_VALUE;
|
|
1087
|
+
* int b = MAX_CHANNEL_VALUE;
|
|
1088
|
+
* for( y = 0; y < kernel_height; y++ ){
|
|
1089
|
+
* for( x = 0; x < kernel_width; x++ ){
|
|
1090
|
+
* a = MIN( a, src[i+y-kernel_height/2][j+x-kernel_width/2][0] )
|
|
1091
|
+
* r = MIN( r, src[i+y-kernel_height/2][j+x-kernel_width/2][1] )
|
|
1092
|
+
* g = MIN( g, src[i+y-kernel_height/2][j+x-kernel_width/2][2] )
|
|
1093
|
+
* b = MIN( b, src[i+y-kernel_height/2][j+x-kernel_width/2][3] )
|
|
1094
|
+
* }
|
|
1095
|
+
* }
|
|
1096
|
+
*
|
|
1097
|
+
* // saturate overflow to representable range
|
|
1098
|
+
* result[i][j][0] = (flags & kvImageLeaveAlphaUnchanged) ? src[i][j] : a;
|
|
1099
|
+
* result[i][j][1] = r;
|
|
1100
|
+
* result[i][j][2] = g;
|
|
1101
|
+
* result[i][j][3] = b;
|
|
1102
|
+
* }
|
|
1103
|
+
* @/textblock </pre>
|
|
1104
|
+
*
|
|
1105
|
+
* If only part of the min filter of the entire image is desired, use srcOffsetToROI_X/Y to set the positioning
|
|
1106
|
+
* of the result tile relative to the src image.
|
|
1107
|
+
*
|
|
1108
|
+
* If kvImageLeaveAlphaUnchanged is not used, it works for any channel order.
|
|
1109
|
+
* If kvImageLeaveAlphaUnchanged is used, then the alpha must be first.
|
|
1110
|
+
* Does not work in place, unless the kvImageDoNotTile flag is used, in which case it will probably
|
|
1111
|
+
* run more slowly.
|
|
1112
|
+
*
|
|
1113
|
+
* @param src The input image
|
|
1114
|
+
* @param dest A preallocated buffer to contain the result image
|
|
1115
|
+
* @param tempBuffer May be NULL. An optional temp buffer in which to store temporary computation. To find the size
|
|
1116
|
+
* of the temp buffer, call the function with the desired parameters and pass the kvImageGetTempBufferSize
|
|
1117
|
+
* flag. The size of the temp buffer will be returned from the left hand side of the function in
|
|
1118
|
+
* place of an error code, and no work will be done on the image data. A temp buffer can provide a speed
|
|
1119
|
+
* improvement, if it can be allocated once and reused. This saves a bunch of VM faults on first use of
|
|
1120
|
+
* the newly allocated temp buffer.
|
|
1121
|
+
* @param srcOffsetToROI_X An offset added to the horizontal position in the src image when calculating the min filter.
|
|
1122
|
+
* It allows the min filter to operate in a tiled fashion for tiles that do not start on the
|
|
1123
|
+
* left edge of the source image.
|
|
1124
|
+
* @param srcOffsetToROI_Y An offset added to the vertical position in the src image when calculating the min filter.
|
|
1125
|
+
* It allows the min filter to operate in a tiled fashion for tiles that do not start on the
|
|
1126
|
+
* top edge of the source image.
|
|
1127
|
+
* @param kernel_height The height of the rectangular kernel. Must be an odd number.
|
|
1128
|
+
* @param kernel_width The width of the rectangular kernel. Must be an odd number.
|
|
1129
|
+
* @param flags The following flags values are allowed:
|
|
1130
|
+
* <pre> @textblock
|
|
1131
|
+
* kvImageNoFlags Default operation
|
|
1132
|
+
*
|
|
1133
|
+
* kvImageDoNotTile Turn off internal multithreading. Useful if, for example, you are doing your own
|
|
1134
|
+
* multithreading and just want the filter to run local to the current thread.
|
|
1135
|
+
* kvImageDoNotTile will also allow the filter to run in place, though more slowly.
|
|
1136
|
+
*
|
|
1137
|
+
* kvImageGetTempBufferSize Return 0. Do no work.
|
|
1138
|
+
*
|
|
1139
|
+
* kvImageLeaveAlphaUnchanged The alpha channel (first byte of pixel in memory) is copied to the destination
|
|
1140
|
+
* without modification, instead of having a min filter applied to it.
|
|
1141
|
+
* @/textblock </pre>
|
|
1142
|
+
* @return The following error codes may result:
|
|
1143
|
+
* <pre> @textblock
|
|
1144
|
+
* kvImageNoError Success.
|
|
1145
|
+
* >=0 If kvImageGetTempBufferSize was among the flags, then no work was done.
|
|
1146
|
+
* Instead, the size of the temp buffer needed is returned.
|
|
1147
|
+
*
|
|
1148
|
+
* kvImageRoiLargerThanInputBuffer dest->width and dest->height must be less than or equal to the corresponding
|
|
1149
|
+
* dimensions in the src image
|
|
1150
|
+
*
|
|
1151
|
+
* kvImageInvalidKernelSize The kernel_height and kernel_width must not be evenly divisible by 2.
|
|
1152
|
+
* @/textblock </pre>
|
|
1153
|
+
*/
|
|
1154
|
+
VIMAGE_PF vImage_Error vImageMin_ARGB8888( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, vImagePixelCount kernel_height, vImagePixelCount kernel_width, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.3), ios(5.0), watchos(1.0), tvos(5.0));
|
|
1155
|
+
|
|
1156
|
+
|
|
1157
|
+
/*!
|
|
1158
|
+
* @function vImageMin_ARGBFFFF
|
|
1159
|
+
* @abstract Apply a min filter to a ARGBFFFF image
|
|
1160
|
+
* @discussion This is a special purpose erode filter for ARGBFFFF data, for rectangular kernels with value 0. It is much faster than the normal erode.
|
|
1161
|
+
*
|
|
1162
|
+
* <pre> @textblock
|
|
1163
|
+
* for each pixel result[i][j] in the image{
|
|
1164
|
+
* float a = INFINITY;
|
|
1165
|
+
* float r = INFINITY;
|
|
1166
|
+
* float g = INFINITY;
|
|
1167
|
+
* float b = INFINITY;
|
|
1168
|
+
* for( y = 0; y < kernel_height; y++ ){
|
|
1169
|
+
* for( x = 0; x < kernel_width; x++ ){
|
|
1170
|
+
* a = MIN( a, src[i+y-kernel_height/2][j+x-kernel_width/2][0] )
|
|
1171
|
+
* r = MIN( r, src[i+y-kernel_height/2][j+x-kernel_width/2][1] )
|
|
1172
|
+
* g = MIN( g, src[i+y-kernel_height/2][j+x-kernel_width/2][2] )
|
|
1173
|
+
* b = MIN( b, src[i+y-kernel_height/2][j+x-kernel_width/2][3] )
|
|
1174
|
+
* }
|
|
1175
|
+
* }
|
|
1176
|
+
*
|
|
1177
|
+
* // saturate overflow to representable range
|
|
1178
|
+
* result[i][j][0] = (flags & kvImageLeaveAlphaUnchanged) ? src[i][j] : a;
|
|
1179
|
+
* result[i][j][1] = r;
|
|
1180
|
+
* result[i][j][2] = g;
|
|
1181
|
+
* result[i][j][3] = b;
|
|
1182
|
+
* }
|
|
1183
|
+
* @/textblock </pre>
|
|
1184
|
+
*
|
|
1185
|
+
* If only part of the min filter of the entire image is desired, use srcOffsetToROI_X/Y to set the positioning
|
|
1186
|
+
* of the result tile relative to the src image.
|
|
1187
|
+
*
|
|
1188
|
+
* If kvImageLeaveAlphaUnchanged is not used, it works for any channel order.
|
|
1189
|
+
* If kvImageLeaveAlphaUnchanged is used, then the alpha must be first.
|
|
1190
|
+
* Does not work in place, unless the kvImageDoNotTile flag is used, in which case it will probably
|
|
1191
|
+
* run more slowly.
|
|
1192
|
+
*
|
|
1193
|
+
* @param src The input image
|
|
1194
|
+
* @param dest A preallocated buffer to contain the result image
|
|
1195
|
+
* @param tempBuffer May be NULL. An optional temp buffer in which to store temporary computation. To find the size
|
|
1196
|
+
* of the temp buffer, call the function with the desired parameters and pass the kvImageGetTempBufferSize
|
|
1197
|
+
* flag. The size of the temp buffer will be returned from the left hand side of the function in
|
|
1198
|
+
* place of an error code, and no work will be done on the image data. A temp buffer can provide a speed
|
|
1199
|
+
* improvement, if it can be allocated once and reused. This saves a bunch of VM faults on first use of
|
|
1200
|
+
* the newly allocated temp buffer.
|
|
1201
|
+
* @param srcOffsetToROI_X An offset added to the horizontal position in the src image when calculating the min filter.
|
|
1202
|
+
* It allows the min filter to operate in a tiled fashion for tiles that do not start on the
|
|
1203
|
+
* left edge of the source image.
|
|
1204
|
+
* @param srcOffsetToROI_Y An offset added to the vertical position in the src image when calculating the min filter.
|
|
1205
|
+
* It allows the min filter to operate in a tiled fashion for tiles that do not start on the
|
|
1206
|
+
* top edge of the source image.
|
|
1207
|
+
* @param kernel_height The height of the rectangular kernel. Must be an odd number.
|
|
1208
|
+
* @param kernel_width The width of the rectangular kernel. Must be an odd number.
|
|
1209
|
+
* @param flags The following flags values are allowed:
|
|
1210
|
+
* <pre> @textblock
|
|
1211
|
+
* kvImageNoFlags Default operation
|
|
1212
|
+
*
|
|
1213
|
+
* kvImageDoNotTile Turn off internal multithreading. Useful if, for example, you are doing your own
|
|
1214
|
+
* multithreading and just want the filter to run local to the current thread.
|
|
1215
|
+
* kvImageDoNotTile will also allow the filter to run in place, though more slowly.
|
|
1216
|
+
*
|
|
1217
|
+
* kvImageGetTempBufferSize Return 0. Do no work.
|
|
1218
|
+
*
|
|
1219
|
+
* kvImageLeaveAlphaUnchanged The alpha channel (first byte of pixel in memory) is copied to the destination
|
|
1220
|
+
* without modification, instead of having a min filter applied to it.
|
|
1221
|
+
* @/textblock </pre>
|
|
1222
|
+
* @return The following error codes may result:
|
|
1223
|
+
* <pre> @textblock
|
|
1224
|
+
* kvImageNoError Success.
|
|
1225
|
+
* >=0 If kvImageGetTempBufferSize was among the flags, then no work was done.
|
|
1226
|
+
* Instead, the size of the temp buffer needed is returned.
|
|
1227
|
+
*
|
|
1228
|
+
* kvImageRoiLargerThanInputBuffer dest->width and dest->height must be less than or equal to the corresponding
|
|
1229
|
+
* dimensions in the src image
|
|
1230
|
+
*
|
|
1231
|
+
* kvImageInvalidKernelSize The kernel_height and kernel_width must not be evenly divisible by 2.
|
|
1232
|
+
* @/textblock </pre>
|
|
1233
|
+
*/
|
|
1234
|
+
VIMAGE_PF vImage_Error vImageMin_ARGBFFFF( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, vImagePixelCount kernel_height, vImagePixelCount kernel_width, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.3), ios(5.0), watchos(1.0), tvos(5.0));
|
|
1235
|
+
|
|
1236
|
+
|
|
1237
|
+
#ifdef __cplusplus
|
|
1238
|
+
}
|
|
1239
|
+
#endif
|
|
1240
|
+
|
|
1241
|
+
#endif /* MORPHOLOGY_H */
|
|
1242
|
+
|
|
1243
|
+
|