我刚刚下载并设法在两个不同的项目中分别运行tesseract ocr和openCV。 (新的opencv和tesseract与iOS 7兼容)
我想将它们包含在一个项目(目标)中。
问题是OpenCV需要使用libc ++作为C ++标准库。虽然TesserAct需要使用Compiler Default作为C ++标准库。
有没有办法设置它们并告诉Xcode使用libc ++ for opencv和Compiler Default for tesseract?
答案 0 :(得分:0)
您可以尝试this example。我在这个项目中尝试了OpenCV
的图像增强功能,我认为它非常好。
答案 1 :(得分:0)
你可能正在谈论这样的事情。我将分享我的经验,当我完全成功OCR :)
cv::vector<cv::Mat> produceThresholds(const cv::Mat img_gray) {
const int THRESHOLD_COUNT = 4;
// Mat img_equalized = equalizeBrightness(img_gray);
cv::vector<cv::Mat> thresholds;
for (int i = 0; i < THRESHOLD_COUNT; i++)
thresholds.push_back(cv::Mat(img_gray.size(), CV_8U));
int i = 0;
// Adaptive
// adaptiveThreshold(img_gray, thresholds[i++], 255, ADAPTIVE_THRESH_MEAN_C,
// THRESH_BINARY_INV , 7, 3);
// adaptiveThreshold(img_gray, thresholds[i++], 255, ADAPTIVE_THRESH_MEAN_C,
// THRESH_BINARY_INV , 13, 3);
// adaptiveThreshold(img_gray, thresholds[i++], 255, ADAPTIVE_THRESH_MEAN_C,
// THRESH_BINARY_INV , 17, 3);
// Wolf
int k = 0, win = 18;
// NiblackSauvolaWolfJolion (img_gray, thresholds[i++], WOLFJOLION, win, win,
// 0.05 + (k * 0.35));
// bitwise_not(thresholds[i-1], thresholds[i-1]);
NiblackSauvolaWolfJolion(img_gray, thresholds[i++], WOLFJOLION, win, win,
0.05 + (k * 0.35));
//bitwise_not(thresholds[i - 1], thresholds[i - 1]);
k = 1;
win = 22;
NiblackSauvolaWolfJolion(img_gray, thresholds[i++], WOLFJOLION, win, win,
0.05 + (k * 0.35));
//bitwise_not(thresholds[i - 1], thresholds[i - 1]);
// NiblackSauvolaWolfJolion (img_gray, thresholds[i++], WOLFJOLION, win, win,
// 0.05 + (k * 0.35));
// bitwise_not(thresholds[i-1], thresholds[i-1]);
// Sauvola
k = 1;
NiblackSauvolaWolfJolion(img_gray, thresholds[i++], SAUVOLA, 12, 12,
0.18 * k);
bitwise_not(thresholds[i - 1], thresholds[i - 1]);
k = 2;
NiblackSauvolaWolfJolion(img_gray, thresholds[i++], SAUVOLA, 12, 12,
0.18 * k);
//bitwise_not(thresholds[i - 1], thresholds[i - 1]);
return thresholds;
// threshold(img_equalized, img_threshold, 100, 255, THRESH_BINARY);
}