微信公众号:OpenCV学堂
关注获取更多计算机视觉与深度学习知识
工作流引擎介绍
配置文件生成
下载与配置工作流引擎SDK
https://appetjpz4tj8166.h5.xiaoeknow.com/p/course/ecourse/preview/course_2XtK2sEi7HNUwt2WscP6tFwxpIb?
解压缩安装包到D盘
D:\oemts_workflow_lib
包含目录
D:\oemts_workflow_lib\include
库目录
D:\oemts_workflow_lib\lib
连接器
D:\oemts_worflow_engine.lib
#include "main_workflow.h"
#include
#include
int main(int argc, char** argv) {
std::shared_ptr engine(new QTongCoreCVWorkFlow());
bool succ = engine->initWorkFlow("D:/oemts_workflow_lib/find_defeact.vm", "69585e470300cdb5a6910131eb639882");
if (!succ) {
std::cout << "Could not load workflow file here..." << std::endl;
return -1;
}
cv::Mat frame = cv::imread("D:/oemts_workflow_lib/4156.bmp");
cv::namedWindow("OpenCV实验大师 C++工作流引擎演示", cv::WINDOW_NORMAL);
cv::Mat result;
std::vector<std::string> logs;
engine->run_workflow(frame, result, logs);
cv::imshow("OpenCV实验大师 C++工作流引擎演示", result);
cv::waitKey(0);
cv::destroyAllWindows();
return 0;
}
SDK调用测试
边缘模板匹配 - 加载配置文件与初始化工作流:
std::shared_ptr
engine(new QTongCoreCVWorkFlow()); bool succ = engine->initWorkFlow("D:/qtong_edge_match.vm", "38735ef8da3a49d5d17d882462bf515b");
cv::Mat frame = cv::imread("D:/facedb/template_t1/cdc.png");
cv::Mat gray;
cv::cvtColor(frame, gray, cv::COLOR_BGR2GRAY);
cv::Mat result;
std::vector<std::string> logs;
engine->run_workflow(gray, result, logs);
运行结果如下:
std::shared_ptr
engine(new QTongCoreCVWorkFlow()); bool succ = engine->initWorkFlow("D:/qtong_caliper.vm", "38735ef8da3a49d5d17d882462bf515b");
if (!succ) {
std::cout << "Could not load workflow file here..." << std::endl;
return -1;
}
cv::Mat frame = cv::imread("D:/images/vm_test/bcirce.jpg");
cv::Vec4i circle(218, 208, 88, -1);
cv::Mat result;
engine->run_measure(frame, result, circle);
cv::Vec3i cc = engine->getMeasureCircleInfo();
std::cout << " x= " << cc[0] << " y= " << cc[1] << " radius = " << cc[2] << std::endl;
cv::imshow("reuslt", result);
运行结果截图如下:
OpenCV4系统化学习