How to "createMask" using "impoly" when two images are shown together in one axes by using 'AlphaData'?

1 回表示 (過去 30 日間)
Dear all,
I have two images; BW = which is a binary image, and ground_truth = which is rgb image. I tried to show them together in one axes using 'AlphaData' as shown in my code below.
I want to be able to generate a binary image (NEW_maskImage) after using the impoly in the same axes. However, I get the following error:
Ambiguous syntax. Associated axes contains more than one image. Specify image handle as input argument to resolve ambiguity.
My code as follows:
figure, imshow(BW);
hold on % two show both images transperently
h = imshow(ground_truth, gray(256));
set(h, 'AlphaData', 0.7)
hx = impoly
wait(hx);
NEW_maskImage = hx.createMask();
Does anyone knows how to overcome this error?
Thank you very much.
Meshoo

採用された回答

Alex Taylor
Alex Taylor 2014 年 4 月 3 日
If you look at the documentation for create mask, you can optionally specify the handle of the HG image object that you want to create the mask for.
You can get this handle as an output argument when displaying your images using imshow/imagesc, etc.
  1 件のコメント
Meshooo
Meshooo 2014 年 4 月 4 日
編集済み: Meshooo 2014 年 4 月 4 日
Thank you very much..but how to specify the handle of the HG?

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

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by