m
suntianyu
2021-07-30 cc6f8a873c7efd28fbbeb7c1c70b28a053586f17
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//
// Created by Scheaven on 2019/11/18.
//
#include "lib/h_interface.h"
#include "lib/std_target.h"
#include <opencv2/opencv.hpp>            // C++
 
using namespace std;
using namespace cv;
void* handle;
 
int main(int argc, char *argv[])
{
//    //视频流信息
    VideoCapture cap;
    int cam_id = 0;
 
    Mat frame, blob;
 
    const char *conf = "../config.json";
    int *max_chan;
    int x = 5;
    max_chan=&x;
    handle = create(conf, max_chan);
 
    void *sr;
    TImage *img = new TImage();
    int i = 0;
    cap = VideoCapture("/data/workspace/01_Scheaven/04_gesture/03_hand.mp4");
 
    while(1){        /* code */
        cap >> frame;
        if(!frame.empty())
        {
            img->width = frame.cols;
            img->height = frame.rows;
            img->channel = frame.channels();
            img->data = frame.data;
 
            const int face_info_size = 0;
            char* face_info;
            sr = get_result_face(handle, img, "", 0, face_info, face_info_size);
            TResult * t_result = (TResult*) sr;
            cout << "t_result->count==" << t_result->count  << endl;
            for (int i=0; i<t_result->count; i++)
                cout << "confidence:" << t_result->targets[i].confidence << endl;
        }else{
            cout << "------------over--" << endl;
            release(handle);
            release_result(sr);
            break;
        }
    }
    return 0;
}