Way to skip a point from ginput? (Without using RETURN)
4 次查看(过去 30 天)
显示 更早的评论
Hello,
I am trying to label specific body positions of a ferret frame by frame from a short video using ginput, storing the coordinates for use later. Say I'm labeling five parts, but in one frame, the parts 1,2 and 5 appear, but 3 and 4 do not: (There are many more positions)
positions = { '1','2', '3', '4', '5' };
[Ferretx, Ferrety] = ginput(length(positions));
Does ginput have a way for accounting for this? I don't want to hit return because I need to skip positions, and still retrieve coordinates for later positions.
I thought I would work around this by inserting a dummy cordinate for and converting those NaN values to deal with later but would like to know if ginput or a similar function would help instead? Another work around I'm thinking is relabing by the order the body parts present themselves in the frame (Ferret is coming into view from right to left)
I'm standardizing and plotting the coordinates in a later use so would not like things to get too messy. Thanks!
0 个评论
回答(1 个)
Rishav
2024-2-27
Hi Emmaneul,
You can insert NaN values for the coordinates where the body parts are not visible in a frame. Later, you can deal with these NaN values appropriately in your analysis.
positions = {'1', '2', '3', '4', '5'};
[Ferretx, Ferrety] = ginput(length(positions));
% Check which positions were not labeled
unlabeled_positions = find(isnan(Ferretx) | isnan(Ferrety));
% Insert NaN for unlabeled positions
Ferretx(unlabeled_positions) = NaN;
Ferrety(unlabeled_positions) = NaN;
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Exploration 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!