Difference between revisions of "OpenCV/Basics/Matrix3Channel"

From ProgrammingExamples
Jump to: navigation, search
(Created page with '==Matrix3Channel.cxx== <source lang="cpp"> #include "cv.h" #include <iostream> int main() { cv::Mat myMatrix(3,3,CV_32FC3); std::cout << "Input:" << std::endl; for(unsig…')
 
m
 
(One intermediate revision by the same user not shown)
Line 49: Line 49:
  
 
ADD_EXECUTABLE(Matrix3Channel Matrix3Channel.cxx)
 
ADD_EXECUTABLE(Matrix3Channel Matrix3Channel.cxx)
TARGET_LINK_LIBRARIES(Matrix3Channel opencv_core opencv_highgui
+
TARGET_LINK_LIBRARIES(Matrix3Channel ${OpenCV_LIBS})
opencv_flann opencv_imgproc opencv_highgui opencv_ml opencv_video opencv_objdetect
+
          opencv_features2d opencv_calib3d opencv_legacy opencv_contrib
+
)
+
  
 
</source>
 
</source>

Latest revision as of 16:46, 21 January 2011

Matrix3Channel.cxx

#include "cv.h"
 
#include <iostream>
 
int main()
{
 
  cv::Mat myMatrix(3,3,CV_32FC3);
  std::cout << "Input:" << std::endl;
  for(unsigned int i = 0; i < 3; i++)
    {
    for(unsigned int j = 0; j < 3; j++)
      {
      cv::Point3f myPoint;
      myPoint.x = 1;
      myPoint.y = 2;
      myPoint.z = 3;
      myMatrix.at<cv::Point3f>(i,j) = myPoint;
      }
    }
 
  std::cout << "Output:" << std::endl;
 
  for(unsigned int i = 0; i < 3; i++)
    {
    for(unsigned int j = 0; j < 3; j++)
      {
      std::cout << myMatrix.at<cv::Point3f>(i,j) << std::endl;
      }
    }
 
  return 0;
}

CMakeLists.txt

cmake_minimum_required(VERSION 2.6)
 
PROJECT(Matrix3Channel)
 
FIND_PACKAGE(OpenCV REQUIRED )
INCLUDE_DIRECTORIES( ${OPENCV_INCLUDE_DIR} )
 
 
ADD_EXECUTABLE(Matrix3Channel Matrix3Channel.cxx)
TARGET_LINK_LIBRARIES(Matrix3Channel ${OpenCV_LIBS})