#pragma once #include #include "../vp_node.h" namespace vp_nodes { // on screen display(short as osd) node. // used for displaying vehicle plate on frame, draw rectangle according to plate color class vp_plate_osd_node: public vp_node { private: // support chinese font cv::Ptr ft2; float mask_threshold = 0.3; // draw color on frame std::map draw_colors {{"blue", cv::Scalar(255, 0, 0)}, {"green", cv::Scalar(0, 255, 0)}, {"yellow", cv::Scalar(0, 255, 255)}, {"white", cv::Scalar(255, 255, 255)}}; // map to Chinese std::map text_colors {{"blue", "蓝"}, {"green", "绿"}, {"yellow", "黄"}, {"white", "白"}}; // history plates at the bottom of screen std::vector plates_his; int height_his = 100; int gap_his = 10; bool display_his = true; protected: virtual std::shared_ptr handle_frame_meta(std::shared_ptr meta) override; public: vp_plate_osd_node(std::string node_name, std::string font = "", bool display_his = true); ~vp_plate_osd_node(); }; }