Обновление OpenCV 4.5 – константы не объявленыC++

Программы на C++. Форум разработчиков
Ответить
Anonymous
 Обновление OpenCV 4.5 – константы не объявлены

Сообщение Anonymous »

После обновления OpenCV 3.2 до 4.5 я получаю пару ошибок компиляции. Кажется, некоторые константы изменили имена
CV_ADAPTIVE_THRESH_GAUSSIAN_C
CV_FILLED

Ошибка
g++ -O3 -std=c++17 txtbin.cpp -o txtbin `pkg-config opencv4 --cflags --libs`
In file included from txtbin.hpp:8,
from txtbin.cpp:11:
deskew.hpp: In member function ‘cv::Mat Deskew::preprocess(const cv::Mat&)’:
deskew.hpp:85:42: error: ‘CV_ADAPTIVE_THRESH_GAUSSIAN_C’ was not declared in this scope
85 | cv::adaptiveThreshold(img, thresh, 255, CV_ADAPTIVE_THRESH_GAUSSIAN_C, cv::THRESH_BINARY, 15, -2);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from txtbin.cpp:11:
txtbin.hpp: In member function ‘void Txtbin::remove_boxes(cv::Mat&)’:
txtbin.hpp:217:79: error: ‘CV_FILLED’ was not declared in this scope; did you mean ‘CLD_KILLED’?
217 | cv::drawContours(mask, contours.contours, i, cv::Scalar(255, 255, 255), CV_FILLED);
| ^~~~~~~~~
| CLD_KILLED
txtbin.hpp: In member function ‘void Txtbin::remove_noise(cv::Mat&)’:
txtbin.hpp:262:78: error: ‘CV_FILLED’ was not declared in this scope; did you mean ‘CLD_KILLED’?
262 | cv::drawContours(mask, contours.contours, i, cv::Scalar(255, 255, 255), CV_FILLED);
| ^~~~~~~~~
| CLD_KILLED
txtbin.hpp: In member function ‘void Txtbin::remove_artifacts(cv::Mat&)’:
txtbin.hpp:289:77: error: ‘CV_FILLED’ was not declared in this scope; did you mean ‘CLD_KILLED’?
289 | cv::drawContours(mask, contours.contours, i, cv::Scalar(255, 255, 255), CV_FILLED);
| ^~~~~~~~~
| CLD_KILLED
txtbin.hpp: In member function ‘Txtbin::Bbox Txtbin::detect_textblock()’:
txtbin.hpp:352:76: error: ‘CV_FILLED’ was not declared in this scope; did you mean ‘CLD_KILLED’?
352 | cv::drawContours(mask, contours.contours, i, cv::Scalar(255, 255, 255), CV_FILLED);
| ^~~~~~~~~
| CLD_KILLED
txtbin.hpp: In member function ‘void Txtbin::detect_background_invert()’:
txtbin.hpp:498:79: error: ‘CV_FILLED’ was not declared in this scope; did you mean ‘CLD_KILLED’?
498 | cv::drawContours(mask, contours.contours, c, cv::Scalar(255, 255, 255), CV_FILLED);
| ^~~~~~~~~
| CLD_KILLED


Подробнее здесь: https://stackoverflow.com/questions/717 ... t-declared
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «C++»