%% 多光谱 变color
%% ish变化 取消亮度部分用全色替代,反变换
%% 得到 color
%% Multi-spectral 1B 2G 3R 4NIR
function ihschange()
imgMulti = imread('02NOV21044347-M2AS_R1C1-000000185940_01_P001.TIF');
imgPan = imread('02NOV21044347-P2AS_R1C1-000000185940_01_P001.TIF');
% 由于原始的图像过大,需要将原图像裁剪,再进行拼接
imgMulti = uint16touint8(imgMulti);
imgPan = uint16touint8(imgPan);
imgMultiRGB = imgMulti(:,:,[3,2,1]);
[mp,np] = size(imgPan);
% 需要做上采样而不是下采样
imgMultiRGBBASE = imresize(imgMultiRGB,[mp np]);
% change the MultiRGB to IHS
% replace the I with imgPan
% change IHS to RGB
% 由于原始图像直接进行HSI变化造成内存不足,将原图像分成16份依次做hsi与rgb变换与替换
N = 16;
% if() 判断是否可以整除
% end
count = 1;
start_index = 1;
end_index = mp/N;
start_index_out = start_index;
end_index_out = end_index;
while(count <= 16)
count
hsi = rgb2hsi(imgMultiRGBBASE(start_index:end_index,:,:));%H S I
hsi(:,:,3) = im2douhble(imgPan(start_index:end_index,:,:));
rgb(start_index_out:end_index_out,:,:) = hsi2rgb(hsi);
count = count +1;
start_index = end_index + 1;
end_index = count*mp/N;
start_index_out = end_index_out +1;
end_index_out = end_index_out + mp/N;
if(count==9)
imwrite(rgb,'output1.png');
clear rgb;
start_index_out = 1;
end_index_out =mp/N;
end
if(count==17)
imwrite(rgb,'output2.png');
end
end
disp('ok');
end
function out_img = uint16touint8(src)
out_img = im2double(src);
out_img = mat2gray(out_img);
out_img = im2uint8(out_img);
end
function out=graychange(ori,tar)
ori = im2double(ori);
mean_t = im2double(mean(mean(tar)));
var_t = im2double(var(double(tar(:))));
mean_o = (mean(mean(ori)));
var_o = (var(double(ori(:))));
out = (var_t/var_o)*(ori - mean_o) + mean_t;
end


海神之光
- 粉丝: 6w+
最新资源
- h2o-app-3.22.0.2.jar
- fms-jvm-1.4.55-sources.jar
- service_2.11-0.0.103-javadoc.jar
- tock-nlp-front-shared-19.9.2-javadoc.jar
- tock-nlp-dialogflow-20.3.0-sources.jar
- braket-jvm-1.3.24-sources.jar
- codecatalyst-jvm-1.5.6-sources.jar
- cloudhsmv2-jvm-1.0.35-sources.jar
- wisp-config-2025.04.16.210958-554a97b-javadoc.jar
- pact-jvm-matchers_2.11-2.1.11-javadoc.jar
- cybrid-api-organization-kotlin-0.79.14-javadoc.jar
- appmesh-jvm-1.3.39-javadoc.jar
- ec2-jvm-1.4.74-sources.jar
- sparkling-water-scoring-package_2.12-3.44.0.3-1-3.5-sources.
- ec2-jvm-1.4.125-sources.jar
- appintegrations-jvm-1.3.88-sources.jar
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈


