Skip to content

pylon/AcquireSingleFrameConfiguration.h#

An instant camera configuration for single frame acquisition. More…

Namespaces#

Name
Pylon
Contains definitions of pylon types.

Classes#

Name
class Pylon::CAcquireSingleFrameConfiguration
An instant camera configuration for single frame acquisition, Use together with CInstantCamera::GrabOne() only.

Detailed Description#

An instant camera configuration for single frame acquisition.

Use together with Pylon::CInstantCamera::GrabOne() only. This instant camera configuration is provided as header-only file. The code can be copied and modified for creating own configuration classes.

Source code#

//-----------------------------------------------------------------------------
//  Basler pylon SDK
//  Copyright (c) 2010-2022 Basler AG
//  http://www.baslerweb.com
//  Author:  Andreas Gau
//-----------------------------------------------------------------------------
#ifndef INCLUDED_ACQUIRESINGLEFRAMECONFIGURATION_H_6529309
#define INCLUDED_ACQUIRESINGLEFRAMECONFIGURATION_H_6529309

#include <pylon/Platform.h>

#ifdef _MSC_VER
#   pragma pack(push, PYLON_PACKING)
#endif /* _MSC_VER */

#include <pylon/InstantCamera.h>
#include <pylon/ParameterIncludes.h>
#include <pylon/ConfigurationHelper.h>

namespace Pylon
{
    class CAcquireSingleFrameConfiguration : public CConfigurationEventHandler
    {
    public:
        virtual ~CAcquireSingleFrameConfiguration()
        {
        }

        static void ApplyConfiguration( GenApi::INodeMap& nodemap )
        {
            using namespace GenApi;

            //Disable all trigger types.
            CConfigurationHelper::DisableAllTriggers( nodemap );

            //Disable compression mode.
            CConfigurationHelper::DisableCompression( nodemap );

            //Disable GenDC streaming.
            CConfigurationHelper::DisableGenDC( nodemap );

            // Set image component.
            CConfigurationHelper::SelectRangeComponent( nodemap );

            //Set acquisition mode.
            CEnumParameter( nodemap, "AcquisitionMode" ).SetValue( "SingleFrame" );
        }

        //Set basic camera settings
        virtual void OnOpened( CInstantCamera& camera )
        {
            try
            {
                ApplyConfiguration( camera.GetNodeMap() );
                // Probe max packet size
                CConfigurationHelper::ProbePacketSize( camera.GetStreamGrabberNodeMap() );
            }
            catch (const GenericException& e)
            {
                throw RUNTIME_EXCEPTION( "Could not apply configuration. Pylon::GenericException caught in OnOpened method msg=%hs", e.what() );
            }
            catch (const std::exception& e)
            {
                throw RUNTIME_EXCEPTION( "Could not apply configuration. std::exception caught in OnOpened method msg=%hs", e.what() );
            }
            catch (...)
            {
                throw RUNTIME_EXCEPTION( "Could not apply configuration. Unknown exception caught in OnOpened method." );
            }
        }
    };

}

#ifdef _MSC_VER
#   pragma pack(pop)
#endif /* _MSC_VER */

#endif /* INCLUDED_ACQUIRESINGLEFRAMECONFIGURATION_H_6529309 */

Updated on 5 July 2022 at 15:30:01