how to change the orientation of an extrapolated image?

2 Ansichten (letzte 30 Tage)
Sreeraj R
Sreeraj R am 26 Nov. 2021
Kommentiert: Sreeraj R am 26 Nov. 2021
hi everyone
i am trying to extrapolate an image. however after extrapolation the orientation of the image changed. the output image covers a different area within India. how do i fix it?
the first one is the original image and the second one is the extrapolated image however the area its covering is different from the first image. i need the second image to be an extrapolated image covering the same area as the first image.
% clc;
% clear all ;
% load coast
% data =('D:\Sreeraj\Earthdata tropomi\New folder\S5P_OFFL_L2__NO2___01012021.nc');
% % ncdisp(data)
% lon = ncread(data,'/PRODUCT/longitude');
% lat = ncread(data,'/PRODUCT/latitude');
% RF = ncread(data,'/PRODUCT/averaging_kernel');
% RF1=permute(RF,[2 3 1]);
% RF2=nan(450,4173,34);
% % RF2=flip(RF1,3);
% %to crop the study area
% for i=1:450
% for j=1:4173
% for k=1:34
% if lat(i,j)>5 & lat(i,j)<45
% RF2(i,j,k)=RF1(i,j,k);
% else
% RF2(i,j,k)=nan;
% end
% end
% end
% end
%
% for i=1:450
% for j=1:4173
% for k=1:34
% if lon(i,j)>60 & lon(i,j)<110
% RF3(i,j,k)=RF2(i,j,k);
% else
% RF3(i,j,k)=nan;
% end
% end
% end
% end
% % RF3(isnan(RF3))=0;
% lat2=lat(2:450,2591:3543);
% lon2=lon(2:450,2591:3543);
% RF4=RF3(2:450,2591:3543,:);
% % RF4(isnan(RF4))=0;
lat3=lat2(1,:)'; %%----extrapolating data
lon3=lon2(:,1);
[X,Y]=meshgrid(lon3,lat3);
%resampling data
[X1,Y1]=meshgrid(lon3(1):0.3869:lon3(end),lat3(1):0.3869:lat3(end));
for i=1:34
v=griddata(X,Y,RF4(:,:,i)',X1,Y1);
v1(:,:,i)=v;
end
the above code is what i have used for the extrapolation. kindly help me to solve this problem
  2 Kommentare
KSSV
KSSV am 26 Nov. 2021
You have to increase the extents of your grid....you have to define your grid in the shape you want. If you use meshgrid it will give you a square/ rectangle domain.
Sreeraj R
Sreeraj R am 26 Nov. 2021
how do i do that sir?

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

KSSV
KSSV am 26 Nov. 2021
Let (X,Y) be your original grid data coordinates.
lon0 = min(X(:)) ; lon1 = max(X(:)) ;
lat0 = min(Y(:)) ; lat1 = max(Y(:)) ;
% Make new grid of desired resolution
x = lon0:0.3869:lon1 ;
y = lat0:0.3869:lat1 ;
[Xi,Yi] = meshgrid(x,y) ;
% get boundary of original grid
idx = boundary(X(:),Y(:)) ;
% USe inpolygon to pick points lying inside the region
Xi(~idx) = NaN ;
Yi(~idx) = NaN ;
Now check is (Xi,YI) satisfying your region.

Weitere Antworten (0)

Kategorien

Mehr zu Geometric Transformation and Image Registration finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by