Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8879361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:56:00+00:00 2026-06-14T19:56:00+00:00

I would like to implement an OCR application that would recognize text from Photos.

  • 0

I would like to implement an OCR application that would recognize text from Photos.

I succeeded in Compiling and Integration the Tesseract Engine in iOS, I succeeded in getting reasonable detection when photographing clear documents (or a photoshot of this text from the screen) but for other text such as signposts, shop signs, colour background, the detection failed.

The Question is What kind of image processing preparations are necessary to get better recognition. For example, I expect that we need to transform the images into grayscale /B&W as well as fixing contrast etc.

How can this be done in iOS, Is there a package for this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T19:56:01+00:00Added an answer on June 14, 2026 at 7:56 pm

    I’m currently working on the same thing.
    I found that a PNG saved in photoshop worked fine, but an image which was originally sourced from the camera then imported into the app never worked.
    Don’t ask me to explain it – but applying this function made these images work. Maybe it’ll work for you too.

    // this does the trick to have tesseract accept the UIImage.
    UIImage * gs_convert_image (UIImage * src_img) {
        CGColorSpaceRef d_colorSpace = CGColorSpaceCreateDeviceRGB();
        /*
         * Note we specify 4 bytes per pixel here even though we ignore the
         * alpha value; you can't specify 3 bytes per-pixel.
         */
        size_t d_bytesPerRow = src_img.size.width * 4;
        unsigned char * imgData = (unsigned char*)malloc(src_img.size.height*d_bytesPerRow);
        CGContextRef context =  CGBitmapContextCreate(imgData, src_img.size.width,
                                                      src_img.size.height,
                                                      8, d_bytesPerRow,
                                                      d_colorSpace,
                                                      kCGImageAlphaNoneSkipFirst);
    
        UIGraphicsPushContext(context);
        // These next two lines 'flip' the drawing so it doesn't appear upside-down.
        CGContextTranslateCTM(context, 0.0, src_img.size.height);
        CGContextScaleCTM(context, 1.0, -1.0);
        // Use UIImage's drawInRect: instead of the CGContextDrawImage function, otherwise you'll have issues when the source image is in portrait orientation.
        [src_img drawInRect:CGRectMake(0.0, 0.0, src_img.size.width, src_img.size.height)];
        UIGraphicsPopContext();
    
        /*
         * At this point, we have the raw ARGB pixel data in the imgData buffer, so
         * we can perform whatever image processing here.
         */
    
    
        // After we've processed the raw data, turn it back into a UIImage instance.
        CGImageRef new_img = CGBitmapContextCreateImage(context);
        UIImage * convertedImage = [[UIImage alloc] initWithCGImage:
                                     new_img];
    
        CGImageRelease(new_img);
        CGContextRelease(context);
        CGColorSpaceRelease(d_colorSpace);
        free(imgData);
        return convertedImage;
    }
    

    I’ve also gone a lot of experimentation preparing the image for tesseract. Resizing, converting to grayscale, then adjusting brightness and contrast seems to work best.

    I’ve also tried this GPUImage library. https://github.com/BradLarson/GPUImage
    And the GPUImageAverageLuminanceThresholdFilter seems to give me a great adjusted image, but tesseract doesn’t seem to work well with it.

    I’ve also put in opencv into my project and plan to try out it’s image routines. Possibly even some box detection to find the text area (i’m hoping this will speed up tesseract).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to implement an application to receive a file from a Bluetooth
I am trying to implement OCR for my Windows Mobile application. I would like
I would like to implement a full text search in an iPhone application. I
I would like to implement a function with R that removes repeated characters in
I would like to implement a switch button, android.widget.Switch (available from API v.14). <Switch
I would like to implement a simple AR desktop application. This application should first
We would like to implement a web form that automatically saves content at regular
I would like to implement an apps that allow users save the webpage including
I would like to implement a command line interface for a Java application. This
I would like to implement a function that takes as input a size n

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.