Remove a region in Image

5 次查看(过去 30 天)
Hi,
I'm looking to remove a region from images. For example, I'd like to use freehand as shown in the image and delete that portion of the image, i.e., turn it in to white because some unpredictable regions like that are troublesome. I'd like to use it for as many time as necessary. I looked into roi, but it turns entire image black and the selected region white. Also, how can you make sure freehand is enclosed. Would you require both ends of the freehand going inside, so you're always sure it is enclosed. Will freehand be always enclosed? Looks like there is a small gap between two ends.
Thanks for the help!

采纳的回答

Image Analyst
Image Analyst 2013-12-16
编辑:Image Analyst 2013-12-16
That is exactly what my freehand masking demo does. It's attached below in blue.
  13 个评论
Kev
Kev 2013-12-17
编辑:Kev 2013-12-17
ImageAnalyst,
Can you help with clearing workspace variables? I've set up a push button in the gui to clear variables and only retain the ratio value from calibration. I'm trying to clear the gui workspace because with the region removal like above, I'm unable to to remove regions in the second picture (second trial, after one measurement is done). It looks like variables need to be cleared and I'd like to clear all the variables (except ratio value) for the second picture.
function clearscreen_Callback(hObject, eventdata, handles)
global xy binary h burnedImage ratio_value
%clearvars xy binary h burnedImage
evalin('base','clear all');
cla;
I get following error on second trial:
Error using imroi/parseInputsForCreateMask (line 83)
Ambiguous syntax. Associated axes contains more than one image. Specify image handle
as input argument to resolve ambiguity. Type "help imroi/createMask" for more
information.
Error in imroi/createMask (line 245)
[obj,h_im] = parseInputsForCreateMask(varargin{:});
Error in FibGUI>blockremover_Callback (line 121)
binary = h.createMask();
Error in gui_mainfcn (line 96)
feval(varargin{:});
Error in FibGUI (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in
@(hObject,eventdata)FibGUI('blockremover_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback
Image Analyst
Image Analyst 2013-12-17
Don't use clear or clearvars or clearall in a GUI, and don't use evalin() - there's never a need to do that. That is what is causing problems. If your axes have more than one image, then call cla('reset') before you call imshow().

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Processing and Computer Vision 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by