public static CVImage CannyEdgeDetection(CVImage image, double threshold1, double threshold2, int aperture_size) { if (image.Channels != 1) { throw new CVException("Canny edge detection supports only one channel image format."); } CVImage result = new CVImage(image.Width, image.Height, CVDepth.Depth8U, 1); // Native call to openCV canny algorithm: PInvoke.cvCanny(new __CvArrPtr(image), new __CvArrPtr(result), threshold1, threshold2, aperture_size); return(result); }