Questions tagged [cikernel]

32 questions
8
votes
3 answers

Adaptive Threshold CIKernel/CIFilter iOS

I have researched all over in order to find a kernel that performs adaptive thresholding on iOS. Unfortunately I do not understand the kernel language or the logic behind it. Below, I have found a routine that performs thresholding…
mmackh
  • 3,550
  • 3
  • 35
  • 51
6
votes
1 answer

No "Metal Compiler" in target's Build Settings

I'm using Xcode 10.1. Even when using the search function in my target's Build Settings, I can't find a "Metal Compiler" or anything related Metal. Described here, there are Metal settings that can be set in Build Settings, but there's nothing I can…
Chewie The Chorkie
  • 4,896
  • 9
  • 46
  • 90
4
votes
3 answers

Metal: vertexFunction defined in .metal file becomes nil once setting Compiler and Linker Options for MSL cikernel

VertexFunction and FragmentFunction defined in .metal file worked nicely, but they became nil once I specified Compiler and Linker Options following Apple's doc: -fcikernel flag in the Other Metal Compiler Flags option, and -cikernel flat in…
4
votes
1 answer

iOS 12 CIKernel Filters CRASH

I am using Following CIColorKernel Code to generate customFilter. kernel vec4 customFilter(__sample image, __sample noise, float time, float inputNoise) { vec2 uv = destCoord() / 1280.0; float d = length(uv - vec2(0.5,0.5)); float blur =…
Abhishek Dave
  • 326
  • 1
  • 14
3
votes
1 answer

Custom Core Image filter color issue

I'm learning how to write custom Core Image filters, but have this problem where the rendered color is not the same as specified in kernel code when color value is between 0 - 1. (Color is correct when equal to 0 or 1.) This is my filter…
Zhe Dang
  • 45
  • 1
  • 4
3
votes
2 answers

How to use CoreImage to create a smooth threshold filter?

Are there existing filters that could be used as a smooth threshold? By this I mean that pixel values should be thresholded between two values, but the intermediate values are interpolated. Basically, I'm trying to implement…
joelg
  • 1,094
  • 9
  • 19
2
votes
1 answer

Custom Metal CIKernel return fixed color produces different color

I hava a custom CIKernel by Metal, I found a weird thing that shader return a fixed color, but screen display is different! I use break point to check produced CIImage object, is really different color. there is my code float4 test(sample_t s) { …
krosshj
  • 855
  • 2
  • 11
  • 25
2
votes
0 answers

Understanding output extend of convolution kernels when blending

I want to process an image with a custom Metal-based convolution CIKernel and blend the result with other images into one composition. But I’m observing strange clipping behavior during blending: To illustrate the point, I created a simple…
Frank Rupprecht
  • 9,191
  • 31
  • 56
2
votes
1 answer

Thresholding image works in Swift and Matlab but not Core Image kernel

tl;dr: When I threshold an image with a specific threshold in Swift, I get clean segmentation (and double checking it in Matlab perfectly matches), but when I do it in a Core Image kernel, it doesn't segment cleanly. Do I have a bug in my…
Cannoliopsida
  • 3,044
  • 5
  • 36
  • 61
2
votes
1 answer

Custom Filter of Core Image and "sig abrt" in Xcode 9.x

I'm writing a code. Here is my full source code. I confirmed that my code runs successfully in Xcode 8.3.3. However, my code crashed in Xcode 9.x (9.1 and 9.2). Exactly, my code crashed in "filter.setValue(inputCIImage, forKey: kCIInputImageKey)"…
MOV
  • 43
  • 5
2
votes
0 answers

Writing Custom CIFilter in iOS 11, Metal Linker

I'm trying to compile custom filters using MSL as discussed in this 2017 WWDC and in this part of the CIFilter Documentation. Without the MTLLINKER_FLAGS my program runs smoothly, but with the flags turned on (value set to -cifilter), my program's…
Chris Wood
  • 306
  • 3
  • 13
1
vote
1 answer

Unexpected behaviour with CIKernel

I made this example to show the problem. It takes 1 pixel from texture by hardcoded coordinate and use as result for each pixel in shader. I expect that all the image will be in the same color. When images are small it works perfectly, but when I…
Artem
  • 364
  • 2
  • 18
1
vote
1 answer

Are there any differences between Metal kernels on iOS and Mac?

Are there any major differences between the Metal Shader Language on iOS and Mac? I'm trying to port my Metal cifilters from iOS, and they seem to look completely different
David
  • 125
  • 2
  • 15
1
vote
1 answer

Core image filter with custom metal kernel doesn't work

I've made a custom CIFilter based on a custom kernel, I can't make it work the output image is filled with black and I can't understand why. Here is the shader: // MARK: Custom kernels float4 eight_bit(sampler image, sampler palette_image, float…
Andrea
  • 26,120
  • 10
  • 85
  • 131
1
vote
0 answers

Pinching image on edges as a custom CIWarpKernel does not produces results as expected

I have developed a custom CIWarpKernel which is the transposition of my Numbers model design as follows: The cell for positive y is: SIN($A2×PI()÷2)×(−COS(B$1×PI())×($A2+1)÷$W$3+SIN($A2 ×PI()÷2)) where $A2 is y, B$1 is x and $W$3 is the center…
Stéphane de Luca
  • 12,745
  • 9
  • 57
  • 95
1
2 3