Difference between revisions of "OpenCV/Basics/MatrixInverse"
From ProgrammingExamples
< OpenCV
Daviddoria (Talk | contribs) m (moved OpenCV/MatrixInverse to OpenCV/Basics/MatrixInverse) |
Daviddoria (Talk | contribs) m |
||
Line 41: | Line 41: | ||
ADD_EXECUTABLE(MatrixInverse MatrixInverse.cxx) | ADD_EXECUTABLE(MatrixInverse MatrixInverse.cxx) | ||
− | TARGET_LINK_LIBRARIES(MatrixInverse | + | TARGET_LINK_LIBRARIES(MatrixInverse ${OpenCV_LIBS}) |
− | + | ||
− | + | ||
− | ) | + | |
</source> | </source> |
Latest revision as of 16:46, 21 January 2011
MatrixInverse.cxx
#include "cv.h" #include <iostream> int main() { cv::Mat A(3,3,CV_32FC1); for(unsigned int i = 0; i < 3; i++) { for(unsigned int j = 0; j < 3; j++) { A.at<float>(i,j) = 2; } } cv::Mat inverted(3,3,CV_32FC1); inverted = A; inverted.inv(); std::cout << "A: " << A << std::endl; std::cout << "inverted: " << inverted << std::endl; return 0; }
CMakeLists.txt
cmake_minimum_required(VERSION 2.6) PROJECT(MatrixInverse) FIND_PACKAGE(OpenCV REQUIRED ) INCLUDE_DIRECTORIES( ${OPENCV_INCLUDE_DIR} ) ADD_EXECUTABLE(MatrixInverse MatrixInverse.cxx) TARGET_LINK_LIBRARIES(MatrixInverse ${OpenCV_LIBS})