Reading Point Cloud, manipulate and change it using keyboard KeyPressFcn
2 次查看(过去 30 天)
显示 更早的评论
My problem is to open stacked point clouds in the given path, visualize, manipulate it, and safe manipulated as a new cloud.
All seems to be ok, but when I open point cloud in Figue using pcshow, it somehow exits function called after 'KeyPressFcn' .
In other words, after pushing arrow point cloud is showed in figure but it exits the function and not reacts on other keys, when i use only displays in the case swich all works, means that this function is working and is not exited till figure is opened.
Any solutions ? I will apreciate any help. Best regards.
My acactual code:
% Tested: Matlab 2020a;
clc
clear all
close all
warning off
orgin_path = 'D:/Dataset';
generated_path = './output';
%% Read PC
ptStack = imageDatastore(orgin_path,...
'ReadFcn',@pc_reader,...
'FileExtensions','.txt',...
'IncludeSubfolders',true,...
'LabelSource','foldernames');
h = figure;
set(h,'KeyPressFcn',{@KeyPressCb ptStack});
%pcshow(ptCloud);
%title(ptFileInfo.Label)
%% Local Functions
% PC reader
function ptCloud = pc_reader(filename) %
points = table2array(readtable(filename));
ptCloud = pointCloud(points);
end
% Keyboard
function KeyPressCb(~,evnt,ptstack)
fprintf('key pressed: %s\n',evnt.Key);
[ptCloud, ptFileInfo] = readimage(ptstack,1);
switch evnt.Key
case 'leftarrow' %next point cloud
disp('case 1')
%pcshow(ptCloud) ?? ############ problem here or
case 'rightarrow' %previeus point cloud
disp('case 2')
case 'uparrow'
disp('case 3')
% function to manipulate PC Rotate X
case 'downarrow'
disp('case 4')
% Rotate Y
case 'escape'
disp('case 5')
% close manipulation
case 'return'
disp('case 6')
%save manipulated point cloud
end
pcshow(ptCloud) % ?? ########## problem here
end
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Point Cloud Processing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!