繁体   English   中英

在javacv中opencv Mat.copyto()方法的等价方法是什么?

[英]What is the equal method to opencv Mat.copyto() method in javacv?

我发现opencv代码示例来识别图像的边缘,我尝试将其转换为javacv,但我找不到Mat.copyto()方法的方法。 请问有人可以解释相同的方法吗? 这是示例代码。
http://docs.opencv.org/doc/tutorials/imgproc/imgtrans/canny_detector/canny_detector.html

   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()的相同方法吗?

我猜这是最相似的:

CvMat dst = src.clone();

在传统的C API中,这是cvCopy(src, dst, detected_edges)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM