Post

Replies

Boosts

Views

Activity

Reply to XCode 13 beta fails to load Metal CoreImage Kernel
It should work when you remove the -I $MTL_HEADER_SEARCH_PATHS part from your custom build rule. Though it is mentioned in the WWDC video, it actually causes problems when MTL_HEADER_SEARCH_PATHS is empty. See this answer to a related question. Usually, you don't need that parameter if you don't have a complicated file graph or external dependencies.
Aug ’21
Reply to Passing MTLTexture to Metal Core Image Kernel
You can simply initialize a CIImage with the texture and pass that to the kernel: let ciImage = CIImage(mtlTexture: texture) The documentation also mentions what you need to do to let Core Image render into a Metal texture. If you want to incorporate a Metal processing step into a Core Image pipeline instead, I recommend you check out CIImageProcessorKernel.
Topic: Graphics & Games SubTopic: Metal Tags:
Jan ’22
Reply to OpenEXR conversion
I recommend using Core Image to read, write, and modify EXR images. Core Image can already natively open PNG and EXR files and write PNG data and files. However, there is no convenient way for writing EXR data of files. That's why we wrote extensions for doing exactly that. You can find them over at Github.
Topic: Media Technologies SubTopic: General Tags:
Feb ’22
Reply to QR Code Generator (CIFilter) colours for light/dark mode ?
You can use the QR code as a mask and blend it with a solid color to effectively colorize it. So you can, for example, create a black and a white version and use the register(...) method of UIImage to "bundle" them both into one dynamic image: let qrCode = filter.outputImage!.transformed(by: transform) // Use the QR code as a mask for blending with a color. // Note that we need to invert the code for that, so the actual code becomes white // and the background becomes black, because white = let color through, black = transparent. let maskFilter = CIFilter.blendWithMask() maskFilter.maskImage = qrCode.applyingFilter("CIColorInvert") // create a version of the code with black foreground... maskFilter.inputImage = CIImage(color: .black) let blackCIImage = maskFilter.outputImage! // ... and one with white foreground maskFilter.inputImage = CIImage(color: .white) let whiteCIImage = maskFilter.outputImage! // render both images let blackImage = context.createCGImage(blackCIImage, from: blackCIImage.extent).map(UIImage.init)! let whiteImage = context.createCGImage(whiteCIImage, from: whiteCIImage.extent).map(UIImage.init)! // use black version for light mode qrImage = blackImage // assign the white version to be used in dark mode qrImage.imageAsset?.register(whiteImage, with: UITraitCollection(userInterfaceStyle: .dark)) return qrImage
Topic: Media Technologies SubTopic: General Tags:
Mar ’22
Reply to CISourceOverComposition unexpected behavior
I guess this is happening because CIPhotoEffectTonal also has an effect on the transparent parts of the image. If you want to limit the effect to the visible part, you can simply crop the image after the effect is applied and before you blend it over the background: video1FilteredImage = [video1FilteredImage imageByCroppingToRect:video1FilteredImage.extent]; By the way: instead of using CIConstantColorGenerator you can simply get a colored image like this: CIImage *colorBackgroundImage = [CIImage imageWithColor:inputColor];
Topic: Media Technologies SubTopic: General Tags:
May ’22
Reply to Compiling CI kernels at runtime
I'm sorry, I meant #include. I'm still getting fatal error: 'CoreImage/CoreImage.h' file not found when calling device.makeLibrary(source: ...).
Topic: Graphics & Games SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jun ’21
Reply to CIImageProcessorKernel output texture not allowed as render target on macOS
Also filed as FB9498614.
Topic: Graphics & Games SubTopic: General Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to CIRAWFilter is never not crashing
Hmm, interesting. I wonder if the filter is not designed to be re-used. Can you please try with rawFilter.previewImage instead of outputImage?
Topic: Media Technologies SubTopic: General Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to XCode 13 beta fails to load Metal CoreImage Kernel
It should work when you remove the -I $MTL_HEADER_SEARCH_PATHS part from your custom build rule. Though it is mentioned in the WWDC video, it actually causes problems when MTL_HEADER_SEARCH_PATHS is empty. See this answer to a related question. Usually, you don't need that parameter if you don't have a complicated file graph or external dependencies.
Replies
Boosts
Views
Activity
Aug ’21
Reply to Allow PHPicker access to original/unadjusted asset
This is also filed as FB9706029. Thanks for looking into it!
Replies
Boosts
Views
Activity
Oct ’21
Reply to Create AVSemanticSegmentationMatte from image data seems to leak memory
Does it still exist after you released the CIContext you used for rendering? The context usually caches some intermediate images and objects to speed up consecutive render calls.
Replies
Boosts
Views
Activity
Dec ’21
Reply to Passing MTLTexture to Metal Core Image Kernel
You can simply initialize a CIImage with the texture and pass that to the kernel: let ciImage = CIImage(mtlTexture: texture) The documentation also mentions what you need to do to let Core Image render into a Metal texture. If you want to incorporate a Metal processing step into a Core Image pipeline instead, I recommend you check out CIImageProcessorKernel.
Topic: Graphics & Games SubTopic: Metal Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to Rendering Core Image to MTLTexture causes huge memory use
Hmm, your code seems ok so far. I guess the issue is caused by something else... Are you sure the texture you create here is released properly? Also, can you please try passing nil as commandBuffer in [context render:...]?
Topic: Graphics & Games SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to OpenEXR conversion
I recommend using Core Image to read, write, and modify EXR images. Core Image can already natively open PNG and EXR files and write PNG data and files. However, there is no convenient way for writing EXR data of files. That's why we wrote extensions for doing exactly that. You can find them over at Github.
Topic: Media Technologies SubTopic: General Tags:
Replies
Boosts
Views
Activity
Feb ’22
Reply to QR Code Generator (CIFilter) colours for light/dark mode ?
You can use the QR code as a mask and blend it with a solid color to effectively colorize it. So you can, for example, create a black and a white version and use the register(...) method of UIImage to "bundle" them both into one dynamic image: let qrCode = filter.outputImage!.transformed(by: transform) // Use the QR code as a mask for blending with a color. // Note that we need to invert the code for that, so the actual code becomes white // and the background becomes black, because white = let color through, black = transparent. let maskFilter = CIFilter.blendWithMask() maskFilter.maskImage = qrCode.applyingFilter("CIColorInvert") // create a version of the code with black foreground... maskFilter.inputImage = CIImage(color: .black) let blackCIImage = maskFilter.outputImage! // ... and one with white foreground maskFilter.inputImage = CIImage(color: .white) let whiteCIImage = maskFilter.outputImage! // render both images let blackImage = context.createCGImage(blackCIImage, from: blackCIImage.extent).map(UIImage.init)! let whiteImage = context.createCGImage(whiteCIImage, from: whiteCIImage.extent).map(UIImage.init)! // use black version for light mode qrImage = blackImage // assign the white version to be used in dark mode qrImage.imageAsset?.register(whiteImage, with: UITraitCollection(userInterfaceStyle: .dark)) return qrImage
Topic: Media Technologies SubTopic: General Tags:
Replies
Boosts
Views
Activity
Mar ’22
Reply to Support tiling in ML-based CIImageProcessorKernel
I also filed a corresponding Feedback (FB9949181). Thanks for looking into it!
Topic: Media Technologies SubTopic: General Tags:
Replies
Boosts
Views
Activity
Mar ’22
Reply to Replacement for deprecated CIRAWFilterOption activeKeys
I think the whole RAW development is now handled by the new CIRAWFilter. This doesn't have an activeKeys property anymore. Instead, you can check for each property individually if it's supported or not. For instance with isContrastSupported or isMoireReductionSupported.
Topic: Media Technologies SubTopic: General Tags:
Replies
Boosts
Views
Activity
Mar ’22
Reply to CIKernel call - performance hit and memory leak
You are capturing self in the roiCallback for no apparent reason. Can you please try to remove the [self] and check again?
Topic: Media Technologies SubTopic: General Tags:
Replies
Boosts
Views
Activity
Apr ’22
Reply to CIKernel ROI Callback Leak
Also filed as FB9989184.
Topic: Media Technologies SubTopic: General Tags:
Replies
Boosts
Views
Activity
Apr ’22
Reply to CISourceOverComposition unexpected behavior
I guess this is happening because CIPhotoEffectTonal also has an effect on the transparent parts of the image. If you want to limit the effect to the visible part, you can simply crop the image after the effect is applied and before you blend it over the background: video1FilteredImage = [video1FilteredImage imageByCroppingToRect:video1FilteredImage.extent]; By the way: instead of using CIConstantColorGenerator you can simply get a colored image like this: CIImage *colorBackgroundImage = [CIImage imageWithColor:inputColor];
Topic: Media Technologies SubTopic: General Tags:
Replies
Boosts
Views
Activity
May ’22