【问题标题】:What is the equal method to opencv Mat.copyto() method in javacv?javacv中opencv Mat.copyto()方法的equal方法是什么?
【发布时间】:2012-07-15 23:40:00
【问题描述】:

我找到了识别图像边缘的 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() 的相等方法吗?

【问题讨论】:

    标签: java opencv javacv


    【解决方案1】:

    我猜这是最相似的:

    CvMat dst = src.clone();
    

    【讨论】:

      【解决方案2】:

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2015-05-06
        • 2018-10-13
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-07-22
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多