Skip to content

Instantly share code, notes, and snippets.

@jtravs
Last active Oct 17, 2019
Embed
What would you like to do?
Very sketchy Vimba interface for Julia
using GLVisualize, Colors, GeometryTypes, Vimba
w = glscreen()
get, close = make_get()
function main(w, img)
while isopen(w)
img = get()
GLAbstraction.set_arg!(obj, :intensity, map(GLVisualize.Intensity{1, Float32}, img))
GLWindow.render_frame(w)
GLWindow.swapbuffers(w)
GLWindow.poll_glfw()
yield()
end
end
img = get()
println("$(size(img))")
imgi = map(GLVisualize.Intensity{1, Float32}, img)
obj = visualize(
imgi,
color_map = [RGBA{Float32}(1, 0, 0), RGBA{Float32}(0, 1, 0)], # any vector of colors will do
color_norm = Vec2f0(0, 10) # map intensity between 0 and 255 befor color lookup in [0-1]
)
_view(obj)
main(w, img)
GLWindow.destroy!(w)
close()
module Vimba
export make_get
const vmblib = ENV["VIMBA_HOME"]*"VimbaC\\Bin\\Win64\\VimbaC"
include("VmbCommonTypes.jl")
function __init__()
err = ccall((:VmbStartup, vmblib), stdcall, VmbError_t, ())
if err != VmbErrorSuccess
error("Vimba: cannot load library")
end
atexit(()->ccall((:VmbShutdown, vmblib), stdcall, Void, ()))
end
const gVimbaHandle = VmbHandle_t(1)
#
# Method: VmbFeatureBoolGet()
#
# Purpose: Get the value of a boolean feature.
#
# Parameters:
#
# [in ] const VmbHandle_t handle Handle for an entity that exposes features
# [in ] const char* name Name of the boolean feature
# [out] VmbBool_t * pValue Value to be read
#
# Returns:
#
# - VmbErrorSuccess: If no error
# - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
# - VmbErrorBadHandle: The given handle is not valid
# - VmbErrorInvalidAccess: Operation is invalid with the current access mode
# - VmbErrorWrongType: The type of feature "name" is not Boolean
# - VmbErrorNotFound: If feature is not found
# - VmbErrorBadParameter: If name or pValue is NULL
#
function VmbFeatureBoolGet(handle::VmbHandle_t, feature::AbstractString)
ret = Ref{VmbBool_t}(VmbBoolFalse)
err = ccall((:VmbFeatureBoolGet, vmblib), stdcall, VmbError_t, (VmbHandle_t, Cstring, Ref{VmbBool_t}), handle, feature, ret)
if err != VmbErrorSuccess
error("Vimba: cannot get bool feature: $feature . Error code: $err")
end
ret[]
end
#
# Method: VmbFeatureIntSet()
#
# Purpose: Set the value of an integer feature.
#
# Parameters:
#
# [in ] const VmbHandle_t handle Handle for an entity that exposes features
# [in ] const char* name Name of the feature
# [in ] VmbInt64_t value Value to set
#
# Returns:
#
# - VmbErrorSuccess: If no error
# - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
# - VmbErrorBadHandle: The given handle is not valid
# - VmbErrorInvalidAccess: Operation is invalid with the current access mode
# - VmbErrorWrongType: The type of feature "name" is not Integer
# - VmbErrorInvalidValue: "value" is either out of bounds or not an increment of the minimum
# - VmbErrorBadParameter: If name is NULL
# - VmbErrorNotFound: If the feature was not found
# - VmbErrorInvalidCall: If called from frame callback
#
function VmbFeatureIntSet(handle::VmbHandle_t, feature::AbstractString, value::Integer)
err = ccall((:VmbFeatureIntSet, vmblib), stdcall, VmbError_t, (VmbHandle_t, Cstring, VmbInt64_t), handle, feature, value)
if err != VmbErrorSuccess
error("Vimba: cannot set int feature: $feature . Error code: $err")
end
end
# Method: VmbFeatureIntGet()
#
# Purpose: Get the value of an integer feature.
#
# Parameters:
#
# [in ] const VmbHandle_t handle Handle for an entity that exposes features
# [in ] const char* name Name of the feature
# [out] VmbInt64_t* pValue Value to get
#
# Returns:
#
# - VmbErrorSuccess: If no error
# - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
# - VmbErrorBadHandle: The given handle is not valid
# - VmbErrorInvalidAccess: Operation is invalid with the current access mode
# - VmbErrorWrongType: The type of feature "name" is not Integer
# - VmbErrorNotFound: The feature was not found
# - VmbErrorBadParameter: If name or pValue is NULL
#
#IMEXPORTC VmbError_t VMB_CALL VmbFeatureIntGet ( const VmbHandle_t handle,
# const char* name,
# VmbInt64_t* pValue );
function VmbFeatureIntGet(handle::VmbHandle_t, feature::AbstractString)
ret = Ref{VmbInt64_t}(0)
err = ccall((:VmbFeatureIntGet, vmblib), stdcall, VmbError_t, (VmbHandle_t, Cstring, Ref{VmbInt64_t}), handle, feature, ret)
if err != VmbErrorSuccess
error("Vimba: cannot get int feature: $feature . Error code: $err")
end
ret[]
end
#
# Method: VmbFeatureEnumGet()
#
# Purpose: Get the value of an enumeration feature.
#
# Parameters:
#
# [in ] const VmbHandle_t handle Handle for an entity that exposes features
# [in ] const char* name Name of the feature
# [out] const char** pValue The current enumeration value. The returned value
# is a reference to the API value
#
# Returns:
#
# - VmbErrorSuccess: If no error
# - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
# - VmbErrorBadHandle: The given handle is not valid
# - VmbErrorInvalidAccess: Operation is invalid with the current access mode
# - VmbErrorWrongType: The type of feature "name" is not Enumeration
# - VmbErrorNotFound: The feature was not found
# - VmbErrorBadParameter: if name or pValue is NULL
#
#IMEXPORTC VmbError_t VMB_CALL VmbFeatureEnumGet ( const VmbHandle_t handle,
# const char* name,
# const char** pValue );
function VmbFeatureEnumGet(handle::VmbHandle_t, name::AbstractString)
value = Ref{Ptr{UInt8}}(0)
err = ccall((:VmbFeatureEnumGet, vmblib), stdcall, VmbError_t, (VmbHandle_t, Cstring, Ref{Ptr{UInt8}}), handle, name, value)
if err != VmbErrorSuccess
error("Vimba: cannot get enum feature: $feature . Error code: $err")
end
unsafe_string(value[])
end
#
# Method: VmbFeatureEnumSet()
#
# Purpose: Set the value of an enumeration feature.
#
# Parameters:
#
# [in ] const VmbHandle_t handle Handle for an entity that exposes features
# [in ] const char* name Name of the feature
# [in ] const char* value Value to set
#
# Returns:
#
# - VmbErrorSuccess: If no error
# - VmbErrorApiNotStarted: Vm[HW Helpdesk #BNN-733-91677]: LAN ports in labbStartup() was not called before the current command
# - VmbErrorInvalidAccess: Operation is invalid with the current access mode
# - VmbErrorBadHandle: The given handle is not valid
# - VmbErrorInvalidAccess: Operation is invalid with the current access mode
# - VmbErrorWrongType: The type of feature "name" is not Enumeration
# - VmbErrorInvalidValue: "value" is not within valid bounds
# - VmbErrorNotFound: The feature was not found
# - VmbErrorBadParameter: If name ore value is NULL
# - VmbErrorInvalidCall: If called from frame callback
#
#IMEXPORTC VmbError_t VMB_CALL VmbFeatureEnumSet ( const VmbHandle_t handle,
# const char* name,
# const char* value );
function VmbFeatureEnumSet(handle::VmbHandle_t, name::AbstractString, value::AbstractString)
err = ccall((:VmbFeatureEnumSet, vmblib), stdcall, VmbError_t, (VmbHandle_t, Cstring, Cstring), handle, name, value)
if err != VmbErrorSuccess
error("Vimba: cannot set enum feature: $feature . Error code: $err")
end
end
#
# Method: VmbFeatureCommandRun()
#
# Purpose: Run a feature command.
#
# Parameters:
#
# [in ] const VmbHandle_t handle Handle for an entity that exposes features
# [in ] const char* name Name of the command feature
#
# Returns:
#
# - VmbErrorSuccess: If no error
# - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
# - VmbErrorBadHandle: The given handle is not valid
# - VmbErrorInvalidAccess: Operation is invalid with the current access mode
# - VmbErrorWrongType: The type of feature "name" is not Command
# - VmbErrorNotFound: Feature was not found
# - VmbErrorBadParameter: name is NULL
#
#IMEXPORTC VmbError_t VMB_CALL VmbFeatureCommandRun ( const VmbHandle_t handle,
# const char* name );
function VmbFeatureCommandRun(handle::VmbHandle_t, command::AbstractString)
err = ccall((:VmbFeatureCommandRun, vmblib), stdcall, VmbError_t, (VmbHandle_t, Cstring), handle, command)
if err != VmbErrorSuccess
error("Vimba: cannot run command: $command . Error code: $err")
end
end
#
# Method: VmbFeatureCommandIsDone()
#
# Purpose: Check if a feature command is done.
#
# Parameters:
#
# [in ] const VmbHandle_t handle Handle for an entity that exposes features
# [in ] const char* name Name of the command feature
# [out] VmbBool_t * pIsDone State of the command.
#
# Returns:
#
# - VmbErrorSuccess: If no error
# - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
# - VmbErrorBadHandle: The given handle is not valid
# - VmbErrorInvalidAccess: Operation is invalid with the current access mode
# - VmbErrorWrongType: The type of feature "name" is not Command
# - VmbErrorNotFound: Feature was not found
# - VmbErrorBadParameter: name or pIsDone is NULL
#
#IMEXPORTC VmbError_t VMB_CALL VmbFeatureCommandIsDone ( const VmbHandle_t handle,
# const char* name,
# VmbBool_t * pIsDone );
function VmbFeatureCommandIsDone(handle::VmbHandle_t, command::AbstractString)
isDone = Ref{VmbBool_t}(VmbBoolFalse)
err = ccall((:VmbFeatureCommandIsDone, vmblib), stdcall, VmbError_t, (VmbHandle_t, Cstring, Ref{VmbBool_t}),
handle, command, isDone)
if err != VmbErrorSuccess
error("Vimba: cannot check if command is complete: $command. Error code: $err")
end
return (isDone[] == VmbBoolTrue)
end
# Purpose: Discovers GigE cameras if GigE TL is present.
# Discovery is switched on only once so that the API can detect all currently connected cameras.
function discovergigecameras()
if VmbFeatureBoolGet(gVimbaHandle, "GeVTLIsPresent") == VmbBoolTrue
VmbFeatureIntSet(gVimbaHandle, "GeVDiscoveryAllDuration", 250)
VmbFeatureCommandRun(gVimbaHandle, "GeVDiscoveryAllOnce")
else
warn("Vimba: GigE transport layer not present or active.")
end
end
# Method: VmbCamerasList()
#
# Purpose: Retrieve a list of all cameras.
#
# Parameters:
#
# [out] VmbCameraInfo_t* pCameraInfo Array of VmbCameraInfo_t, allocated by
# the caller. The camera list is
# copied here. May be NULL if pNumFound is used for size query.
# [in ] VmbUint32_t listLength Number of VmbCameraInfo_t elements provided
# [out] VmbUint32_t* pNumFound Number of VmbCameraInfo_t elements found.
# [in ] VmbUint32_t sizeofCameraInfo Size of the structure (if pCameraInfo == NULL this parameter is ignored)
#
# Returns:
#
# - VmbErrorSuccess: If no error
# - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
# - VmbErrorStructSize: The given struct size is not valid for this API version
# - VmbErrorMoreData: The given list length was insufficient to hold all available entries
# - VmbErrorBadParameter: The pNumFound parameter was NULL
#
# Details: Camera detection is started with the registration of the "DiscoveryCameraEvent"
# event or the first call of VmbCamerasList(), which may be delayed if no
# "DiscoveryCameraEvent" event is registered (see examples).
# VmbCamerasList() is usually called twice: once with an empty array to query the
# list length, and then again with an array of the correct length. If camera
# lists change between the calls, pNumFound may deviate from the query return.
#
#IMEXPORTC VmbError_t VMB_CALL VmbCamerasList ( VmbCameraInfo_t* pCameraInfo,
# VmbUint32_t listLength,
# VmbUint32_t* pNumFound,
# VmbUint32_t sizeofCameraInfo );
immutable VmbCameraInfo
cameraId::Ptr{UInt8} # Unique identifier for each camera
cameraName::Ptr{UInt8} # Name of the camera
modelName::Ptr{UInt8} # Model name
serial::Ptr{UInt8} # Serial number
permittedAccess::VmbAccessMode_t # Used access mode, see VmbAccessModeType
interfaceId::Ptr{UInt8} # Unique value for each interface or bus
end
type CameraInfo
cameraId::String # Unique identifier for each camera
cameraName::String # Name of the camera
modelName::String # Model name
serial::String # Serial number
permittedAccess::UInt32 # Used access mode
interfaceId::String # Unique value for each interface or bus
end
type Camera
info::CameraInfo
handle::VmbHandle_t
end
function CameraInfo(c::VmbCameraInfo)
CameraInfo(unsafe_string(c.cameraId), unsafe_string(c.cameraName),
unsafe_string(c.modelName), unsafe_string(c.serial),
c.permittedAccess,
unsafe_string(c.interfaceId))
end
function listcameras()
ncameras = Ref{VmbUint32_t}(0)
err = ccall((:VmbCamerasList, vmblib), stdcall, VmbError_t,
(Ptr{VmbCameraInfo}, VmbUint32_t, Ref{VmbUint32_t}, VmbUint32_t),
C_NULL, 0, ncameras, sizeof(VmbCameraInfo))
if err != VmbErrorSuccess || ncameras[] < 1
error("Vimba: could not list cameras or no cameras present. Error code: $err")
end
cameras = Array{VmbCameraInfo}(ncameras[])
err = ccall((:VmbCamerasList,vmblib), stdcall, VmbError_t,
(Ref{VmbCameraInfo}, VmbUint32_t, Ref{VmbUint32_t}, VmbUint32_t),
cameras, length(cameras), ncameras, sizeof(VmbCameraInfo))
if err != VmbErrorSuccess
error("Vimba: could not list cameras. Error code: $err")
end
println("$cameras")
return [CameraInfo(cam) for cam in cameras[1:ncameras[]]]
end
#
# Method: VmbCameraOpen()
#
# Purpose: Open the specified camera.
#
# Parameters:
#
# [in ] const char* idString ID of the camera
# [in ] VmbAccessMode_t accessMode Determines the level of control you have on the camera
# [out] VmbHandle_t* pCameraHandle A camera handle
#
# Returns:
#
# - VmbErrorSuccess: If no error
# - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
# - VmbErrorNotFound: The designated camera cannot be found
# - VmbErrorInvalidAccess: Operation is invalid with the current access mode
# - VmbErrorInvalidCall: if called from frame callback
# - VmbErrorBadParameter: if idString or pCameraHandle is NULL
#
# Details: A camera may be opened in a specific access mode, which determines
# the level of control you have on a camera.
# Examples for "idString":
# "DEV_81237473991" for an ID given by a transport layer,
# "169.254.12.13" for an IP address,
# "000F314C4BE5" for a MAC address or
# "DEV_1234567890" for an ID as reported by Vimba
#
#IMEXPORTC VmbError_t VMB_CALL VmbCameraOpen ( const char* idString,
# VmbAccessMode_t accessMode,
# VmbHandle_t* pCameraHandle );
function opencamera(c::CameraInfo; access_mode=1)
handle = Ref{VmbHandle_t}(0)
err = ccall((:VmbCameraOpen, vmblib), stdcall, VmbError_t, (Cstring, VmbAccessMode_t, Ref{VmbHandle_t}),
c.cameraId, access_mode, handle)
if err != VmbErrorSuccess
error("Vimba: cannot open camera. Error code: $err")
end
camera = Camera(c, handle[])
VmbFeatureCommandRun(camera.handle, "GVSPAdjustPacketSize" )
i = 0
while !VmbFeatureCommandIsDone(camera.handle, "GVSPAdjustPacketSize")
i += 1
end
println("$i")
camera
end
#
# Method: VmbCameraClose()
#
# Purpose: Close the specified camera.
#
# Parameters:
#
# [in ] const VmbHandle_t cameraHandle A valid camera handle
#
# Returns:
#
# - VmbErrorSuccess: If no error
# - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
# - VmbErrorInvalidCall: If called from frame callback
#
# Details: Depending on the access mode this camera was opened with, events are killed,
# callbacks are unregistered, and camera control is released.
#
#IMEXPORTC VmbError_t VMB_CALL VmbCameraClose ( const VmbHandle_t cameraHandle );
function closecamera(c::Camera)
err = ccall((:VmbCameraClose, vmblib), stdcall, VmbError_t, (VmbHandle_t,), c.handle)
if err != VmbErrorSuccess
error("Vimba: cannot close camera. Error code: $err")
end
end
function capturestart(c::Camera)
err = ccall((:VmbCaptureStart, vmblib), stdcall, VmbError_t, (VmbHandle_t,), c.handle)
if err != VmbErrorSuccess
error("Vimba: cannot start capture. Error code: $err")
end
end
function captureend(c::Camera)
err = ccall((:VmbCaptureEnd, vmblib), stdcall, VmbError_t, (VmbHandle_t,), c.handle)
if err != VmbErrorSuccess
error("Vimba: cannot stop capture. Error code: $err")
end
end
#
# Frame delivered by the camera
#
type VmbFrame
buffer::Ptr{Void} # Comprises image and ancillary data
bufferSize::VmbUint32_t # Size of the data buffer
context_1::Ptr{Void} # User context filled during queuing
context_2::Ptr{Void} # User context filled during queuing
context_3::Ptr{Void} # User context filled during queuing
context_4::Ptr{Void} # User context filled during queuing
receiveStatus::VmbFrameStatus_t # Resulting status of the receive operation
receiveFlags::VmbFrameFlags_t # Resulting flags of the receive operation
imageSize::VmbUint32_t # Size of the image data inside the data buffer
ancillarySize::VmbUint32_t # Size of the ancillary data inside the data buffer
pixelFormat::VmbPixelFormat_t # Pixel format of the image
width::VmbUint32_t # Width of an image
height::VmbUint32_t # Height of an imag
offsetX::VmbUint32_t # Horizontal offset of an image
offsetY::VmbUint32_t # Vertical offset of an image
frameID::VmbUint64_t # Unique ID of this frame in this stream
timestamp::VmbUint64_t # Timestamp of the data transfer
end
type Frame
vmbframe::VmbFrame
data::Array{UInt8,1}
pxl_fmt::String
end
function Frame(c::Camera)
payloadsize = VmbFeatureIntGet(c.handle, "PayloadSize")
data = Array{UInt8,1}(payloadsize)
pxl_fmt = VmbFeatureEnumGet(c.handle, "PixelFormat")
Frame(VmbFrame(pointer(data, 1), payloadsize,
C_NULL, C_NULL, C_NULL, C_NULL,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
data, pxl_fmt)
end
function framequeue(c::Camera, f::Frame)
err = ccall((:VmbCaptureFrameQueue, vmblib), stdcall, VmbError_t, (VmbHandle_t, Ref{VmbFrame}, Ptr{Void}),
c.handle, f.vmbframe, C_NULL)
if err != VmbErrorSuccess
error("Vimba: cannot queue frame. Error code: $err")
end
end
function announceframe(c::Camera, f::Frame)
err = ccall((:VmbFrameAnnounce, vmblib), stdcall, VmbError_t, (VmbHandle_t, Ref{VmbFrame}, VmbUint32_t),
c.handle, f.vmbframe, sizeof(VmbFrame))
if err != VmbErrorSuccess
error("Vimba: cannot announce frame. Error code: $err")
end
end
# timeout in ms
function framewait(c::Camera, f::Frame, timeout)
err = ccall((:VmbCaptureFrameWait, vmblib), VmbError_t, (VmbHandle_t, Ref{VmbFrame}, VmbUint32_t),
c.handle, f.vmbframe, timeout)
if err != VmbErrorSuccess
error("Vimba: cannot capture frame. Error code: $err")
end
end
function retreiveimg(f::Frame)
if f.vmbframe.receiveStatus != VmbFrameStatusComplete
error("Vimba: frame capture status is not complete: $(f.vmbframe.receiveStatus)" )
end
if f.pxl_fmt != "Mono8"
error("Unsupported pixel format")
end
reshape(copy(f.data), (f.vmbframe.height, f.vmbframe.width))
end
function framerevoke(c::Camera, f::Frame)
err = ccall((:VmbFrameRevoke, vmblib), stdcall, VmbError_t, (VmbHandle_t, Ref{VmbFrame}),
c.handle, f.vmbframe)
if err != VmbErrorSuccess
error("Vimba: cannot revoke frame. Error code: $err")
end
end
function synchronousgrab()
discovergigecameras()
cameras = listcameras()
println("$cameras")
camera = opencamera(cameras[1])
println("$camera")
VmbFeatureEnumSet(camera.handle, "PixelFormat", "Mono8")
frame = Frame(camera)
println("$(frame.vmbframe.width) $(frame.vmbframe.height)")
announceframe(camera, frame)
println("$(frame.vmbframe.width) $(frame.vmbframe.height)")
capturestart(camera)
println("$(frame.vmbframe.width) $(frame.vmbframe.height)")
framequeue(camera, frame)
println("$(frame.vmbframe.width) $(frame.vmbframe.height)")
VmbFeatureCommandRun(camera.handle, "AcquisitionStart")
framewait(camera, frame, 1000)
println("$(frame.vmbframe.width) $(frame.vmbframe.height)")
VmbFeatureCommandRun(camera.handle, "AcquisitionStop")
captureend(camera)
img = retrieveimg(frame)
framerevoke(camera, frame)
closecamera(camera)
return img
end
function make_get()
discovergigecameras()
cameras = listcameras()
camera = opencamera(cameras[1])
println("$camera")
VmbFeatureEnumSet(camera.handle, "PixelFormat", "Mono8")
VmbFeatureEnumSet(camera.handle, "AcquisitionMode", "Continuous")
VmbFeatureEnumSet(camera.handle, "TriggerSource", "Freerun")
VmbFeatureEnumSet(camera.handle, "ExposureMode", "Timed")
VmbFeatureIntSet(camera.handle, "BinningHorizontal", 1)
VmbFeatureIntSet(camera.handle, "BinningVertical", 1)
VmbFeatureIntSet(camera.handle, "OffsetX", 0)
VmbFeatureIntSet(camera.handle, "OffsetY", 0)
VmbFeatureIntSet(camera.handle, "Height", VmbFeatureIntGet(camera.handle, "HeightMax"))
VmbFeatureIntSet(camera.handle, "Width", VmbFeatureIntGet(camera.handle, "WidthMax"))
frame = Frame(camera)
announceframe(camera, frame)
capturestart(camera)
function get()
framequeue(camera, frame)
VmbFeatureCommandRun(camera.handle, "AcquisitionStart")
framewait(camera, frame, 5000)
while frame.vmbframe.receiveStatus != VmbFrameStatusComplete
framequeue(camera, frame)
framewait(camera, frame, 5000)
end
VmbFeatureCommandRun(camera.handle, "AcquisitionStop")
return retreiveimg(frame)
end
function close()
captureend(camera)
framerevoke(camera, frame)
closecamera(camera)
end
return get, close
end
end
typealias VmbInt8_t Int8
typealias VmbUint8_t UInt8
typealias VmbInt16_t Int16
typealias VmbUint16_t UInt16
typealias VmbInt32_t Int32
typealias VmbUint32_t UInt32
typealias VmbInt64_t Int64
typealias VmbUint64_t UInt64
typealias VmbHandle_t Ptr{Void}
typealias VmbBool_t Cchar
const VmbBoolTrue = 1
const VmbBoolFalse = 0
typealias VmbUchar_t Cuchar
typealias VmbError_t VmbInt32_t
const VmbErrorSuccess = 0 # No error
const VmbErrorInternalFault = -1 # Unexpected fault in VimbaC or driver
const VmbErrorApiNotStarted = -2 # VmbStartup() was not called before the current command
const VmbErrorNotFound = -3 # The designated instance (camera, feature etc.) cannot be found
const VmbErrorBadHandle = -4 # The given handle is not valid
const VmbErrorDeviceNotOpen = -5 # Device was not opened for usage
const VmbErrorInvalidAccess = -6 # Operation is invalid with the current access mode
const VmbErrorBadParameter = -7 # One of the parameters is invalid (usually an illegal pointer)
const VmbErrorStructSize = -8 # The given struct size is not valid for this version of the API
const VmbErrorMoreData = -9 # More data available in a string/list than space is provided
const VmbErrorWrongType = -10 # Wrong feature type for this access function
const VmbErrorInvalidValue = -11 # The value is not valid; either out of bounds or not an increment of the minimum
const VmbErrorTimeout = -12 # Timeout during wait
const VmbErrorOther = -13 # Other error
const VmbErrorResources = -14 # Resources not available (e.g. memory)
const VmbErrorInvalidCall = -15 # Call is invalid in the current context (e.g. callback)
const VmbErrorNoTL = -16 # No transport layers are found
const VmbErrorNotImplemented = -17 # API feature is not implemented
const VmbErrorNotSupported = -18 # API feature is not supported
const VmbErrorIncomplete = -19 # A multiple registers read or write is partially completed
immutable VmbVersionInfo_t;
major::VmbUint32_t
minor::VmbUint32_t
patch::VmbUint32_t
end
const VmbPixelMono = 0x01000000 # Monochrome pixel
const VmbPixelColor = 0x02000000 # Pixel bearing color information
const VmbPixelOccupy8Bit = 0x00080000 # Pixel effectively occupies 8 bits
const VmbPixelOccupy10Bit = 0x000A0000 # Pixel effectively occupies 10 bits
const VmbPixelOccupy12Bit = 0x000C0000 # Pixel effectively occupies 12 bits
const VmbPixelOccupy14Bit = 0x000E0000 # Pixel effectively occupies 14 bits
const VmbPixelOccupy16Bit = 0x00100000 # Pixel effectively occupies 16 bits
const VmbPixelOccupy24Bit = 0x00180000 # Pixel effectively occupies 24 bits
const VmbPixelOccupy32Bit = 0x00200000 # Pixel effectively occupies 32 bits
const VmbPixelOccupy48Bit = 0x00300000 # Pixel effectively occupies 48 bits
const VmbPixelOccupy64Bit = 0x00400000 # Pixel effectively occupies 48 bits
const VmbPixelFormatMono8 = VmbPixelMono | VmbPixelOccupy8Bit | 0x0001 # Monochrome, 8 bits (PFNC:Mono8)
const VmbPixelFormatMono10 = VmbPixelMono | VmbPixelOccupy16Bit | 0x0003 # Monochrome, 10 bits in 16 bits (PFNC:Mono10)
const VmbPixelFormatMono10p = VmbPixelMono | VmbPixelOccupy10Bit | 0x0046 # Monochrome, 10 bits in 16 bits (PFNC:Mono10p)
const VmbPixelFormatMono12 = VmbPixelMono | VmbPixelOccupy16Bit | 0x0005 # Monochrome, 12 bits in 16 bits (PFNC:Mono12)
const VmbPixelFormatMono12Packed = VmbPixelMono | VmbPixelOccupy12Bit | 0x0006 # Monochrome, 2x12 bits in 24 bits (GEV:Mono12Packed)
const VmbPixelFormatMono12p = VmbPixelMono | VmbPixelOccupy12Bit | 0x0047 # Monochrome, 2x12 bits in 24 bits (PFNC:MonoPacked)
const VmbPixelFormatMono14 = VmbPixelMono | VmbPixelOccupy16Bit | 0x0025 # Monochrome, 14 bits in 16 bits (PFNC:Mono14)
const VmbPixelFormatMono16 = VmbPixelMono | VmbPixelOccupy16Bit | 0x0007 # Monochrome, 16 bits (PFNC:Mono16)
const VmbPixelFormatBayerGR8 = VmbPixelMono | VmbPixelOccupy8Bit | 0x0008 # Bayer-color, 8 bits, starting with GR line (PFNC:BayerGR8)
const VmbPixelFormatBayerRG8 = VmbPixelMono | VmbPixelOccupy8Bit | 0x0009 # Bayer-color, 8 bits, starting with RG line (PFNC:BayerRG8)
const VmbPixelFormatBayerG = VmbPixelMono | VmbPixelOccupy8Bit | 0x000A # Bayer-color, 8 bits, starting with GB line (PFNC:BayerGB8)
const VmbPixelFormatBayerBG8 = VmbPixelMono | VmbPixelOccupy8Bit | 0x000B # Bayer-color, 8 bits, starting with BG line (PFNC:BayerBG8)
const VmbPixelFormatBayerGR10 = VmbPixelMono | VmbPixelOccupy16Bit | 0x000C # Bayer-color, 10 bits in 16 bits, starting with GR line (PFNC:BayerGR10)
const VmbPixelFormatBayerRG10 = VmbPixelMono | VmbPixelOccupy16Bit | 0x000D # Bayer-color, 10 bits in 16 bits, starting with RG line (PFNC:BayerRG10)
const VmbPixelFormatBayerGB10 = VmbPixelMono | VmbPixelOccupy16Bit | 0x000E # Bayer-color, 10 bits in 16 bits, starting with GB line (PFNC:BayerGB10)
const VmbPixelFormatBayerBG10 = VmbPixelMono | VmbPixelOccupy16Bit | 0x000F # Bayer-color, 10 bits in 16 bits, starting with BG line (PFNC:BayerBG10)
const VmbPixelFormatBayerGR12 = VmbPixelMono | VmbPixelOccupy16Bit | 0x0010 # Bayer-color, 12 bits in 16 bits, starting with GR line (PFNC:BayerGR12)
const VmbPixelFormatBayerRG12 = VmbPixelMono | VmbPixelOccupy16Bit | 0x0011 # Bayer-color, 12 bits in 16 bits, starting with RG line (PFNC:BayerRG12)
const VmbPixelFormatBayerGB12 = VmbPixelMono | VmbPixelOccupy16Bit | 0x0012 # Bayer-color, 12 bits in 16 bits, starting with GB line (PFNC:BayerGB12)
const VmbPixelFormatBayerBG12 = VmbPixelMono | VmbPixelOccupy16Bit | 0x0013 # Bayer-color, 12 bits in 16 bits, starting with BG line (PFNC:BayerBG12)
const VmbPixelFormatBayerGR12Packed = VmbPixelMono | VmbPixelOccupy12Bit | 0x002A # Bayer-color, 2x12 bits in 24 bits, starting with GR line (GEV:BayerGR12Packed)
const VmbPixelFormatBayerRG12Packed = VmbPixelMono | VmbPixelOccupy12Bit | 0x002B # Bayer-color, 2x12 bits in 24 bits, starting with RG line (GEV:BayerRG12Packed)
const VmbPixelFormatBayerGB12Packed = VmbPixelMono | VmbPixelOccupy12Bit | 0x002C # Bayer-color, 2x12 bits in 24 bits, starting with GB line (GEV:BayerGB12Packed)
const VmbPixelFormatBayerBG12Packed = VmbPixelMono | VmbPixelOccupy12Bit | 0x002D # Bayer-color, 2x12 bits in 24 bits, starting with BG line (GEV:BayerBG12Packed)
const VmbPixelFormatBayerGR10p = VmbPixelMono | VmbPixelOccupy10Bit | 0x0056 # Bayer-color, 12 bits continuous packed, starting with GR line (PFNC:BayerGR10p)
const VmbPixelFormatBayerRG10p = VmbPixelMono | VmbPixelOccupy10Bit | 0x0058 # Bayer-color, 12 bits continuous packed, starting with RG line (PFNC:BayerRG10p)
const VmbPixelFormatBayerGB10p = VmbPixelMono | VmbPixelOccupy10Bit | 0x0054 # Bayer-color, 12 bits continuous packed, starting with GB line (PFNC:BayerGB10p)
const VmbPixelFormatBayerBG10p = VmbPixelMono | VmbPixelOccupy10Bit | 0x0052 # Bayer-color, 12 bits continuous packed, starting with BG line (PFNC:BayerBG10p)
const VmbPixelFormatBayerGR12p = VmbPixelMono | VmbPixelOccupy12Bit | 0x0057 # Bayer-color, 12 bits continuous packed, starting with GR line (PFNC:BayerGR12p)
const VmbPixelFormatBayerRG12p = VmbPixelMono | VmbPixelOccupy12Bit | 0x0059 # Bayer-color, 12 bits continuous packed, starting with RG line (PFNC:BayerRG12p)
const VmbPixelFormatBayerGB12p = VmbPixelMono | VmbPixelOccupy12Bit | 0x0055 # Bayer-color, 12 bits continuous packed, starting with GB line (PFNC:BayerGB12p)
const VmbPixelFormatBayerBG12p = VmbPixelMono | VmbPixelOccupy12Bit | 0x0053 # Bayer-color, 12 bits continuous packed, starting with BG line (PFNC:BayerBG12p)
const VmbPixelFormatBayerGR16 = VmbPixelMono | VmbPixelOccupy16Bit | 0x002E # Bayer-color, 16 bits, starting with GR line (PFNC:BayerGR16)
const VmbPixelFormatBayerRG16 = VmbPixelMono | VmbPixelOccupy16Bit | 0x002F # Bayer-color, 16 bits, starting with RG line (PFNC:BayerRG16)
const VmbPixelFormatBayerGB16 = VmbPixelMono | VmbPixelOccupy16Bit | 0x0030 # Bayer-color, 16 bits, starting with GB line (PFNC:BayerGB16)
const VmbPixelFormatBayerBG16 = VmbPixelMono | VmbPixelOccupy16Bit | 0x0031 # Bayer-color, 16 bits, starting with BG line (PFNC:BayerBG16)
const VmbPixelFormatRgb8 = VmbPixelColor | VmbPixelOccupy24Bit | 0x0014 # RGB, 8 bits x 3 (PFNC:RGB8)
const VmbPixelFormatBgr8 = VmbPixelColor | VmbPixelOccupy24Bit | 0x0015 # BGR, 8 bits x 3 (PFNC:BGR8)
const VmbPixelFormatRgb10 = VmbPixelColor | VmbPixelOccupy48Bit | 0x0018 # RGB, 12 bits in 16 bits x 3 (PFNC:RGB12)
const VmbPixelFormatBgr10 = VmbPixelColor | VmbPixelOccupy48Bit | 0x0019 # RGB, 12 bits in 16 bits x 3 (PFNC:RGB12)
const VmbPixelFormatRgb12 = VmbPixelColor | VmbPixelOccupy48Bit | 0x001A # RGB, 12 bits in 16 bits x 3 (PFNC:RGB12)
const VmbPixelFormatBgr12 = VmbPixelColor | VmbPixelOccupy48Bit | 0x001B # RGB, 12 bits in 16 bits x 3 (PFNC:RGB12)
const VmbPixelFormatRgb16 = VmbPixelColor | VmbPixelOccupy48Bit | 0x0033 # RGB, 16 bits x 3 (PFNC:RGB16)
const VmbPixelFormatBgr16 = VmbPixelColor | VmbPixelOccupy48Bit | 0x004B # RGB, 16 bits x 3 (PFNC:RGB16)
const VmbPixelFormatArgb8 = VmbPixelColor | VmbPixelOccupy32Bit | 0x0016 # ARGB, 8 bits x 4 (PFNC:RGBa8)
const VmbPixelFormatRgba8 = VmbPixelFormatArgb8 # RGBA, 8 bits x 4, legacy name
const VmbPixelFormatBgra8 = VmbPixelColor | VmbPixelOccupy32Bit | 0x0017 # BGRA, 8 bits x 4 (PFNC:BGRa8)
const VmbPixelFormatRgba10 = VmbPixelColor | VmbPixelOccupy64Bit | 0x005F # RGBA, 8 bits x 4, legacy name
const VmbPixelFormatBgra10 = VmbPixelColor | VmbPixelOccupy64Bit | 0x004C # RGBA, 8 bits x 4, legacy name
const VmbPixelFormatRgba12 = VmbPixelColor | VmbPixelOccupy64Bit | 0x0061 # RGBA, 8 bits x 4, legacy name
const VmbPixelFormatBgra12 = VmbPixelColor | VmbPixelOccupy64Bit | 0x004E # RGBA, 8 bits x 4, legacy name
const VmbPixelFormatRgba16 = VmbPixelColor | VmbPixelOccupy64Bit | 0x0064 # RGBA, 8 bits x 4, legacy name
const VmbPixelFormatBgra16 = VmbPixelColor | VmbPixelOccupy64Bit | 0x0051 # RGBA, 8 bits x 4, legacy name
const VmbPixelFormatYuv411 = VmbPixelColor | VmbPixelOccupy12Bit | 0x001E # YUV 411 with 8 bits (GEV:YUV411Packed)
const VmbPixelFormatYuv422 = VmbPixelColor | VmbPixelOccupy16Bit | 0x001F # YUV 422 with 8 bits (GEV:YUV422Packed)
const VmbPixelFormatYuv444 = VmbPixelColor | VmbPixelOccupy24Bit | 0x0020 # YUV 444 with 8 bits (GEV:YUV444Packed)
const VmbPixelFormatYCbCr411_8_CbYYCrYY = VmbPixelColor | VmbPixelOccupy12Bit | 0x003C # Y´CbCr 411 with 8 bits (PFNC:YCbCr411_8_CbYYCrYY) - identical to VmbPixelFormatYuv411
const VmbPixelFormatYCbCr422_8_CbYCrY = VmbPixelColor | VmbPixelOccupy16Bit | 0x0043 # Y´CbCr 422 with 8 bits (PFNC:YCbCr422_8_CbYCrY) - identical to VmbPixelFormatYuv422
const VmbPixelFormatYCbCr8_CbYCr = VmbPixelColor | VmbPixelOccupy24Bit | 0x003A # Y´CbCr 444 with 8 bits (PFNC:YCbCr8_CbYCr) - identical to VmbPixelFormatYuv444
typealias VmbPixelFormat_t VmbUint32_t
#
# Access mode for configurable devices (interfaces, cameras).
# Used in VmbCameraInfo_t, VmbInterfaceInfo_t as flags, so multiple modes can be
# announced, while in VmbCameraOpen(), no combination must be used.
#
const VmbAccessModeNone = 0 # No access
const VmbAccessModeFull = 1 # Read and write access
const VmbAccessModeRead = 2 # Only read access
const VmbAccessModeConfig = 4 # Device configuration access
const VmbAccessModeLite = 8 # Device read/write access without feature access (only addresses)
typealias VmbAccessMode_t VmbUint32_t # Type for an AccessMode; for values see VmbAccessModeType
#
# Status of a frame transfer
#
const VmbFrameStatusComplete = 0 # Frame has been completed without errors
const VmbFrameStatusIncomplete = -1 # Frame could not be filled to the end
const VmbFrameStatusTooSmall = -2 # Frame buffer was too small
const VmbFrameStatusInvalid = -3 # Frame buffer was invalid
typealias VmbFrameStatus_t VmbInt32_t # Type for the frame status; for values see VmbFrameStatusType
#
# Frame flags
#
const VmbFrameFlagsNone = 0
const VmbFrameFlagsDimension = 1 # Frame's dimension is provided
const VmbFrameFlagsOffset = 2 # Frame's Offset is provided (ROI)
const VmbFrameFlagsFrameID = 4 # Frame's ID is provided
const VmbFrameFlagsTimestamp = 8 # Frame's Timestamp is provided
typealias VmbFrameFlags_t VmbUint32_t # Type for Frame flags; f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment