Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/Camera.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export serial, model, vendor, isrunning, start!, stop!, getimage, getimage!, sav
trigger!,
exposure, exposure!, exposure_limits,
autoexposure_limits, autoexposure_limits!,
autoexposure_metering_mode!, autoexposure_lighting_mode!,
framerate, framerate!, framerate_limits,
gain, gain!, gain_limits,
adcbits, adcbits!,
Expand Down Expand Up @@ -38,7 +39,7 @@ mutable struct Camera
names = Dict{String, String}()
cam = new(handle, names)
finalizer(_release!, cam)

# Activate chunk mode
set!(SpinBooleanNode(cam, "ChunkModeActive"), true)
_chunkselect(cam, ["FrameID", "FrameCounter"], "frame indentification")
Expand All @@ -49,7 +50,7 @@ mutable struct Camera
cam.names["AutoExposureTimeLowerLimit"] = "AutoExposureTimeLowerLimit"
cam.names["AutoExposureTimeUpperLimit"] = "AutoExposureTimeUpperLimit"
cam.names["AcquisitionFrameRateEnabled"] = "AcquisitionFrameRateEnabled"

try
Spinnaker.get(Spinnaker.SpinFloatNode(cam, "AutoExposureTimeLowerLimit"))
catch
Expand All @@ -75,7 +76,7 @@ function _chunkselect(cam::Camera, chunknames::Vector{String}, desc::String)
fail = true
i = 1
while fail == true
try
try
fail = false
set!(SpinEnumNode(cam, "ChunkSelector"), chunknames[i])
set!(SpinBooleanNode(cam, "ChunkEnable"), true)
Expand Down Expand Up @@ -248,7 +249,7 @@ end
format, and thus the array will be in the range [0,1].

To return images compatible with Images.jl, one can request a Gray value, e.g.,
`getimage!(cam, Gray{N0f8}, normalize=true)`.
`getimage!(cam, Gray{N0f8}, normalize=true)`.

Function also returns image ID and timestamp metadata.
"""
Expand Down
46 changes: 46 additions & 0 deletions src/camera/acquisition.jl
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,52 @@ function autoexposure_limits(cam::Camera)
get(SpinFloatNode(cam, cam.names["AutoExposureTimeUpperLimit"])))
end

"""
autoexposure_lighting_mode!(::Camera, mode::String)

Change autoexposure lighting mode.
Options:
- "AutoDetect": Automatically detect
- "Backlight": Used when a strong light is coming from the back of the object.
- "Frontlight": Used when a strong light is shining in the front of the object
while the background is dark.
- "Normal": Used when the object is not under backlight or frontlight conditions
"""
function autoexposure_lighting_mode!(cam::Camera, mode::String)
if in(mode, ["AutoDetect", "Backlight", "Frontlight", "Normal"])
set!(SpinEnumNode(cam, "AutoExposureLightingMode"), mode)
else
@error """Lighting mode "$(mode)" not recognized"""
end
end

"""
autoexposure_metering_mode!(::Camera)

Change autoexposure lighting mode to "Normal" and set the autoexposure metering mode.
Options:
- "Average": Measures the light from the entire scene uniformly to determine
the final exposure value. Every portion of the exposed area has
the same contribution.
- "Spot": Measures a small area (about 3%) in the center of the scene while
the rest of the scene is ignored. This mode is used when the
scene has a high contrast and the object of interest is relatively
small.
- "Partial": Measures the light from a larger area (about 11%) in the center
of the scene. This mode is used when very dark or bright regions
appear at the edge of the frame.
- "CenterWeighted": (No SDK docs)
- "HistgramPeak": (No SDK docs)
"""
function autoexposure_metering_mode!(cam::Camera, mode::String)
if in(mode, ["Average","Spot","Partial","CenterWeighted","HistgramPeak"])
autoexposure_lighting_mode!(cam, "Normal")
set!(SpinEnumNode(cam, "AutoExposureMeteringMode"), mode)
else
@error """Metering mode "$(mode)" not recognized"""
end
end

"""
framerate(::Camera) -> Float

Expand Down