mirror of https://github.com/2martens/uni.git
[CCV] Finished load, modify and save source file
Signed-off-by: Jim Martens <github@2martens.de>
This commit is contained in:
parent
22d20c4edb
commit
27b11b6a01
|
@ -1,3 +1,5 @@
|
||||||
find_package( OpenCV REQUIRED )
|
find_package( OpenCV REQUIRED )
|
||||||
add_executable(displayImage displayImage.cpp)
|
add_executable(displayImage displayImage.cpp)
|
||||||
|
add_executable(loadModifySave loadModifySaveImage.cpp)
|
||||||
target_link_libraries( displayImage ${OpenCV_LIBS} )
|
target_link_libraries( displayImage ${OpenCV_LIBS} )
|
||||||
|
target_link_libraries( loadModifySave ${OpenCV_LIBS} )
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
//
|
||||||
|
// Created by jim on 4/7/17.
|
||||||
|
//
|
||||||
|
#include <opencv2/opencv.hpp>
|
||||||
|
|
||||||
|
using namespace cv;
|
||||||
|
|
||||||
|
int main( int argc, char** argv )
|
||||||
|
{
|
||||||
|
char* imageName = argv[1];
|
||||||
|
|
||||||
|
Mat image;
|
||||||
|
image = imread( imageName, 1 );
|
||||||
|
|
||||||
|
if( argc != 2 || !image.data )
|
||||||
|
{
|
||||||
|
printf( " No image data \n " );
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Mat gray_image;
|
||||||
|
cvtColor( image, gray_image, CV_BGR2GRAY );
|
||||||
|
|
||||||
|
imwrite( "Gray_Image.jpg", gray_image );
|
||||||
|
|
||||||
|
namedWindow( imageName, CV_WINDOW_NORMAL );
|
||||||
|
namedWindow( "Gray image", CV_WINDOW_NORMAL);
|
||||||
|
|
||||||
|
imshow( imageName, image );
|
||||||
|
imshow( "Gray image", gray_image );
|
||||||
|
|
||||||
|
waitKey(0);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue