How can I overlay a google earth image with a quiver plot?
19 次查看(过去 30 天)
显示 更早的评论
Hello, I would like to overlay a google image with a quiver plot but have no idea where to start. The purpose is to display current velocities around a reef.
It would be great if someone could point me in the right direction to start with.
0 个评论
采纳的回答
Jonathan LeSage
2013-10-18
编辑:Jonathan LeSage
2013-10-18
If you have a map image of your area of interest, you could plot and scale the map coordinates using the imagesc function after reading the image in with the imread function. Furthermore, if you have known points of reference on the map and know the scale, you can simply plot your quiver plot directly over the map image!
Here is an extremely basic outline of how your code could look. The coordinates are up to you to fill in, of course:
% Import map image
mapImage = imread('map.jpg');
imagesc(xMin:xMax,yMin:yMax,mapImage);
hold on;
% Overlay the quiver plot
quiver(x,y,dx,dy);
The primary trick here is to ensure your scales of the map and your quiver plot are aligned. I am also assuming that you will be plotting over a relatively small area such that map projection/transformations are not an issue. I would recommend brushing up on projections, just in case:
You could also check out the MATLAB mapping toolbox that helps make georeferencing more straightforward.
Hope this helps to get you started!
2 个评论
Anna Marshall
2020-5-3
Hi Jonathan- I have a similar question with overlaying a quiver plot onto an image that I am hoping you might be able to help me with. I have an image with orientations that I would like to overlay quiver arrows on to (and then change the colors based on angles). Do you have any suggestions for how to overlay the quiver plot? Thanks!
rgbImage = imread('DJI_0022.jpg'); %inputs image
hFig = figure;
subplot(2, 2, 1);
imshow(rgbImage)
axis('on', 'image');
impixelinfo;
title('Original RGB Image', 'FontSize', 20);
grayImage = rgb2gray(rgbImage); %convers to grayscale
subplot(2, 2, 2);
imshow(grayImage)
axis('on', 'image');
impixelinfo;
title('Gray Scale Image', 'FontSize', 20);
edgeImage = edge(grayImage, 'Canny', 0.6);
subplot(2, 2, 3);
imshow(edgeImage)
axis('on', 'image');
title('Canny Edge Image', 'FontSize', 20);
hFig.WindowState = 'maximized';
drawnow;
figure
% Get coordinates.
props = regionprops(edgeImage, 'PixelList');
for k = 1 : length(props)
thisList = props(k).PixelList;
fprintf('\nFor blob #%d of %d:\n ', k, length(props))
for k2 = 1 : size(thisList, 1)
thisx = thisList(k2, 1);
thisy = thisList(k2, 2);
fprintf('(%d, %d), ', thisx, thisy);
end
end
props = regionprops(edgeImage, 'Orientation');
allAngles = [props.Orientation];
histogram(allAngles);
grid on;
xlabel('Angle', 'FontSize', 20);
ylabel('Count', 'FontSize', 20);
H=histogram(allAngles);
Image Analyst
2020-5-3
I think I did that in this link. Below the colors overlaid onto the gray scale image correspond to the angle of the edge blobs.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/290032/image.png)
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Geodesy and Mapping 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!