You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
1.7 KiB

7 months ago
//
// Created by alg002 on 8/22/24.
//
#ifndef NANOTRACK_DEMO_DEMO_UTILS_H
#define NANOTRACK_DEMO_DEMO_UTILS_H
#include <iostream>
#include <cstdlib>
#include <chrono>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fstream>
#include <unistd.h>
#include <pthread.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <fcntl.h>
#include <vector>
#include <math.h>
#include <deque>
#include <sys/ioctl.h>
#include <dirent.h>
#include <iostream>
#include "gd_alg_type.h"
#include "cJSON.h"
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
using namespace std;
using namespace cv;
std::vector <std::string> 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<float> &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<string>& 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<int> get_color(int cls);
#endif //NANOTRACK_DEMO_DEMO_UTILS_H