CIImage is an image class from Apple's CoreImage framework. It is supplemented by other CoreImage classes -- such as CIFilter, CIContext, CIVector and CIColor. Although a CIImage holds image data, it is not an image. Core Image doesn’t actually render an image until it is told to do so. This “lazy evaluation” method allows Core Image to operate as efficiently as possible.
Questions tagged [ciimage]
280 questions
6
votes
1 answer
CIAdditionCompositing giving incorrect effect
I am trying to create an image by averaging several other images. To achieve this, I first darken each image by a factor equivalent to the number of images I am averaging:
func darkenImage(by multiplier: CGFloat) -> CIImage? {
let divImage =…
![](../../users/profiles/3259074.webp)
Jorn
- 1,024
- 8
- 24
6
votes
0 answers
How to crop and flip CVPixelBuffer and return CVPixelBuffer?
I am making an swift video app.
In my app, I need to crop and horizontally flip CVPixelBuffer and return result which type is also CVPixelBuffer.
I tried few things.
First, I used 'CVPixelBufferCreateWithBytes'
func resizePixelBuffer(_…
![](../../users/profiles/8293462.webp)
HB.K
- 157
- 1
- 10
6
votes
1 answer
Swift 4.1 Failed to get a bitmap representation of this NSImage
This code sample was working in a macOS playground:
import Cocoa
import XCPlayground
func getResImg(name: String, ext: String) -> CIImage {
guard let fileURL = Bundle.main.url(forResource: name, withExtension: ext) else {
fatalError("can't…
![](../../users/profiles/9810591.webp)
Fritz
- 85
- 7
6
votes
1 answer
IOS: Ambiguous Use of init(CGImage)
I am trying to convert a CGImage into a CIImage; however, it is not working.
This line of code:
let personciImage = CIImage(CGImage: imageView.image!.CGImage!)
throws the following error
Ambiguous use of 'init(CGImage)'
I'm really confused as to…
![](../../users/profiles/2251258.webp)
James Dorfman
- 1,592
- 5
- 17
- 32
6
votes
1 answer
ios9 - Issues with cropping CVImageBuffer
I am facing few issues related to cropping with iOS9 SDK.
I have the following code to resize a image (converting from 4:3 to 16:9 by cropping in middle). This used to work fine till iOS8 SDK. With iOS 9, the bottom area is blank.
…
![](../../users/profiles/4032392.webp)
manishg
- 8,120
- 1
- 10
- 15
6
votes
2 answers
Given a CIImage, what is the fastest way to write image data to disk?
I'm working with PhotoKit and have implemented filters users can apply to photos in their Photo Library. I am currently obtaining the image, applying a filter, returning the edited version as a CIImage, then I convert the CIImage into NSData using…
![](../../users/profiles/1795356.webp)
Jordan H
- 45,794
- 29
- 162
- 306
6
votes
0 answers
CIImage, CIDetector - how to find other objects in images other than faces
Is there anyway to find other objects in images without having to integrate other 3rd party libraries like openCV and write all the algorithms myself..
i.e. if i wanted to locate anything an in image that looks like a door? or locate anything that…
![](../../users/profiles/3802461.webp)
croc_hunter
- 285
- 1
- 12
6
votes
1 answer
Why properties method of CIImage returns nil
I'm developing an application using coreImage framework.I created a CIImage from UIImage.
CIImage *image = [CIImage imageWithCGImage:self.canvasImage.CGImage];
here self.canvasImage is a UIImage,I debug it and object image is being created by…
![](../../users/profiles/2940227.webp)
shabista JD
- 115
- 6
5
votes
0 answers
Why is CoreImage doing a memcpy when all my surfaces are on the GPU
When trying to debug why certain CoreImage renders increased our CPU usage significantly, I can see in the sample trace that when I crop and composite images in certain ways, CoreImage is doing memcpys. When I take out the crop filter, it goes…
![](../../users/profiles/205032.webp)
Ken Aspeslagh
- 11,296
- 2
- 32
- 40
5
votes
3 answers
How can you make a CVPixelBuffer directly from a CIImage instead of a UIImage in Swift?
I am recording filtered video through an iPhone camera, and there is a huge increase in CPU usage when converting a CIImage to a UIImage in real time while recording. My buffer function to make a CVPixelBuffer uses a UIImage, which so far requires…
![](../../users/profiles/586006.webp)
Chewie The Chorkie
- 3,401
- 4
- 37
- 77
5
votes
0 answers
How to create border in ciimage in swift
I'm writing a feature for correcting perspective of documents scanned from ios camera.
I want to create a border effect around the document whose edge has been determined. CiImage has the initializer property with which i can create a color overlay…
![](../../users/profiles/7369128.webp)
Nutan Niraula
- 156
- 1
- 7
5
votes
2 answers
Cropping CIImage
I have a class that takes an UIImage, initializes a CIImage with it like so:
workingImage = CIImage.init(image: baseImage!)
Then the image is used to cut out 9 neighbouring squares in a 3x3 pattern out of it - in a loop:
for x in 0..<3
{
…
![](../../users/profiles/6589751.webp)
VID44R
- 61
- 1
- 5
5
votes
1 answer
MAC OS Xcode Swift 2.2 Convert NSImage to CIImage
I like to convert an NSImage to a CIImage in swift 2.2 for a mac app.
Does anybody have some example code?
![](../../users/profiles/6530932.webp)
FJC
- 203
- 1
- 8
5
votes
1 answer
UIImageView contentMode not working after blur effect application
I'm attempting to set the image property of a UIImageView to an image I'm blurring with CoreImage. The code works perfectly with an unfiltered image, but when I set the background image to the filtered image, contentMode appears to stop working for…
![](../../users/profiles/4655467.webp)
Derrick Hunt
- 371
- 3
- 13
5
votes
2 answers
Image rotating after CIFilter
I'm applying a CIFilter to a portrait image. For some reason, it gets rotated 90 clockwise. How can I fix this? My code is below
var imgOrientation = oImage.imageOrientation
var imgScale = oImage.scale
let originalImage = CIImage(image:…
![](../../users/profiles/3330259.webp)
SpaceShroomies
- 1,455
- 2
- 15
- 23