Help using coordinates to overlay an image on a plot
조회 수: 6 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
답변 (2개)
Mike Garrity
2015년 7월 24일
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])
댓글 수: 0
Kelly Kearney
2015년 7월 24일
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.).
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!