2D Image Capture Process
Note
The 2D image capture process has significantly changed with Zivid SDK 2.9. To see the process for an earlier SDK version, change the Knowledge Base version in the top left corner.
The 2D capture API returns when the acquisition is done.
const auto frame2D = camera.capture(settings2D);
using (var frame2D = camera.Capture(settings2D))
with camera.capture(settings_2d) as frame_2d:
The method to get the image from the Frame2D object returns after the 2D image is available in CPU memory. This function call blocks until processing and copying are finished. The image object holds a handle to the image data in CPU memory.
Tip
Use recommended hardware to minimize 2D image processing time.
const auto image = frame2D.imageRGBA();
var image = frame2D.ImageRGBA();
image = frame_2d.image_rgba()
It is possible to get the image in different modes, e.g. BGRA
or sRGB
.
For more information, see 2D Color Spaces and Output Formats.
Note
In C++, class Zivid::Image
inherits from Zivid::Array2D
and provides, in addition, a method to save the image in PNG file format.
When the image is available on the CPU memory, we can utilize it in our machine vision application or save it to disk.
const auto imageFile = "Image.png";
std::cout << "Saving 2D color image to file: " << imageFile << std::endl;
image.save(imageFile);
var imageFile = "Image.png";
Console.WriteLine("Saving 2D color image to file: {0}", imageFile);
image.Save(imageFile);
image_file = "Image.png"
print(f"Saving 2D color image to file: {image_file}")
image.save(image_file)
Tip
For optimized timing, move the robot or move the objects in the scene after the 2D capture API returns. This has to happen before or at the same time when calling the API to get the image from the Frame2D object.
Version History
SDK |
Changes |
---|---|
2.12.0 |
2D acquisition time on Zivid 2+ is reduced by up to 50%. |
2.11.0 |
Added support for SRGB color space. |
2.9.0 |
Capture function returns when the acquisition is done and improved capture speed. |
2.8.0 |
Improved capture speed of Zivid 2. |