X-Git-Url: http://git.euphorik.ch/index.cgi?a=blobdiff_plain;f=WCudaMSE%2FBilatTools_OpenCV%2Fsrc%2Fcore%2Ftuto%2Ftuto.cpp;fp=WCudaMSE%2FBilatTools_OpenCV%2Fsrc%2Fcore%2Ftuto%2Ftuto.cpp;h=537735f6e3282fda5441881130865ac9a9343489;hb=8d08c12b29c2a14684f35c023ee39e694bb80d25;hp=0000000000000000000000000000000000000000;hpb=226de81f7e1f1fbf4ac79d0d089e8a05ec7159a0;p=GPU.git diff --git a/WCudaMSE/BilatTools_OpenCV/src/core/tuto/tuto.cpp b/WCudaMSE/BilatTools_OpenCV/src/core/tuto/tuto.cpp new file mode 100755 index 0000000..537735f --- /dev/null +++ b/WCudaMSE/BilatTools_OpenCV/src/core/tuto/tuto.cpp @@ -0,0 +1,131 @@ +#include + +#include +#include + +using std::cout; +using std::cerr; +using std::endl; +using std::string; + +using namespace cv; + +/*----------------------------------------------------------------------*\ + |* Declaration *| + \*---------------------------------------------------------------------*/ + +/*--------------------------------------*\ + |* Public *| + \*-------------------------------------*/ + +int tuto(string nameVideo); + +/*--------------------------------------*\ + |* Private *| + \*-------------------------------------*/ + +static int work(VideoCapture* ptrVideoCapture); + +/*----------------------------------------------------------------------*\ + |* Implementation *| + \*---------------------------------------------------------------------*/ + +/*--------------------------------------*\ + |* Public *| + \*-------------------------------------*/ + +/** + * http://docs.opencv.org/doc/tutorials/highgui/video-input-psnr-ssim/video-input-psnr-ssim.html + */ +int tuto(string nameVideo) + { + + try + { + //v1 + // VideoCapture cap(nameVideo); + + //v2 + VideoCapture cap; + cap.open(nameVideo); + + if (!cap.isOpened()) + { + return EXIT_FAILURE; + } + + else + { + return work(&cap); + } + + } + catch (cv::Exception& e) + { + const char* err_msg = e.what(); + + cerr << "Tuto failed" << endl; + cerr << err_msg << endl; + + return EXIT_FAILURE; + } + + } + +/*--------------------------------------*\ + |* Private *| + \*-------------------------------------*/ + +int work(VideoCapture* ptrVideoCapture) + { + cout<<"[Tuto] : work"<> frame : try" << endl; // debug + cap >> frame; // get a new frame from camera + + if (frame.empty()) + { + return EXIT_SUCCESS; + } + else + { + // ColorConversion + { + // http://siggiorn.com/wp-content/uploads/libraries/opencv-java/docs/sj/opencv/Constants.ColorConversion.html + //int colorConversion=CV_BGR2GRAY; // ok + //int colorConversion=CV_BGR2RGBA ; // ko + int colorConversion = CV_BGR2BGRA; // ok + cvtColor(frame, edges, colorConversion); + } + + // Effet + { + //GaussianBlur(edges, edges, Size(7, 7), 1.5, 1.5); + //Canny(edges, edges, 0, 30, 3); + } + + imshow("edges", edges); + + if (waitKey(delay) >= 0) + { + return EXIT_SUCCESS; + } + } + } + } + +/*----------------------------------------------------------------------*\ + |* End *| + \*---------------------------------------------------------------------*/ +