Help us shape the future of Go! Take the 2026 Go Developer Survey

hikrobot

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 15 Imported by: 0

README

go-hikrobot-sdk

Go Reference CI

Go bindings for Hikrobot machine-vision cameras (GigE Vision, USB3 Vision and GenTL frame grabbers) through the vendor's MVS runtime. No cgo.

It runs on Windows, Linux and macOS. The MVS runtime library is loaded when the program runs, so:

  • go build needs no C compiler, MVS headers or import libraries, and CGO_ENABLED=0 works;
  • you can cross-compile for any supported target from any machine;
  • a machine without MVS still runs your program; Load just returns an error.
import hikrobot "github.com/bronystylecrazy/go-hikrobot-sdk"

Requirements

  • Go 1.25 or newer.
  • The MVS client for your OS, which installs the runtime library. Load("") looks here:
Platform Runtime Load("") opens
Windows amd64 C:\Program Files (x86)\Common Files\MVS\Runtime\Win64_x64\MvCameraControl.dll
Linux amd64 $MVCAM_COMMON_RUNENV/64/libMvCameraControl.so, else /opt/MVS/lib/64/…, else the loader's search path
Linux arm64 $MVCAM_COMMON_RUNENV/aarch64/libMvCameraControl.so, else /opt/MVS/lib/aarch64/…, else the loader's search path
macOS amd64 / arm64 /Library/Frameworks/MvCameraControl.framework/MvCameraControl

On macOS, the MVS .dmg installs the runtime framework (the MVS_SDK_*_Runtime.pkg inside it is enough). It is a universal binary, so both Apple Silicon and Intel builds work.

Pass a path to Load to use another location. Other platforms compile, but Load returns ErrUnsupported. MVS 4.1 and newer runtimes are supported; struct layouts are checked against MVS 4.8 (Windows) and 5.1 (Linux).

Linux: the runtime loads its sibling libraries (pixel conversion, transport layers) by name, so its directory must be on the loader's search path when your program starts; a running process cannot add it. Either start the program with the MVS environment, as the installer's set_env_path.sh sets up for login shells:

export MVCAM_COMMON_RUNENV=/opt/MVS/lib
export LD_LIBRARY_PATH=/opt/MVS/lib/aarch64:$LD_LIBRARY_PATH   # /opt/MVS/lib/64 on x86_64

or register it once, system-wide, which also covers systemd services:

echo /opt/MVS/lib/aarch64 | sudo tee /etc/ld.so.conf.d/mvs.conf && sudo ldconfig

Without either, Load and enumeration still work, but conversion fails with "failed to load library".

Quick start

sdk, err := hikrobot.Load("") // "" = default MVS install path
if err != nil {
	log.Fatal(err)
}
defer sdk.Close()

devices, err := sdk.Devices(0) // 0 = GigE + USB3
if err != nil || len(devices) == 0 {
	log.Fatal("no camera", err)
}
cam, err := sdk.Open(devices[0])
if err != nil {
	log.Fatal(err) // errors.Is(err, hikrobot.ErrAccessDenied) if another program holds it
}
defer cam.Close()

cam.SetEnumString("TriggerMode", "Off")
cam.SetFloat("ExposureTime", 20000) // µs
cam.SetGrabStrategy(hikrobot.GrabLatestOnly)
if err := cam.StartGrabbing(); err != nil {
	log.Fatal(err)
}

frame, err := cam.Grab(time.Second)
if err != nil {
	log.Fatal(err) // errors.Is(err, hikrobot.ErrTimeout) when no frame arrived
}
defer frame.Release()

img, err := cam.Image(frame) // *image.RGBA, debayered by the SDK

Runnable programs are in examples/: list prints the cameras and whether each is free; grab captures frames (free-running or software-triggered) and saves a PNG.

What's covered

