Difference between revisions of "OpenCV/WishList/ConvertPointsHomogeneous"

From ProgrammingExamples
Jump to: navigation, search
(Created page with '==ConvertPointsHomogeneous.cxx== <source lang="cpp"> #include "opencv2/core/core.hpp" #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/calib3d/calib3d.hpp" #include "open…')
 
Line 1: Line 1:
 +
 +
OpenCV Error: Assertion failed (_dst.fixedType()) in convertPointsHomogeneous
 +
 
==ConvertPointsHomogeneous.cxx==
 
==ConvertPointsHomogeneous.cxx==
 
<source lang="cpp">
 
<source lang="cpp">

Revision as of 15:23, 4 August 2011

OpenCV Error: Assertion failed (_dst.fixedType()) in convertPointsHomogeneous

ConvertPointsHomogeneous.cxx

#include "opencv2/core/core.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/highgui/highgui.hpp"
 
#include <iostream>
#include <string>
 
int main( int argc, char* argv[])
{
  // Create the known projection matrix
  cv::Mat Thomogeneous(4,1,cv::DataType<double>::type);
  Thomogeneous.at<double>(0,0) = -2.8058e-01;
  Thomogeneous.at<double>(1,0) = -6.8326e-02;
  Thomogeneous.at<double>(2,0) = 5.1458e-07;
  Thomogeneous.at<double>(3,0) = 5.1458e-07;
 
  std::cout << "Thomogeneous: " << Thomogeneous << std::endl;
 
  //cv::Mat T(3,1,cv::DataType<double>::type); // translation vector
  cv::Mat T;
  cv::convertPointsHomogeneous(Thomogeneous, T);
 
  std::cout << "T: " << T << std::endl;
 
  return 0;
}

CMakeLists.txt

cmake_minimum_required(VERSION 2.6)
 
PROJECT(ConvertPointsHomogeneous)
 
FIND_PACKAGE(OpenCV REQUIRED )
INCLUDE_DIRECTORIES( ${OPENCV_INCLUDE_DIR} )
 
ADD_EXECUTABLE(ConvertPointsHomogeneous ConvertPointsHomogeneous.cxx)
TARGET_LINK_LIBRARIES(ConvertPointsHomogeneous opencv_core opencv_highgui
opencv_flann opencv_imgproc opencv_highgui opencv_ml opencv_video opencv_objdetect
          opencv_features2d opencv_calib3d opencv_legacy opencv_contrib
)