save and loading ROIs
5 次查看(过去 30 天)
显示 更早的评论
I want to save ROIs that selected from a jpg image using imfreehand. And in other jpg image, I want load save ROIs and adjust their position separately. How can I save ROIs and read again?
0 个评论
采纳的回答
Image Analyst
2013-8-20
I'd save them into a .mat file with the save() function, and recall with the load() function.
3 个评论
Matt Kindig
2013-8-20
What doesn't work about this approach? Your r1 should be back in the workspace after you call the load() command.
Image Analyst
2013-8-20
编辑:Image Analyst
2013-8-20
Moving the ROI has nothing to do with saving and recalling it. First of all, you can get the (x,y) coordinates like this:
hFH = imfreehand();
% Get the x,y coordinates from the ROI object.
xy = hFH.getPosition;
x = xy(:, 1);
y = xy(:, 2);
plot(x, y, 'r-'); % Draw it over the image.
Next you need to move it. Probably the easiest thing for you to do is to have scrollbars, one vertical and one horizontal. In the vertical scrollbar callback, increment or decrement the y value, and in the horizontal scrollbar callback increment or decrement the x values. See the FAQ: http://matlab.wikia.com/wiki/FAQ#How_can_I_share_data_between_callback_functions_in_my_GUI.28s.29.3F. If you want to get fancier you could use the mousemove callback to drag the ROI around.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!