Area API
Runtime Load, SDK.Close, SDK.Version
Discovery SDK.Devices, SDK.Find (by serial, IP, model or name), SDK.Accessible
Connection SDK.Open, SDK.OpenMode (exclusive / control / monitor), Camera.Connected, Camera.OnException (disconnect events)
GenICam nodes GetInt/SetInt, GetFloat/SetFloat, GetEnum/SetEnum/SetEnumString/GetEnumString/EnumSymbol, GetBool/SetBool, GetString/SetString, Execute (commands such as TriggerSoftware)
Settings files SaveFeatures, LoadFeatures
Acquisition StartGrabbing, StopGrabbing, Grab, SetGrabStrategy, SetOutputQueueSize, SetImageNodeNum, ClearImageBuffer
GigE transport OptimalPacketSize (applied on open), SetResend
Conversion Image (RGBA), Preview (scaled RGBA), ConvertTo (any SDK output, e.g. BGR8Packed for OpenCV), SetBayerQuality; on a Camera, or on a camera-free SDK.NewConverter for saved raw frames

Anything else in the GenICam feature tree is reachable through the node accessors by name; see the camera's feature list in the MVS client.

Frames

Grab copies each image out of the SDK's buffer and gives the buffer back before returning, so a slow consumer never starves the SDK. The copies come from a per-camera pool and are reference-counted:

  • you own the frame Grab returns; call Release once;
  • call Retain before handing a frame to another goroutine, and have that goroutine Release it;
  • Data() is valid only while you hold a reference, and must not be modified.

Preview(frame, width) is built for live views of large sensors. For Mono8 and 8-bit Bayer frames it subsamples whole 2×2 colour cells before demosaicing, so a 1620-pixel preview of a 20 MP BayerGB8 frame costs a fraction of a full conversion (about 1 ms for the subsampling).

Errors

SDK failures are *hikrobot.Error values carrying the SDK function and its MV_E_* code, with a readable description. Match them with errors.Is:

if errors.Is(err, hikrobot.ErrTimeout) { /* no frame yet */ }
if errors.Is(err, hikrobot.ErrAccessDenied) { /* camera open elsewhere */ }
if errors.Is(err, hikrobot.ErrNodeNotFound) { /* feature not on this model */ }

Testing

go test ./... runs everywhere. Besides unit tests for struct layouts, device parsing, frame ownership and Bayer subsampling, it builds testdata/fakemvs, a small stand-in for the MVS runtime written in C, and drives every binding through the real loading and calling path: integer, float and bool arguments, struct pointers, frame buffers, and exception callbacks arriving on a foreign thread. CI runs this on Linux, macOS and Windows, with and without cgo. It needs a C compiler (cc, or gcc on Windows) and is skipped without one.

With MVS installed, the hardware tests run when asked:

HIKROBOT_TEST=runtime go test -v -run Hardware   # no camera: load, enumerate, convert with the real SDK
HIKROBOT_TEST=monitor go test -v -run Hardware   # + read camera nodes beside a program holding AccessControl
HIKROBOT_TEST=grab go test -v -run Hardware      # exclusive: configures the camera and grabs
# optional: HIKROBOT_CAMERA=<serial, IP, model or name>, HIKROBOT_SDK=<runtime path>

runtime mode has passed against the real runtimes of MVS 4.8 on Windows x64, MVS 5.1 on Linux aarch64, and MVS 5.0 (SDK 4.7) on macOS arm64 and x86_64. grab mode, and the grab example with and without software trigger, have passed on Windows x64 with an MV-CS200-10GC (20 MP BayerGB8, GigE).

How it works

Each SDK function is resolved from the runtime on first use. Windows calls go through syscall; Linux and macOS use purego (dlopen without cgo), with the one float-taking function bound by signature so the value lands in a vector register. Go mirrors of the C structs live in layout.go, and layout_test.go pins every size and offset to values compiled from CameraParams.h. One difference matters: MvGvspPixelType holds both -1 and values above 0x7FFFFFFF, so GCC and Clang make it 8 bytes while MSVC makes it 4, and the frame-info and conversion structs differ between Windows and Linux/macOS. The Linux layout was confirmed against the real runtime. Functions missing from an older runtime fail only when you call them. No Hikrobot code or headers are included in this repository.

