Scatter plot data different resolution satellite images
4 ビュー (過去 30 日間)
古いコメントを表示
I have two satellite images with different resolutions and I would like to do a scatter plot comparing pixels
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/151047/image.jpeg)
for the same latitude and longitude. I have both images in netcdf format, with their correspondent latitude, longitude and band information (in this case Reflectance at 859 nm). Any ideas on how I could do this in matlab? I have inserted an image showing what I want to obtain (Vanhellemont & Ruddick 2015).
2 件のコメント
Walter Roberson
2015 年 6 月 10 日
Is the scale large enough that curvature of the Earth must be worried about, or can it be treated as flat rectangular?
回答 (1 件)
Chad Greene
2015 年 6 月 10 日
If both images are the same size, and each pixel in image A corresponds to the same lat/lon of the same pixel in image B, You can get a scatter plot by
plot(A(:),B(:),'b.')
Does the color in your example image correspond to density of scattered points? If so, something like this might help.
Here's an example with some random data:
% Create lat/lon grid:
[lon,lat] = meshgrid(-180:180,-90:90);
% Create two sample data images:
A = 50*cosd(lat) + 5*sind(lon);
B = A+30*randn(size(A))./(A.^1.2);
A = A/2e3;
B = B/2e3;
B(B<0) = NaN;
% Set ocean data to NaN:
ocean = ~landmask(lat,lon);
A(ocean) = NaN;
B(ocean) = NaN;
figure
subplot(211)
pcolor(lon,lat,A);
colormap(brewermap(256,'*BrBg'))
shading flat
axis tight
borders('countries','color',rgb('dark gray'),'nomap')
title 'Image A'
subplot(212)
pcolor(lon,lat,B);
shading flat
axis tight
borders('countries','color',rgb('dark gray'),'nomap')
title 'Image B'
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/177339/image.png)
And to compare the two images:
figure
plot(A(:),B(:),'b.')
axis([0 0.03 0 0.03])
hold on
polyplot(A(:),B(:),'k-')
xlabel 'Rrs 859 nm (MODIS-Terra)'
ylabel 'Rrs 865 nm (OLI)'
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/177340/image.png)
Above, landmask, brewermap, borders, rgb, and polyplot are all available on the File Exchange site.
2 件のコメント
Chad Greene
2015 年 6 月 11 日
Ah, you mean horizontal spatial resolution. I'd use interp2 to downsample the higher resolution image. But note that simply using interp2 may result in slightly aliased data from high-spatial-frequency information, so you may want to do a low-pass filter before interp2. If you have the image processing toolbox, imresize is another option.
参考
カテゴリ
Help Center および File Exchange で Visual Exploration についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!