#include <iostream>
#include <opencv2/opencv.hpp>
using namespace std;
using namespace cv;
Mat img1, img2, img3, img_gray, kernel_x, kernel_y;
char win1[] = "window1";
char win2[] = "window2";
char win3[] = "window3";
char win4[] = "window4";
int threshold_value = 0;
int max_value = 255;
RNG rng(12345);
void Canny_C(int,void*);
//Canny
int Demo_Canny()
{
img1 = imread("D://images//box//0019-00.jpg");
if (img1.empty())
{
cout << "could not load image..." << endl;
return 0;
}
imshow(win1, img1);
createTrackbar("track", win1, &threshold_value, max_value, Canny_C);
Canny_C(0,0);
return 0;
}
void Canny_C(int, void*)
{
blur(img1, img2, Size(3, 3), Point(-1, -1));
Canny(img2, img3, threshold_value, threshold_value+3, 3, false);
imshow(win2, img3);
}
int main()
{
Demo_Canny();
waitKey(0);
return 0;
}