'callback', {@submit_image, ax}); end function draw_square(ax) % 绘制正方形 rectangle(ax, 'position', [-0.01, -0.01, 0.02, 0.02], 'edgecolor', 'b', 'linewidth', 2); end function submit_image(~, ~, ax) % 从用户选择图片并进行识别 [file, path] = uigetfile({'*.jpg;*.png;*.bmp', 'Image Files';'*.*', 'All Files'}, '选择一张图片'); if isequal(file, 0) return; end img = imread(fullfile(path, file)); imshow(img, 'parent', ax); % 在此处添加正方形与闭合曲线识别的代码 end square_with_curve_gui(); [2024-11-13 19:59:10 | AI写代码神器 | 366点数解答]