License

MIT. The MVS runtime is Hikrobot's software, distributed under its own licence; install it from Hikrobot.

Documentation

Overview

Package hikrobot drives Hikrobot machine-vision cameras (GigE Vision, USB3 Vision and GenTL frame grabbers) through the vendor's MVS runtime, without cgo.

The runtime (MvCameraControl.dll, libMvCameraControl.so or .dylib) is loaded by Load at run time, so programs build on any platform and cross-compile without the MVS headers or a C toolchain. Capture works on Windows, Linux and macOS (amd64 and arm64; Windows amd64 only) wherever MVS is installed; elsewhere Load returns ErrUnsupported.

A minimal capture loop:

sdk, err := hikrobot.Load("") // default MVS install path
if err != nil { ... }
defer sdk.Close()
devices, err := sdk.Devices(0)
if err != nil || len(devices) == 0 { ... }
cam, err := sdk.Open(devices[0])
if err != nil { ... }
defer cam.Close()
_ = cam.SetEnumString("TriggerMode", "Off")
if err := cam.StartGrabbing(); err != nil { ... }
frame, err := cam.Grab(time.Second)
if err != nil { ... }
defer frame.Release()
img, err := cam.Image(frame) // *image.RGBA, debayered by the SDK

Frames are copied out of the SDK's buffer before Grab returns, so the SDK buffer is always given back. The copies come from a per-camera pool: call Release once you are done, and Retain before sharing a frame with another goroutine.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTimeout         = &Error{Code: 0x80000007} // MV_E_NODATA: no frame within the timeout
	ErrNotSupported    = &Error{Code: 0x80000001} // MV_E_SUPPORT
	ErrParameter       = &Error{Code: 0x80000004} // MV_E_PARAMETER
	ErrNodeNotFound    = &Error{Code: 0x80000109} // MV_E_GC_NODE_NOT_FOUND
	ErrNodeAccess      = &Error{Code: 0x80000106} // MV_E_GC_ACCESS: node not readable/writable now
	ErrAccessDenied    = &Error{Code: 0x80000203} // MV_E_ACCESS_DENIED: opened by another program
	ErrBusy            = &Error{Code: 0x80000204} // MV_E_BUSY: device busy or network down
	ErrDisconnected    = &Error{Code: 0x80000211} // MV_E_DEV_DISCONNECT
	ErrBufferTooSmall  = &Error{Code: 0x8000000A} // MV_E_NOENOUGH_BUF
	ErrUnsupportedType = &Error{Code: 0x80000500} // MV_E_SUPPORT_PIXEL_FORMAT
)

Common SDK failures, for use with errors.Is.

View Source
var ErrClosed = errors.New("hikrobot: camera is closed")

ErrClosed is returned by calls on a closed Camera.

View Source
var ErrUnsupported = errors.New("hikrobot: MVS is not supported on this platform")

ErrUnsupported is returned by Load on platforms this package cannot load the MVS runtime on. Supported: windows/amd64, linux/amd64, linux/arm64, darwin/amd64 and darwin/arm64.

Functions

func DefaultRuntimePath

func DefaultRuntimePath() string

DefaultRuntimePath is where the MVS installer puts the runtime: the MvCameraControl framework on macOS; on Linux, under $MVCAM_COMMON_RUNENV (set by the installer) or /opt/MVS/lib.

Types

type AccessMode

type AccessMode uint32

AccessMode is how SDK.OpenMode claims the camera (MV_ACCESS_*).

const (
	// AccessExclusive gives full control; other programs may only read the
	// control channel register.
	AccessExclusive AccessMode = 1
	// AccessControl gives full control while letting other programs read
	// every register.
	AccessControl AccessMode = 3
	// AccessMonitor opens read-only alongside a program that opened the
	// camera with AccessControl (an AccessExclusive holder refuses it).
	// GigE only.
	AccessMonitor AccessMode = 7
)

