前提・実現したいこと
C++版OpenCVへの移植
発生している問題・エラーメッセージ
for文内の dOp = .5*permute( [-1 0 1]', d:-1:1 ); 上のコードの働きがわからずC++への移植ができていません
該当のソースコード
言語:MATLAB
function dG = filterDoog( dims, sigmas, nderivs, show ) nd = length( dims ); if( nargin<4 || isempty(show) ); show=0; end; if( length(sigmas)~=nd ); error('invalid sigmas'); end if( length(nderivs)~=nd ); error('invalid nderivs'); end % get initial Gaussian dG = filterGauss( dims, [], sigmas.^2, 0 ); % compute derivatives along each axis for d=1:nd if( d==1 ); dOp=.5*[-1 0 1]'; else dOp = .5*permute( [-1 0 1]', d:-1:1 ); end if( nd==1 || nd==2 ) for i=1:nderivs(d); dG = conv2( dG, dOp, 'same' ); end else for i=1:nderivs(d); dG = convn( dG, dOp, 'same' ); end end end % normalize (don't need to adjust mean since DOOG always have 0 mean) dG=dG/norm(dG(:),1); % display if( show && nd<=3 ) filterVisualize( dG, show ); title( ['sigs=[' num2str(sigmas) '], derivs=[' num2str( nderivs ) ']']); end
試したこと
MATLABのデバックモードで実際に実行可能であることは確認しました
補足情報(FW/ツールのバージョンなど)
MATLAB:MATLAB R2017b
C++ :Microsoft Visual Studio 2017
OpenCV: ver3以降の文法でお願いします(ver3.4で書く予定です)
元コードが載っているGitHubのURLとなります
「filterDoog.m」
https://github.com/pdollar/toolbox/blob/master/filters/filterDoog.m
あなたの回答
tips
プレビュー