Tag: core image

GPUImage遮罩透明度

我在我的应用程序中使用Brad Larson的GPUImage框架,我需要制作mask.jpg和照片的掩码。 所以蒙版图像是黑色背景和白色几何graphics的两种颜色图像。 所以基本上掩蔽工作,问题是我不能做掩码的透明度。 为了使我需要将mask.png的黑色replace为更浅的颜色(更多灰色到白色)。 所以我试图从这里使用代码 想用另一种颜色 – iPhone来改变图像中的特定颜色 但它不起作用,阿尔法设置为0,我不知道为什么。 我试图debugging,一切似乎都很好,但它返回一个UIImage与透明的颜色,而不是黑色。 有没有办法让它没有coregraphics。 也许coreimage?

iOS中的漫画

我正在尝试在iOS中将漫画效果应用于照片。 我search了很多东西,但发现很多东西。 我已经检查了https://github.com/BradLarson/GPUImage以获得图像的草图,以便我可以在草图上应用各种filter。 但仍然陷在它。 我已经看到这个链接也创build草图效果使用布拉德拉森GPUImage在对象C,但无法得到适当的组合。 请帮助我,如果你发现了类似的东西。 提前致谢。

核心图像 – 在CMSampleBufferRef上渲染一个透明的图像会导致它周围的黑框

我正在使用AVFoundation的AVCaptureVideoDataOutput录制的video上添加水印/徽标。 我的类被设置为sampleBufferDelegate并接收CMSamplebufferRefs。 我已经将某些效果应用于CMSampleBufferRefs CVPixelBuffer,并将其传回给AVAssetWriter。 左上angular的徽标使用透明PNG提供。 我遇到的问题是,一旦写入video,UIImage的透明部分是黑色的。 任何人都知道我做错了什么或可能会忘记? 下面的代码片段: //somewhere in the init of the class; _eaglContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; _ciContext = [CIContext contextWithEAGLContext:_eaglContext options: @{ kCIContextWorkingColorSpace : [NSNull null] }]; //samplebufferdelegate method: – (void) captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection { CVPixelBufferRef pixelBuffer = CMSampleBufferGetImageBuffer(sampleBuffer); CVPixelBufferLockBaseAddress(pixelBuffer, 0); …. UIImage *logoImage = [UIImage imageNamed:@"logo.png"]; CIImage *renderImage […]

iOS6:如何使用从cvPixelBufferref到CIImage的YUV到RGB的转换function

从iOS6开始,苹果已经通过这个调用给出了使用原生YUV到CIImage的规定 initWithCVPixelBuffer:选项: 在核心的图像编程指南中,他们提到了这个function 利用iOS 6.0及更高版本中对YUV图像的支持。 相机像素缓冲区本来就是YUV,但大多数image processingalgorithm需要RBGA数据。 两者之间的转换是有成本的。 Core Image支持从CVPixelBuffer对象读取YUB并应用适当的颜色转换。 options = @ {(id)kCVPixelBufferPixelFormatTypeKey:@(kCVPixelFormatType_420YpCvCr88iPlanarFullRange)}; 但是,我无法正确使用它。 我有一个原始的YUV数据。 所以,这就是我所做的 void *YUV[3] = {data[0], data[1], data[2]}; size_t planeWidth[3] = {width, width/2, width/2}; size_t planeHeight[3] = {height, height/2, height/2}; size_t planeBytesPerRow[3] = {stride, stride/2, stride/2}; CVPixelBufferRef pixelBuffer = NULL; CVReturn ret = CVPixelBufferCreateWithPlanarBytes(kCFAllocatorDefault, width, height, kCVPixelFormatType_420YpCbCr8PlanarFullRange, nil, width*height*1.5, 3, […]

如何在ios 5.0中执行Bump Distortion?

我需要在ios 5.0中执行凹凸失真…我的xcode不显示任何错误,也没有得到任何输出…而跟踪和打印凹凸filter实例打印空值… 任何想法… 一些post显示,这是不工作在iOS 5.0,任何其他方式是有执行凹凸失真… 提前致谢…. 问候, SpyNet的 我的代码… context = [CIContext contextWithOptions:nil]; CIFilter *bumpDistortion = [CIFilter filterWithName:@"CIBumpDistortion"]; [bumpDistortion setValue:ciimage forKey:kCIInputImageKey]; [bumpDistortion setValue:[CIVector vectorWithX:200 Y:150] forKey:@"inputCenter"]; [bumpDistortion setValue:[NSNumber numberWithFloat:100] forKey:@"inputRadius"]; [bumpDistortion setValue:[NSNumber numberWithFloat:3.0] forKey:@"inputScale"]; CIImage *imageOutput = [bumpDistortion outputImage]; CGImageRef cgimg = [context createCGImage:imageOutput fromRect:[imageOutput extent]]; UIImage *newImg = [UIImage imageWithCGImage:cgimg]; [self.imageView setImage:newImg];

使用CIFilter后,图像自动旋转

我正在编写一个让用户拍照并编辑的应用程序。 我正在使用UISliders实现亮度/对比度/饱和度的工具,我正在使用Core Image Filter类。 当我打开应用程序,我可以拍照并正确显示。 但是,如果我select编辑图片,然后使用任何描述的滑块工具,图像将逆时针旋转90度。 这里是有问题的代码: – (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. self.navigationItem.hidesBackButton = YES; //hide default nav //get image to display DBConnector *dbconnector = [[DBConnector alloc] init]; album.moments = [dbconnector getMomentsForAlbum:album.title]; Moment *mmt = [album.moments firstObject]; _imageView.image = [mmt.moment firstObject]; CGImageRef aCGImage = _imageView.image.CGImage; CIImage […]