我正在使用暗网从实时视频流中检测对象,并希望将每一帧传递给 dlib 以跟踪该对象,但我很困惑我如何将帧从暗网的demo.c 传递到 dlib 并进行跟踪。我需要使用 c c++ 连接器吗?如果是,如何?任何解释或线索都会有所帮助。谢谢...
我想要传递 ipl 图像并想要跟踪对象的 Dlib 文件。
#include <dlib/image_processing.h>
#include <dlib/gui_widgets.h>
#include <dlib/image_io.h>
#include <dlib/dir_nav.h>
#include "dlib/opencv.h"
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
#include <opencv2/opencv.hpp>
using namespace cv;
using namespace dlib;
using namespace std;
extern "C"{
int enx = 203, int eny = 190, int enw = 98, int enh = 86;
void track(IplImage * ipl, int enx, int eny, int enw, int enh)
{
Mat frame = cvarrToMat(ipl);
image_window win;
correlation_tracker tracker;
array2d<rgb_pixel> img;
std::cout << "Starting" << std::endl;
assign_image(img, cv_image<bgr_pixel>(frame));
tracker.start_track(img, centered_rect(point(enx, eny), enw, enh));
win.set_image(img);
win.clear_overlay();
win.add_overlay(tracker.get_position());
while(ipl) {
Mat frame = cvarrToMat(ipl);
assign_image(img, cv_image<bgr_pixel>(frame));
tracker.update(img);
win.set_image(img);
win.clear_overlay();
win.add_overlay(tracker.get_position());
}
}
}