<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://programmingexamples.net/w/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://programmingexamples.net/w/index.php?action=history&amp;feed=atom&amp;title=OpenCV%2FWishList%2FProjectPoints</id>
		<title>OpenCV/WishList/ProjectPoints - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://programmingexamples.net/w/index.php?action=history&amp;feed=atom&amp;title=OpenCV%2FWishList%2FProjectPoints"/>
		<link rel="alternate" type="text/html" href="http://programmingexamples.net/w/index.php?title=OpenCV/WishList/ProjectPoints&amp;action=history"/>
		<updated>2026-04-25T10:49:53Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.23.5</generator>

	<entry>
		<id>http://programmingexamples.net/w/index.php?title=OpenCV/WishList/ProjectPoints&amp;diff=4728&amp;oldid=prev</id>
		<title>Daviddoria at 14:51, 16 August 2011</title>
		<link rel="alternate" type="text/html" href="http://programmingexamples.net/w/index.php?title=OpenCV/WishList/ProjectPoints&amp;diff=4728&amp;oldid=prev"/>
				<updated>2011-08-16T14:51:49Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 14:51, 16 August 2011&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;OpenCV Error: Formats of input arguments do not match (All the matrices must have the same data type) in cvRodrigues2, file /home/ddoria/src/OpenCV-2.3.0/modules/calib3d/src/calibration.cpp, line 507&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;This example has a projection matrix and corresponding 3D/2D points hard coded. The idea is to project the 3D points using the projection matrix, and demonstrate that the 3D points get projected to near their corresponding 2D point.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;terminate called after throwing an instance of 'cv::Exception'&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt; &lt;/ins&gt;OpenCV Error: Formats of input arguments do not match (All the matrices must have the same data type) in cvRodrigues2, file /home/ddoria/src/OpenCV- 2.3.0/modules/calib3d/src/calibration.cpp, line 507&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt; &lt;/ins&gt;terminate called after throwing an instance of 'cv::Exception'&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; what():&amp;#160; /home/ddoria/src/OpenCV-2.3.0/modules/calib3d/src/calibration.cpp:507: error: (-205) All the matrices must have the same data type in function cvRodrigues2&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; what():&amp;#160; /home/ddoria/src/OpenCV-2.3.0/modules/calib3d/src/calibration.cpp:507: error: (-205) All the matrices must have the same data type in function cvRodrigues2&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Daviddoria</name></author>	</entry>

	<entry>
		<id>http://programmingexamples.net/w/index.php?title=OpenCV/WishList/ProjectPoints&amp;diff=4701&amp;oldid=prev</id>
		<title>Daviddoria: Created page with 'OpenCV Error: Formats of input arguments do not match (All the matrices must have the same data type) in cvRodrigues2, file /home/ddoria/src/OpenCV-2.3.0/modules/calib3d/src/cali…'</title>
		<link rel="alternate" type="text/html" href="http://programmingexamples.net/w/index.php?title=OpenCV/WishList/ProjectPoints&amp;diff=4701&amp;oldid=prev"/>
				<updated>2011-08-02T13:38:16Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;#039;OpenCV Error: Formats of input arguments do not match (All the matrices must have the same data type) in cvRodrigues2, file /home/ddoria/src/OpenCV-2.3.0/modules/calib3d/src/cali…&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;OpenCV Error: Formats of input arguments do not match (All the matrices must have the same data type) in cvRodrigues2, file /home/ddoria/src/OpenCV-2.3.0/modules/calib3d/src/calibration.cpp, line 507&lt;br /&gt;
terminate called after throwing an instance of 'cv::Exception'&lt;br /&gt;
  what():  /home/ddoria/src/OpenCV-2.3.0/modules/calib3d/src/calibration.cpp:507: error: (-205) All the matrices must have the same data type in function cvRodrigues2&lt;br /&gt;
