show image independently

i was building a program for capturing image from webcam, and show it using imshow(image) but suddenly after the image is captured, the image is shown in the part of gui, what i mean is to show the image independently, help me guys! thx!

 採用された回答

Jan
Jan 2011 年 10 月 21 日

0 投票

imshow displays the image in the current AXES-object. I assume "showing the image independently" means to display it in a new figure. Then:
newFigureH = figure;
newAxesH = axes('Parent', newFigureH);
imshow(rand(100, 100, 3), 'Parent', newAxesH);

7 件のコメント

Izzo
Izzo 2011 年 10 月 21 日
yes you got what i meant, but when i comitted the code it's shown this error:
??? Error using ==> axes
Invalid object handle
Error in ==> file at 61
newAxesH = axes('Parent', newFigureH);
Jan
Jan 2011 年 10 月 21 日
And why is newFigureH invalid? Did you insert the "newFigureH=figure" line above? Did you close the new figure?
Izzo
Izzo 2011 年 10 月 21 日
i don't know, i assume 'figure' is the image right? maybe if you know simpler code
Image Analyst
Image Analyst 2011 年 10 月 21 日
How can you not know? Do you have that line or not? Yes or no? That line creates a brand new, separate figure window. You need that, so look for it!
Izzo
Izzo 2011 年 10 月 22 日
yes i have that line of course, but i dont know why the axes is invalid
here is my code
newFigureH = img;
newAxesH = axes('Parent', newFigureH);
imshow(rand(100, 100, 3), 'Parent', newAxesH);
img is the image that i want to show
Walter Roberson
Walter Roberson 2011 年 10 月 22 日
No, Izzo, where Jan showed "figure" you require a figure number, and cannot use an image handle. An image is a single bit-mapped drawing such as a photograph, and cannot contain any other objects (except an annotation object.)
If img is the image you want to show, then you need to adapt Jan's example to
newFigureH = figure;
newAxesH = axes('Parent', newFigureH);
imshow(img, 'Parent', newAxesH);
Izzo
Izzo 2011 年 10 月 22 日
right it works! thank you very much for you guys help

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeConvert Image Type についてさらに検索

質問済み:

2011 年 10 月 21 日

Community Treasure Hunt

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

Start Hunting!

Translated by