How to merge a contour plot with the image it is derived from
9 ビュー (過去 30 日間)
古いコメントを表示
Hello, I have this challenge of overlaying a contour plot with that of the image from which it was derived, as both images now have different scale axes. The program I used is attached along with the relevant mat file, jpg file from which the mat file was obtained and the resultant merged image I obtained. Please help. Thank you.
Z = load('Ir_6707.mat');
flds = fieldnames(Z);% Fieldnames of data.
field = flds{1};% First field in data structure.
A = Z.(field);
B = -272.+A;% converts from kelvin to celsius
H = fspecial('average');% Creates predefined average 2_D filter
image = imfilter(B,H);% Applies filter to image
contour(flipud(image));
[C,h] = contour(interp2(flipud(image),'spline'));
clabel(C,h);
hold on
imagesc(flipud(B));
0 件のコメント
回答 (1 件)
Thorsten
2015 年 10 月 20 日
編集済み: Thorsten
2015 年 10 月 20 日
I failed to run your code, because
>> contour(flipud(image));
Error using flipud (line 19)
X must be a 2-D matrix.
I use Matlab R2012a.
Note that you treat A as if is where a matrix of temperature values in Kelvin; but is seems to be an RGB image. Also the correct formula is celsius = kelvin - 273.15.
To show an overlay of the image and the contour:
Z = load('Ir_6707.mat');
flds = fieldnames(Z);% Fieldnames of data.
field = flds{1};% First field in data structure.
A = Z.(field);
G = rgb2gray(A);
H = fspecial('average');%
image = imfilter(G,H);
imshow(A)
contour(image)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!