【问题标题】:TesserAct and OpenCVTesserAct 和 OpenCV
【发布时间】:2014-04-04 15:34:55
【问题描述】:

我刚刚下载并设法在两个不同的项目中分别运行 tesseract ocr 和 openCV。 (新的opencv和tesseract兼容iOS 7)

我想将它们包含在单个项目(目标)中。

问题是 OpenCV 需要使用 libc++ 作为 C++ 标准库。而 TesserAct 需要使用 Compiler Default 作为 C++ 标准库。

有没有办法同时设置它们并告诉 Xcode 对 opencv 使用 libc++,对 tesseract 使用 Compiler Default?

【问题讨论】:

  • 这个问题已经得到解答。参考这个link

标签: ios opencv tesseract


【解决方案1】:

你可以试试this example。我在这个项目中尝试了OpenCV的图像增强,我认为它非常好。

【讨论】:

  • 链接上的代码结果非常糟糕。 Github 上的所有 IOS tesseract 样本都有不好的结果。
  • @CanÜrek 你肯定不能在不改变任何东西的情况下使用这段代码来获得好的结果。 OCR 的图像处理并不容易。您可以尝试我的其他问题在 OCR 之前应用二值化:stackoverflow.com/questions/21696386/…
  • 感谢您的链接。但我在 IOS 的 OCR 项目上工作了一个月。而且我无法提高我的成绩。预处理对我来说是个大问题。
  • @CanÜrek 你知道吗?我曾经在这个 OCR 项目上工作了很长时间,通过尝试多种方式,我得到了一个很好的结果(不完美,但仍然很好)。查看这个库(在我之前的接受答案中)liris.cnrs.fr/christian.wolf/software/binarize 并使用正确的参数尝试自己的库(在许多情况下进行测试,直到获得方面结果)。我只能这样帮你。祝你好运!
【解决方案2】:

您可能在谈论这样的事情。当我完全成功 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);
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-02
    • 2014-12-02
    • 1970-01-01
    • 2015-07-14
    • 1970-01-01
    • 2023-03-16
    相关资源
    最近更新 更多