How to make this code convertible for Matlab Coder

조회 수: 2 (최근 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 CenterFile Exchange에서 MATLAB Coder에 대해 자세히 알아보기

태그

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by