function temp1
    close all
    p="/mnt/m/logs/4077/jetson/image-generator/images/sonobot-5077/20230817/sonobot-5077_20230817_120429174_20230817_120652691_360_3552FA9A.png";
    pp=imread(p);
    figure(1)
    im1=imshow(pp);
    figure(2)
    im2=imshow(pp);
    set(im1,"ButtonDownFcn",{@p1,im2});

end

function p1(src,event,im2)
    if event.Button == 1  
        po=event.IntersectionPoint;
        h = images.roi.Rectangle();
        addlistener(h,'MovingROI',@(src,evt) updateLabel(src,evt,im2));
        addlistener(h,'ROIClicked',@updateUnits);
        %cp = hAx.CurrentPoint;
        cp = po(1:2);
        h.beginDrawingFromPoint(cp);
    end
end

function updateLabel(src,evt,im2)
    figure(2)
    data=get(2,'UserData');
    if isempty(data)
        h=rectangle("Position",evt.Source(1).Position,'FaceColor',[1,0,0]);
        set(2,"UserData",h);
    else
        data.Position=evt.Source(1).Position;
    end
end

function updateUnits(src,evt)
    evt
end