1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | % Created by Author % Version 1.0 % June 12, 2024 % If you have any question about this code, % please do not hesitate to contact me via E-mail: % jeremy456@163.com % Blog: % http://blog.sciencenet.cn/u/lixujeremy % http://lixuworld.blogspot.com/ clear; clc; timebegin=tic; cur_data=date; cur_time=fix(clock); str1=sprintf('%s %.2d:%.2d:%.2d', cur_data, cur_time(4), cur_time(5), cur_time(6)); fprintf('Time Begin: '); fprintf(str1); fprintf('\n'); filepath='S2A_tile_20180201_18PVS.tif'; image=imread(filepath); image=uint8(255.*rescale(image)); stdimage=double(image); rgb=image(:, :, 1:3); rgb=imadjust(rgb, stretchlim(rgb), []); % imshow(rgb); % Case_1: r(1/4)g(2)b(3) c1_1=(stdimage(:, :, 1)+stdimage(:, :, 4))./2; c1_1=uint8(c1_1); c1=cat(3, c1_1, image(:, :, 2), image(:, :, 3)); c1=imadjust(c1, stretchlim(c1), []); % imshow(c1); % Case_2: r(3)g(4)b(1/4) c2_1=(stdimage(:, :, 1)+stdimage(:, :, 4))./2; c2_1=uint8(c2_1); c2=cat(3, image(:, :, 3), image(:, :, 4), c2_1); c2=imadjust(c2, stretchlim(c2), []); % imshow(c2); % Case_3: r(2)g(3)b(3/4) c3_3=(stdimage(:, :, 3)+stdimage(:, :, 4))./2; c3_3=uint8(c3_3); c3=cat(3, image(:, :, 2), image(:, :, 3), c3_3); c3=imadjust(c3, stretchlim(c3), []); % imshow(c3); comimage=[rgb, c1; c2, c3]; imwrite(comimage, 'comimage.png'); fprintf('Time Begin: '); fprintf(str1); fprintf('\n'); cur_data=date; cur_time=fix(clock); str2=sprintf('%s %.2d:%.2d:%.2d', cur_data, cur_time(4), cur_time(5), cur_time(6)); fprintf('Time End: '); disp(str2); timespan=toc(timebegin); fprintf('Time Span: %.4f s\n', timespan); disp('**********************************************************'); |
[1] Original File: Getting Started 1 of 4: Create a project. 2021-04-26
No comments:
Post a Comment