【Tiff】Matlab读取Tiff显示(控制颜色)

来源:互联网 发布:监控上显示无网络视频 编辑:程序博客网 时间:2024/05/22 04:49

1、参考链接:http://blog.csdn.net/seamanj/article/details/35786497

http://blog.163.com/yinhexiwen@126/blog/static/64048266201141211190442/


main.m

%% 读取并显示原始图像clearclcclose allfilename = 'A2(A-B).tif';%A = geotiffread(filename);A = imread(filename);A = double(A);AGood = PrcessMatError(A);%% 显示三维图像[M,N] = size(AGood);[MM,NN] = meshgrid(1:M,1:N);h = figure;AGood_filt=medfilt2(AGood,[5 5]);% 滤波为5:代表平滑程度 越大越平滑hs = surf(MM',NN',AGood);colormap(flip(jet))set(hs,'edgecolor','none')zlabel('沉降量值/(m)')shading interpcolorbar saveas(hs,[filename '.fig'])

PrcessMatError.m

function [ A ] = PrcessMatError( A )%FINDERROFLAG Summary of this function goes here%   Detailed explanation goes hereAzeros = zeros(size(A));[hang,lie] = size(A);for i = 1:hang    for j = 1:lie        if ( abs(A(i,j)) > 1e16 )            A(i,j) = nan;        elseif abs(A(i,j)) < 1e-3            A(i,j) = 0;        end    endendend

总结如下(参考链接2):

颜色为64*3的矩阵,可以手动自制颜色。

mat_color = hsv;

发现mat_color为64*3,更改矩阵使用colormap命令设置颜色。


原创粉丝点击