#include "../../nodes/vp_image_src_node.h"
|
#include "../../nodes/infers/vp_ppocr_text_detector_node.h"
|
#include "../../nodes/proc/vp_expr_check_node.h"
|
#include "../../nodes/osd/vp_expr_osd_node.h"
|
#include "../../nodes/broker/vp_expr_socket_broker_node.h"
|
#include "../../nodes/vp_screen_des_node.h"
|
#include "../../nodes/vp_rtmp_des_node.h"
|
#include "../../utils/analysis_board/vp_analysis_board.h"
|
|
/*
|
* ## math_expression_check_pipeline ##
|
* detect math expressions first, then parse and calculate, send results(yes or no) via socket.
|
*/
|
|
int main(int argc, char* argv[]) {
|
// get directory for test video and models
|
assert(argc == 2);
|
std::string data_dir(argv[1]);
|
if (!vp_utils::ends_with(data_dir, "/")) {
|
data_dir += "/";
|
}
|
|
VP_SET_LOG_LEVEL(vp_utils::vp_log_level::INFO);
|
VP_LOGGER_INIT();
|
|
// create nodes
|
//auto file_src_0 = std::make_shared<vp_nodes::vp_file_src_node>("file_src_0", 0, "./vp_data/test_video/ocr.mp4", 0.4);
|
auto image_src_0 = std::make_shared<vp_nodes::vp_image_src_node>("image_src_0", 0, data_dir + "vp_data/test_images/text/math/%d.jpg", 3);
|
auto ppocr_text_detector = std::make_shared<vp_nodes::vp_ppocr_text_detector_node>("ppocr_text_detector", data_dir + "vp_data/models/text/ppocr/ch_PP-OCRv3_det_infer", data_dir + "vp_data/models/text/ppocr/ch_ppocr_mobile_v2.0_cls_infer", data_dir + "vp_data/models/text/ppocr/ch_PP-OCRv3_rec_infer", data_dir + "vp_data/models/text/ppocr/ppocr_keys_v1.txt");
|
auto expr_checker = std::make_shared<vp_nodes::vp_expr_check_node>("expr_checker");
|
auto osd = std::make_shared<vp_nodes::vp_expr_osd_node>("osd", data_dir + "vp_data/font/NotoSansCJKsc-Medium.otf");
|
auto broker = std::make_shared<vp_nodes::vp_expr_socket_broker_node>("broker", "192.168.77.68", 3333, "static/screenshot_images");
|
auto screen_des_0 = std::make_shared<vp_nodes::vp_screen_des_node>("screen_des_0", 0);
|
auto rtmp_des_0 = std::make_shared<vp_nodes::vp_rtmp_des_node>("rtmp_des_0", 0, "rtmp://192.168.77.60/live/math_review");
|
|
// construct pipeline
|
ppocr_text_detector->attach_to({image_src_0});
|
expr_checker->attach_to({ppocr_text_detector});
|
osd->attach_to({expr_checker});
|
broker->attach_to({osd});
|
screen_des_0->attach_to({broker});
|
rtmp_des_0->attach_to({broker});
|
|
// start pipeline
|
image_src_0->start();
|
|
// visualize pipeline for debug
|
vp_utils::vp_analysis_board board({image_src_0});
|
board.display();
|
}
|