Difference between revisions of "OpenCV/Basics/Matrix"
From ProgrammingExamples
< OpenCV
Daviddoria (Talk | contribs) (Created page with '==Matrix.cxx== <source lang="cpp"> #include "cv.h" #include <iostream> using namespace cv; int main() { Mat R(3,3,CV_32FC1); for(unsigned int i = 0; i < 3; i++) { …') |
Daviddoria (Talk | contribs) m (→CMakeLists.txt) |
||
(One intermediate revision by the same user not shown) | |||
Line 45: | Line 45: | ||
ADD_EXECUTABLE(Matrix Matrix.cxx) | ADD_EXECUTABLE(Matrix Matrix.cxx) | ||
− | TARGET_LINK_LIBRARIES(Matrix | + | TARGET_LINK_LIBRARIES(Matrix ${OpenCV_LIBS}) |
− | + | ||
− | + | ||
− | ) | + | |
</source> | </source> |
Latest revision as of 16:46, 21 January 2011
Matrix.cxx
#include "cv.h" #include <iostream> using namespace cv; int main() { Mat R(3,3,CV_32FC1); for(unsigned int i = 0; i < 3; i++) { for(unsigned int j = 0; j < 3; j++) { R.at<float>(i,j) = 2; } } for(unsigned int i = 0; i < 3; i++) { for(unsigned int j = 0; j < 3; j++) { std::cout << R.at<float>(i,j) << std::endl; } } return 0; }
CMakeLists.txt
cmake_minimum_required(VERSION 2.6) PROJECT(Matrix) FIND_PACKAGE(OpenCV REQUIRED ) INCLUDE_DIRECTORIES( ${OPENCV_INCLUDE_DIR} ) ADD_EXECUTABLE(Matrix Matrix.cxx) TARGET_LINK_LIBRARIES(Matrix ${OpenCV_LIBS})