void CannyThreshold(int, void*) { /// Reduce noise with a kernel 3x3 blur( src_gray, detected_edges, Size(3,3) ); /// Canny detector Canny( detected_edges, detected_edges, lowThreshold, lowThreshold*ratio, kernel_size ); /// Using Canny's output as a mask, we display our result dst = Scalar::all(0); src.copyTo( dst, detected_edges); imshow( window_name, dst ); /// Wait until user exit program by pressing a key int m = getOptimalDFTSize( dst.rows ); int n = getOptimalDFTSize( dst.cols ); // on the border add zero values copyMakeBorder(dst, padded, 0, m - dst.rows, 0, n - dst.cols, BORDER_CONSTANT, Scalar::all(0)); Mat planes[] = {Mat_<float>(padded), Mat::zeros(padded.size(), CV_32F)}; Mat complexdst; merge(planes, 2, complexdst); // Add to the expanded another plane with zeros dft(complexdst, complexdst); // this way the result may fit in the source matrix
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)