// // Created by alg002 on 8/22/24. // #ifndef NANOTRACK_DEMO_DEMO_UTILS_H #define NANOTRACK_DEMO_DEMO_UTILS_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "gd_alg_type.h" #include "cJSON.h" #include #include #include using namespace std; using namespace cv; std::vector ImgsTxtReader(std::string imgTxtPath); std::string replace_str(std::string str, const std::string& from, const std::string& to); cv::Rect ExpandRect(cv::Rect rectin, float ratio, int imW,int imH); bool UpdateTrackScoreDeque(std::deque &sts, float score, int size, float sthd, float *avgScore); void resolve_labeled_json(const char*js_file, gud_rect_t1 *bbox); int resolve_mulit_labeled_json(const char*js_file, gud_rect_t1 *bbox); void cxy_wh_2_rect(const cv::Point2f& pos, const cv::Point2f& sz, cv::Rect &rect); void ot_v2_jsonReader(const char *js_path, gud_nano_config_t *ot_config); int DirAndMkdir(const char* pathname); void Stringsplit(string str, const char split,vector& res); void stripWhiteSpace (string &str); int CV_RectIOU(cv::Rect re1, cv::Rect re2); void swapYUV_I420toNV12(unsigned char* i420bytes, unsigned char* nv12bytes, int width, int height); void BGR2YUV_nv12(cv::Mat src, cv::Mat &dst); std::vector get_color(int cls); #endif //NANOTRACK_DEMO_DEMO_UTILS_H