I am tracking objects in images. I want to show my results on a plot. So I use image2D() function to plot two consecutive images and label the objects by numbers then shows how they maps from image1 to image2 as
16 => 0, 17 => 16, 18 => 0, 19 => 17,
20 => 18, 21 => 20, 22 => 19, 23 => 22, 24 => 23,
25 => 25, 26 => 24
0 = object died.
Now, I want to show arrow from n^th object (say 26) in image1 to m^th in image2 (i.e. 24) for visually intuitive presentation. Is it possible to draw an arrow from given coordinates in plot1 p1(x1, y1) to coordinates in plot2 p2(x2, y2)?
EDIT: Adding a sample script showing dummy image plots.
library(plot3D)
#we will create dummy images first
img1 <- matrix(0, nrow = 100, ncol = 100)
img2 <- matrix(0, nrow = 100, ncol = 100)
#add an objects to img1 and img2
img1[41:44, 31:35] <- rnorm(20) #object1 in image 1
img2[44:47, 33:37] <- rnorm(20) #object1 in image 2
img1[11:14, 71:75] <- rnorm(20) #object2 in image 1
img2[14:17, 73:77] <- rnorm(20) #object2 in image 2
# cordinates are x and y
x <- 1:100
y <- 1:100
#now plot them
par(mfrow=c(1,2))
image2D(img1, x, y)
image2D(img2, x, y)
Now, I want to plot two arrows from objects in image1 to objects in image2 to show association.