how to execute stop(vid) when i close the imshow figure while running a while loop?

조회 수: 1 (최근 30일)
i am capturing images from a camera in real time and displaying the processed image in a while loop. As soon as I close the figure window, an error pops up. I want to execute stop(vid) after i close the figure and don't want the error to exist.
the error is as given below
Error using matlab.ui.Figure/set Invalid or deleted object.
Error in imshow (line 343) set(fig_handle, 'NextPlot', 'replacechildren')
Error in LiveDetector (line 40) imshow(imgOut);toc;
  댓글 수: 5
zhuang Xu
zhuang Xu 2019년 1월 12일
So have you solved this problem,bro ? How did you achieve that ?
Walter Roberson
Walter Roberson 2019년 1월 12일
use the close request callback that I linked to . That is exactly the kind of purpose the callback was designed for.

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

답변 (1개)

Walter Roberson
Walter Roberson 2018년 12월 11일
use a callback to detect the close attempt .use it to stop the video before deleting the figure.

Community Treasure Hunt

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

Start Hunting!

Translated by