How to make this code convertible for Matlab Coder

3 ビュー (過去 30 日間)
Suzy
Suzy 2021 年 1 月 3 日
コメント済み: Suzy 2021 年 1 月 4 日
I am converting matlab to cpp with Matlab coder. I know that Mat object arrays aren't supported for matlab convertion and therefore I am getting error on the last line. Now, my question is how can I change the code to get pointsA and pointsB without causing issue on Matlab coder.
function imgLocated = imageMatch(f1, vpts1, imgB, resizeAlign)
originalB = imgB;
imgB = imresize(imgB, resizeAlign);
imgB = rgb2gray(imgB);
imgB = histeq(imgB);
points2 = detectFASTFeatures(imgB);
[f2,vpts2] = extractFeatures(imgB,points2);
indexPairs = matchFeatures(f1,f2);
pointsA = vpts1(indexPairs(:,1)); pointsB = vpts2(indexPairs(:,2));
if (pointsA.Count < 5 && pointsB.Count < 5)
disp("Could not auto align, not enought number of features.");
imgLocated = originalB;
return;
end
[tform, ~, pointsAm] = estimateGeometricTransform(pointsB, pointsA, 'affine');
tform.T(3,1) = (1/resizeAlign)*tform.T(3,1); tform.T(3,2) = (1/resizeAlign)*tform.T(3,2);
%fprintf('Number of matches %d\n', pointsAm.Count);
if (pointsAm.Count > 4)
imgLocated = imwarp(originalB, tform, 'OutputView', imref2d(size(originalB)));
else
disp("Could not auto align, no enought matches.");
imgLocated = originalB;
end
end
  2 件のコメント
Darshan Ramakant Bhat
Darshan Ramakant Bhat 2021 年 1 月 4 日
It is difficult to answer the question with the given details. Can you please attach a sample functions and scripts to reproduce the issue ?
Suzy
Suzy 2021 年 1 月 4 日
I have updated giving the full function.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB Coder についてさらに検索

タグ

製品


リリース

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by