Way to skip a point from ginput? (Without using RETURN)

5 Ansichten (letzte 30 Tage)
Emmanuel Osikpa
Emmanuel Osikpa am 23 Mai 2021
Beantwortet: Rishav am 27 Feb. 2024
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!

Antworten (1)

Rishav
Rishav am 27 Feb. 2024
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;

Kategorien

Mehr zu Data Exploration finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by