How can i edit the points of a saved ROI?

4 ビュー (過去 30 日間)
Leontios Hadjileontiadis
Leontios Hadjileontiadis 2014 年 3 月 21 日
回答済み: William Thielicke 2023 年 11 月 30 日
Hello, when i use the roipoly i have all the interactive facilities in the selection of the ROI points and i can edit the curve until i select CreateMask. Then I save the points of the ROI but i cannot have the same functionality if i just redraw the points in a new figure. I wonder if i could re-activate again the interactive facilities of roipoly but on the drawn ROI in a new figure, so i could make some corrections if needed. Thanks!
  1 件のコメント
William Thielicke
William Thielicke 2023 年 11 月 30 日
I have the same question. A least I think so.
I display an image, then create a ROI using
figure
imshow(imread('baby.jpg'))
roi = images.roi.AssistedFreehand(Color="y");
draw(roi)
Then, I am drawing a little bit, and when I am lucky with the result, I close the figure. Now I would like to open the same (or maybe even another) image, display the ROI from above, and maybe edit it a bit.
But I do not know how to display an existing ROI (namely the variable "roi" from the iamge above in the newly opened image.
I think converting the ROI to a mask or something and then converting it back to a ROI is not a nice solution.
Thanks for your input!!

サインインしてコメントする。

回答 (1 件)

William Thielicke
William Thielicke 2023 年 11 月 30 日
I think I found the solution:
figure
imshow(imread('baby.jpg'))
roi = images.roi.AssistedFreehand(Color="y");
draw(roi)
Then, before closing the figure:
Old_position=roi.Position;
Old_waypoints=roi.Waypoints;
Then the figure can be closed. Open a new figure and display an image
close all
clear roi
figure
imshow(imread('baby.jpg'))
And then let Matlab redraw the ROI from step 1
drawfreehand('Position', Old_position,'Waypoints',Old_waypoints);

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by