type BayerQuality

type BayerQuality uint32

BayerQuality is the SDK's demosaicing method for Bayer conversions.

const (
	BayerFast        BayerQuality = 0
	BayerBalanced    BayerQuality = 1
	BayerOptimal     BayerQuality = 2
	BayerOptimalPlus BayerQuality = 3
)

type Camera

type Camera struct {
	// contains filtered or unexported fields
}

Camera is an open device. Its methods are safe for concurrent use; Close waits for calls in progress, including a Grab blocked on its timeout.

func (*Camera) ClearImageBuffer

func (c *Camera) ClearImageBuffer() error

ClearImageBuffer drops frames queued in the SDK.

func (*Camera) Close

func (c *Camera) Close() error

Close stops grabbing and releases the camera. It is safe to call twice.

func (*Camera) Connected

func (c *Camera) Connected() bool

Connected reports whether the SDK still reaches the camera.

func (*Camera) ConvertTo

func (c *Camera) ConvertTo(f *Frame, dst PixelType, buf []byte) ([]byte, error)

ConvertTo converts f to the dst pixel type (e.g. BGR8Packed for OpenCV) with the SDK, reusing buf when it is large enough.

func (*Camera) Device

func (c *Camera) Device() Device

Device is the device this camera was opened from.

func (*Camera) EnumSymbol

func (c *Camera) EnumSymbol(key string, value uint32) (string, error)

EnumSymbol names one value of an enumeration node.

func (*Camera) Execute

func (c *Camera) Execute(key string) error

Execute runs a command node, e.g. "TriggerSoftware".

func (*Camera) GetBool

func (c *Camera) GetBool(key string) (bool, error)

GetBool reads a boolean node.

func (*Camera) GetEnum

func (c *Camera) GetEnum(key string) (EnumValue, error)

GetEnum reads an enumeration node's numeric value.

func (*Camera) GetEnumString

func (c *Camera) GetEnumString(key string) (string, error)

GetEnumString reads an enumeration node's current symbol, e.g. "BayerGB8" for "PixelFormat".

func (*Camera) GetFloat

func (c *Camera) GetFloat(key string) (FloatValue, error)

GetFloat reads a float node, e.g. "ExposureTime".

func (*Camera) GetInt

func (c *Camera) GetInt(key string) (IntValue, error)

GetInt reads an integer node, e.g. "Width".

func (*Camera) GetString

func (c *Camera) GetString(key string) (string, error)

GetString reads a string node, e.g. "DeviceUserID".

func (*Camera) Grab

func (c *Camera) Grab(timeout time.Duration) (*Frame, error)

Grab waits up to timeout for the next frame and copies it out of the SDK. It returns ErrTimeout (via errors.Is) when no frame arrived. Release the frame when done with it.

func (*Camera) Image

func (c *Camera) Image(f *Frame) (*image.RGBA, error)

Image converts f to full-resolution RGBA.

func (*Camera) LoadFeatures

func (c *Camera) LoadFeatures(path string) error

LoadFeatures applies settings saved by SaveFeatures. Stop grabbing first.

func (*Camera) OnException

func (c *Camera) OnException(fn func(Exception)) error

OnException calls fn, on its own goroutine, for each asynchronous device event such as ExceptionDisconnected. A later call replaces fn.

func (*Camera) OptimalPacketSize

func (c *Camera) OptimalPacketSize() (int, error)

OptimalPacketSize is the largest GigE packet the network path carries.

func (*Camera) Preview

func (c *Camera) Preview(f *Frame, width int) (*image.RGBA, error)

Preview converts f to RGBA scaled to width pixels wide (0 keeps the full size). Mono8 and 8-bit Bayer frames are downsampled before demosaicing, keeping whole colour cells, which makes a small live view much cheaper than converting the full frame.

func (*Camera) SaveFeatures

func (c *Camera) SaveFeatures(path string) error

