core-image

Average color of a CIImage … a faster method

天涯浪子 提交于 2019-12-08 03:30:40
问题 I have a CIImage that is 258x258. I apply a filter CIAreaAverage to it, in order to get the green value of the average color of that image. I am using this function to get that... // channel 0,1,2 = red, green, blue func averageColorOfImage (_ inputImage: CIImage, _ channel: Int) -> Double { let extentVector = CIVector(x: inputImage.extent.origin.x, y: inputImage.extent.origin.y, z: inputImage.extent.size.width, w: inputImage.extent.size.height) guard let filter = CIFilter(name:

CIImage drawing EXC_BAD_ACCESS

六眼飞鱼酱① 提交于 2019-12-08 02:34:08
问题 So, I have a CIImage that I'm attempting to draw in an NSView 's -drawRect method. This is the line of code that I call to draw the image: [outputCoreImage drawInRect: [self bounds] fromRect: originalBounds operation: NSCompositeSourceOver fraction: 1]; outputCoreImage , originalBounds , and [self bounds] are all non- nil , and indeed are their respective expected values. On Lion (OS X 10.7), this worked fine, however on Mountain Lion (OS X 10.8) I receive an EXC_BAD_ACCESS on this line. If I

How to apply HSB color filters to UIImage

霸气de小男生 提交于 2019-12-08 02:27:23
问题 I've been struggling for a few days for a project on UIImage colorization. The idea is that the app will embark a set of images that I will have to colorize with values retrieved from a webservice. Some sort of themes if you wish. The designer I work with gave me a background image on all of his Photoshop values. The first problem is that Photoshop uses HSL and iOS uses HSB. So the first challenge was to translate the values from Photoshop. Photoshop HSL: -28 (range -180 => +180), 100 (range

Color Specific Hue/Saturation from Photoshop to iOS

大城市里の小女人 提交于 2019-12-08 02:04:11
问题 I'm trying to use GPUImage and CIFilter to map this filter. Please note, I need help mapping the color (Reds) specific (note: NOT Master, just Reds) photoshop element to iOS. Does anyone know how to manipulate a CIFilter or GPUImage class to get the photoshop effect below in iOS? 回答1: You could use GPUImage with the lookup filter: GPUImageLookupFilter: Uses an RGB color lookup image to remap the colors in an image. First, use your favourite photo editing application to apply a filter to

How to change Brightness, Contrast and Saturation using CIColorControls via UISlider with Swift

馋奶兔 提交于 2019-12-07 20:59:28
问题 I'm working on a Photo Filter App and as you can see I added a feature to adjust contrast, brightness, saturation, and noise. But the problem is they work independently, which means when I'm adjusting let's say brightness as soon as I start editing contrast, it returns to the original brightness. Here is a preview when I'm putting the brightness to the maximum (the image gets white) and then trying to adjust its contrast and the slider changes the contrast of an original image. Here I was

UIImage masking with gesture

不打扰是莪最后的温柔 提交于 2019-12-07 15:19:30
I'm trying to achieve selective color feature in iOS. I personally think that first draw shape using finger gesture and convert that into mask, But at the same time it should be real time, It should work as i move my finger across the grayscale image. Can anyone direct me to correct path. Sample app : https://itunes.apple.com/us/app/color-splash/id304871603?mt=8 Thanks. You can position two UIImageViews over each other, the color version in the background and the black&white version in the foreground. Then you can use touchesBegan , touchesMoved and so on events to track user input. In touches

Create a CI Filter Chain

可紊 提交于 2019-12-07 13:44:42
问题 How do I get combine GI Filter effects. I would like to combine CISepiaTone with CIPhotoEffectMono. Currently I have something like this for a filter. case 1:{ filter = [CIFilter filterWithName:@"CISepiaTone" keysAndValues: kCIInputImageKey, beginImage, @"inputIntensity", [NSNumber numberWithFloat:0.8], nil]; break; } 回答1: Apple gives a detailed example in its documentation : https://developer.apple.com/library/ios/documentation/graphicsimaging/Conceptual/CoreImaging/ci_tasks/ci_tasks.html

iOS UIImage being rotated when after going through CIFilter

こ雲淡風輕ζ 提交于 2019-12-07 12:13:02
问题 I'm working with filtering images that I'm taking with the camera. I pass the image I get from the camera through the below method. Which I have the returned UIImage sent to a UIImageView . For some reason when it passes through this method the image is getting rotated. What am I doing wrong? - (UIImage *) applyFilterToImage:(UIImage *)image withFilter:(NSString *)filterName { beginImage = [[[CIImage alloc] initWithImage:image] autorelease]; context = [CIContext contextWithOptions:nil];

iOS - CoreImage - Add an effect to partial of image

核能气质少年 提交于 2019-12-07 04:11:58
问题 I just have a look on CoreImage framework on iOS 5, found that it's easy to add an effect to whole image. I wonder if possible to add an effect on special part of image (a rectangle). for example add gray scale effect on partial of image/ I look forward to your help. Thanks, Huy 回答1: Watch session 510 from the WWDC 2012 videos. They present a technique how to apply a mask to a CIImage . You need to learn how to chain the filters together. In particular take a look at: CICrop ,

Apply Core Image Filter to Video on OS X using Swift

﹥>﹥吖頭↗ 提交于 2019-12-06 14:58:43
I am planning to build an NSOpenGLView for an OS X app using SWIFT which can be used to apply Core Image Filter and effects to a video, so far I have worked on the code for the video Controller to add video playback, but I am not sure how to apply the filter to the video: class VideoMediaViewController: NSViewController { weak var mainView : DTMainViewController? @IBOutlet weak var aVPlayerView: AVPlayerView! var url:NSURL?{ didSet{ // this is the setter } } var observer:AnyObject? var player:AVPlayer? var videoOutput:AVPlayerItemVideoOutput? var ciContext:CIContext? var loadStatus:NSNumber?