How can I smoothly switch between images?

2 ビュー (過去 30 日間)
Mark Saffer
Mark Saffer 2018 年 8 月 15 日
コメント済み: OCDER 2018 年 8 月 15 日
Hello
I'm working on an experimental set-up that requires the smooth switching of images. For example image 1 is of a table lamp with the light OFF and image 2 is of the same table lamp with the light ON (same size and from the same angle). I would like to switch these images so it appears that the table lamp turns ON and OFF. So image 1 is displayed for 5 seconds and then is switched with image 2. Thanks.
Mark

採用された回答

OCDER
OCDER 2018 年 8 月 15 日
ImOn = ones(100, 'logical'); %For you, imread('lamp_on.png');
ImOff = zeros(100, 'logical'); %For you, imread('lamp_off.png');
Ion = imshow(ImOn);
hold on
Ioff = imshow(ImOff);
Ioff.Visible = 'off';
hold off
for j = 1:10
if strcmpi(Ion.Visible, 'on')
Ion.Visible = 'off';
Ioff.Visible = 'on';
else
Ion.Visible = 'on';
Ioff.Visible = 'off';
end
pause(5);
end
  2 件のコメント
Mark Saffer
Mark Saffer 2018 年 8 月 15 日
Perfect. Thanks so much for the fast response.
OCDER
OCDER 2018 年 8 月 15 日
You're welcome!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by