【问题标题】:Structured Edge detection - OpenCV - IOS结构化边缘检测 - OpenCV - IOS
【发布时间】:2018-12-30 15:22:13
【问题描述】:

我正在尝试使用 piotr Dollar 的模型来检测 IOS 中的边缘,如此处所建议的。 https://docs.opencv.org/3.1.0/d0/da5/tutorial_ximgproc_prediction.html

String modelFilename = "./model.yml.gz";
Ptr<StructuredEdgeDetection> pDollar = createStructuredEdgeDetection(modelFilename);
pDollar->detectEdges(image, edges);

虽然上面的代码在我的机器上工作。 (苹果系统)。我无法使其在 IOS 上运行。 我收到以下错误。

  libc++abi.dylib: terminating with uncaught exception of type cv::Exception: OpenCV(3.4.2) 
../cv3.4/opencv-3.4.2/modules/ximgproc/src/structured_edge_detection.cpp:432: error: (-215:Assertion failed) 
modelFile.isOpened() in function 'StructuredEdgeDetectionImpl'

我已经查看了以下链接。

https://stackoverflow.com/a/49753953/381786 https://github.com/opencv/opencv/issues/8106

有关如何执行此操作的任何指示。

【问题讨论】:

    标签: ios opencv image-processing opencv3.0 edge-detection


    【解决方案1】:

    除了提供添加的资源路径外,还必须通过 swift 的 Bundle.main.path API 获取路径。

    let path = Bundle.main.path(forResource: "model.yml", ofType: "gz"); 
    

    使用此 api,可以获取资源的路径并使用它来检测边缘。

    【讨论】:

      猜你喜欢
      • 2016-02-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多