Iphone 图像处理openCV
可能重复:Iphone 图像处理openCV,iphone,ios,opencv,Iphone,Ios,Opencv,可能重复: 我想将灰色图像转换成黑白(具有良好的对比度)。我正在使用openCV。我在过去的3天里苦苦挣扎,但我的输出图像不清晰,如下所示 谢谢 原始图像: 输出图像: 试试这个,它将帮助您获得正确的图像 UIImage *image=[UIImage imageNamed:@"EUqAd.jpg"]; UIImageView *imageView=[[UIImageView alloc]initWithFrame:CGRectMake(20, 20, 280, 150)];
我想将灰色图像转换成黑白(具有良好的对比度)。我正在使用openCV。我在过去的3天里苦苦挣扎,但我的输出图像不清晰,如下所示 谢谢 原始图像: 输出图像:
试试这个,它将帮助您获得正确的图像
UIImage *image=[UIImage imageNamed:@"EUqAd.jpg"];
UIImageView *imageView=[[UIImageView alloc]initWithFrame:CGRectMake(20, 20, 280, 150)];
imageView.image=image;
[self.view addSubview:imageView];
CGRect rect = CGRectMake(0, 0, image.size.width, image.size.height);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextClipToMask(context, rect, image.CGImage);
CGContextSetFillColorWithColor(context, [[UIColor whiteColor] CGColor]);
CGContextFillRect(context, rect);
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImage *flippedImage = [UIImage imageWithCGImage:img.CGImage
scale:1.0 orientation: UIImageOrientationDownMirrored];
UIImageView *imageView1=[[UIImageView alloc]initWithFrame:CGRectMake(20, 200, 280, 150)];
imageView1.image=flippedImage;
[self.view addSubview:imageView1];
@NickBull这也是我的问题,我想我在这个问题上多解释了一点,所以我在这里再次问你,你在这个问题上没有向你的另一个问题提供任何额外的信息。你不应该仅仅因为一个现有问题没有答案就提出一个新问题。返回到另一个问题,添加更多信息或回答评论中的问题以解释更多信息。