Difference between revisions of "OpenCV/Basics/Image"
From ProgrammingExamples
< OpenCV
Daviddoria (Talk | contribs) (Created page with '==Image.cxx== <source lang="cpp"> #include "cv.h" #include <iostream> int main() { // Create an image of scalars (the '1' as the last parameter) IplImage* image = cvCreateI…') |
Daviddoria (Talk | contribs) m (→CMakeLists.txt) |
||
Line 32: | Line 32: | ||
ADD_EXECUTABLE(Image Image.cxx) | ADD_EXECUTABLE(Image Image.cxx) | ||
− | TARGET_LINK_LIBRARIES(Image | + | TARGET_LINK_LIBRARIES(Image ${OpenCV_LIBS}) |
− | + | ||
− | + | ||
− | ) | + | |
</source> | </source> |
Latest revision as of 16:46, 21 January 2011
Image.cxx
#include "cv.h" #include <iostream> int main() { // Create an image of scalars (the '1' as the last parameter) IplImage* image = cvCreateImage(cvSize(20,10), IPL_DEPTH_8U, 1); // Access a pixel CvScalar pixel = cvGet2D(image, 4, 5); // Access a component of the pixel std::cout << pixel.val[0] << std::endl; return 0; }
CMakeLists.txt
cmake_minimum_required(VERSION 2.6) PROJECT(Image) FIND_PACKAGE(OpenCV REQUIRED ) INCLUDE_DIRECTORIES( ${OPENCV_INCLUDE_DIR} ) ADD_EXECUTABLE(Image Image.cxx) TARGET_LINK_LIBRARIES(Image ${OpenCV_LIBS})