Problem in updating graphic handles on images in a GUI in MATLAB 2018b

1 visualización (últimos 30 días)
Hi! I have written a set of codes to develop a GUI for image processing in MATLAB 2014b (not using GUIDE). Using it a series of images can be loaded on an axis and then image processing tools can be applied to detect the edges. Moreover, there are options for image adjustments, like, edges created can be deleted and/or a portion of it can be moved to change the shape of the contour. When these edge adjustment operations are finished the changes were visible realtime in the 2014b version, i.e. the graphic handles on the images got updated. But when I am using the code in 2018b version, then those changes are not updated in the image. I have used the command 'drawnow' inside the code after plotting the graphic handle for the contour already.
As it is not a single code andthe codes are longer, so I cannot give the code here. But I am explainign the methodology. Let us say, two variables 'con_x' and 'con_y' contain the x and y coordinates of the points. I have simply set con_x=[] and con_y=[] for deleting the contour and used plot command again to update the contour on the image. When run in 2014b version this operation results in disappearance of the contour, but in 2018b version it does not occur. I have tried altering con_x and con_y with a series of zeros instead of empty matrix, but could not get the result.
One possible way to solve the problem is to load the whole image after every such operation, but that makes the operations slow, and it is unnecessary computational burden. Any assistance to solve the probem is appreciated.

Respuestas (1)

Walter Roberson
Walter Roberson el 3 de En. de 2020
I have used the command 'drawnow' inside the code after plotting the graphic handle for the contour already.
That is expected behaviour in all versions of MATLAB since at least the days of MATLAB 5.0 .
The display is defined to be updated only upon one of the following circumstances:
  • drawnow() is called
  • pause() is called
  • uiwait() or waitfor() is called
  • a figure is created or brought into focus by calling figure()
  • a figure is made visible or invisible
  • control returns to the MATLAB prompt because all executing functions and callbacks return
  • control is given to the MATLAB prompt by a breakpoint being encountered or keyboard() being called
Notice this list does not include the creation or deletion of any graphics object or part of a graphics object other than figures -- not unless no code is executing and you are sitting at the MATLAB command prompt.
The list also does not include returning from a callback that modifies a graphics object -- not unless doing so results in returning ot the MATLAB command prompt. If the callback interrupted a loop or a long-executing calculation or even another callback, then the display is not executed until one of the above-listed circumstances.
  3 comentarios
Walter Roberson
Walter Roberson el 3 de En. de 2020
That reminds me of some Windows specific graphics glitches that Jan has mentioned in the past for R2018b. Possibly updating to the newest Update for R2018b might help, if you have not already done so.
Sreerup Banerjee
Sreerup Banerjee el 3 de En. de 2020
I see. Many thanks. I will update it and try.

Iniciar sesión para comentar.

Categorías

Más información sobre Interactive Control and Callbacks en Help Center y File Exchange.

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by