March 5, 2012

              pylon 3.0 – Learn More About the New API

              The new pylon C++ API is more user friendly than the previous release and only uses the “pylon Low Level C++ API.” Detailed knowledge about GigE Vision and Basler camera technology is now automatically handled in new classes by the driver itself. The lines of code, which need to be programmed within the customers’ vision application, are thus reduced by a factor of 10 to 20. This cuts the amount of time and work needed for pylon integration significantly and users will start to see project results much faster. In addition, the robustness of the driver integration has been improved as more expert knowledge is now included in the new API extension.
              Backward Compatibility
              The 3.0 release is fully compatible with older 2.x releases, as new functions have been added instead of changing the existing API. Tests integrated into the pylon quality frame work will verify its backward compatibility in upcoming releases as well. Customers can thus upgrade to the latest API release now, or at a later date, whichever best suits their project planning needs.

              Customers using an older pylon release can also benefit from other improvements and bug fixes in the new release without code redesigns – please refer to the pylon Release Notes document for a full list.
              An Easy Example
              The following lines of codes illustrate a generic acquisition task for a vision application and show how easy it is to grab images with the new pylon API:

              // Open the first available camera device
              CInstantCamera camera( CTlFactory::GetInstance().CreateFirstDevice());

              // Start grabbing a number of images
              camera.StartGrabbing( c_countOfImagesToGrab);

              // Create a smart pointer handling the grab result data.
              CGrabResultPtr ptrGrabResult;

              // This loop runs until all images are grabbed
              while ( camera.IsGrabbing()) {

                 // Get the next grabbed image here
                 camera.RetrieveResult( 5000, ptrGrabResult, TimeoutHandling_ThrowException);

                 // and do some kind of "processing"
                 if (ptrGrabResult->GrabSucceeded()) {
              const uint8_t *pImageBuffer = (uint8_t *) ptrGrabResult->GetBuffer();
                     cout << "Gray value of first pixel: " << (uint32_t) pImageBuffer[0] << endl;

              This sample illustrates how to grab and process images using the CInstantCamera class. The images are grabbed and processed asynchronously, i.e. while the application is processing a buffer, the next image is grabbed in parallel. The CInstantCamera class uses a pool of buffers to retrieve image data from the camera device and to transfer them to the PC. Once a buffer is full with grabbed images and transferred, the buffer images can be processed by the application. A new intelligent "Smart Pointer" mechanism handles the buffers within the application and makes sure that, after processing, the buffers will be reused for the next grabbed images.

              In comparison with the former pylon 2.x API, this sample illustrates that you don’t need to set up and configure details of the image acquisition any longer – details, such as defining the size of buffers, resource allocation and registering and queuing-in buffers. Also when the image acquisition process is canceled or stopped, you no longer need to clean up everything on your own, that is deregistering buffers or freeing up memory manually. All these operations are now handled automatically by the CInstantCamera class.

              The new API also covers the following generic tasks in an equally easy way:
              • camera parameterization
              • acquisition of images and the management of memory buffers on the PC
              • use of callbacks e.g. to find out if new images are available.
              • conversion of grabbed images into other formats like BMP, PNG, TIFF and JPG
              • saving images in various formats to the PC's hard disk
              • recording grabbed image series into AVI files on the PC's hard disk
              The “Migrating from Previous Releases” section in the Programmer’s Guide and API Reference helps to port existing pylon 2.x code to the new High Level 3.0 C++ API to leverage the new features. The pylon 3.0 SDK will come with a new set of code samples showing you how to use the new API functionality in practice.

              Try it out now – Free Download
              Take a closer look and download the free pylon 3.0 driver package for Windows 32bit or 64bit from our Downloads Section.

                RSS Feed

                Subscribe the Basler News RSS Feed and get the latest news stories directly delivered to you.
                RSS News Feed
                Please activate cookies in order to download files without having to fill in your data again the next time you visit.