c++ - Bagon 先生为 Mean Shift Segmentation 提供的 edison_wrapper_mex.cpp 的 Mex 文件在 MATLAB 2014a 中不起作用

标签 c++ matlab

我正在尝试为这个 EDISON 代码运行 MEX 包装器以实现均值偏移 segmentation 在 MATLAB 2014a 的 Shai Bagon 先生的网站上提供。为了 运行此代码我遵循下面提到的过程。

在 MATLAB 命令窗口中,我正在输入以下指令 (我已经安装了 Visual Studio 2010)

第一步:>>mex-setup

Step2:选择VC++

第 3 步:现在尝试运行下面给出的 compile_edison_wrapper

但是出现错误:

Error using mex
edison_wrapper_mex.cpp
d:\mean shift\edge/BgEdgeList.h : error C4335: Mac file format detected: 
  please convert the source file to either
  DOS or UNIX format
  D:\Mean shift\edison_wrapper_mex.cpp(134) : warning C4018: '<' :
   signed/unsigned mismatch

   D:\Mean shift\edison_wrapper_mex.cpp(168) : warning C4018: '<' : 
   signed/unsigned mismatch
   D:\Mean shift\edison_wrapper_mex.cpp(179) : warning C4018: '<' :  
   signed/unsigned mismatch
   Error in compile_edison_wrapper (line 1)
   mex -O edison_wrapper_mex.cpp ...

最佳答案

  1. 将文件 edison_wrapper_mex.h 中的 '/' 更改为 '\' 这是因为代码可能是用 Mac 编写的。

  2. 按照指示尝试编译。它会在 edges 文件夹中的 .h 和 .cpp 文件中给出一些错误。这是因为这些文件以 UTF-8 格式编码,而 Windows 要求它是 UTF-16LE。您可以使用任何编辑器重新编码或复制粘贴整个文本,您会注意到“换行”字符丢失。只需按回车键,让它看起来令人愉悦。在 edges 文件夹和 Voila 中以相同的名称保存文件。

  3. 我在“edge\BgEdgeDetect.cpp”中从 math.h 中模糊使用 pow 时遇到了一些错误。只需转到错误指向的行号 (386),并通过显式将其加倍(正如我在下面所做的那样)或类型转换为 (double) 将第一个参数加倍。 IE。 变化:

    w = pow(2,(-2*WL_))*factorial(2*WL_)/(factorial(WL_-i)*factorial(WL_+i));
    

到:

    w = pow(2.0,(-2*WL_))*factorial(2*WL_)/(factorial(WL_-i)*factorial(WL_+i));

关于c++ - Bagon 先生为 Mean Shift Segmentation 提供的 edison_wrapper_mex.cpp 的 Mex 文件在 MATLAB 2014a 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31693621/

相关文章:

c++ - 模板相关的名称解析不应该找到没有链接的声明?

C++ 从函数数组中调用函数

matlab - 下标索引必须是实数正整数或逻辑误差与 matlab 中的均值函数

performance - 快速巧合搜索算法?

matlab - 检测图像中的数独方 block

c++ - 将小部件大小设置为另一个大小的一半

c++ - 在大模板类中专门化单个方法

matlab - 回调函数中的 Getrect() 有运行时错误

performance - 如何加速matlab中的双循环

c++ - 如何在like查询中使用sqlite icu