• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TessBaseAPI类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中TessBaseAPI的典型用法代码示例。如果您正苦于以下问题:C++ TessBaseAPI类的具体用法?C++ TessBaseAPI怎么用?C++ TessBaseAPI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TessBaseAPI类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: ClearAdaptiveClassifier

void TesseractProcessor::ClearAdaptiveClassifier()
{
	if (_apiInstance != NULL)
	{
		TessBaseAPI* api = (TessBaseAPI*)_apiInstance.ToPointer();
		api->ClearAdaptiveClassifier();
	}
}
开发者ID:DilipNikam,项目名称:tesseractdotnet,代码行数:8,代码来源:TesseractInitializer.cpp


示例2: End

void TesseractProcessor::End()
{
	if (_apiInstance != NULL)
	{
		TessBaseAPI* api = (TessBaseAPI*)_apiInstance.ToPointer();
		api->End();
	}
}
开发者ID:DilipNikam,项目名称:tesseractdotnet,代码行数:8,代码来源:TesseractInitializer.cpp


示例3: DisableThresholder

void TesseractProcessor::DisableThresholder()
{
	if (_apiInstance == NULL)
		return;

	TessBaseAPI* api = (TessBaseAPI*)_apiInstance.ToPointer();
	
	api->SetThresholder(NULL);
}
开发者ID:EdsonMoretti95,项目名称:tesseract-ocr-dotnet,代码行数:9,代码来源:TesseractConfigurator.cpp


示例4: UseThresholder

void TesseractProcessor::UseThresholder()
{
	if (_apiInstance == NULL)
		return;

	TessBaseAPI* api = (TessBaseAPI*)_apiInstance.ToPointer();
	
	ImageThresholder* thresholder = new ImageThresholder();
	api->SetThresholder(thresholder);
}
开发者ID:EdsonMoretti95,项目名称:tesseract-ocr-dotnet,代码行数:10,代码来源:TesseractConfigurator.cpp


示例5: SetVariable

bool TesseractProcessor::SetVariable(System::String* name, System::String* value)
{
	if (_apiInstance == NULL)
		return false;

	TessBaseAPI* api = (TessBaseAPI*)_apiInstance.ToPointer();
	bool succeed = api->SetVariable(Helper::StringToPointer(name), Helper::StringToPointer(value));

	return succeed;
}
开发者ID:EdsonMoretti95,项目名称:tesseract-ocr-dotnet,代码行数:10,代码来源:TesseractConfigurator.cpp


示例6: GetTesseractEngineVersion

String* TesseractProcessor::GetTesseractEngineVersion()
{
	if (_apiInstance != NULL)
	{
		TessBaseAPI* api = (TessBaseAPI*)_apiInstance.ToPointer();
		return Helper::PointerToString(api->Version());
	}

	return NULL;
}
开发者ID:DilipNikam,项目名称:tesseractdotnet,代码行数:10,代码来源:TesseractInitializer.cpp


示例7: GetStringVariable

System::String* TesseractProcessor::GetStringVariable(System::String* name)
{
	if (_apiInstance == NULL)
		return false;

	TessBaseAPI* api = (TessBaseAPI*)_apiInstance.ToPointer();

	const char *value = api->GetStringVariable(Helper::StringToPointer(name));

	return Helper::PointerToString(value);
}
开发者ID:EdsonMoretti95,项目名称:tesseract-ocr-dotnet,代码行数:11,代码来源:TesseractConfigurator.cpp


示例8: GetDoubleVariable

bool TesseractProcessor::GetDoubleVariable(System::String* name, double __gc* value)
{
	if (_apiInstance == NULL)
		return false;

	TessBaseAPI* api = (TessBaseAPI*)_apiInstance.ToPointer();

	double val = 0;
	bool succeed = api->GetDoubleVariable(Helper::StringToPointer(name), &val);
	*value = val;

	return succeed;
}
开发者ID:EdsonMoretti95,项目名称:tesseract-ocr-dotnet,代码行数:13,代码来源:TesseractConfigurator.cpp


示例9: ocr_tesseract

