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
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Specifying Target for Graphics Output 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!