...
Code Block |
---|
#projektitiedosto TEMPLATE = app CONFIG += console CONFIG -= app_bundle CONFIG -= qt SOURCES += main.cpp INCLUDEPATH += /usr/include/opencv2 #katso, että nämä löytyvät ko. hakemistosta LIBS += /usr/lib/libopencv_core.so LIBS += /usr/lib/libopencv_highgui.so LIBS += /usr/lib/libopencv_imgproc.so #lähdekoodi #include <iostream> #include <opencv2/opencv.hpp> #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/imgproc/imgproc.hpp> using namespace cv; using namespace std; /* * * Aja alla oleva komento ennen debuggausta, niin debuggeri toimii echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope A PTRACE scope of "0" is the more permissive mode. A scope of "1" limits PTRACE only to direct child processes (e.g. "gdb name-of-program" and "strace -f name-of-program" work, but gdb's "attach" and "strace -fp $PID" do not). The PTRACE scope is ignored when a user has CAP_SYS_PTRACE, so "sudo strace -fp $PID" will work as before. For more details see: https://wiki.ubuntu.com/SecurityTeam/Roadmap/KernelHardening#ptrace */ //first example //int main() //{ // int a=0; // cin >> a; // cout << "Hello World!" << endl; // return 0; //} //second example //int main(int argc, char **argv) //{ // Mat im = imread("image.jpg", CV_LOAD_IMAGE_COLOR); // namedWindow("Hello"); // char c; // imshow("Hello", im); // cout << "Press 'q' to quit..." << endl; // //cin >> c; // while(1) // { // c=waitKey(1000); // // cout<<c<<" "; // if(((char) c) == 'q') break; // } // destroyAllWindows(); // return 0; //} //third example //// Global variables //const int slider_max = 1; //int slider; //Mat img; //// Callback function for trackbar event //void on_trackbar(int pos, void *) //{ //Mat img_converted; //if(pos > 0) cvtColor(img, img_converted, CV_RGB2GRAY); //else img_converted = img; //imshow("Trackbar app", img_converted); //} //int main() //{ //img = imread("image.jpg"); //namedWindow("Trackbar app"); //imshow("Trackbar app", img); //slider = 0; //createTrackbar("RGB <-> Grayscale", "Trackbar app", &slider, slider_max, on_trackbar); //while(char(waitKey(1)) != 'q') {} //return 0; //} |