Tag: uiimage

从UIImage本地扫描条形码(即不使用ZBar)

自iOS7以来,我一直使用苹果提供的本地条形码扫描器function,这很好,但我需要扫描一些静态图像,以便自动编目条形码。 我无法find一种方法来做到这一点本质上,所以我使用了一个名为zBar的开源软件包,并在大多数情况下,它工作正常。 但是,它往往会返回错误的值,有时会找不到条形码。 我也从头开始构buildc ++库,但是在OS X构build中我得到了相同的结果。 这似乎也是一个被遗弃的项目。 即使我从电脑显示器扫描图像,苹果公司的本地解决scheme也会在这个静态图像上find条形码! 对于返回错误/不正确值的图像也是如此。 那么是否有使用苹果的库扫描UIImage?

在TableView中不正确的图像大小

我正在创build一个包含来自URL的图像的表格视图,但是图像不会重新调整到所有视图的大小,直到我将其预先设置在行中。 任何想法为什么发生? 这是一个自定义的tableview 我的代码是: – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ static NSString *CellIdentifier = @"Celula_Noticias"; Celula_Noticias *cell = (Celula_Noticias*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { NSArray * top= [[NSBundle mainBundle] loadNibNamed:@"Celula_Noticias" owner:self options:nil]; for(id currentObject in top){ if ([currentObject isKindOfClass:[Celula_Noticias class]]) { cell= (Celula_Noticias *) currentObject; break; } } } cell.Image_Noticias_1.image=[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[[noticias objectAtIndex:indexPath.row […]

旋转GPUImageTiltShiftFilter – GPUImage

我想要一个非水平的GPUImageTiltShiftFilter旋转。 我想旋转到任意的旋转angular度。 我也想要filter是快速的,它可以与UIRotationGestureRecongizer用户界面旋转。 我该怎么做呢?

iOS / Objective C:将RGB数据转换为UIImage

我需要帮助将24/32位RGB原始图像转换为uiimage。 我已经从Paul Solt和其他人那里尝试了这些例子,但没有任何工作。 任何人都可以请示例或教程? 图像数据保存在nsdata,我想有一个JPG或PNG图像。 Thx Thorsten 我使用Paul Solt的代码,它做了一些事情,但是图像看起来像是一幅图像中的图像信息的四倍。 我不能在这里发布图像:编辑:我在评论之间的方法开始添加行,现在它的工作原理:-) + (UIImage *) convertBitmapRGBA8ToUIImage:(unsigned char *) buffer withWidth:(int) width withHeight:(int) height { // added code char* rgba = (char*)malloc(width*height*4); for(int i=0; i < width*height; ++i) { rgba[4*i] = buffer[3*i]; rgba[4*i+1] = buffer[3*i+1]; rgba[4*i+2] = buffer[3*i+2]; rgba[4*i+3] = 255; } // size_t bufferLength = width * […]

如何检测UIImage的非透明部分何时与UIImage的另一个不透明部分接触

我很难完成一些我认为会更容易的事情。 我试图运行一个方法,只要UIImage中的图片的非透明部分触及UIImage中包含的图像的另一个不透明的部分。 我列举了一个例子来帮助进一步解释我的问题。 正如你在上面的图片中看到的,我有两个都在UIImage中的三angular形。 三angular形都是PNG图片。 只有三angular形是可见的,因为背景是透明的。 这两个UIImage都在UIImageView中。 我希望能够在三angular形的可见部分接触另一个三angular形的可见部分时运行方法。 有人可以帮帮我吗?

仅在另一个UIImage中移动UIImage

我有一个UIImageView显示的UIImage 。 我也有一个UIImageView中的第一个图像上方的图像。 我想只能在第一张图片的边框内拖动第二张图片。 为了让我的目标看起来更清晰一些: http : //img689.imageshack.us/img689/6136/56308823.png 。 绿色的引脚应该是可拖动的,但不应该可以将引脚拖入蓝色(在地图之外)。 此时该引脚是可拖动的,但我不知道如何检查引脚是否在地图之外。 编辑:我使用这种方法在我的UIImageView子类为可拖拽的引脚: – (UIColor *)colorAtPosition:(CGPoint)position { CGRect sourceRect = CGRectMake(position.x, position.y, 1.f, 1.f); CGImageRef imageRef = CGImageCreateWithImageInRect([[MapViewController sharedMapViewController]getImage].CGImage, sourceRect); CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); unsigned char *buffer = malloc(4); CGBitmapInfo bitmapInfo = kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big; CGContextRef context = CGBitmapContextCreate(buffer, 1, 1, 8, 4, colorSpace, bitmapInfo); CGColorSpaceRelease(colorSpace); […]

内存泄漏iOS(UIImageView,UIImage,CGImage)没有在ARC上释放

我试图实现一个简单的videostream,但由于某种原因,我的记忆将不会被释放: (void)updateImage:(UIImage *)image{ self.indicator.hidden = TRUE; //CGImageRelease([self.imageView.image CGImage]); self.imageView.image = nil; self.imageView.image = image; [self.imageView setNeedsDisplay]; } 如果我使用 CGImageRelease([self.imageView.image CGImage]); 内存将被释放。 但是,当我回到以前的视图控制器应用程序将崩溃,因为它试图释放为我已经释放的图像分配的内存。 这个方法是从asynchronous任务中调用的,它使用下面的命令创build一个图像: UIImage *image = [UIImage imageWithCGImage:cgImage]; CGImageRelease(cgImage); CGDataProviderRelease(provider); CFRelease(data); 据我了解,UIImage现在拥有CGImage,我不应该释放它。 那么无论如何,当我用新的图像更新UIImageView时,确保UIImage被释放?

裁剪UIImage(CoreGraphics,iOS)时的性能问题

我们要做的事情的基本思想是我们有一个大的UIImage,我们想把它分成几块。 该函数的用户可以传递多行和多列,并且图像将被相应地裁剪(即,3行和3列将图像分割成9个)。 问题是,我们遇到性能问题,当试图用CoreGraphics完成这个。 我们需要的最大网格是5×5,完成操作需要几秒钟的时间(注册为用户的滞后时间),这当然远非最佳。 我和我的同事在这方面花了一段时间,并且在网上search失败的答案。 我们都不是非常有经验的核心graphics,所以我希望在代码中有一些愚蠢的错误,将解决我们的问题。 这是留给你,所以用户,请帮助我们搞清楚! 我们使用http://www.hive05.com/2008/11/crop-an-image-using-the-iphone-sdk/上的教程来修改我们的代码。 下面的function: -(void) getImagesFromImage:(UIImage*)image withRow:(NSInteger)rows withColumn:(NSInteger)columns { CGSize imageSize = image.size; CGFloat xPos = 0.0; CGFloat yPos = 0.0; CGFloat width = imageSize.width / columns; CGFloat height = imageSize.height / rows; int imageCounter = 0; //create a context to do our clipping in UIGraphicsBeginImageContext(CGSizeMake(width, height)); CGContextRef currentContext = […]

触摸时更改表格单元格的UIImage

我有下面这个设置,但是当我触摸表格单元格时,我得到了警报,所以我知道该方法正在被调用,但单元格左侧的图像没有改变。 这是我的代码看起来像:在视图控制器我有这2个方法: -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath; { UITableViewCell *cell = nil; cell = [tableView dequeueReusableCellWithIdentifier:@"homeworkcell"]; if(cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"homeworkcell"]; } cell.textLabel.text = [tabledata objectAtIndex:indexPath.row]; //static NSString *CellIdentifier = @"Cell"; /* if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier]; }*/ // Configure the cell. //———————————-START———————-Set image of […]

从UIImage中删除Alpha通道

我使用以下方法从文件系统中获取解压缩的uiimage。 但是,当打开颜色混合图层时,即使将UIImageView设置为“不透明”,UIImageView也会显示为红色。 文件系统上的图像没有alpha通道。 我试过设置CGContextSetAlpha(bitmapContext,1),但仍然有混合层。 任何人都知道如何使用CGContextDrawImage删除alpha通道? – (UIImage *)decompressedImage { CGImageRef imageRef = self.CGImage; CGRect rect = CGRectMake(0.f, 0.f, CGImageGetWidth(imageRef), CGImageGetHeight(imageRef)); CGContextRef bitmapContext = CGBitmapContextCreate(NULL, rect.size.width, rect.size.height, CGImageGetBitsPerComponent(imageRef), CGImageGetBytesPerRow(imageRef), CGImageGetColorSpace(imageRef), kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Little ); // kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Little are the bit flags required // so that the main thread doesn't have any conversions to do. CGContextDrawImage(bitmapContext, […]