GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — setsm_postprocessing/mosaic.m at master · ihowat/setsm_postprocessing Expand file tree/ Copy pathmosaic.mMore file actions executable file ·130 lines (101 loc) · 3.68 KB / Copy pathmosaic.mFile metadata and controlsexecutable file ·130 lines (101 loc) · 3.68 KB 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 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 function mosaic(db,tiles,res,outdir,varargin) % MOSAIC upper level function for mosaicking DEM strips to a set of tiles % % mosaic(db,tiles,res,outdir) % mosaic(db,tiles,res,outdir,gcp) %% parse and error check varargin if ~isempty(varargin) gcp=varargin{1}; if ~isfield(gcp,'x') || ~isfield(gcp,'y') || ~isfield(gcp,'z') error('gcp arg must be structure with fields x,y,z') end end tilef = cellstr([char(tiles.I),... repmat(['_',num2str(res),'m_dem.mat'],length(tiles.I),1)]); %% Loop through tiles and mosaic for n=1:length(tiles.I) outname=[outdir,'/',tiles.I{n},'_',num2str(res),'m_dem.mat']; if exist(outname,'file') fprintf('tile dem %s exists\n',tiles.I{n}) % fprintf('tile %s exists deleting\n',tiles.I{n}) % delete(outname); else fprintf('building tile %s: %d of %d\n',tiles.I{n},n,length(tiles.I)) strips2tile(db,tiles.x0(n),tiles.x1(n),tiles.y0(n),tiles.y1(n),res,... outname,'disableReg'); end if exist(outname,'file') if exist(strrep(outname,'dem.mat','reg_dem.mat'),'file') fprintf('tile reg dem %s exists\n',tiles.I{n}); else % Apply gcp registration if gcp's provided if exist('gcp','var') fprintf('appling ground control\n'); m = matfile(outname); registerTile(m,gcp); clear m end end end end %% Align unregistered tiles % find unregistered tiles by intersect/removing with registered list f=dir([outdir,'/*m_dem.mat']); f=cellfun(@(x) [outdir,'/',x], {f.name}, 'UniformOutput',false); freg=dir([outdir,'/*m_reg_dem.mat']); freg=cellfun(@(x) [outdir,'/',x], {freg.name}, 'UniformOutput',false); % remove unregistered files that already have registered files [~,IA]=intersect(f,strrep(freg,'_reg','')); f(IA)=[]; batchAlignTile(f,freg); %% Blend tile edges % get list of tiles from current directory tilef=dir([outdir,'/*m_reg_dem.mat']); tilef = cellfun(@(x) [outdir,'/',x], {tilef.name}, 'UniformOutput',false); %batchMergeTileBuffer(tilef); %% Crop Buffers and Write Tiles To Geotiffs tilef=dir([outdir,'/*m_dem.mat']); tilef = cellfun(@(x) [outdir,'/',x], {tilef.name}, 'UniformOutput',false); for i=1:length(tilef) fprintf('writing tif %d of %d\n',i,length(tilef)) if exist(strrep(tilef{i},'dem.mat','reg_dem.mat'),'file') fi=strrep(tilef{i},'dem.mat','reg_dem.mat'); else fi=tilef{i}; end fprintf('source: %s\n',fi); load(fi,'x','y'); % crop buffer tile x=x(101:end-100); y=y(101:end-100); OutDemName = strrep(fi,'.mat','.tif'); if ~exist(OutDemName,'file'); load(fi,'z'); z=z(101:end-100,101:end-100); z(isnan(z)) = -9999; writeGeotiff(OutDemName,x,y,z,4,-9999,'polar stereo north') clear z end OutMatchtagName = strrep(fi,'dem.mat','matchtag.tif'); if ~exist(OutMatchtagName,'file'); load(fi,'mt'); mt =mt(101:end-100,101:end-100); writeGeotiff(OutMatchtagName,x,y,mt,1,0,'polar stereo north') clear mt end OutOrthoName = strrep(fi,'dem.mat','ortho.tif'); if ~exist(OutOrthoName ,'file'); load(fi,'or'); or =or(101:end-100,101:end-100); writeGeotiff(OutOrthoName ,x,y,or,2,0,'polar stereo north') clear or end; OutDaynumName = strrep(fi,'dem.mat','daynum.tif'); if ~exist(OutDaynumName,'file'); load(fi,'dy'); dy =dy(101:end-100,101:end-100); writeGeotiff(OutDaynumName,x,y,dy,2,0,'polar stereo north') clear dy end clear x y end |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |