update.particles: Update identified particles.

Description Usage Arguments Value Author(s) Examples

View source: R/nnFunctions.R

Description

Apply trained artificial neural network to particleStat object.

Usage

1
2
## S3 method for class 'particles'
update(object, neuralnet, pca = TRUE, colorimages = NULL, sbg = NULL, ...)

Arguments

object

Object of class 'nnTrackdemObject'.

neuralnet

Trained neural net obtained from testNN

pca

Logical. By default TRUE, indicating that a principal component analysis is performed on the predictors.

colorimages

An array with the original full color images, in order to plot on the original images, obtained by loadImages. By default the original color images are used.

sbg

Images subtracted from background, as obtained by subtractBackground. By default, the original subtracted images are used.

...

further arguments passed to or from other methods.

Value

Data frame class 'particles', containing updated particle statistics (excluding particles that have been filtered out by the neural net).

Author(s)

Marjolein Bruijning, Caspar A. Hallmann & Marco D. Visser

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## Not run: 
dir.create("images")
## Create image sequence
traj <- simulTrajec(path="images",
                    nframes=30,nIndividuals=20,domain='square',
                    h=0.01,rho=0.9,movingNoise=TRUE,
                    parsMoving = list(density=20, duration=10, size=1,
                                      speed = 10, colRange = c(0,1)),
                    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))
nframes <- 3
frames <- order(tapply(partIden$patchID,partIden$frame,length),
                decreasing=TRUE)[1:nframes]
mId <- manuallySelect(particles=partIden,frame=frames)
finalNN <- testNN(dat=mId,repetitions=10,maxH=4,prop=c(6,2,2))
partIdenNN <- update(particles=partIden,neuralnet=finalNN)

## End(Not run)

trackdem documentation built on Sept. 25, 2021, 1:07 a.m.