-
Notifications
You must be signed in to change notification settings - Fork 0
/
template_detect.h
61 lines (46 loc) · 2.25 KB
/
template_detect.h
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
57
58
59
60
61
#ifndef TEMPLATE_DETECT_H
#define TEMPLATE_DETECT_H
#include <config.h>
#include <opencv2/opencv.hpp>
#include <opencv2/core/core.hpp>
#include "opencv2/core/utility.hpp"
#include <opencv2/highgui/highgui.hpp>
/// CUDA //
#include <opencv2/opencv_modules.hpp> //THe Cuda Defines are in here
#if defined(USE_CUDA) && defined(HAVE_OPENCV_CUDAARITHM) && defined(HAVE_OPENCV_CUDAIMGPROC)
#include "opencv2/cudaimgproc.hpp"
#include "opencv2/cudaarithm.hpp"
#include <opencv2/core/cuda.hpp>
#endif
#include <QString>
///
/// \brief loadTemplatesFromDirectory
/// \param strDir
/// \return
///
std::vector<cv::Mat> loadTemplatesFromDirectory(QString strDir);
//makeTemplateCache(angleStep)
void makeTemplateVar(cv::Mat& templateIn,cv::Mat& imgTemplateOut, int iAngleStepDeg);
//int templatefindFishInImage(cv::Mat& imgGreyIn,cv::Mat& imgtempl,cv::Size templSz, double& matchScore, cv::Point& locations_tl,int& startRow,int& startCol);
int templatefindFishInImage(cv::Mat& imgGreyIn,cv::Mat& imgtempl,cv::Size templSz, double& matchScore, cv::Point& locations_tl,int& startRow,int& startCol,bool findFirstMatch);
double doTemplateMatchAroundPoint(const cv::Mat& maskedImg_gray,cv::Point pt,int& iLastKnownGoodTemplateRow,
int& iLastKnownGoodTemplateCol,int& detectedAngle, cv::Point& detectedPoint,
const cv::Mat& frameOut );
///
/// \brief addTemplateToCache Expands the Cache with all the fish body image templates by one row
/// Assumes all template images have the same size
/// \param imgTempl
/// \param idxTempl
/// \return idxTempl
///
int addTemplateToCache(cv::Mat& imgTempl,cv::Mat& FishTemplateCache,int idxTempl);
int deleteTemplateRow(cv::Mat& imgTempl,cv::Mat& FishTemplateCache,int idxTempl);
#if defined(USE_CUDA) && defined(HAVE_OPENCV_CUDAARITHM) && defined(HAVE_OPENCV_CUDAIMGPROC)
double gpu_matchTemplate(cv::Mat templ_h,cv::cuda::GpuMat& image_h,cv::Point& ptBestMatch);
#endif
///\brief Compiles Mean Image from List of Mat template Images by accummulating the matrices
cv::Mat makeMeanTemplateImage(std::vector<cv::Mat> vTemplImg);
static cv::Mat loadImage(const std::string& name);
//expandTemplateCache(newTemplateImage)
//templatefindFishInImage()
#endif // TEMPLATE_DETECT_H