Join 2 different points in different images in MATLAB -


i have 2 different images of same dimensions. there 1 point of interest in each image. want join 2 images joining 2 points in plot line. how can that? rough idea of image: http://i.imgbox.com/abhql3xt.png

let's create 2 images

>> [x,y] = meshgrid(-200:200, -200:200); >> im1 = exp(-sqrt(x.^2+y.^2)/100); >> im2 = exp(-sqrt(x.^2+y.^2)/200); 

you can display them side side imagesc command:

>> imagesc([im1 im2]); 

enter image description here

now want connect 2 points in images, coordinates (100, 300) , (300, 50). because images side side, need add width of first image x coordinate in second image:

>> width = size(im1, 2); >> x1 = 100; y1 = 300; >> x2 = 300 + width; y2 = 50; 

now can put hold on image (so can plot on top of it) , plot line connecting 2 points:

>> hold on; >> plot([x1 x2], [y1 y2], 'r', 'linewidth', 2) 

enter image description here


Comments