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
5
votes
2 answers
Converting CIImage to CGImage too slow
I need to convert a CIImage to a CGImage. This is the code I am currently using:
CGImageRef img = [myContext createCGImage:ciImage fromRect:[ciImage extent]];
But his line of code is very slow for images with a regular size. Much to slow that I can…
![](../../users/profiles/3433993.webp)
Laurens
- 75
- 1
- 7
5
votes
2 answers
CIImage(IOS): Adding 3x3 convolution after a monochrome filter somehow restores color
I'm converting ciimage to monochrome, clipping with CICrop
and running sobel to detect edges, #if section at the bottom is
used to display result
CIImage *ci = [[CIImage alloc] initWithCGImage:uiImage.CGImage];
CIImage *gray = [CIFilter…
![](../../users/profiles/3544438.webp)
Anton Tropashko
- 4,300
- 3
- 31
- 53
5
votes
1 answer
Crop CMSampleBufferRef
I am trying to crop image in CMSampleBufferRef to a specific size. I am making 5 steps - 1. Getting PixelBuffer from SampleBuffer 2. Converting PixelBuffer to CIImage 3. Cropping CIImage 4. Rendering CIImage back to PixelBuffer 5. Attaching…
![](../../users/profiles/1736654.webp)
Laz
- 431
- 7
- 12
5
votes
3 answers
Colors Inverted when Creating UIImage from CIImage (iOS 6.0)
I've been trying a ton of different options and tricks for getting a UIImage to build properly from a CIImage. But, every time I create the CIImage its colors seem to be inverted.
The most recent code I have is:
NSURL *url = [[NSBundle mainBundle]…
![](../../users/profiles/1218605.webp)
C4 - Travis
- 4,492
- 4
- 29
- 56
5
votes
1 answer
Getting UIImage from CIImage does not work properly
I am having trouble with getting a UIImage from and CIImage. The line of code below works fine on iOS6: (Output image is an CIImage)
self.imageView = [UIImage imageWithCIImage:outputImage];
or
[self.imageView setImage:[UIImage…
![](../../users/profiles/697581.webp)
dana0550
- 1,125
- 1
- 8
- 16
4
votes
1 answer
RGB values of CIImage pixel
I want to access the average colour value of a specific area of CVPixelBuffer that I get from ARFrame in real-time. I managed to crop the image, use filter to calculate average colour and after converting to CGImage I get the value from the pixel…
![](../../users/profiles/9206019.webp)
RealUglyDuck
- 216
- 1
- 9
4
votes
2 answers
App crash when blurring an image with `CIFilter`
Since using this function to blur an image, I get frequent crash reports with CoreImage:
// Code exactly as in app
extension UserImage {
func blurImage(_ radius: CGFloat) -> UIImage? {
guard let ciImage = CIImage(image: self) else {
…
![](../../users/profiles/1870795.webp)
Manuel
- 11,849
- 3
- 39
- 93
4
votes
2 answers
Retrieve the last frame of live camera preview in swift
I have an AR app where the view is constantly showing what the back camera is seeing and sending each frame for analysis to VisionRequest.
When the object was identified, I would like to capture that particular last frame and save it as a regular…
![](../../users/profiles/134788.webp)
Ayrad
- 3,766
- 7
- 38
- 81
4
votes
1 answer
Create CIImage Pattern from image file
I'm trying to understand what is the most efficient way to create a CIImage with a pattern, based on an image file.
let patternImage = UIImage(named: "pattern.png")
The first approach I took:
// First create UIColor pattern
let uiColorPattern =…
![](../../users/profiles/4156957.webp)
Roi Mulia
- 4,846
- 9
- 43
- 92
4
votes
0 answers
Should I set a color space for a CIImage or a CIContext?
Core Image lets us specify a color space for a CIContext, as in:
let context = CIContext(options: [kCIContextOutputColorSpace: NSNull(),
kCIContextWorkingColorSpace: NSNull()])
Or for a CIImage, as in:
let image =…
![](../../users/profiles/297868.webp)
Kartick Vaddadi
- 4,265
- 5
- 33
- 45
4
votes
2 answers
rotate CIImage around center with CIFilter
I'm trying to rotate the pixel data of a CMSampleBuffer (coming from the camera) and display it in a UIImageView. I Don't want to rotate the view itself. It has to be the actual pixel data.
I grab the feed, convert it to a CIImage and with a…
![](../../users/profiles/1205482.webp)
Ramin Afshar
- 939
- 2
- 14
- 33
4
votes
2 answers
CIImage extent in pixels or points?
I'm working with a CIImage, and while I understand it's not a linear image, it does hold some data.
My question is whether or not a CIImage's extent property returns pixels or points? According to the documentation, which says very little, it's…
![](../../users/profiles/236480.webp)
kineticac
- 775
- 1
- 9
- 16
4
votes
0 answers
create local movie out of `CVPixelBufferRef` which gets trimmed at the beginning after some time
I do have lots of CVPixelBufferRef which I would like to append to a movie in "real time", i.e. I get 50 - 60 CVPixelBufferRef per second (as they are frames) and would like to create a local video out of it.
Even better would be if I could have…
![](../../users/profiles/27404.webp)
swalkner
- 15,150
- 25
- 107
- 195
4
votes
1 answer
Null passed to a callee that requires a non-null argument
I have been using this to convert a CIImage to NSData for ages:
NSData *data = [imageRep representationUsingType: NSPNGFileType
properties:nil];
Now on El Capitan I have this error on the second line:
Null passed to a…
![](../../users/profiles/316469.webp)
Duck
- 32,792
- 46
- 221
- 426
4
votes
1 answer
Creating transparent gradient and use it as an alpha-mask in SpriteKit
I am trying to make a gradient and use it as an alpha mask. Right now, I am able to make an image similar to this (from black to transparent):
This is the code which I use to make all this:
private func createImage(width: CGFloat, height: CGFloat)…
![](../../users/profiles/3402095.webp)
Whirlwind
- 13,478
- 6
- 48
- 124