plotCamera: ButtonDownFcn usage
显示 更早的评论
Hi,
I have plotted a point cloud and a camera pose using structure from motion using the below matlab documentation.
I want to show the image of input camera by clicking on the camera.
In my case I have 6 cameras
I think I am doing something wrong with the function itself, can someone help me with the solution?
Thank you,
Amarbold
camPoses = poses(vSet);
figure;
plotCamera(camPoses, 'Size', 0.2, 'ButtonDownFcn', @imshowOrig);
hold on
function imshowOrig(camPoses,~)
idx = camPoses.ViewId;
imshow(pics{idx});
end
3 个评论
Mario Malic
2021-2-3
编辑:Mario Malic
2021-2-3
Hello,
It is not super clear to me how passing arguments into callback work but try this
plotCamera(camPoses, 'Size', 0.2, 'ButtonDownFcn', {@imshowOrig,camPoses, pics});
hold on
function imshowOrig(Source,~, camPoses, pics) % First two arguments are Source and Event
idx = camPoses.ViewId;
Source % this is for you to check what is the source object, is it figure or is it axes or something else (I never used plotCamera)
% if it's axes, then you need to uncomment the second line below, if not, use first line to find axes object
% ax = findall(Source, 'type', 'axes');
% ax = Source;
imshow(pics{idx}, 'Parent', ax);
end
Amarbold Purev
2021-2-3
编辑:Amarbold Purev
2021-2-3
Mario Malic
2021-2-3
It was unnecessary, I have edited my code in comment. Read, you'll need to do some things in order for it to work.
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Camera Calibration 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!