1. 程式人生 > >SelectiveSearchCodeIJCV遇到First two input arguments should have the same 2D dimension

SelectiveSearchCodeIJCV遇到First two input arguments should have the same 2D dimension

words ati sigma his window first cpp arr bind

在windows 10+visual studio環境下運行SelectiveSearchCodeIJCV中的demo.m難免會出現下列錯誤

-----------------------

if(~exist(‘mexFelzenSegmentIndex‘,‘var‘))

-----------------------


錯誤使用 CountVisualWordsIndex (line 21)
First two input arguments should have the same 2D dimension


出錯 BlobStructColourHist


出錯 Image2HierarchicalGrouping (line 42)
[colourHist blobSizes] = BlobStructColourHist(blobIndIm, colourIm);


出錯 demo (line 61)
[boxes blobIndIm blobBoxes hierarchy] = Image2HierarchicalGrouping(im, sigma, k, minSize, colorType,

simFunctionHandles);

原因是:Dependencies/FelzenSegment/mexFelzenSegmentIndex.cpp

行149:int* dims = (int*) mxGetDimensions(input[0]);

中int的問題。

方法一:

把demo.m中mex Dependencies/FelzenSegment/mexFelzenSegmentIndex.cpp -output mexFelzenSegmentIndex;

改為

mex -compatibleArrayDims Dependencies/FelzenSegment/mexFelzenSegmentIndex.cpp -output mexFelzenSegmentIndex;

因為在 mex -compatibleArrayDims下mwSize才等於C中的int。

方法二:

直接將

int* dims = (int*) mxGetDimensions(input[0]);

改為跨平臺使用的數據類型mwSize

mwSize* dims = (mwSize*) mxGetDimensions(input[0]);

SelectiveSearchCodeIJCV遇到First two input arguments should have the same 2D dimension