View source: R/trackFunctions.R
mergeTracks | R Documentation |
mergeTracks
attempts to merge to two track objects as obtained by
trackParticles
.
mergeTracks(records1, records2, L = NULL, weight = NULL, logsizes = FALSE)
records1 |
Object of class 'tracked',
obtained using |
records2 |
Object of class 'tracked',
obtained using |
L |
Numeric. Maximum cost for linking a particle to another particle.
When the cost is larger,
particles will be not be linked (resulting in the begin or end of a segment).
If |
weight |
Vector containing 3 weights to calculate costs. Depending
on the study system user may want to value certain elements over others.
Weights are ordered as follows;
first number gives the weight for differences in x and y coordinates;
second number
gives the weight for particle size differences. Note that the
difference between the predicted location and the observed location is
not taken into account in this function. If |
logsizes |
Logical. Default is |
A list of class 'TrDm' and 'records'. Use 'summary' and 'plot'.
Marjolein Bruijning, Caspar A. Hallmann & Marco D. Visser
## Not run:
## Create image sequence
dir.create("images")
traj <- simulTrajec(path="images",
nframes=60,nIndividuals=20,domain="square",
h=0.01,rho=0.9,sizes=runif(20,0.004,0.006))
## Analyse first part
dir <- "images"
allFullImages1 <- loadImages (dirPictures=dir,nImages=1:30)
stillBack1 <- createBackground(allFullImages1)
allImages1 <- subtractBackground(bg=stillBack1)
partIden1 <- identifyParticles(sbg=allImages1,
pixelRange=c(1,500),
threshold=-0.1)
records1 <- trackParticles(partIden1,L=20,R=2)
## Analyse second part
allFullImages2 <- loadImages (dirPictures=dir,nImages=31:60)
stillBack2 <- createBackground(allFullImages2)
allImages2 <- subtractBackground(bg=stillBack2)
partIden2 <- identifyParticles(sbg=allImages2,
pixelRange=c(1,500),
threshold=-0.1)
records2 <- trackParticles(partIden2,L=20,R=2)
## Merge tracks
records <- mergeTracks(records1,records2)
plot(records,colorimages=allFullImages1,type="trajectories",incThres=10)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.