&lt;br /&gt;
==ProjectPoints.cxx==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;quot;opencv2/core/core.hpp&amp;quot;&lt;br /&gt;
#include &amp;quot;opencv2/imgproc/imgproc.hpp&amp;quot;&lt;br /&gt;
#include &amp;quot;opencv2/calib3d/calib3d.hpp&amp;quot;&lt;br /&gt;
#include &amp;quot;opencv2/highgui/highgui.hpp&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
#include &amp;lt;string&amp;gt;&lt;br /&gt;
&lt;br /&gt;
std::vector&amp;lt;cv::Point2f&amp;gt; Generate2DPoints();&lt;br /&gt;
std::vector&amp;lt;cv::Point3f&amp;gt; Generate3DPoints();&lt;br /&gt;
&lt;br /&gt;
int main( int argc, char* argv[])&lt;br /&gt;
{&lt;br /&gt;
  // Read points&lt;br /&gt;
  std::vector&amp;lt;cv::Point2f&amp;gt; imagePoints = Generate2DPoints();&lt;br /&gt;
  std::vector&amp;lt;cv::Point3f&amp;gt; objectPoints = Generate3DPoints();&lt;br /&gt;
&lt;br /&gt;
  // Create the known projection matrix&lt;br /&gt;
  cv::Mat P(3,4,cv::DataType&amp;lt;float&amp;gt;::type);&lt;br /&gt;
  P.at&amp;lt;float&amp;gt;(0,0) = -2.8058e-01;&lt;br /&gt;
  P.at&amp;lt;float&amp;gt;(1,0) = -6.8326e-02;&lt;br /&gt;
  P.at&amp;lt;float&amp;gt;(2,0) = 5.1458e-07;&lt;br /&gt;
&lt;br /&gt;
  P.at&amp;lt;float&amp;gt;(0,1) = 2.0045e-02;&lt;br /&gt;
  P.at&amp;lt;float&amp;gt;(1,1) = -3.1718e-01;&lt;br /&gt;
  P.at&amp;lt;float&amp;gt;(2,1) = 4.5840e-06;&lt;br /&gt;
&lt;br /&gt;
  P.at&amp;lt;float&amp;gt;(0,2) = 1.8102e-01;&lt;br /&gt;
  P.at&amp;lt;float&amp;gt;(1,2) = -7.2974e-02;&lt;br /&gt;
  P.at&amp;lt;float&amp;gt;(2,2) = 2.6699e-06;&lt;br /&gt;
&lt;br /&gt;
  P.at&amp;lt;float&amp;gt;(0,3) = 6.6062e-01;&lt;br /&gt;
  P.at&amp;lt;float&amp;gt;(1,3) = 5.8402e-01;&lt;br /&gt;
  P.at&amp;lt;float&amp;gt;(2,3) = 1.5590e-03;&lt;br /&gt;
  &lt;br /&gt;
    // Decompose the projection matrix into:&lt;br /&gt;
  cv::Mat K(3,3,cv::DataType&amp;lt;float&amp;gt;::type); // intrinsic parameter matrix&lt;br /&gt;
  cv::Mat rvec(3,3,cv::DataType&amp;lt;float&amp;gt;::type); // rotation matrix&lt;br /&gt;
  cv::Mat T(4,1,cv::DataType&amp;lt;float&amp;gt;::type); // translation vector&lt;br /&gt;
&lt;br /&gt;
  cv::decomposeProjectionMatrix(P, K, rvec, T);&lt;br /&gt;
  &lt;br /&gt;
  // Create zero distortion&lt;br /&gt;
  cv::Mat distCoeffs(4,1,cv::DataType&amp;lt;float&amp;gt;::type);&lt;br /&gt;
  distCoeffs.at&amp;lt;float&amp;gt;(0) = 0;&lt;br /&gt;
  distCoeffs.at&amp;lt;float&amp;gt;(1) = 0;&lt;br /&gt;
  distCoeffs.at&amp;lt;float&amp;gt;(2) = 0;&lt;br /&gt;
  distCoeffs.at&amp;lt;float&amp;gt;(3) = 0;&lt;br /&gt;
  &lt;br /&gt;
  std::vector&amp;lt;cv::Point2f&amp;gt; projectedPoints;&lt;br /&gt;
  cv::projectPoints(objectPoints, rvec, T, K, distCoeffs, projectedPoints);&lt;br /&gt;
  &lt;br /&gt;
  for(unsigned int i = 0; i &amp;lt; projectedPoints.size(); ++i)&lt;br /&gt;
    {&lt;br /&gt;
    std::cout &amp;lt;&amp;lt; &amp;quot;Image point: &amp;quot; &amp;lt;&amp;lt; imagePoints[i] &amp;lt;&amp;lt; &amp;quot; Projected to &amp;quot; &amp;lt;&amp;lt; projectedPoints[i] &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
  return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
std::vector&amp;lt;cv::Point2f&amp;gt; Generate2DPoints()&lt;br /&gt;
{&lt;br /&gt;
  std::vector&amp;lt;cv::Point2f&amp;gt; points;&lt;br /&gt;
&lt;br /&gt;
  float x,y;&lt;br /&gt;
&lt;br /&gt;
  x=282;y=274;&lt;br /&gt;
  points.push_back(cv::Point2f(x,y));&lt;br /&gt;
  &lt;br /&gt;
  x=397;y=227;&lt;br /&gt;
  points.push_back(cv::Point2f(x,y));&lt;br /&gt;
  &lt;br /&gt;
  x=577;y=271;&lt;br /&gt;
  points.push_back(cv::Point2f(x,y));&lt;br /&gt;
  &lt;br /&gt;
  x=462;y=318;&lt;br /&gt;
  points.push_back(cv::Point2f(x,y));&lt;br /&gt;
  &lt;br /&gt;
  x=270;y=479;&lt;br /&gt;
  points.push_back(cv::Point2f(x,y));&lt;br /&gt;
  &lt;br /&gt;
  x=450;y=523;&lt;br /&gt;
  points.push_back(cv::Point2f(x,y));&lt;br /&gt;
  &lt;br /&gt;
  x=566;y=475;&lt;br /&gt;
  points.push_back(cv::Point2f(x,y));&lt;br /&gt;
  /*&lt;br /&gt;
  for(unsigned int i = 0; i &amp;lt; points.size(); ++i)&lt;br /&gt;
    {&lt;br /&gt;
    std::cout &amp;lt;&amp;lt; points[i] &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
    }&lt;br /&gt;
  */&lt;br /&gt;
  return points;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
std::vector&amp;lt;cv::Point3f&amp;gt; Generate3DPoints()&lt;br /&gt;
{&lt;br /&gt;
  std::vector&amp;lt;cv::Point3f&amp;gt; points;&lt;br /&gt;
&lt;br /&gt;
  float x,y,z;&lt;br /&gt;
  &lt;br /&gt;
  x=.5;y=.5;z=-.5;&lt;br /&gt;
  points.push_back(cv::Point3f(x,y,z));&lt;br /&gt;
  &lt;br /&gt;
  x=.5;y=.5;z=.5;&lt;br /&gt;
  points.push_back(cv::Point3f(x,y,z));&lt;br /&gt;
  &lt;br /&gt;
  x=-.5;y=.5;z=.5;&lt;br /&gt;
  points.push_back(cv::Point3f(x,y,z));&lt;br /&gt;
  &lt;br /&gt;
  x=-.5;y=.5;z=-.5;&lt;br /&gt;
  points.push_back(cv::Point3f(x,y,z));&lt;br /&gt;
  &lt;br /&gt;
  x=.5;y=-.5;z=-.5;&lt;br /&gt;
  points.push_back(cv::Point3f(x,y,z));&lt;br /&gt;
  &lt;br /&gt;
  x=-.5;y=-.5;z=-.5;&lt;br /&gt;
  points.push_back(cv::Point3f(x,y,z));&lt;br /&gt;
  &lt;br /&gt;
  x=-.5;y=-.5;z=.5;&lt;br /&gt;
  points.push_back(cv::Point3f(x,y,z));&lt;br /&gt;
  &lt;br /&gt;
  /*&lt;br /&gt;
  for(unsigned int i = 0; i &amp;lt; points.size(); ++i)&lt;br /&gt;
    {&lt;br /&gt;
    std::cout &amp;lt;&amp;lt; points[i] &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
    }&lt;br /&gt;
  */&lt;br /&gt;
  return points;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==CMakeLists.txt==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cmake&amp;quot;&amp;gt;&lt;br /&gt;
cmake_minimum_required(VERSION 2.6)&lt;br /&gt;
&lt;br /&gt;
PROJECT(ProjectPoints)&lt;br /&gt;
&lt;br /&gt;
FIND_PACKAGE(OpenCV REQUIRED )&lt;br /&gt;
INCLUDE_DIRECTORIES( ${OPENCV_INCLUDE_DIR} )&lt;br /&gt;
&lt;br /&gt;
ADD_EXECUTABLE(ProjectPoints ProjectPoints.cxx)&lt;br /&gt;
TARGET_LINK_LIBRARIES(ProjectPoints opencv_core opencv_highgui&lt;br /&gt;
opencv_flann opencv_imgproc opencv_highgui opencv_ml opencv_video opencv_objdetect&lt;br /&gt;
          opencv_features2d opencv_calib3d opencv_legacy opencv_contrib&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daviddoria</name></author>	</entry>

	</feed>