I am trying out the object detection and tracking for augmented reality Mathworks example. https://www.mathworks.com/videos/object-recognition-and-tracking-for-augmented-reality-90546.html
I have tried running the code but I am getting an error saying 'Unrecognized function or variable 'oldInlierLocation'. I have included a snippet of it below.
How do I define it? I am new to Matlab and I could not find any resources or answers on this.
if(nnz(isValid>=2))
[trackingGTransform,oldInlierLocation,newInlierLocation]= ...
estimationGeometricTransform(...
oldValidLocation,newValidLocation,'similarity');
end
figure(1)
showMatchedFeatures(prevCameraFrame,cameraFrame,...
oldInlierLocation,newInlierLocation,'Montage');

 채택된 답변

Steven Lord
Steven Lord 2022년 5월 11일

1 개 추천

You made at least one mistake copying the code from around 4:10 in that video. Your code:
if(nnz(isValid>=2))
The video's code:
if (nnz(isValid) >= 2)
The placement of that first right parenthesis is important. In your code, the if condition is never satisfied and so the code inside the if statement is not executed. Therefore the variable oldInlierLocations never gets defined. In the video code, the if condition is satisfied and so the code inside executes and defines oldInlierLocations.

댓글 수: 1

Thank you so much for pointing out Steven! Totally overlooked that part

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by