<?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%2FConvenience%2FConvertMatrixType</id>
		<title>OpenCV/Convenience/ConvertMatrixType - 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%2FConvenience%2FConvertMatrixType"/>
		<link rel="alternate" type="text/html" href="http://programmingexamples.net/w/index.php?title=OpenCV/Convenience/ConvertMatrixType&amp;action=history"/>
		<updated>2026-06-13T10:10:59Z</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/Convenience/ConvertMatrixType&amp;diff=532&amp;oldid=prev</id>
		<title>Daviddoria: /* CMakeLists.txt */</title>
		<link rel="alternate" type="text/html" href="http://programmingexamples.net/w/index.php?title=OpenCV/Convenience/ConvertMatrixType&amp;diff=532&amp;oldid=prev"/>
				<updated>2011-01-21T20:47:33Z</updated>
		
		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;CMakeLists.txt&lt;/span&gt;&lt;/span&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 20:47, 21 January 2011&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 64:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 64:&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;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;ADD_EXECUTABLE(ConvertMatrixType ConvertMatrixType.cxx)&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;ADD_EXECUTABLE(ConvertMatrixType ConvertMatrixType.cxx)&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;TARGET_LINK_LIBRARIES(ConvertMatrixType &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;opencv_core opencv_highgui&lt;/del&gt;&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;TARGET_LINK_LIBRARIES(ConvertMatrixType &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;${OpenCV_LIBS}&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;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;opencv_flann opencv_imgproc opencv_highgui opencv_ml opencv_video opencv_objdetect&lt;/del&gt;&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;/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;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; opencv_features2d opencv_calib3d opencv_legacy opencv_contrib&lt;/del&gt;&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;/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;)&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;/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;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;lt;/source&amp;gt;&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;lt;/source&amp;gt;&lt;/div&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/Convenience/ConvertMatrixType&amp;diff=493&amp;oldid=prev</id>
		<title>Daviddoria: Created page with '==ConvertMatrixType.cxx== &lt;source lang=&quot;cpp&quot;&gt; #include &quot;cv.h&quot;  #include &lt;iostream&gt;  cv::Mat GetFloat(cv::Mat M);  int main(int, char*[]) {   cv::Mat doubleMatrix(3,3,CV_64FC1);  …'</title>
		<link rel="alternate" type="text/html" href="http://programmingexamples.net/w/index.php?title=OpenCV/Convenience/ConvertMatrixType&amp;diff=493&amp;oldid=prev"/>
				<updated>2011-01-20T23:44:48Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;#039;==ConvertMatrixType.cxx== &amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt; #include &amp;quot;cv.h&amp;quot;  #include &amp;lt;iostream&amp;gt;  cv::Mat GetFloat(cv::Mat M);  int main(int, char*[]) {   cv::Mat doubleMatrix(3,3,CV_64FC1);  …&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==ConvertMatrixType.cxx==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;quot;cv.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
cv::Mat GetFloat(cv::Mat M);&lt;br /&gt;
&lt;br /&gt;
int main(int, char*[])&lt;br /&gt;
{&lt;br /&gt;
  cv::Mat doubleMatrix(3,3,CV_64FC1);&lt;br /&gt;
&lt;br /&gt;
  for(unsigned int i = 0; i &amp;lt; 3; i++)&lt;br /&gt;
    {&lt;br /&gt;
    for(unsigned int j = 0; j &amp;lt; 3; j++)&lt;br /&gt;
      {&lt;br /&gt;
      doubleMatrix.at&amp;lt;float&amp;gt;(i,j) = 1;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
  cv::Mat floatMatrix(3,3,CV_32FC1);&lt;br /&gt;
  floatMatrix = GetFloat(doubleMatrix);&lt;br /&gt;
  &lt;br /&gt;
  return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
cv::Mat GetFloat(cv::Mat M)&lt;br /&gt;
{&lt;br /&gt;
  // This function converts a matrix from double to float&lt;br /&gt;
  if(M.depth() == 5)&lt;br /&gt;
  {&lt;br /&gt;
    return M;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  if(M.depth() == 6)&lt;br /&gt;
  {&lt;br /&gt;
    cv::Mat K(M.rows,M.cols,CV_32FC1);&lt;br /&gt;
    for(unsigned int row = 0; row &amp;lt; 3; row++)&lt;br /&gt;
    {&lt;br /&gt;
      for(unsigned int col = 0; col &amp;lt; 3; col++)&lt;br /&gt;
      {&lt;br /&gt;
      K.at&amp;lt;float&amp;gt;(row,col) = M.at&amp;lt;double&amp;gt;(row,col);&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
    return K;&lt;br /&gt;
  }&lt;br /&gt;
  else&lt;br /&gt;
  {&lt;br /&gt;
    std::cerr &amp;lt;&amp;lt; &amp;quot;Check the type of M! It is depth &amp;quot; &amp;lt;&amp;lt; M.depth() &amp;lt;&amp;lt; &amp;quot; !&amp;quot; &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
    exit(-1);&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(ConvertMatrixType)&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(ConvertMatrixType ConvertMatrixType.cxx)&lt;br /&gt;
TARGET_LINK_LIBRARIES(ConvertMatrixType 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>