Exemple #1
0
/*!
 *
 */
void CameraParameters::glGetProjectionMatrix(const cv::Size orgImgSize, const cv::Size size,
    double proj_matrix[], double gnear, double gfar, bool invert) throw(cv::Exception)
{
  // Annoying message in GL applications that apply undistortion in the own applications
//  if (cv::countNonZero(_distor)!=0)
//    std::cerr<< "CameraParameters::glGetProjectionMatrix - The camera has distortion "
//      "coefficients " <<__FILE__<<" "<<__LINE__<<std::endl;

  if (isValid()==false)
    throw cv::Exception(9100,"invalid camera parameters","CameraParameters::glGetProjectionMatrix",
                        __FILE__,__LINE__);

  //Determine the resized info
  double Ax=static_cast<double>(size.width)/static_cast<double>(orgImgSize.width);
  double Ay=static_cast<double>(size.height)/static_cast<double>(orgImgSize.height);
  double fx=_k.at<float>(0,0)*Ax;
  double cx=_k.at<float>(0,2)*Ax;
  double fy=_k.at<float>(1,1)*Ay;
  double cy=_k.at<float>(1,2)*Ay;
  double cparam[3][4] =
  {
    {fx,   0,  cx, 0},
    {0,   fy,  cy, 0},
    {0,    0,   1, 0}
  };

  argConvGLcpara2( cparam, size.width, size.height, gnear, gfar, proj_matrix, invert );
}
Exemple #2
0
void argConvGLcpara( ARParam *param, double gnear, double gfar, float m[16] )
{
    argConvGLcpara2( param->mat, param->xsize, param->ysize, gnear, gfar, m );
}