#include <opencv2 /imgproc.hpp>
#include <opencv2 /highgui.hpp>
#include <iostream>
using namespace cv;
using namespace std;

Mat src_gray;
Mat dst, detected_edges; 
int lowThreshold = 50;
int highThreshold = 140;

int main()
{
	Mat src = imread("dog.png", IMREAD_COLOR); 
    if(src.empty())
    {
    	cout << "Could not open or find the image\n" << endl;
        return -1;
    }
    cvtColor(src, src_gray, COLOR_BGR2GRAY);
    blur(src_gray, detected_edges, Size(3, 3));
    Canny(detected_edges, detected_edges, lowThreshold, highThreshold, 3);
    namedWindow("Canny Edge", WINDOW_AUTOSIZE);
    imshow("Canny Edge", detected_edges);
    
    waitKey(0);
    return 0;
}

 

+ Recent posts