g_resolution.m 1.13 KB
function g_resolution

%zstr = num2str(zone);

rootdir = '/Volumes/DyDisk/opc/images';
calfile = [rootdir,'/calib/opc_rect.mat'];
sample  = [rootdir,'/calib/20140203_1456.jpg'];

load(calfile)

res = nan.*LON;

mask(:,   1:1550) = NaN;         % above the horizon
mask(:,2500:end ) = NaN;

xlon = LON;
ylat = LAT;

xlon(:,2500:end) = [];
ylat(:,2500:end) = [];
xlon(:,1:1550)   = [];
ylat(:,1:1550)   = [];

[x y k] = ll2mtu(48.3296,-68.8349,ylat,xlon);

x = x';
y = y';

nx = size(x,1);
ny = size(x,2);

dx1 = abs(diff(x,1,1));
dx1(nx,:) = dx1(nx-1,:);
dx2 = abs(diff(x,1,2));
dx2(:,ny) = dx2(:,ny-1);

dy1 = abs(diff(y,1,1));
dy1(nx,:) = dy1(nx-1,:);
dy2 = abs(diff(y,1,2));
dy2(:,ny) = dy2(:,ny-1);

dx = (dx1 + dx2)./2;
dy = (dy1 + dy2)./2;

res = 1./(1./dx + 1./dy);

%res = (dx1 + dx2)./2 + (dy1 + dy2)./2;
%res = abs(res);

%x = uint8(x);
%y = uint8(y);

figure(1)

%subplot(2,1,1)
I = imread(sample);
I(2500:end,:,:) = [];
I(1:1550,:,:)   = [];
imshow(I);
saveas(gcf,'crop_sample.png','png');

figure(2)
%subplot(2,1,2)
imagesc(log(res)); colorbar
saveas(gcf,'crop_resolution.png','png');
colormap jet
set(gca,'DataAspectRatio',[1 1 1]);
%caxis([0.1 4])