Questions tagged [ciimage]

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.

294 questions
5
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 { …
Manuel
  • 14,274
  • 6
  • 57
  • 130
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…
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 { …
VID44R
  • 61
  • 1
  • 5
5
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)…
Whirlwind
  • 14,286
  • 11
  • 68
  • 157
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…
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:…
SpaceShroomies
  • 1,635
  • 2
  • 17
  • 23
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…
Anton Tropashko
  • 5,486
  • 5
  • 41
  • 66
5
votes
2 answers

How to add text to CIImage?

I am working with the Photos framework and have created an app that will apply a filter to an image. Now instead of applying a filter, I want to add text on top of the image. This API provides me with a CIImage which I can use to create an output…
Jordan H
  • 52,571
  • 37
  • 201
  • 351
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…
Laz
  • 538
  • 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]…
C4 - Travis
  • 4,502
  • 4
  • 31
  • 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…
dana0550
  • 1,125
  • 1
  • 9
  • 16
4
votes
0 answers

Convert from CMSampleBuffer to NSData image without exceeding 50MB of memory

Error exceeding memory allowance when processing CMSampleBuffer to NSData conversion in RPBroadcastSampleHandler. Error code: Thread 7: EXC_RESOURCE RESOURCE_TYPE_MEMORY (limit = 50 MB, unused = 0x0) I am processing the function of converting a…
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…
RealUglyDuck
  • 338
  • 2
  • 13
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…
Ayrad
  • 3,996
  • 8
  • 45
  • 86
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 =…
Roi Mulia
  • 5,626
  • 11
  • 54
  • 105
1 2
3
19 20