在 Qt 中使用 for 与 OpenCV3 时出错

error using for in qt with opencv3

本文关键字:OpenCV3 出错 for Qt      更新时间:2023-10-16

>我从 Mitrocontrollers 获取源代码示例,以及更多关于使用 c++ 识别车牌的信息。但我发现了一些错误。例如,我在此代码中有错误:

for (auto &vectorOfMatchingChars : vectorOfVectorsOfMatchingCharsInScene) {                     // for each group of matching chars
        PossiblePlate possiblePlate = extractPlate(imgOriginalScene, vectorOfMatchingChars);        // attempt to extract plate
        if (possiblePlate.imgPlate.empty() == false) {                                              // if plate was found
            vectorOfPossiblePlates.push_back(possiblePlate);                                        // add to vector of possible plates
        }
    }

错误是":"标记之前的预期初始值设定项,输入末尾的预期主表达式,输入末尾的预期";"等。我必须怎么做才能解决这些错误?

你应该像这样修改你的 .pro ::

TEMPLATE = app
CONFIG += console c++14
CONFIG -= app_bundle
CONFIG -= qt

专注于 C++14。这将启用C++14版本。

由于我不知道您的 .pro 是什么样子,所以我在这里举了一个例子。

要启用 C++14,您需要专门添加以下行:

配置 += c++14