//
|
// Created by Scheaven on 2019/11/18.
|
//
|
#include "h_interface.h"
|
#include "std_target.h"
|
#include "time.h"
|
|
|
#ifdef OPENCV
|
#include <opencv2/opencv.hpp> // C++
|
#pragma comment(lib, "opencv_core249.lib")
|
#pragma comment(lib, "opencv_imgproc249.lib")
|
#pragma comment(lib, "opencv_highgui249.lib")
|
|
#endif // OPENCV
|
using namespace std;
|
using namespace cv;
|
void* handle;
|
|
int main(int argc, char *argv[])
|
{
|
// //视频流信息
|
VideoCapture cap;
|
VideoCapture cap2;
|
int cam_id = 0;
|
int cam_id2 = 1;
|
std::string cam_name = "18eadadc-f583-4517-8c5d-e2a8cb605f97";
|
std::string cam_name2 = "71ddf5e0-c059-48d7-8a58-dfe824d6e462";
|
|
try {
|
// cap.open("rtsp://admin:a1234567@192.168.5.35:554/h264/ch1/main/av_stream");
|
// cap2.open("rtsp://admin:a1234567@192.168.5.34:554/h264/ch1/main/av_stream");
|
cap.open("/data/disk1/project/data/01_reid/sun_37.avi");
|
cap2.open("/data/disk1/project/data/01_reid/sun_51.avi");
|
// cap.open("/home/disk2/workspace/Scheaven/data/01_reid/cD3.avi");
|
// cap2.open("/home/disk2/workspace/Scheaven/data/01_reid/cT3.avi");
|
}catch(exception){
|
cout<<"输入视频"<<endl;
|
return 0;
|
}
|
|
Mat frame, blob;
|
Mat frame2, blob2;
|
|
const char *conf = "../config.json";
|
int *max_chan;
|
int x = 5;
|
max_chan=&x;
|
handle = create(conf, max_chan);
|
|
void *sr;
|
void *sr2;
|
TImage *img = new TImage();
|
TImage *img2 = new TImage();
|
int i = 0;
|
|
while (true)
|
{
|
std::vector<int> cam_ids;
|
//读取视频帧
|
cap >> frame;
|
//cap2 >> frame2;
|
//if(i++%5!= 0)
|
// sleep(1000);
|
|
clock_t t_strat2 = clock();
|
if(!frame.empty())
|
{
|
img->width = frame.cols;
|
img->height = frame.rows;
|
img->channel = frame.channels();
|
img->data = frame.data;
|
sr = get_result(handle, img, 0);
|
|
TResult * t_result = (TResult*) sr;
|
|
cout << "=======t_result->count==" << t_result->count << endl;
|
for (int i=0; i<t_result->count; i++)
|
cout << "====1111111111===confidence:" << t_result->targets[i].confidence << endl;
|
|
}else{
|
cout << "-----------------------over--" << endl;
|
release(handle);
|
release_result(sr);
|
break;
|
}
|
|
clock_t t_strat3 = clock();
|
cout << "rps---"<< CLOCKS_PER_SEC/(t_strat3 - t_strat2) <<endl;
|
//
|
// if(!frame2.empty())
|
// {
|
// img2->width = frame2.cols;
|
// img2->height = frame2.rows;
|
// img2->channel = frame2.channels();
|
// img2->data = frame2.data;
|
//
|
// sr2 = get_result(handle, img, 1);
|
//
|
// TResult * t_result2 = (TResult*) sr2;
|
//
|
// cout << "=======t_result2->count==" << t_result2->count << endl;
|
// for (int i=0; i<t_result2->count; i++)
|
// cout << "====22222222===confidence:" << t_result2->targets[i].id << endl;
|
//
|
// }else{
|
// cout << "-----------------------over2--" << endl;
|
// release(handle);
|
// release_result(sr2);
|
// break;
|
// }
|
}
|
return 0;
|
}
|
|