【问题标题】:image processing openCV [duplicate]图像处理openCV [重复]
【发布时间】:2012-11-07 20:03:12
【问题描述】:

可能重复:
OCR using openCV

我想将灰色图像转换为黑白(具有良好对比度)。我正在使用openCV。我从过去 3 天开始一​​直在苦苦挣扎,但我的输出图像不清楚,如下所示。

谢谢

原图:

输出图像:

【问题讨论】:

  • @NickBull 这也是我的问题,我想我在那个问题中解释了一点,所以我在这里再问一次
  • 您没有在此问题中向您的其他问题提供任何额外信息。你不应该仅仅因为你没有得到现有问题的答案就打开一个新问题。返回另一个问题并添加更多信息或回复 cmets 中的问题以进行更多说明。

标签: iphone ios opencv


【解决方案1】:

试试这个,它将帮助您获得正确的图像

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];

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-10-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-06-11
    • 1970-01-01
    • 2017-12-20
    相关资源
    最近更新 更多