Help using coordinates to overlay an image on a plot
Ältere Kommentare anzeigen
I have a plot of experimental points and am trying to add an aerial image, sort of a map, overlain on the plot. But the image is an awkward shape, so using imagesc didn't work well. I have reference points within the picture that line up to the grid my plot is on. Is there a way I can use those to line up the picture with the plot? The plot is 2D.
Antworten (2)
Mike Garrity
am 24 Jul. 2015
The Image object (which is created by the image & imagesc commands) has a pair of properties named XData and YData. Normally, when you create an Image object using one of these commands, the XData is set to [1 N], where N is the number of columns in the image. In the same way, the YData is set to [1 M], where M is the number of rows.
But you can set these to different values. For example, this will give you an image which goes from 1 to 2 in X, and 2 to 3 in Y:
img = imread('ngc6543a.jpg');
h = image(img,'XData',[1 2],'YData',[2 3])
The return value h is a handle to that Image object. You can call set and get to modify it:
set(h,'XData',[4 5])
Kelly Kearney
am 24 Jul. 2015
0 Stimmen
If you need more than a simple translation of coordinates, you may want to look at the image registration functions in the Image Processing Toolbox ( cpselect, cpcorr, imwarp, etc.).
Kategorien
Mehr zu Image Processing Toolbox finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!