Putting a legend on a fused image

12 次查看(过去 30 天)
I have the following code:
figure()
total_grid = imfuse(pB_grid, pA_grid, "falsecolor");
imshow(total_grid,'InitialMagnification', 800)
title("Initial placement of cells")
Is there anyway to add a legend to this to make clear which points are from the pB_grid and which are from the pA_grid?
Thanks

采纳的回答

DGM
DGM 2022-4-10
编辑:DGM 2022-4-10
Here's one way to work around the issue:
A = imread('cameraman.tif');
B = fliplr(A);
F = imfuse(A,B,'falsecolor');
imshow(F); hold on
% use empty scatter objects to give legend() something to use
ha = scatter([],[],10,[0 1 0],'filled');
hb = scatter([],[],10,[1 0 1],'filled');
legend([ha hb],{'image A','image B'})
Depending on the object content of the images being used, the result may be totally counterintuitive. In the above example, the legend is correct. Image A is represented in green, but the primary feature is a man in dark clothing, so he's filled with the bright regions of image B. As a consequence, he's apparently the exact opposite of the color indicated by the legend. Using imfuse() like this is a great way to make things confusing unless all your objects are positive (bright) features.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Specifying Target for Graphics Output 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by