2016-04-01 11 views
0

私はフィーチャ抽出とエピポーラジオメトリを使用しています。しかし、私は常に次のようなエラーに出くわすよ:警告:非浮動小数点データを単精度に変換する

Warning: Converting non-floating point data to single. In pdist2 (line 219) In extractFeaturesU (line 93)

警告メッセージを返すコード行は次のとおりです。

[distance, position] = sort(pdist2(double(repmat(featuresA, size(xPoints, 1))), featuresB), 2, 'ascend'); 

上記の行を含むコードの一部を以下に表示されています。 double型の1と単一のタイプの1:

%% extract features 
corresponding = []; 
rightBound = size(sharpImageB, 2); 
xPoints = 3 : 3 : rightBound - 3; 
for index = 1 : size(realWantedPoints, 2) 
    %extract features from wanted points 
    disp('extracting features from wanted points...'); 
    if strcmp(desc, 'hog') 
     [featuresA, pointsA] = extractHOGFeatures(sharpImageA, realWantedPoints(:, index)', ... 
     'CellSize', [8 8], 'BlockSize', [2 2], 'NumBins', 9, 'UseSignedOrientation', true); 
    elseif strcmp(desc, 'block') 
     [featuresA, pointsA] = extractFeatures(sharpImageA, realWantedPoints(:, index)', ... 
     'Method', 'Block', 'BlockSize', 21, 'Upright', true); 
    elseif strcmp(desc, 'surf') 
     [featuresA, pointsA] = extractFeatures(sharpImageA, realWantedPoints(:, index)', ... 
     'Method', 'SURF', 'SURFSize', 64, 'Upright', true); 
    end 

    % generate epipolar line points 
    liner = star([1 0 0]) * [realWantedPoints(:, index); 1]; 
    yPoints = -(liner(3) + (liner(1) * xPoints))/liner(2); 
    matrixB = [xPoints', yPoints']; 

    % extract features from epipolar line points 
    disp('extracting features from epipolar line points...'); 
    if strcmp('hog', desc) 
     [featuresB, pointsB] = extractHOGFeatures(sharpImageB, matrixB, ... 
     'CellSize', [8 8], 'BlockSize', [2 2], 'NumBins', 9, 'UseSignedOrientation', true); 
    elseif strcmp('block', desc) 
     [featuresB, pointsB] = extractFeatures(sharpImageB, matrixB, ... 
     'Method', 'Block', 'BlockSize', 21, 'Upright', true); 
    elseif strcmp('surf', desc) 
     [featuresB, pointsB] = extractFeatures(greyB, matrixB, ... 
     'Method', 'SURF', 'SURFSize', 64, 'Upright', true); 
    end 

    % calculate similarity 
    [distance, position] = sort(pdist2(double(repmat(featuresA, size(xPoints, 1))), featuresB), 2, 'ascend'); 
    corresponding = [corresponding; pointsB(position(1), :)]; 
end 

xB = corresponding(:, 1); 
yB = corresponding(:, 2); 
+0

フィーチャBのデータタイプは何ですか? –

答えて

0

は、私は2つの変数にpdist2を呼び出すことによって、そのエラーを生成することができます。例えば。

x = ones(5,1,'single'); 
y = ones(5,1,'double'); 
pdist2(x,y); 

私の推測では、あなたのfeaturesB変数が単精度浮動小数点であるので、(あなたが明示的に変換するための二重です)pdist2ためにあなたの最初の引数の型と一致しないということです。

+0

あなたは正しかった!それは働いた、ありがとう –

関連する問題