传递cv :: Point数组作为参数

时间:2018-04-30 07:32:53

标签: c++ arguments

我尽力通过头文件将cv :: Point数组作为参数传递给函数。当我尝试构建它时,我不断收到错误。我试图直接传递它并作为指针没有成功。

这是作为指针传递时出现的错误:

  

错误:未定义引用`objDistanceCalc(cv :: Point_ *,int,   INT)'

这是包含main函数的opencv_test.cpp文件中的函数调用。

#include "stereo_calc.h"
...
Point pos[4];
...
double dist = objDistanceCalc(pos, src_width_half, src_hight);
...

头文件stereo_calc.h:

#ifndef STEREO_CALC_H
#define STEREO_CALC_H

#include <opencv2/core.hpp>

double objDistanceCalc(cv::Point*, int, int);

#endif // STEREO_CALC_H

stereo_cam.cpp

#include "stereo_calc.h"
#include <opencv2/core.hpp>

// Calculates distance to an object given two similar positions on two stereo images
double objDistanceCalc(cv::Point* positions[4], int pixel_width, int pixel_hight)
{
  double D;   // distance
  double b = 41.4;   // distance between stereo cameras (41.4mm for leopard mounted 27.04.2018)
  double f = 2.8;   // focal length [mm] (~2.8mm for leopard, datasheet)
  double x1, x2;  // position distance from center in the left and right camera

  return(D);
}

有人知道我在这里做错了什么吗?当我从主文件中删除objDistanceCalc函数时,代码构建良好。

0 个答案:

没有答案