How can I overlay a google earth image with a quiver plot?

조회 수: 10 (최근 30일)
Danielle
Danielle 2013년 10월 18일
댓글: Image Analyst 2020년 5월 3일
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.

채택된 답변

Jonathan LeSage
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
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
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.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Vector Fields에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by