我想创建一个应用程序,我想要做一些图像处理。所以我想知道是否有任何开源图像处理库可用?我也想创建一个这样的过滤器Glamour Filter任何有关这方面的帮助将非常感激。如果有人已经有一个源代码来创建棕褐色,黑白旋转缩放代码比请发送。由于图像处理iphone中的魅力滤镜
2
A
回答
-2
搜索OpenCV的
1
这里是黑白色&效果
- (UIImage*) createGrayCopy:(UIImage*) source {
int width = source.size.width;
int height = source.size.height;
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray();
CGContextRef context = CGBitmapContextCreate (nil, width,
height,
8, // bits per component
0,
colorSpace,
kCGImageAlphaNone);
CGColorSpaceRelease(colorSpace);
if (context == NULL) {
return nil;
}
CGContextDrawImage(context,
CGRectMake(0, 0, width, height), source.CGImage);
UIImage *grayImage = [UIImage imageWithCGImage:CGBitmapContextCreateImage(context)];
CGContextRelease(context);
return grayImage;
}
+1
您发布的黑白代码实际上是灰色效果。我需要实际的空白和白色效果的代码。我已经发布了棕褐色滤镜的代码。 – 2010-11-18 04:43:12
6
的代码下面是棕褐色图像的代码
-(UIImage*)makeSepiaScale:(UIImage*)image
{
CGImageRef cgImage = [image CGImage];
CGDataProviderRef provider = CGImageGetDataProvider(cgImage);
CFDataRef bitmapData = CGDataProviderCopyData(provider);
UInt8* data = (UInt8*)CFDataGetBytePtr(bitmapData);
int width = image.size.width;
int height = image.size.height;
NSInteger myDataLength = width * height * 4;
for (int i = 0; i < myDataLength; i+=4)
{
UInt8 r_pixel = data[i];
UInt8 g_pixel = data[i+1];
UInt8 b_pixel = data[i+2];
int outputRed = (r_pixel * .393) + (g_pixel *.769) + (b_pixel * .189);
int outputGreen = (r_pixel * .349) + (g_pixel *.686) + (b_pixel * .168);
int outputBlue = (r_pixel * .272) + (g_pixel *.534) + (b_pixel * .131);
if(outputRed>255)outputRed=255;
if(outputGreen>255)outputGreen=255;
if(outputBlue>255)outputBlue=255;
data[i] = outputRed;
data[i+1] = outputGreen;
data[i+2] = outputBlue;
}
CGDataProviderRef provider2 = CGDataProviderCreateWithData(NULL, data, myDataLength, NULL);
int bitsPerComponent = 8;
int bitsPerPixel = 32;
int bytesPerRow = 4 * width;
CGColorSpaceRef colorSpaceRef = CGColorSpaceCreateDeviceRGB();
CGBitmapInfo bitmapInfo = kCGBitmapByteOrderDefault;
CGColorRenderingIntent renderingIntent = kCGRenderingIntentDefault;
CGImageRef imageRef = CGImageCreate(width, height, bitsPerComponent, bitsPerPixel, bytesPerRow, colorSpaceRef, bitmapInfo, provider2, NULL, NO, renderingIntent);
CGColorSpaceRelease(colorSpaceRef); // YOU CAN RELEASE THIS NOW
CGDataProviderRelease(provider2); // YOU CAN RELEASE THIS NOW
CFRelease(bitmapData);
UIImage *sepiaImage = [UIImage imageWithCGImage:imageRef];
CGImageRelease(imageRef); // YOU CAN RELEASE THIS NOW
return sepiaImage;
}
+0
对于那些现在需要iOS 5和更高版本的用户,您可以直接应用内置的SepiaTone CIFilter来做同样的事情。 – 2013-11-05 16:26:52
+0
这只适用于.png图片 – Chandru 2014-02-18 14:13:40
相关问题
- 1. 滤镜/图像纹理Iphone
- 2. 图像处理中的反滤镜?
- 3. 魅力文件处理支持++
- 4. 图像处理中是否有分辨率增强滤镜?
- 5. CUDA /推力图像处理
- 6. GPU图像滤镜
- 7. 图像处理Iphone
- 8. iphone,图像处理
- 9. 魅力++外HPC
- 10. 图像处理中的双边过滤
- 11. 图像处理图像过滤器
- 12. JavaScript滤镜图像颜色
- 13. 锐化图像滤镜
- 14. iphone - 数字图像处理
- 15. iPhone Objective-C图像处理
- 16. 使用scipy/numpy在python中进行图像处理的高通滤镜
- 17. Iphone图像处理图像APIS
- 18. TideSDK是否有图像处理能力?
- 19. 镜像+ iphone
- 20. 魅力无法创建魅力商店客户端
- 21. Java上的图像处理过滤器
- 22. 用浣熊魅力切换视图
- 23. 设置魅力中的链接顺序
- 24. 图像处理 - 实现Sobel滤波器
- 25. 图像处理过滤器不适用
- 26. 图像处理和描边过滤器
- 27. 魅力降许可证
- 28. OpenGl中的镜像图像
- 29. html5图像滤镜与画布
- 30. Android图像滤镜应用程序
OpenCV的是一个人脸检测库。这不是图像过滤器。我很喜欢图片过滤器库 – 2010-08-30 13:04:34