SaveFeatures writes the camera's current settings to a file that LoadFeatures can apply later.

func (*Camera) SetBayerQuality

func (c *Camera) SetBayerQuality(q BayerQuality) error

SetBayerQuality sets the demosaicing used by Image, Preview and ConvertTo.

func (*Camera) SetBool

func (c *Camera) SetBool(key string, value bool) error

SetBool writes a boolean node.

func (*Camera) SetEnum

func (c *Camera) SetEnum(key string, value uint32) error

SetEnum writes an enumeration node by numeric value.

func (*Camera) SetEnumString

func (c *Camera) SetEnumString(key, symbol string) error

SetEnumString writes an enumeration node by symbol, e.g. SetEnumString("TriggerMode", "Off").

func (*Camera) SetFloat

func (c *Camera) SetFloat(key string, value float32) error

SetFloat writes a float node, e.g. "ExposureTime" in µs.

func (*Camera) SetGrabStrategy

func (c *Camera) SetGrabStrategy(s GrabStrategy) error

SetGrabStrategy chooses which queued frame Grab returns. Set it before StartGrabbing.

func (*Camera) SetImageNodeNum

func (c *Camera) SetImageNodeNum(n int) error

SetImageNodeNum sets how many frame buffers the SDK allocates.

func (*Camera) SetInt

func (c *Camera) SetInt(key string, value int64) error

SetInt writes an integer node.

func (*Camera) SetOutputQueueSize

func (c *Camera) SetOutputQueueSize(n int) error

SetOutputQueueSize bounds the queue kept by GrabLatest.

func (*Camera) SetResend

func (c *Camera) SetResend(enable bool, maxPercent int, timeout time.Duration) error

SetResend controls GigE packet resend. maxPercent caps resend requests as a share of a frame's packets; timeout is how long to wait for a resent packet.

func (*Camera) SetString

func (c *Camera) SetString(key, value string) error

SetString writes a string node.

func (*Camera) StartGrabbing

func (c *Camera) StartGrabbing() error

StartGrabbing starts acquisition. Configure trigger mode, pixel format and region first; most of those nodes are locked while grabbing.

func (*Camera) StopGrabbing

func (c *Camera) StopGrabbing() error

StopGrabbing stops acquisition.

type Converter

type Converter struct {
	// contains filtered or unexported fields
}

Converter runs the SDK's pixel conversion without a camera, e.g. on raw frames saved earlier and loaded with NewFrame. It is safe for concurrent use.

func (*Converter) Close

func (k *Converter) Close() error

Close releases the handle. It is safe to call twice.

func (*Converter) ConvertTo

func (c *Converter) ConvertTo(f *Frame, dst PixelType, buf []byte) ([]byte, error)

ConvertTo converts f to the dst pixel type (e.g. BGR8Packed for OpenCV) with the SDK, reusing buf when it is large enough.

func (*Converter) Image

func (c *Converter) Image(f *Frame) (*image.RGBA, error)

Image converts f to full-resolution RGBA.

func (*Converter) Preview

func (c *Converter) Preview(f *Frame, width int) (*image.RGBA, error)

Preview converts f to RGBA scaled to width pixels wide (0 keeps the full size). Mono8 and 8-bit Bayer frames are downsampled before demosaicing, keeping whole colour cells, which makes a small live view much cheaper than converting the full frame.

func (*Converter) SetBayerQuality

func (c *Converter) SetBayerQuality(q BayerQuality) error

SetBayerQuality sets the demosaicing used by Image, Preview and ConvertTo.

type Device

type Device struct {
	Transport Transport
	Vendor    string
	Model     string
	Serial    string
	// UserName is the camera's user-defined name (DeviceUserID).
	UserName string
	// IP is the current address of a GigE camera; invalid otherwise.
	IP netip.Addr
	// MAC is set for GigE cameras.
	MAC net.HardwareAddr
	// contains filtered or unexported fields
}

