2017-06-13 76 views
0
function [x, y] = get_one_point_from_image(input_image) 
    % read image 
    I = im2double(input_image); 
    handle = subplot(1,1,1); 
    imshow(I); 

    % let the user pick one point 
    [x,y] = ginput(1); 

    % round to integer to match required input by regiongrowing function 
    x = round(x); 
    y = round(y); 

    close(handle); 
end 

此例程彈出一個窗口。關閉圖像窗口

我需要那個窗口關閉時,選擇一個點完成。

但是,這個例程不起作用。

回答

3

您無法關閉「子圖」,您需要關閉該圖。

您可以隨時close gcf(gfc =獲得當前數字),或者如果您希望它更可靠,請在開頭創建數字handle=figure;並關閉它。

注意:創建1x1x1子圖是沒有意義的