PySpin.Image¶
- class Image(*args, **kwargs)¶
The image object class.
- static Create() ImagePtr¶
- static Create(image) ImagePtr
Parameters¶
image: Spinnaker::ImagePtr const
Create(width, height, offsetX, offsetY, pixelFormat, pData) -> ImagePtr
Parameters¶
width: size_t height: size_t offsetX: size_t offsetY: size_t pixelFormat: enum Spinnaker::PixelFormatEnums pData: void *
Create(width, height, offsetX, offsetY, pixelFormat, pData, dataPayloadType, dataSize) -> ImagePtr
Parameters¶
width: size_t height: size_t offsetX: size_t offsetY: size_t pixelFormat: enum Spinnaker::PixelFormatEnums pData: void * dataPayloadType: enum Spinnaker::TLPayloadType dataSize: size_t
Creates a new Image object, either using a default constructor, copied from another ImagePtr, or using width, height, offset_x, offset_y, pixel format, and a NumPy array containing 8-bit unsigned ints representing the image data (replaces the void* pData argument).
- static GetImageStatusDescription(status) char const *¶
Parameters¶
status: enum Spinnaker::ImageStatus
- static Load(pFilename, format=SPINNAKER_IMAGE_FILE_FORMAT_FROM_FILE_EXT) ImagePtr¶
Parameters¶
pFilename: char const * format: enum Spinnaker::ImageFileFormat
- CheckCRC(self) bool¶
Checks if the computed checksum matches with chunk data’s ImageCRC
Returns true if computed checksum matches with the chunk data’s CRC and false otherwise.
- DeepCopy(self, pSrcImage)¶
Parameters¶
pSrcImage: Spinnaker::ImagePtr const
Performs a deep copy of the Image. After this operation, the image contents and member variables will be the same. The Images will not share a buffer. The Image’s current buffer will not be released.
- param pSrcImage:
The Image to copy the data from.
- GetBitsPerPixel(self) size_t¶
Gets the number of bits used per pixel in the image. This information is retrieved from the Transport Layer Image format headers. It is retrieved on a per image basis.
The number of bits used per pixel.
- GetBufferSize(self) size_t¶
Gets the size of the buffer associated with the image in bytes.
For user created images, this function returns the size of the user provided data if the data size was provided. If the data size was not provided, the buffer size is calculated based on the image dimensions and pixel format.
See: GetImageSize()
GetValidPayloadSize()
The size of the buffer, in bytes.
- GetChunkData(self) ChunkData¶
Returns a pointer to a chunk data interface. No ownership is transfered, the chunk data interface reference is valid until Image::Release() is called on this image.
ChunkData interface that provides access to image chunks.
- GetChunkLayoutId(self) uint64_t¶
Returns the id of the chunk data layout.
uint64_t value representing the id of the chunk data layout.
- GetColorProcessing(self) Spinnaker::ColorProcessingAlgorithm¶
Gets the color algorithm used to produce the image.
See: ImageProcessor::Convert()
The color processing algorithm used to produce the image.
- GetDataAbsoluteMax(self) float¶
Get the value for which no image data will exceed.
the maximim theoretical image data value
- GetDataAbsoluteMin(self) float¶
Get the value for which no image data will be less than
the minimum theoretical image data value
- GetFrameID(self) uint64_t¶
Gets the frame ID for this image.
The frame ID.
- GetHeight(self) size_t¶
Gets the height of the image in pixels. This information is retrieved from the Transport Layer Image format headers. It is retrieved on a per image basis.
The height in pixels.
- GetID(self) uint64_t¶
Gets a unique ID for this image that is associated with a stream. Note that an ID of 0 indicates that the image is no longer associated with a stream or is a copy of the original image.
See: GetFrameID()
The 64 bit unique id for this image.
- GetImagePayloadType(self) Spinnaker::ImagePayloadType¶
Gets the image specific payload type.
Image payload type
- GetImageSize(self) size_t¶
Returns the size of the image
If the image is compressed, the value returned represents the size of the compressed image data in bytes. For chunk enabled data transmissions, only the size of the image chunk is reported here. If the image chunk is compressed, the value returned represents the size of the compressed image data in bytes. The entire chunk data payload including the image chunk and other optional data chunks can be queried by GetValidPayloadSize().
See: GetBufferSize()
GetValidPayloadSize()
The image size in bytes.
- GetImageStatus(self) Spinnaker::ImageStatus¶
Returns data integrity status of the image returned from GetNextImage()
Returns whether image has any data integrity issues.
- GetNumChannels(self) size_t¶
Gets the number of channels (depth) used in the image. Returns 0 if the number of channels for the given pixel format is unknown.
The number of channels per pixel.
- GetPayloadType(self) size_t¶
Gets the device specific payload type that was transmitted. This is a Transport Layer specific value that identifies how the image was transmitted. This information is retrieved from the Transport Layer Image format headers. It is retrieved on a per image basis.
Transport Layer device specific payload type.
- GetPixelFormat(self) Spinnaker::PixelFormatEnums¶
Returns an enum value that represents the pixel format of this image. The enum can be used with the easy access GenICam features available through the Camera.h header file. This easy access enum can also be used in the ImageProcessor::Convert() function.
See: ImageProcessor::Convert()
enum value representing the PixelFormat.
- GetPixelFormatIntType(self) Spinnaker::PixelFormatIntType¶
Returns an enum value that represents the integer type used in the pixel format of this image.
enum value representing the integer type used.
- GetPixelFormatName(self) gcstring¶
Returns a string value that represents this image’s pixel format. The string is a valid SFNC name that maps to the underlying TL specific pixel format. This is the most generic way to identify the pixel format of the image.
string value representing the PixelFormat.
- GetPrivateData(self) void *¶
Gets a pointer to the user passed data associated with the image. This function is considered unsafe. The pointer returned could be invalidated if the buffer is released. The pointer may also be invalidated if the Image object is passed to Image::Release().
TODO: no way to set private data for image yet.
A pointer to the user passed data pointer.
- GetSerialNumber(self) gcstring¶
Gets the serial number of the camera that captured the image. Note that an empty string indicates that the image is not associated with a camera
The serial number of the camera that captured the image.
- GetStreamIndex(self) uint64_t¶
Gets the stream channel index of where the image is received.
The stream channel index of where this image is received.
- GetStride(self) size_t¶
Gets the stride of the image in bytes. The stride of an image is how many bytes are in each row. This information is retrieved from the Transport Layer Image format headers. It is retrieved on a per image basis.
The stride in bytes.
- GetTLPayloadType(self) Spinnaker::TLPayloadType¶
Gets the GenTL payload type that was transmitted. This is a generic Transport agnostic value that identifies how the image was transmitted. This information is retrieved from the Transport Layer Image format headers. It is retrieved on a per image basis.
Transport Layer agnostic GenTL payload type.
- GetTLPixelFormat(self) uint64_t¶
Gets the pixel format of the image. This is a Transport Layer specific pixel format that identifies how the pixels in the image should be interpreted. To understand how to interpret this value it is necessary to know what the transport layer namespace is. This can be retrieved through a call to GetTLPixelFormatNamespace(). This information is retrieved from the Transport Layer Image format headers. It is retrieved on a per image basis.
See: GetTLPixelFormatNamespace()
Transport Layer specific pixel format.
- GetTLPixelFormatNamespace(self) Spinnaker::TLPixelFormatNamespace¶
Returns an enum value that represents the namespace in which this image’s TL specific pixel format resides. This information is important to properly interpret the value returned by GetTLPixelFormat()
See: GetTLPixelFormat()
enum value representing the PixelFormatNamespace.
- GetTimeStamp(self) uint64_t¶
Gets the time stamp for the image in nanoseconds.
The time stamp of the image.
- GetValidPayloadSize(self) size_t¶
Returns the size of valid data in the image payload.
This is the actual amount of data read from the device. For non-chunk images, the value returned here is equal to the value returned by GetImageSize(). For chunk enabled data transmissions, the sum of the image chunk, other optional data chunks (e.g. ExposureTime) and their associated chunk headers is returned here. Note that GetBufferSize() returns the total size of bytes allocated for the image and could be equal to or greater than the size returned by this function.
See: GetBufferSize()
GetImageSize()
size_t value representing valid payload.
- GetWidth(self) size_t¶
Gets the width of the image in pixels. This information is retrieved from the Transport Layer image format headers. It is retrieved on a per image basis.
The width in pixels.
- GetXOffset(self) size_t¶
Gets the ROI x offset in pixels for this image. This information is retrieved from the Transport Layer Image format headers. It is retrieved on a per image basis.
The x offset in pixels.
- GetXPadding(self) size_t¶
Gets the x padding in bytes for this image. This is the number of bytes at the end of each line to facilitate alignment in buffers. This information is retrieved from the Transport Layer Image format headers. It is retrieved on a per image basis.
The x padding in bytes.
- GetYOffset(self) size_t¶
Gets the ROI y offset in pixels for this image. This information is retrieved from the Transport Layer Image format headers. It is retrieved on a per image basis.
The y offset in pixels.
- GetYPadding(self) size_t¶
Gets the y padding in bytes for this image. This is the number of bytes at the end of each image to facilitate alignment in buffers. This information is retrieved from the Transport Layer Image format headers. It is retrieved on a per image basis.
The y padding in bytes.
- HasCRC(self) bool¶
Checks if the image contains ImageCRC checksum from chunk data
Returns true if image contains ImageCRC checksum from chunk data and false otherwise.
- HasChunkData(self) bool¶
Checks if the image contains chunk data
Returns true if image contains chunk data and false otherwise.
- IsCompressed(self) bool¶
Returns a boolean value indicating whether this image is compressed.
Returns true if image is compressed, false otherwise.
- IsInUse(self) bool¶
Returns true if the image is still in use by the stream
Returns true if the image is in use and false otherwise.
- IsIncomplete(self) bool¶
Returns a boolean value indicating if this image was incomplete. An image is marked as incomplete if the transport layer received less data then it requested.
Returns true if image is incomplete, false otherwise.
- Release(self)¶
- ResetImage(self, width, height, offsetX, offsetY, pixelFormat)¶
Parameters¶
width: size_t height: size_t offsetX: size_t offsetY: size_t pixelFormat: enum Spinnaker::PixelFormatEnums
ResetImage(self, width, height, offsetX, offsetY, pixelFormat, pData)
Parameters¶
width: size_t height: size_t offsetX: size_t offsetY: size_t pixelFormat: enum Spinnaker::PixelFormatEnums pData: void *
ResetImage(self, width, height, offsetX, offsetY, pixelFormat, pData, dataPayloadType, dataSize)
Parameters¶
width: size_t height: size_t offsetX: size_t offsetY: size_t pixelFormat: enum Spinnaker::PixelFormatEnums pData: void * dataPayloadType: enum Spinnaker::TLPayloadType dataSize: size_t
Sets new dimensions of the image object. This function is used to create an image from existing image data with a specific payload type, such as a compressed image.
- param width:
The width of image in pixels to set.
- param height:
The height of image in pixels to set.
- param offsetX:
The x offset in pixels to set.
- param offsetY:
The y offset in pixels to set.
- param pixelFormat:
Pixel format to set.
- param pData:
Pointer to the image buffer.
- param dataPayloadType:
The payload type of the data. This value can be retrieved from an existing image by using the GetTLPayloadType() function call.
- param dataSize:
The size of the provided data in bytes
- See:
GetTLPayloadType()
- Save(self, pFilename, format=SPINNAKER_IMAGE_FILE_FORMAT_FROM_FILE_EXT)¶
Parameters¶
pFilename: char const * format: enum Spinnaker::ImageFileFormat
Save(self, pFilename, pOption)
Parameters¶
pFilename: char const * pOption: Spinnaker::PNGOption &
Save(self, pFilename, pOption)
Parameters¶
pFilename: char const * pOption: Spinnaker::PPMOption &
Save(self, pFilename, pOption)
Parameters¶
pFilename: char const * pOption: Spinnaker::PGMOption &
Save(self, pFilename, pOption)
Parameters¶
pFilename: char const * pOption: Spinnaker::TIFFOption &
Save(self, pFilename, pOption)
Parameters¶
pFilename: char const * pOption: Spinnaker::JPEGOption &
Save(self, pFilename, pOption)
Parameters¶
pFilename: char const * pOption: Spinnaker::JPG2Option &
Save(self, pFilename, pOption)
Parameters¶
pFilename: char const * pOption: Spinnaker::BMPOption &
Save(self, pFilename, pOption)
Parameters¶
pFilename: char const * pOption: Spinnaker::GenDCOption &
Save(self, pFilename, pOption)
Parameters¶
pFilename: char const * pOption: Spinnaker::SIOption &
Saves the image to the specified file name with the options specified.
- param pFilename:
Filename to save image with.
- param pOption:
Options to use while saving image.