派生自 Algorithm/baseDetector

Scheaven
2021-07-28 eb98b4028b6d6997a458d2ae7ec1635c4d1e4a6c
test code
5个文件已修改
26 ■■■■■ 已修改文件
demo.cpp 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/core/ari_manager.cpp 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/core/ari_manager.h 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/draw_util.cpp 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/draw_util.h 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
demo.cpp
@@ -48,7 +48,7 @@
            for (int i=0; i<t_result->count; i++)
            {
                cout << "confidence:" << t_result->targets[i].confidence << endl;
                draw_SDK_result(frame, t_result->targets[i]);
                // draw_SDK_result(frame, t_result->targets[i]);
            }
        }else{
            cout << "------------over--" << endl;
src/core/ari_manager.cpp
@@ -8,7 +8,8 @@
AriManager::AriManager()
{
    Config config;
    // config.net_type = COMMON;
    config.net_type = COMMON;
    if(m_staticStruct::type==2)
        config.net_type = SMALL;
    else
@@ -56,18 +57,15 @@
    // cv::imshow("img",image0);
    // cv::waitKey(0);
    Timer timer;
    timer.reset();
    this->detector->detect(batch_img, batch_res);
    timer.out("detect");
    t_result.targets = (Target*)malloc(sizeof(Target)*batch_res[0].size());
    // 将算法结果转化为标准的格式(以目标检测为例)
    // 将算法结果转化为标准的格式(以目标检测为例)""
    int w_count = 0;
    for (const auto &result_box:batch_res[0])
    {
        // if(result_box.id == 0)
        // {
        if(result_box.id == 1)
        {
            Target target;
            init_target(&target);
@@ -93,10 +91,11 @@
            t_result.targets[w_count] = target;
            w_count ++;
        // }
        }
    }
    std::cout << "eve batch_res size:: "<< batch_res[0].size() << " w_count: " << w_count <<std::endl;
    t_result.count = w_count;
        draw_SDK_result(cam_id, frame, t_result); //多线程无法调用绘图
    draw_SDK_result(cam_id, frame, t_result); //多线程无法调用绘图
}
void AriManager::init_target(Target *t){
src/core/ari_manager.h
@@ -7,6 +7,7 @@
#include "std_target.h"
#include "config.h"
#include "detector.h"
#include "../utils/draw_util.h"
using namespace std;
using namespace cv;
src/utils/draw_util.cpp
@@ -80,7 +80,8 @@
    cv::waitKey(0);
}
cv::VideoWriter writer("/opt/vasystem/valog/01_Scheanve/01_baseDetector.avi", cv::VideoWriter::fourcc('M','J','P','G'),24, cv::Size(800,500), true);
cv::VideoWriter writer("./01_baseDetector.avi", cv::VideoWriter::fourcc('M','J','P','G'),24, cv::Size(800,500), true);
// cv::VideoWriter writer("/opt/vasystem/valog/01_Scheanve/01_baseDetector.avi", cv::VideoWriter::fourcc('M','J','P','G'),24, cv::Size(800,500), true);
void draw_SDK_result(const int cam_id, cv::Mat mat_img, TResult& t_result)
{
src/utils/draw_util.h
@@ -12,5 +12,8 @@
void create_foldert(const char *path);
void draw_SDK_result(cv::Mat mat_img, Target& target);
void draw_SDK_result(const int cam_id, cv::Mat mat_img,  TResult& t_result);
#endif //DRAW_UTIL_H