trackParticles | R Documentation |
trackParticles
reconstructs trajectories by linking particles.
trackParticles(
particles,
L = 50,
R = 2,
weight = c(1, 1, 1),
costconstant = FALSE,
logsizes = FALSE
)
particles |
Object of class 'particles',
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).
Default set at |
R |
Integer. Link to how many subsequent frames? Default set
at |
weight |
Vector containing 3 weights to calculate costs. Depending on the study system, users may want to value certain elements over others. For instance, when individuals can vary in size over frames (which happens when objects move away or towards a camera) the "size" weight may be decreased. 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; third number gives the difference between the predicted location and the observed location. The latter is calculated using the location of the identified particle in the previous frame. |
costconstant |
Logical. Default is |
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:
dir.create("images")
## Create image sequence
traj <- simulTrajec(path="images",
nframes=30,nIndividuals=20,domain="square",
h=0.01,rho=0.9,
sizes=runif(20,0.004,0.006))
## Load images
dir <- "images"
allFullImages <- loadImages (dirPictures=dir,nImages=1:30)
stillBack <- createBackground(allFullImages,method="mean")
allImages <- subtractBackground(stillBack)
partIden <- identifyParticles(allImages,threshold=-0.1,
pixelRange=c(3,400))
records <- trackParticles(particles,L=40,R=2)
summary(records)
plot(records,type="trajectories")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.