필터 지우기
필터 지우기

How to plot imagesc plot over .jpg image?

조회 수: 4 (최근 30일)
Kalasagarreddi Kottakota
Kalasagarreddi Kottakota 2022년 2월 4일
댓글: Kalasagarreddi Kottakota 2022년 2월 4일
The result of this plot only shows image 'Top.jpg' with a colorbar, but I am looking for imagesc plot over the rgb image.
figure()
rgb = imread('Top.jpg');
image(rgb)
axis image
hold on
imagesc(x_coord,y_coord,Ax)
alpha(0.5)
colorbar
colormap jet

채택된 답변

DGM
DGM 2022년 2월 4일
Both objects exist in the same axes, so they share the same coordinate space. If you're going to specify x,y coordinates for the second object, then it's in units of pixels. If you set x_coord and y_coord to be something like [0 1], then the second plot will be microscopic and essentially invisible.
rgb = imread('peppers.png');
s = size(rgb);
image(rgb)
axis image
hold on
% note the scale
h2 = imagesc([0 100],[0 100],rand(100));
h2.AlphaData = 0.5;
colorbar
colormap jet
How you handle this depends entirely on the meaning of those coordinates with respect to the other image. If your x,y coordinates are mismatched like in the above example and you want them to cover the image, then use them for both images.
figure
rgb = imread('peppers.png');
s = size(rgb);
h1 = image([0 100],[0 100],rgb);
hold on
h2 = imagesc([0 100],[0 100],rand(100));
h2.AlphaData = 0.5;
colorbar
colormap jet
% force unequal aspect ratio
set(gca,'dataaspectratio',[s(1:2)/max(s(1:2)) 1]);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Orange에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by