-4

重複の可能性:
openCV を使用した OCR

グレーの画像を白黒に変換したい(コントラストが良い)。私はopenCVを使用しています。過去 3 日間苦労していますが、以下に示すように出力イメージが明確ではありません。

ありがとう

元の画像: ここに画像の説明を入力

出力画像:

ここに画像の説明を入力

4

1 に答える 1

0

これを試してみると、適切な画像を取得するのに役立ちます

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];
于 2012-11-07T12:03:12.580 に答える