Device describes one enumerated camera. Pass it to SDK.Open; a Device built by hand cannot be opened.

func (Device) String

func (d Device) String() string

type EnumValue

type EnumValue struct {
	Current   uint32
	Supported []uint32
}

EnumValue is an enumeration node's current value and the values the camera accepts right now.

type Error

type Error struct {
	Op   string
	Code uint32
}

Error is a failed MVS call. Code is the SDK's MV_E_* value; Op names the SDK function that returned it.

func (*Error) Error

func (e *Error) Error() string

func (*Error) Is

func (e *Error) Is(target error) bool

Is matches any Error with the same Code, so errors.Is(err, ErrTimeout) holds whichever SDK function reported it.

type Exception

type Exception uint32

Exception is an asynchronous device event delivered to Camera.OnException.

const (
	ExceptionDisconnected Exception = 0x00008001
	ExceptionVersionCheck Exception = 0x00008002
)

func (Exception) String

func (e Exception) String() string

type FloatValue

type FloatValue struct{ Current, Min, Max float32 }

FloatValue is a float node's value and limits.

type Frame

type Frame struct {
	Width, Height int
	PixelType     PixelType
	// Number is the camera's frame counter.
	Number uint32
	// LostPackets counts GigE packets missing from this frame.
	LostPackets uint32
	// HostTime is when the host received the frame.
	HostTime time.Time
	// DeviceTimestamp is the camera's tick counter at exposure (see the
	// GevTimestampTickFrequency node for its rate).
	DeviceTimestamp uint64
	// contains filtered or unexported fields
}

Frame is one image copied out of the SDK. Its pixels are immutable and stay valid until the last owner calls Release. Grab hands you one ownership; Retain adds another, e.g. before passing the frame to another goroutine.

func NewFrame

func NewFrame(width, height int, pixelType PixelType, data []byte) (*Frame, error)

NewFrame copies data into a standalone frame, e.g. to replay a saved raw image through Camera.Image.

func (*Frame) Data

func (f *Frame) Data() []byte

Data returns the pixel bytes as the camera sent them. Do not modify them, and do not use them after your last Release.

func (*Frame) Release

func (f *Frame) Release()

Release gives up one ownership. The last Release recycles the pixel buffer for a later Grab.

func (*Frame) Retain

func (f *Frame) Retain() bool

Retain adds an ownership. It returns false if the frame was already fully released, in which case the caller must not use it.

type GrabStrategy

type GrabStrategy uint32

GrabStrategy is how Grab picks frames from the SDK's queue (MV_GRAB_STRATEGY).

const (
	// GrabOneByOne returns every frame in arrival order (SDK default).
	GrabOneByOne GrabStrategy = 0
	// GrabLatestOnly drops everything but the newest frame. Use it for live
	// views where a slow consumer must not fall behind.
	GrabLatestOnly GrabStrategy = 1
	// GrabLatest keeps the newest frames, up to SetOutputQueueSize of them.
	GrabLatest GrabStrategy = 2
	// GrabUpcoming ignores queued frames and waits for the next one.
	GrabUpcoming GrabStrategy = 3
)

type IntValue

type IntValue struct{ Current, Min, Max, Increment int64 }

IntValue is an integer node's value and constraints.

type PixelType

type PixelType uint32

