2017-06-13 75 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子图是没有意义的