// ================= // || Worksheet 4 // || In this example, we are going to build the famous Canny edge detector. // ================= // for comparison, see: // // https://en.wikipedia.org/wiki/Canny_edge_detector #include #include #include #include #include #include #include using namespace std; using namespace cv; int worksheetfour( Mat& colorImage ) { // Part one: Read in the image. // we'll do everything in greyscale for now. // Part two: take the horizontal derivatives // design a convolution kernel that takes discretizes the 1D derivative along the x axis. // Part three: take the vertical derivatives // apply the same kernel to the y axis. this output should be stored in a seperate matrix // Hint: Do i need a new kernel? what about matrix transpose? // http://docs.opencv.org/modules/core/doc/operations_on_arrays.html // Part four: sum the squares of the derivative images, take the square root, and store it in a new image. // we saw how to do basic operators on image pixels earlier. Hint: might need to use the c++ function 'sqrt' // Part five: display the output image. // easy! return 0; }