string ocr_tesseract(Mat im) {
	// Pass it to Tesseract API
    TessBaseAPI tess;
    tess.Init(NULL, "eng", OEM_DEFAULT);
    tess.SetPageSegMode(PSM_SINGLE_BLOCK);
    tess.SetImage((uchar*)im.data, im.cols, im.rows, 1, im.cols);

    // Get the text
    char* out = tess.GetUTF8Text();
    string ret = (string)out;
    
    return ret;
}
开发者ID:koroder,项目名称:Audio-streaming-of-classroom-projection,代码行数:13,代码来源:processImage_1.cpp


示例10: InternalFinally

void TesseractProcessor::InternalFinally()
{
	if (_apiInstance != NULL)
	{
		TessBaseAPI* api = (TessBaseAPI*)_apiInstance.ToPointer();

		api->End();

		delete api;
		api = null;

		_apiInstance = NULL;
	}
}
开发者ID:DilipNikam,项目名称:tesseractdotnet,代码行数:14,代码来源:TesseractInitializer.cpp


示例11: str

	DLL_API char *ocr(char *argv)
	{
		TessBaseAPI myOCR;
		string str(argv);		
		string delimiter = " ";

		size_t pos = 0;
		string token;
		vector <string> vecArgv;
		while ((pos = str.find(delimiter)) != std::string::npos) 
		{
			token = str.substr(0, pos);
			vecArgv.push_back(token);			
			str.erase(0, pos + delimiter.length());
		}

		vecArgv.push_back(str);
		if (vecArgv.size() != 2)
		{		
			return "오류 : 인자값 : 언어(eng or kor) 파일명";
		}

		if (myOCR.Init(NULL, vecArgv[0].c_str()))
		{				
			return "오류 : Init";
		}

		static string strMsg;
		STRING text_out;
		if (!myOCR.ProcessPages(vecArgv[1].c_str(), NULL, 0, &text_out))
		{			
			return "오류 : ProcessPages";
		}		

		strMsg = text_out.string();		

		int nLen = MultiByteToWideChar(CP_UTF8, 0, strMsg.c_str(), strMsg.size(), NULL, NULL);
		wstring strUni(nLen,0);
		MultiByteToWideChar(CP_UTF8, 0, strMsg.c_str(), strMsg.size(), &strUni[0], nLen);		
		
		strMsg.clear();
		nLen = WideCharToMultiByte(CP_ACP, 0, &strUni[0], -1, NULL, 0, NULL, NULL);			
		strMsg.resize(nLen,0);
		WideCharToMultiByte(CP_ACP, 0, &strUni[0], -1, &strMsg[0], nLen, NULL, NULL);			

		myOCR.End();
		return (char *)strMsg.c_str();
	}
开发者ID:sddari,项目名称:Flow,代码行数:48,代码来源:Ocr.cpp


示例12: Init

bool TesseractProcessor::Init(String* dataPath, String* lang, int ocrEngineMode)
{
	bool bSucced = false;

	_dataPath = dataPath;
	_lang = lang;
	_ocrEngineMode = ocrEngineMode;

	if (_apiInstance != NULL)
	{
		TessBaseAPI* api = (TessBaseAPI*)_apiInstance.ToPointer();
		bSucced = api->Init(
			Helper::StringToPointer(dataPath), 
			Helper::StringToPointer(lang),
			TesseractConverter::ParseOcrEngineMode(ocrEngineMode)) >= 0;
	}

	return bSucced;
}
开发者ID:DilipNikam,项目名称:tesseractdotnet,代码行数:19,代码来源:TesseractInitializer.cpp


示例13: OCRit

//----------------------------------------------------------------------------------
void OCRit(Mat inputimg, vector<vector<Point>>points, char data[][60], Mat &outputimg, char lang[]){
	TessBaseAPI tess;
	
	tess.Init(NULL, lang, OEM_DEFAULT);
	cout << "\n\n";
	for (unsigned int c = 0; c < points.size(); c++){
		Mat imag = inputimg(Rect(points[c][0], points[c][1]));
		Mat img;
		cvtColor(imag, img, COLOR_BGR2GRAY);//use img to do ocr now

		tess.SetImage((uchar*)img.data, img.size().width, img.size().height, img.channels(), img.step1());
		char* out = tess.GetUTF8Text();
		cout << c + 1 << " -- " << out << "\n";
		strcpy(data[c],out);
		//removed to prevent alteration of original pan
		//rectangle(outputimg, points[c][0], points[c][1],1,4,0);
	}



}
开发者ID:Pranavgulati,项目名称:VeriSmart,代码行数:22,代码来源:Source.cpp


