1 Star 4 Fork 3

psdem/视频识别与跟踪

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
opticalFlow_gpu.h 1.59 KB
一键复制 编辑 原始数据 按行查看 历史
psdem 提交于 2022-08-26 08:22 . Signed-off-by: psdem wuwenxuan2000@163.com
#pragma once
#include "out.h"
#include <opencv2/core.hpp>
#include <opencv2/cudaoptflow.hpp>
#include <opencv2/cudaimgproc.hpp>
#include <vector>
#include <array>
class opticalFlow_gpu
{
out outPoints;
cv::Size winSize;
int maxLevel;
int iters;
const int errorMax = 4;
static const int maxCorners = 15;
double quailityLevel;
double minDistance;
public:
explicit opticalFlow_gpu(int srcType);
inline void detect_corners(cv::cuda::GpuMat &img, cv::cuda::GpuMat &corners, cv::InputArray &mask, cv::cuda::Stream &stream)
{
detector->detect(img, corners, mask, stream);
};
static void download(const cv::cuda::GpuMat &d_mat, std::vector<uchar> &vec, cv::cuda::Stream &stream);
static void download(const cv::cuda::GpuMat &d_mat, std::vector<cv::Point2f> &vec, cv::cuda::Stream &stream);
static void upload(cv::cuda::GpuMat & d_mat, cv::Mat& mat, cv::cuda::Stream & stream);
static void upload(cv::cuda::GpuMat &d_mat, std::vector<cv::Point2f> &vec, cv::cuda::Stream &stream);
//void draw(cv::Mat& frame, const std::vector<cv::Point2f>& corners, const std::vector<cv::Point2f>& nextPts, const std::vector<uchar>& status);
void sift(cv::Mat& frame, const std::vector<cv::Point2f>& p0, const std::vector<cv::Point2f>& p0r, const std::vector<cv::Point2f>& nextPts, const std::vector<uchar>& status);
//void draw(cv::Mat& frame, const std::vector<cv::Point2f>& corners);
cv::Ptr<cv::cuda::SparsePyrLKOpticalFlow> d_pyrLK_sparse;
cv::Ptr<cv::cuda::CornersDetector> detector;
std::vector<cv::Scalar> colors;
//std::vector<cv::Point2f> betterPts;
std::vector<std::vector<cv::Point2f> > tracks;
//int num;
};
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/psdem/video-recognition-and-tracking.git
git@gitee.com:psdem/video-recognition-and-tracking.git
psdem
video-recognition-and-tracking
视频识别与跟踪
master

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385