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

  • SEARCH
  • Home
  • 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 9031421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T07:43:42+00:00 2026-06-16T07:43:42+00:00

I use tesseract and opencv in my project. But the problem is when I

  • 0

I use tesseract and opencv in my project.

But the problem is when I use opencv to show the image, there only appear the image window but the image didn’t appear and it was totally grey.

If I comment the codes related to tesseract, the opencv can shoow image properly.

It’s so weird. Can any body help me?

Thanks in advance!

#include "stdafx.h"
#include <string>
#include <opencv2/opencv.hpp>

using namespace std;
using namespace cv;


int main() {
// [1]
const char* imagename = "phototest.tif";
Mat img = imread(imagename);
if(img.empty())
{
    fprintf(stderr, "Can not load image %s\n", imagename);
    return -1;
}
imshow("image", img);

tesseract::TessBaseAPI *myOCR = 
        new tesseract::TessBaseAPI();

// [2]
printf("Tesseract-ocr version: %s\n",
       myOCR->Version());
printf("Leptonica version: %s\n",
       getLeptonicaVersion());

// [3]
if (myOCR->Init(NULL, "eng")) {
  fprintf(stderr, "Could not initialize tesseract.\n");
  exit(1);
}

// [4]
Pix *pix = pixRead("phototest.tif");
myOCR->SetImage(pix);

// [5]
char* outText = myOCR->GetUTF8Text();
printf("OCR output:\n\n");
printf(outText);

// [6]
myOCR->Clear();
myOCR->End();
delete [] outText;
pixDestroy(&pix);
system("pause");
return 0;
}   
  • 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-16T07:43:44+00:00Added an answer on June 16, 2026 at 7:43 am

    Can you try to add a cv::waitkey(10) somewhere after your imshow, that may solve your problem.
    You can replace system(pause) by cv::waitkey(-1) also.

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

Sidebar

Related Questions

use an icon (.png transparent background) for my menu. There isn't any problem for
I have a problem with a locally installed library. In my project there is
i am tying to build a tesseract project to use as a library for
I'm developing an android app that uses the OpenCV and Tesseract library. I only
Use Case Show a photo uploaded by the user in a square box with
I'm trying to use Tesseract-OCR to detect the text of images with pure text
I am trying to use tesseract-2.04 in my iPhone application and just want to
I have got the Libraries for Number Recognition i.e tesseract But i dont know
I tried to configure NetBeans(7.2) project to use Tess4J library. Unfortunately all I get
I understand that I need to use LoadLibrary(). But what other steps do I

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.