Difference between revisions of "OpenCV/ImageProcessing/Smoothing"
From ProgrammingExamples
< OpenCV
(Smoothing an image and displaying it along with the original.) |
Daviddoria (Talk | contribs) |
||
(2 intermediate revisions by one other user not shown) | |||
Line 29: | Line 29: | ||
+ | </source> | ||
+ | |||
+ | |||
+ | |||
+ | ==CMakeLists.txt== | ||
+ | <source lang="cmake"> | ||
+ | cmake_minimum_required(VERSION 2.6) | ||
+ | |||
+ | PROJECT(Smoothing) | ||
+ | |||
+ | FIND_PACKAGE(OpenCV REQUIRED ) | ||
+ | INCLUDE_DIRECTORIES( ${OPENCV_INCLUDE_DIR} ) | ||
+ | |||
+ | ADD_EXECUTABLE(Smoothing Smoothing.cpp) | ||
+ | TARGET_LINK_LIBRARIES(Smoothing ${OpenCV_LIBS}) | ||
</source> | </source> |
Latest revision as of 20:34, 21 January 2011
You will want to make sure that you include the imgproc, highgui, and core, libraries in your project settings.
Smoothing.cxx
#include <iostream> #include "cv.h" #include "highgui.h" using namespace cv; int main(int argc, char** argv) { IplImage* original_image = cvLoadImage( "image.png"); cvNamedWindow("Original Image", CV_WINDOW_AUTOSIZE); cvNamedWindow("Output Image", CV_WINDOW_AUTOSIZE); IplImage* smoothed_image = cvCreateImage(cvGetSize(original_image),IPL_DEPTH_8U,3); cvSmooth(original_image,smoothed_image,CV_GAUSSIAN,9,9); cvShowImage("Original Image",original_image); cvShowImage("Output Image",smoothed_image); cvWaitKey(0); cvReleaseImage( &original_image); cvReleaseImage( &smoothed_image); cvDestroyWindow("Original Image"); cvDestroyWindow("Output Image"); return 0; }
CMakeLists.txt
cmake_minimum_required(VERSION 2.6) PROJECT(Smoothing) FIND_PACKAGE(OpenCV REQUIRED ) INCLUDE_DIRECTORIES( ${OPENCV_INCLUDE_DIR} ) ADD_EXECUTABLE(Smoothing Smoothing.cpp) TARGET_LINK_LIBRARIES(Smoothing ${OpenCV_LIBS})