How to make this code convertible for Matlab Coder
조회 수: 2 (최근 30일)
이전 댓글 표시
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
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 ?
답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!