+
+void CannyThreshold()
+{
+ if ( g_edges == NULL)
+ {
+ g_edges = cvCreateMat(g_srcGray->rows,g_srcGray->cols,CV_8UC1);
+ }
+
+ // Commented out lines are used during testing to show the image to screen, can also save the test images
+ //cvShowImage("display", g_srcGray);
+ //cvWaitKey(0);
+
+ // Reduce noise with a kernel blurxblur. Input the grayscale source image, output to edges. (0's mean it's determined from kernel sizes)
+ cvSmooth( g_srcGray, g_edges, CV_GAUSSIAN, blur, blur ,0 ,0 );
+
+ //Save the image
+ //cvSaveImage("test_blurred.jpg",g_edges,0);
+
+ //cvShowImage("display", g_edges);
+ //cvWaitKey(0);
+
+ // Find the edges in the image
+ cvCanny( g_edges, g_edges, lowThreshold, lowThreshold*ratio, kernel_size );
+
+ //Save the image
+ //cvSaveImage("test_edge.jpg",g_edges,0);
+
+ //cvShowImage("display", g_edges);
+ //cvWaitKey(0);
+
+}
+
+ /**
+ * Read the dilatometer image. The value changed will correspond to the new location of the edge.
+ * @param val - Will store the read value if successful