フィルターのクリア

How to capture image in gui?

3 ビュー (過去 30 日間)
syafini alias
syafini alias 2018 年 2 月 16 日
コメント済み: Image Analyst 2022 年 3 月 17 日
I have created gui with two axes and one pushbutton. I use axes1 to view live video from webcam and i don't have problem with it. But i don't know how to capture the image from axes1 and display the image in axes2.

採用された回答

Image Analyst
Image Analyst 2018 年 2 月 17 日
Try this:
axes(handles.axes1); % Switch focus to axes1.
theImage = getimage(); % Snag the image out of axes1.
axes(handles.axes2); % Switch focus to axes2.
imshow(theImage); % Place theImage into axes2.
If you want to make more compact, you could skip axes() and pass the axes handle into getimage() and imshow() but then to get other things, like title() etc., to appear on the correct axes you'll have to pass the handles into those functions too. If you call axes() things like titles will appear on the current axes (the one you just passed into axes() function).
  3 件のコメント
OMKAR KATKOLE
OMKAR KATKOLE 2022 年 3 月 17 日
source code pls?
Image Analyst
Image Analyst 2022 年 3 月 17 日
@OMKAR KATKOLE I showed the source code. It's just those 4 lines of code.

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

その他の回答 (1 件)

Roy Kadesh
Roy Kadesh 2018 年 2 月 16 日
You can use screencapture to use Java to make a capture of the contents of the axis, which you can then imshow (or image, or set(ax2,'CData',IM)).
  1 件のコメント
Image Analyst
Image Analyst 2022 年 3 月 17 日
Or you can use exportgraphics() or copygraphics() if you have R2020b or later.

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

カテゴリ

Help Center および File ExchangePrinting and Saving についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by