Putting a legend on a fused image
조회 수: 3 (최근 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에서 Legend에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
