How to update images in GUI?

조회 수: 3 (최근 30일)
rupam baruah
rupam baruah 2015년 12월 7일
답변: Walter Roberson 2015년 12월 7일
I have a binary image with 4 objects. I am trying to remove objects by using imfreehand function. But the problem is: First I delete OBJECT2 using imfreehand. Then when I tried to delete OBJECT3 , OBJECT3 is deleted but again OBJECT2 reappeared in the image. How to update image after each operation?
  댓글 수: 2
Walter Roberson
Walter Roberson 2015년 12월 7일
Please show your code of how you delete objects.
rupam baruah
rupam baruah 2015년 12월 7일
h=imfreehand();
bw=h.createMask();
handles.bi=handles.i4;
handles.bi(bw)=0;
imshow(handles.bi);
guidata(hObject,handles);
...... Here i4 is the initial image ....

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2015년 12월 7일
Is that the same code as you use for OBJECT3 ? If so then the problem is that you are resetting to the original image handles.i4 each time. If you change the assignment to
if ~isfield(handles, 'bi')
handles.bi = handles.i4;
end
then it will only be done if it has not been done before and otherwise will proceed to work with the existing handles.bi that had the object deleted from it already.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by