PySpin.CameraBase¶
- class CameraBase(*args, **kwargs)¶
The base class for the camera object.
- BeginAcquisition(self)¶
Spinnaker::CameraBase::BeginAcquisition BeginAcquisition Starts the image acquisition engine. The camera must be initialized via a call to Init() before starting an acquisition.
Note that an error SPINNAKER_ERR_NOT_IMPLEMENTED will be thrown if an unsupported combination of stream mode and buffer ownership is set.
See: Init()
- DeInit(self)¶
Spinnaker::CameraBase::DeInit DeInit Disconnects camera port, resets camera back to read access and frees GenICam node map and GUI XML.
Do not call more functions that access the remote device such as WritePort/ReadPort after calling DeInit(). Events should also be unregistered before calling camera DeInit(). Otherwise an exception will be thrown in the DeInit() call and require the user to unregister events before the camera can be re-initialized again.
See: Init()
See: UnregisterEventHandler(EventHandler & evtHandlerToUnregister)
- DiscoverMaxPacketSize(self) unsigned int¶
Spinnaker::CameraBase::DiscoverMaxPacketSize DiscoverMaxPacketSize Returns the largest packet size that can be safely used on the interface that device is connected to
The maximum packet size returned.
- EndAcquisition(self)¶
Spinnaker::CameraBase::EndAcquisition EndAcquisition Stops the image acquisition engine. If EndAcquisition() is called without a prior call to BeginAcquisition() an error message “Camera is not started” will be thrown. All Images that were acquired using GetNextImage() or GetNextImageSync() need to be released first using image->Release() or imageList->Release() before calling EndAcquisition(). All buffers in the input pool and output queue will be discarded when EndAcquisition() is called.
See: Init()
See: BeginAcquisition()
See: GetNextImage( grabTimeout )
See: GetNextImageSync( grabTimeout )
See: Image::Release()
- ForceIP(self)¶
Spinnaker::CameraBase::ForceIP ForceIP Forces the camera to be on the same subnet as its corresponding interface.
- GetAccessMode(self) Spinnaker::GenApi::EAccessMode¶
Spinnaker::CameraBase::GetAccessMode GetAccessMode Returns the access mode that the software has on the Camera. The camera does not need to be initialized before calling this function.
See: Init()
An enumeration value indicating the access mode
- GetActiveNumDataStreams(self) unsigned int¶
Spinnaker::CameraBase::GetActiveNumDataStreams GetActiveNumDataStreams Returns the number of data streams that are currently active.
The number of active data streams
- GetBufferOwnership(self) Spinnaker::BufferOwnership¶
Spinnaker::CameraBase::GetBufferOwnership GetBufferOwnership Gets data buffer ownership. The data buffers can be owned by System or User. If the system owns the buffers, the memory required for the buffers are allocated and freed by the library. If user owns the buffers, the user is responsible for allocating and ultimately freeing the memory. By default, data buffers are owned by the System.
See: SetBufferOwnership()
See: SetUserBuffers()
Buffer ownership
- GetDeviceID(self) gcstring¶
Spinnaker::CameraBase::GetDeviceID GetDeviceID This returns a unique id string that identifies the camera; a unique string for USB devices, and MAC address for GEV devices.
string that uniquely identifies the camera
- GetDeviceSerialNumber(self) gcstring¶
Spinnaker::CameraBase::GetDeviceSerialNumber GetDeviceSerialNumber This returns a manufacturer specific serial number that identifies the camera.
serial number string that identifies the camera
- GetGuiXml(self) gcstring¶
Spinnaker::CameraBase::GetGuiXml GetGuiXml Returns the GUI XML that can be passed into the Spinnaker GUI framework
GenICam::gcstring that represents the uncompressed GUI XML file
- GetNextImage(self, grabTimeout=EVENT_TIMEOUT_INFINITE, streamIndex=0) ImagePtr¶
Parameters¶
grabTimeout: uint64_t streamIndex: uint64_t
Spinnaker::CameraBase::GetNextImage GetNextImage Gets the next image that was received by the transport layer. This function will block for the specified timeout period until an image arrives. Most cameras support one stream so the default streamIndex is 0, but if a camera supports multiple streams the user can input the streamIndex to select from which stream to grab images.
See: Init()
See: BeginAcquisition()
See: EndAcquisition()
Args: grabTimeout: A 64bit value that represents a timeout in milliseconds streamIndex: The index of the stream to grab the image from pointer to an Image object
- GetNextImageSync(self, grabTimeout=EVENT_TIMEOUT_INFINITE) ImageList¶
Parameters¶
grabTimeout: uint64_t
Spinnaker::CameraBase::GetNextImageSync GetNextImageSync If a camera supports one or more streams, this function gets one image from each of the camera’s streams, and returns the image(s) in a list. This function will block for the specified timeout period until an image arrives on all the streams.
Note: This function should not be used together with GetNextImage. Results will be undeterministic and could lead to missing or lost of images.
See: Init()
See: BeginAcquisition()
See: EndAcquisition()
Args: grabTimeout: A 64bit value that represents a timeout in milliseconds a list containing the Image objects
- GetNodeMap(self) INodeMap¶
Spinnaker::CameraBase::GetNodeMap GetNodeMap Gets a reference to the node map that is generated from a GenICam XML file. The camera must be initialized by a call to Init() first before a node map reference can be successfully acquired.
See: Init()
A reference to the INodeMap.
- GetNumDataStreams(self) unsigned int¶
Spinnaker::CameraBase::GetNumDataStreams GetNumDataStreams Returns the total number of streams that the device supports. For configurable multistream cameras, use GetActiveNumDataStreams() to get the number of active streams.
See: GetActiveNumDataStreams()
The total number of data streams
- GetNumImagesInUse(self) unsigned int¶
Spinnaker::CameraBase::GetNumImagesInUse GetNumImagesInUse Returns the number of images that are currently in use. Each of the images that are currently in use must be cleaned up with a call to image->Release() before calling system->ReleaseInstance().
The number of images that needs to be cleaned up.
- GetProducer(self) Spinnaker::ProducerPtr¶
Spinnaker::CameraBase::GetProducer Returns a producer from which this camera is enumerated.
A Producer object.
- GetTLDeviceNodeMap(self) INodeMap¶
Spinnaker::CameraBase::GetTLDeviceNodeMap GetTLDeviceNodeMap Gets a reference to the node map that is generated from a GenICam XML file for the GenTL Device module. The camera does not need to be initialized before acquiring this node map.
A reference to the INodeMap.
- GetTLStreamNodeMap(self, streamIndex=0) INodeMap¶
Parameters¶
streamIndex: uint64_t
Spinnaker::CameraBase::GetTLStreamNodeMap GetTLStreamNodeMap Gets a reference to the node map that is generated from a GenICam XML file for the GenTL Stream module. The camera does not need to be initialized before acquiring this node map.
- param streamIndex:
The index of the stream to grab the image from
A reference to the INodeMap.
- GetUserBufferCount(self) uint64_t¶
Spinnaker::CameraBase::GetUserBufferCount GetUserBufferCount Gets the number of user memory buffers. This will throw an exception if user memory buffer has not been set. If the user memory is contiguous, this will throw an exception unless BeginAcquisition() has been called.
See: BeginAcquisition()
See: SetUserBuffers()
The number of user memory buffers
- GetUserBufferSize(self) uint64_t¶
Spinnaker::CameraBase::GetUserBufferSize GetUserBufferSize Gets the size of one user memory buffer (in bytes). This will throw an exception if user memory buffer has not been set. If the user memory is contiguous, this will throw an exception unless BeginAcquisition() has been called. To prevent image tearing when working with USB3 cameras, the size of each buffer should be equal to: ((unsigned int) (bufferSize + 1024 - 1) / 1024) * 1024 where 1024 is the USB3 packet size.
See: BeginAcquisition()
See: SetUserBuffers()
The size of one user memory buffer (in bytes)
- GetUserBufferTotalSize(self) uint64_t¶
Spinnaker::CameraBase::GetUserBufferTotalSize GetUserBufferTotalSize Gets the total size of all the user memory buffers (in bytes). This will throw an exception if user memory buffer has not been set. The total size should be GetUserBufferSize() multiplied by GetUserBufferCount() or larger.
See: GetUserBufferCount()
See: GetUserBufferSize()
See: SetUserBuffers()
The total size of all the user memory buffers (in bytes)
- Init(self)¶
Spinnaker::CameraBase::Init Init Connects to camera with read and write access, retrieves remote device and GUI XML and generates node map references.
This function needs to be called before any camera related API calls such as BeginAcquisition(), EndAcquisition(), GetNodeMap(), GetNextImage() and GetNextImageSync().
See: BeginAcquisition()
See: EndAcquisition()
See: GetNodeMap()
See: GetNextImage()
See: GetNextImageSync()
- IsInitialized(self) bool¶
Spinnaker::CameraBase::IsInitialized IsInitialized Checks if camera is initialized. This function needs to return true in order to retrieve a valid NodeMap from the GetNodeMap() call.
See: GetNodeMap()
If camera is initialized or not
- IsStreaming(self) bool¶
Spinnaker::CameraBase::IsStreaming IsStreaming Returns true if the camera is currently streaming or false if it is not.
See: Init()
returns true if camera is streaming and false otherwise.
- IsValid(self) bool¶
Spinnaker::CameraBase::IsValid IsValid Checks a flag to determine if camera is still valid for use.
If camera is valid or not
- RegisterEventHandler(self, evtHandlerToRegister)¶
Parameters¶
evtHandlerToRegister: Spinnaker::EventHandler &
RegisterEventHandler(self, evtHandlerToRegister, eventName)
Parameters¶
evtHandlerToRegister: Spinnaker::DeviceEventHandler & eventName: Spinnaker::GenICam::gcstring const &
RegisterEventHandler(self, evtHandlerToRegister, streamIndex)
Parameters¶
evtHandlerToRegister: Spinnaker::ImageEventHandler & streamIndex: uint64_t
- Spinnaker::CameraBase::RegisterEventHandler
RegisterEventHandler(ImageEventHandler &, uint64_t) Registers a specific stream handler for the camera given a stream
index. The camera has to be initialized first with a call to Init() before registering handlers for events.
See: Init()
See: UnregisterEventHandler()
Args: evtHandlerToRegister: The event handler to register for the camera streamIndex: The index of the stream of where this handler will be registered to
- SetBufferOwnership(self, mode)¶
Parameters¶
mode: enum Spinnaker::BufferOwnership const
Spinnaker::CameraBase::SetBufferOwnership SetBufferOwnership Sets data buffer ownership. The data buffers can be owned by System or User. If the system owns the buffers, the memory required for the buffers are allocated and freed by the library. If user owns the buffers, the user is responsible for allocating and ultimately freeing the memory. By default, data buffers are owned by the library.
Note that an error SPINNAKER_ERR_NOT_IMPLEMENTED will be thrown during BeginAcquisition() if an unsupported combination of stream mode and buffer ownership is set.
See: GetBufferOwnership()
See: SetUserBuffers()
Args: mode: Buffer ownership to set
- SetUserBuffers(self, pMemBuffers, totalSize)¶
Parameters¶
pMemBuffers: void *const totalSize: uint64_t
SetUserBuffers(self, ppMemBuffers, bufferCount, bufferSize)
Parameters¶
ppMemBuffers: void **const bufferCount: uint64_t const bufferSize: uint64_t const
Spinnaker::CameraBase::SetUserBuffers SetUserBuffers Specify non-contiguous user allocated memory to use as data buffers. Each pointer to a buffer must have enough memory to hold one image. To prevent image tearing when working with USB3 cameras, the size of each buffer should be equal to: ((unsigned int) (bufferSize + 1024 - 1) / 1024) * 1024 where 1024 is the USB3 packet size.
See: GetBufferOwnership()
See: SetBufferOwnership()
See: GetUserBufferCount()
See: GetUserBufferSize()
See: GetUserBufferTotalSize()
Args: ppMemBuffers: Pointer to pointers that each point to a single user memory buffer to be written to bufferCount: The number of user memory buffers bufferSize: The size of the memory allocated for each user buffer (in bytes)
- UnregisterAllLoggingEventHandlers(self)¶
Spinnaker::CameraBase::UnregisterAllLoggingEventHandlers Unregisters all previously registered logging events.
- UnregisterEventHandler(self, evtHandlerToUnregister)¶
Parameters¶
evtHandlerToUnregister: Spinnaker::EventHandler &
Spinnaker::CameraBase::UnregisterEventHandler UnregisterEventHandler Unregisters any type of event handler for the camera. Event handlers should be unregistered first before calling camera DeInit(). Otherwise an exception will be thrown in the DeInit() call and require the user to unregister event handlers before the camera can be re-initialized again.
See: DeInit()
See: RegisterEventHandler()
Args: evtHandlerToUnregister: The event handler to unregister from the camera