loadPhoto: Load a photograph from a file.

Description Usage Arguments Details Value Methods (by class) See Also Examples

Description

Helper function to generate a new CanopyPhoto. Only support JPEG and TIFF format.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
loadPhoto(
  x,
  upperLeft = NULL,
  width = NULL,
  height = NULL,
  equipment = NULL,
  fisheye = NULL,
  datetime = NULL,
  geoLocation = NULL,
  bearing = NULL,
  elevation = NULL,
  slope = NULL,
  exposureTime = NULL,
  fNumber = NULL,
  isoSpeed = NULL
)

## S4 method for signature 'character'
loadPhoto(
  x,
  upperLeft = NULL,
  width = NULL,
  height = NULL,
  equipment = NULL,
  fisheye = NULL,
  datetime = NULL,
  geoLocation = NULL,
  bearing = NULL,
  elevation = NULL,
  slope = NULL,
  exposureTime = NULL,
  fNumber = NULL,
  isoSpeed = NULL
)

## S4 method for signature 'missing'
loadPhoto(x)

Arguments

x

character or missing.

upperLeft

numeric of length 2. Default is NULL, see Details.

width

integer. Default is NULL, see Details.

height

integer. Default is NULL, see Details.

equipment

one-length character. Default is NULL, see equipment.

fisheye

FishEye. See fisheye.

datetime

one-length character. Default is NULL. The accepted formats are: yyyy/mm/dd hh:mm:ss or yyyy-mm-dd hh:mm:ss, see datetime.

geoLocation

SpatialPoints with only 1 point. Default is NULL, see geoLocation.

bearing

Angle with only 1 value. Default is NULL, see bearing.

elevation

Angle with only 1 value. Default is NULL, see elevation.

slope

Angle with only 1 value. Default is NULL, see slope.

exposureTime

numeric. Default is NULL, see Details.

fNumber

numeric. Default is NULL, see Details.

isoSpeed

numeric. Default is NULL, see Details.

Details

To make a photograph ready to process with caiman package, use loadPhoto with a path to the file as argument, this creates a new CanopyPhoto. To load only a region of the file use upperLeft, width and height, both in pixels (these must be equals if you are loading a hemispherical photograph). To get the upperLeft corner of your region of interest, I recommend use ImageJ or IrfanView.

To get an example of a CanopyPhoto, run loadPhoto(). This data-example is an hemispherical photograph taken in a Nothofagus pumilio forest, in Argentina. To know what equipment was used to take it, use equipment. To know when it was taken, use datetime. To know where it was taken, use geoLocation. To know how the camera was physically oriented use bearing, slope and fisheye. To know the exposure use exposureTime, fNumber and isoSpeed. The metadata of a new CanopyPhoto could be provided as arguments for loadPhoto, but also can be set for an existing object using replacement methods (see examples).

Value

CanopyPhoto.

Methods (by class)

See Also

cloneSlots, doMask, calcExposure.

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
25
26
27
28
29
30
x <- loadPhoto() # or use a path to a file on your disk
x
plot(x)

path <- system.file("external/UnFavAutoE3.jpg", package="caiman")
# You can also set all or any slots
x <- loadPhoto(path, equipment = "some string", fisheye = newFishEye(),
                  datetime = "2000/01/01 12:00:00",
                    geocode = SpatialPoints(cbind(-43, -71)),
                      bearing = asAngle(0), elevation = asAngle(90))
x
plot(x)

path <- system.file("external/Black_caiman_Macrofotografie_2.jpg",
                                                              package="caiman")
x <- loadPhoto(path)
x
plot(x)
x <- loadPhoto(path, upperLeft = c(49, 29), width = 140, height = 81)
x
plot(x)

# this is what upperLeft means in hemispherical photographs:
x <- extend(makeRimage(200), extent(-50, 250, -20, 220))
extent(x) <- extent(0, ncol(x), 0 , nrow(x))
e <- extent(50, 250, 20, 220)
plot(is.na(x), legend = FALSE, axes = FALSE, box = FALSE,
  xlab = "240 px", ylab = "300 px")
plot(e, add = TRUE)
text(sp::SpatialPoints(cbind(50, 220)), "upperLeft = c(20, 50)", col = "white")

GastonMauroDiaz/caiman documentation built on Jan. 22, 2022, 4:43 a.m.