How to make this code convertible for Matlab Coder

2 views (last 30 days)
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 Comments
Darshan Ramakant Bhat
Darshan Ramakant Bhat on 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 ?

Sign in to comment.

Answers (0)

Categories

Find more on MATLAB Coder in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!