PixelType is a GigE Vision pixel format code (PixelType_Gvsp_* in the SDK's PixelType.h). Bits 16-23 hold the bits per pixel.

const (
	Mono8       PixelType = 0x01080001
	Mono10      PixelType = 0x01100003
	Mono12      PixelType = 0x01100005
	Mono16      PixelType = 0x01100007
	BayerGR8    PixelType = 0x01080008
	BayerRG8    PixelType = 0x01080009
	BayerGB8    PixelType = 0x0108000A
	BayerBG8    PixelType = 0x0108000B
	BayerGR10   PixelType = 0x0110000C
	BayerRG10   PixelType = 0x0110000D
	BayerGB10   PixelType = 0x0110000E
	BayerBG10   PixelType = 0x0110000F
	BayerGR12   PixelType = 0x01100010
	BayerRG12   PixelType = 0x01100011
	BayerGB12   PixelType = 0x01100012
	BayerBG12   PixelType = 0x01100013
	RGB8Packed  PixelType = 0x02180014
	BGR8Packed  PixelType = 0x02180015
	RGBA8Packed PixelType = 0x02200016
	BGRA8Packed PixelType = 0x02200017
	YUV422      PixelType = 0x0210001F
	YUV422YUYV  PixelType = 0x02100032
)

Common pixel types. Any other code the camera reports works too; it simply prints as hex.

func (PixelType) BitsPerPixel

func (p PixelType) BitsPerPixel() int

BitsPerPixel is the storage size of one pixel.

func (PixelType) Is8BitRaw

func (p PixelType) Is8BitRaw() bool

Is8BitRaw reports Mono8 and the four 8-bit Bayer layouts: one byte per pixel, which Camera.Preview can downsample before conversion.

func (PixelType) String

func (p PixelType) String() string

String returns the GenICam name, e.g. "BayerGB8", or the hex code.

type SDK

type SDK struct {
	// contains filtered or unexported fields
}

SDK is a loaded MVS runtime. One per process is enough; it is safe for concurrent use.

func Load

func Load(path string) (*SDK, error)

Load opens MvCameraControl.dll at path, or at DefaultRuntimePath when path is empty, and initializes it. Close it when done.

func (*SDK) Accessible

func (s *SDK) Accessible(d Device, mode AccessMode) bool

Accessible reports whether d can be opened in mode right now. It is false while another program, such as the MVS client, holds the camera.

func (*SDK) Close

func (s *SDK) Close() error

Close finalizes and unloads the runtime. Close every Camera first.

func (*SDK) Devices

func (s *SDK) Devices(transports Transport) ([]Device, error)

Devices lists the cameras reachable over the given transports, or over GigE and USB3 when transports is 0. Device order follows the SDK.

func (*SDK) Find

func (s *SDK) Find(key string) (Device, error)

Find returns the first device whose serial number, IP address, model or user-defined name equals key, ignoring case.

func (*SDK) NewConverter

func (s *SDK) NewConverter() (*Converter, error)

NewConverter creates a conversion handle that is not tied to any camera. Close it when done.

func (*SDK) Open

func (s *SDK) Open(d Device) (*Camera, error)

Open claims d with exclusive access. See OpenMode.

func (*SDK) OpenMode

func (s *SDK) OpenMode(d Device, mode AccessMode) (_ *Camera, err error)

OpenMode opens d. Unless mode is AccessMonitor, a GigE camera also gets the SDK's optimal packet size for the link, as MVS's own samples do. Grabbing does not start until StartGrabbing.

func (*SDK) Version

func (s *SDK) Version() string

Version is the runtime's version, e.g. "4.8.2.2".

type Transport

type Transport uint32

Transport is a transport-layer bit (MV_*_DEVICE). Combine them to choose what SDK.Devices enumerates.

const (
	TransportGigE           Transport = 0x00000001
	TransportUSB3           Transport = 0x00000004
	TransportCameraLink     Transport = 0x00000008
	TransportGenTLGigE      Transport = 0x00000040
	TransportGenTLCameraLnk Transport = 0x00000080
	TransportGenTLCXP       Transport = 0x00000100
	TransportGenTLXoF       Transport = 0x00000200
	TransportGenTLVirtual   Transport = 0x00000800
	TransportGenTLXoC       Transport = 0x00001000
)

func (Transport) String

func (t Transport) String() string

Directories

Path Synopsis
examples
grab command
Command grab captures frames from a Hikrobot camera and saves the last one as a PNG.
Command grab captures frames from a Hikrobot camera and saves the last one as a PNG.
list command
Command list prints the Hikrobot cameras MVS can see.
Command list prints the Hikrobot cameras MVS can see.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL