Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "ros/ros.h"
00026 #include <message_filters/time_synchronizer.h>
00027 #include "TextLocator.hpp"
00028
00029 using namespace ros;
00030 using namespace std;
00031
00032 int main(int argc, char **argv) {
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053 init(argc, argv, "text_locator_node");
00054 NodeHandle n;
00055 Rate r(3);
00056
00057 vector<ccv_swt_param_t> params;
00058 params.push_back(ccv_swt_default_params);
00059 bool enableRecognition, enableDebug, enablePcl;
00060 param::param<bool>("enable_recognition", enableRecognition, true);
00061 param::param<bool>("enable_pcl", enablePcl, true);
00062 param::param<bool>("enable_param_debug", enableDebug, false);
00063
00064 string lang, page_mode;
00065 param::param<std::string>("lang", lang, "eng");
00066 param::param<std::string>("page_mode", page_mode, "PSM_SINGLE_LINE");
00067
00068 tesseract::PageSegMode pagesegmode;
00069 if (page_mode == "PSM_OSD_ONLY") {
00070 pagesegmode = tesseract::PSM_OSD_ONLY;
00071 } else if (page_mode == "PSM_AUTO_OSD") {
00072 pagesegmode = tesseract::PSM_AUTO_OSD;
00073 } else if (page_mode == "PSM_AUTO_ONLY") {
00074 pagesegmode = tesseract::PSM_AUTO_ONLY;
00075 } else if (page_mode == "PSM_AUTO") {
00076 pagesegmode = tesseract::PSM_AUTO;
00077 } else if (page_mode == "PSM_SINGLE_COLUMN") {
00078 pagesegmode = tesseract::PSM_SINGLE_COLUMN;
00079 } else if (page_mode == "PSM_SINGLE_BLOCK_VERT_TEXT") {
00080 pagesegmode = tesseract::PSM_SINGLE_BLOCK_VERT_TEXT;
00081 } else if (page_mode == "PSM_SINGLE_BLOCK") {
00082 pagesegmode = tesseract::PSM_SINGLE_BLOCK;
00083 } else if (page_mode == "PSM_SINGLE_LINE") {
00084 pagesegmode = tesseract::PSM_SINGLE_LINE;
00085 } else if (page_mode == "PSM_SINGLE_WORD") {
00086 pagesegmode = tesseract::PSM_SINGLE_WORD;
00087 } else if (page_mode == "PSM_SINGLE_CHAR") {
00088 pagesegmode = tesseract::PSM_SINGLE_CHAR;
00089 }
00090
00091 ros_text_locator::TextLocator tl(n, pagesegmode, lang, params,
00092 enableRecognition, enableDebug, enablePcl);
00093 tl.run();
00094
00095 while (ros::ok())
00096 {
00097 ros::spinOnce();
00098 r.sleep();
00099 }
00100
00101 return 0;
00102 }