我發現opencv代碼示例來識別圖像的邊緣,我嘗試將其轉換爲javacv,但我找不到Mat.copyto()方法的方法。請問有人能解釋一下它的平等方法嗎?這是示例代碼。
http://docs.opencv.org/doc/tutorials/imgproc/imgtrans/canny_detector/canny_detector.htmljavacv中opencv Mat.copyto()方法的等價方法是什麼?
Mat src, src_gray;
Mat dst, detected_edges;
int edgeThresh = 1;
int lowThreshold;
int const max_lowThreshold = 100;
int ratio = 3;
int kernel_size = 3;
char* window_name = "Edge Map";
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);
}
這是轉換的方法
CvMat src, src_gray;
CvMat dst, detected_edges;
int edgeThresh = 1;
int lowThreshold;
final int max_lowThreshold = 100;
int ratio = 3;
int kernel_size = 3;
String window_name = "Edge Map";
int CannyThreshold()
{
cvSmooth(src_gray, detected_edges, 3, 3);
cvCanny(detected_edges, detected_edges, lowThreshold, lowThreshold*ratio, kernel_size);
cvZero(dst);
src.copyTo(dst, detected_edges); // *** This line gives compile error
cvShowImage(window_name, dst);
}
請可以有一個人解釋Mat.copyto等於()的方法?