How to make this code convertible for Matlab Coder

1 vue (au cours des 30 derniers jours)
Suzy
Suzy le 3 Jan 2021
Commenté : Suzy le 4 Jan 2021
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 commentaires
Darshan Ramakant Bhat
Darshan Ramakant Bhat le 4 Jan 2021
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 le 4 Jan 2021
I have updated giving the full function.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur MATLAB Coder dans Help Center et File Exchange

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by