示例14: GetBoolVariable

BEGIN_NAMSPACE

USING_COMMON_SYSTEM

USING_TESSERACT

USING_TESSERACT_ENGINE_WRAPPER


// ===============================================================
// GET/SET VARIABLES
bool TesseractProcessor::GetBoolVariable(System::String* name, bool __gc* value)
{
	if (_apiInstance == NULL)
		return false;

	TessBaseAPI* api = (TessBaseAPI*)_apiInstance.ToPointer();

	bool val = false;
	bool succeed = api->GetBoolVariable(Helper::StringToPointer(name), &val);
	*value = val;

	return succeed;
}
开发者ID:EdsonMoretti95,项目名称:tesseract-ocr-dotnet,代码行数:24,代码来源:TesseractConfigurator.cpp


示例15: main


//.........这里部分代码省略.........
		{
			if (testSortingOk[k] == sudokuRect[j].x)
				temp.push_back(sudokuRect[j]);
			else
			{
				for (int t = i; t <= ti + 9; t++)
				{
					if (testSortingOk[k] == sudokuRect[t].x)
					{
						temp.push_back(sudokuRect[t]);
						break;
					}
				}
			}

			k++;
		}

	}

	sudokuRect.clear();
	erode(resultImage, resultImage, crossKernel, Point(-1, -1), 1);
	dilate(resultImage, resultImage, elipseKernel, Point(-1, -1), 1);
	for (int k = 0; k < temp.size(); k++)
		sudokuRect.push_back(temp[k]);
	for (int k = 0; k < sudokuRect.size(); k++)
	{
		rectangle(resultImage, sudokuRect[k], Scalar(128, 255, 255), 2);//그림
		imshow("testSudoImage34", resultImage);
		waitKey();
	}

		const char *path = "/tessdate";
	TessBaseAPI tess; //tesseract 선언

		//TessBaseAPI *api = new TessBaseAPI();

	tess.Init(NULL, "eng", tesseract::OEM_DEFAULT); //한국어로 인식 기본 숫자 되어있음
	/*
		if (api->Init(NULL, "eng"))
		{
			fprintf(stderr, "could not initailze teseract\n");
			exit(1);
		}
		*/

	string tessRecogNum[81][1]; //글자로 인식해오므로 넣을곳 만들어줌
	int sudoTestte[81]; //스도쿠 번호 넣을곳을 만들어줌
	int d = 0;

	for (int i = 0; i<sudokuRect.size(); i++)
	{
		cvtColor(testSudo, testSudoImage, COLOR_GRAY2BGR);
		rectangle(testSudoImage, sudokuRect[i], Scalar(128, 255, 255), 2);//그림

		Mat cutImage = testSudo(sudokuRect[i]);
		//	imshow("cutImage", cutImage);
		Mat tempImage = repeat(cutImage, 1, 1);


		Mat numberImage = tempImage.clone();//스도쿠 된것만 복사시킴
		//imshow("numberImage", numberImage);
		imwrite("numberImage.jpg", numberImage, params);
		Mat resultNImage(tempImage.size(), CV_8UC3);
		waitKey();
开发者ID:Wandererer,项目名称:SudokuImageRecongnitionUsingTesseract3.0.2,代码行数:66,代码来源:sudokutesseracttest.cpp


示例16: main

int main(int argc, char* argv[]) {
 
    const char* name_main = "Plate Recognition";
    const char* name_edge = "Edge Window";
    #if defined(__DMDEBUG)
    const char* name_mask = "Mask Window";
    #endif
    const char* name_bwframe = "BW Window";
    const char* name_crop = "CROP Window";
    const char* name_ctrl = "Control Window";


    unsigned int i;
    Mat frame;
    Mat bwframe;
    Mat edge;

    TessBaseAPI *OCR = new TessBaseAPI();
    if(OCR->Init(NULL, "eng")) {
      cout << "Could not initialize tesseract OCR\n";
      return -1;
    }

    if( argc != 2) {
      cout << "You must specify a file to load\n";
      return -1;
    }
     
    VideoCapture cap(argv[1]);
    if(!cap.isOpened()) {
      cout << "Cannot open file " << argv[1] << endl;
      return -1;
    }

    namedWindow(name_main, 0);
    namedWindow(name_edge, 0);
    #if defined(__DMDEBUG)
    namedWindow(name_mask, 0);
    #endif
    namedWindow(name_bwframe, 0);
    namedWindow(name_ctrl, 0);
    //#if defined(__DMDEBUG)
    namedWindow(name_crop, 0);

    namedWindow("AAA", 0);

    //#endif
    createTrackbar( "Contour perimeter", name_ctrl, &high_switch_value, 100, switch_callback_h, NULL );
    createTrackbar( "Min area", name_ctrl, &minimum_area, 100000, NULL, NULL);
    createTrackbar( "Max area", name_ctrl, &maximum_area, 100000, NULL, NULL);
    createTrackbar( "Threshold", name_ctrl, &threshold_val, 255, NULL, NULL);
    //createTrackbar( "thr size", name_ctrl, &athr_size, 255, athr_callback, &athr_size);
    createTrackbar( "Plate Thr", name_ctrl, &threshold2_val, 255, NULL, NULL);
    //createTrackbar( "PThr size", name_ctrl, &athr2_size, 255, athr_callback, &athr2_size);

    waitKey();

    for(;;) {

      //try {
         cap >> frame;
      //} catch(int e) {
      //   frame = imread(argv[1], 3);
      //}
      cvtColor(frame, bwframe, CV_RGB2GRAY);

      imshow(name_bwframe, bwframe); 

      // extract V channel from HSV image
      Mat vframe(frame.rows, frame.cols, CV_8UC1);
      Mat tvframe(frame.rows, frame.cols, CV_8UC3);
      cvtColor(frame, tvframe, CV_RGB2HSV);
      int from_to[] = { 2,0 };
      mixChannels( &tvframe, 1, &vframe,1, from_to, 1);

      // maximize contrast
      // https://github.com/oesmith/OpenANPR/blob/master/anpr/preprocess.py
      Mat el=getStructuringElement(MORPH_ELLIPSE, Size(3,3), Point(1,1));
      Mat bh(vframe.rows, vframe.cols, CV_8UC1);
      Mat th(vframe.rows, vframe.cols, CV_8UC1);
      Mat s1(vframe.rows, vframe.cols, CV_8UC1);
      morphologyEx(vframe, th, MORPH_TOPHAT, el, Point(1,1), 1);
      morphologyEx(vframe, bh, MORPH_BLACKHAT, el, Point(1,1), 1);
      add(vframe, th, s1);
      subtract(s1,bh, vframe);

      // Smooth image to remove rumor
      GaussianBlur(vframe, vframe, Size(5,5), 5, 5, BORDER_DEFAULT);

      imshow("AAA", vframe);

      // apply your filter
      Canny(bwframe, edge, threshold_val, 255);
      //Canny(vframe, edge, threshold_val, 255);
      //threshold( bwframe, edge, threshold_val, 255, CV_THRESH_BINARY );
      //threshold( vframe, edge, threshold_val, 255, CV_THRESH_BINARY );
      //adaptiveThreshold(bwframe, edge, threshold_val, 
      //                  CV_ADAPTIVE_THRESH_GAUSSIAN_C, CV_THRESH_BINARY, athr_size, 5);
                       // OR CV_ADAPTIVE_THRES_MEAN_C
      //adaptiveThreshold(vframe, edge, threshold_val, CV_ADAPTIVE_THRESH_GAUSSIAN_C, CV_THRESH_BINARY_INV, athr_size, 9);
//.........这里部分代码省略.........
开发者ID:liangsirrun,项目名称:liprec,代码行数:101,代码来源:liprec_old.cpp



注:本文中的TessBaseAPI类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Tesselator类代码示例发布时间:2022-05-31
下一篇:
C++ TerrainTile类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap