Scatter plot data different resolution satellite images
4 views (last 30 days)
Show older comments
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 Comments
Walter Roberson
on 10 Jun 2015
Is the scale large enough that curvature of the Earth must be worried about, or can it be treated as flat rectangular?
Answers (1)
Chad Greene
on 10 Jun 2015
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 Comments
Chad Greene
on 11 Jun 2015
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.
See Also
Categories
Find more on Visual Exploration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!