How to use Baumer industrial camera Baumer industrial camera to use HDR function through BGAPISDK (C#)

Baumer industrial camera

Baumer Industrial Cameras Baumer cameras are high-performance, high-quality industrial cameras that can be used in various application scenarios, such as object detection, counting and recognition, motion analysis and image processing.

Baumer's 10 Gigabit cameras have excellent image processing performance and can transmit high-resolution images in real time. In addition, the camera features fast data transfer, low power consumption, easy integration, and high scalability.
​Baumer
industrial cameras are often used in the field of high-speed synchronous acquisition due to their superior and stable performance and quality, and usually use various image algorithms to improve the quality of the captured images.

Technical background of Baumer industrial camera BGAPISDK and HDR function

The BGAPI SDK for Baumer industrial cameras is a set of software development kits developed by Baumer for its camera product series. The SDK provides a set of APIs that enable developers to write professional applications to control, capture, process and display images and data from Baumer cameras. BGAPI SDK supports multiple programming languages, including C++, C#, Visual Basic, LabVIEW, Matlab, etc., and provides a large number of sample codes and documents to help users get started easily and quickly complete application development.

The BGAPI SDK provides a wealth of functions to control all parameters of the Baumer camera, including exposure time, gain, white balance, trigger mode, etc., and supports various data formats, such as Raw, BMP, JPG, etc., and also provides real-time display , data acquisition, image processing and other functions, providing developers with highly customized solutions. In addition, BGAPI SDK also supports the development of multi-camera systems, and can support various computer operating systems, such as Windows, Linux, Mac OS, etc.

The HDR (High Dynamic Range) function of industrial cameras is an image processing technology that can enhance the dynamic range of photos and improve image quality by taking multiple photos with different exposure levels and fusing them together.

When taking high-contrast photos, for example, in the same scene, some areas are too bright, while other areas are too dark. If you shoot with a normal exposure level, the data of the bright part will be lost, and the dark part will be too black to be recognized. At this time, the HDR function can collect multiple photos and combine them into one photo, make full use of multiple sets of data, and follow the principle of human eye adaptation to achieve the effect of optimizing the image. The HDR feature allows for a more gorgeous image quality with more detail and color depth.

In industrial applications, the HDR function can help industrial cameras shoot objects or scenes with relatively high contrast, making the image quality and details more abundant, which can not only meet the needs for image details and color depth, but also provide better quality for the algorithm. image data. Therefore, the HDR function has been widely used in industrial automation, machine vision and other high-precision or high-contrast industrial applications.

This article introduces the function of using BGAPI SDK to use HDR high dynamic range.

Baumer industrial cameras use HDR function through BGAPISDK

The following describes how to use the HDR function of Baumer industrial cameras through BGAPISDK in C#

1. Reference the appropriate class file

The code is as follows (example):

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Data;
using System.Globalization;
using System.Diagnostics;
using System.IO;

2. Use the HDR high dynamic range function through BGAPISDK

The core code of Baumer industrial camera setting HDR high dynamic range mode is as follows:

if(mDevice!= null)
{
    
    
	 mDevice.RemoteNodeList["HDREnable"].Value = true;
    System.Console.Write("  HDREnable                 : {0}\n", (bool)mDevice.RemoteNodeList["HDREnable"].Value);

    only HXG
    //mDevice.RemoteNodeList["HDREnableTriggerAutoMode"].Value = false;
    //System.Console.Write("  HDREnableTriggerAutoMode  : {0}\n", (bool)mDevice.RemoteNodeList["HDREnableTriggerAutoMode"].Value);

    mDevice.RemoteNodeList["HDRIndex"].Value = (long)0;
    System.Console.Write("  HDRIndex                  : {0}\n", (long)mDevice.RemoteNodeList["HDRIndex"].Value);
    mDevice.RemoteNodeList["HDRExposureRatio"].Value = (long)185;
    System.Console.Write("   HDRExposureRatio         : {0}\n", (long)mDevice.RemoteNodeList["HDRExposureRatio"].Value);
    System.Console.Write("   HDRExposureRatioPercent  : {0}\n", (double)mDevice.RemoteNodeList["HDRExposureRatioPercent"].Value);
    mDevice.RemoteNodeList["HDRExposureRatio"].Value = (long)40;
    System.Console.Write("   HDRPotentialAbs          : {0}\n", (long)mDevice.RemoteNodeList["HDRPotentialAbs"].Value);

    mDevice.RemoteNodeList["HDRIndex"].Value = (long)1;
    System.Console.Write("  HDRIndex                  : {0}\n", (long)mDevice.RemoteNodeList["HDRIndex"].Value);
    mDevice.RemoteNodeList["HDRExposureRatio"].Value = (long)45;
    System.Console.Write("   HDRExposureRatio         : {0}\n", (long)mDevice.RemoteNodeList["HDRExposureRatio"].Value);
    System.Console.Write("   HDRExposureRatioPercent  : {0}\n", (double)mDevice.RemoteNodeList["HDRExposureRatioPercent"].Value);
    mDevice.RemoteNodeList["HDRExposureRatio"].Value = (long)20;
    System.Console.Write("   HDRPotentialAbs          : {0}\n", (long)mDevice.RemoteNodeList["HDRPotentialAbs"].Value);
    System.Console.Write("\n");

    datastreamList = mDevice.DataStreams;
    datastreamList.Refresh(100);
    mDataStream = datastreamList.Values.First();
    mDataStream.Open();

	bufferList = mDataStream.BufferList;
    for (int i = 0; i < 4; i++)
    {
    
    
        mBuffer = new BGAPI2.Buffer();
        bufferList.Add(mBuffer);
        mBuffer.QueueBuffer();
    }

    mDataStream.StartAcquisition();
    mDevice.RemoteNodeList["AcquisitionStart"].Execute();

    BGAPI2.Buffer mBufferFilled = null;
    for (int i = 0; i < 12; i++)
    {
    
    
        mBufferFilled = mDataStream.GetFilledBuffer(1000);
        if (mBufferFilled == null) {
    
     System.Console.Write("Error: Buffer Timeout after 1000 msec\n"); }
        else if (mBuffer.IsIncomplete == true) {
    
     System.Console.Write("Error: Image is incomplete\n"); mBufferFilled.QueueBuffer(); }
        else {
    
     System.Console.Write(" Image {0} received\n", mBufferFilled.FrameID); mBufferFilled.QueueBuffer(); }
    }

    mDevice.RemoteNodeList["AcquisitionAbort"].Execute();
    mDevice.RemoteNodeList["AcquisitionStop"].Execute();
    mDataStream.StopAcquisition();

    bufferList.DiscardAllBuffers();
    while (bufferList.Count > 0)
    {
    
    
        mBuffer = (BGAPI2.Buffer)bufferList.Values.First();
        bufferList.RevokeBuffer(mBuffer);
    }
    mDataStream.Close();
    mDevice.Close();	
	

}
    

3. Turn off the HDR high dynamic range function through BGAPISDK

if(mDevice!= null)
{
    
    
	 mDevice.RemoteNodeList["HDREnable"].Value = false;	
}
    

Advantages of Baumer industrial cameras using HDR function

The HDR (High Dynamic Range) function of industrial cameras can bring the following advantages:

Expand the dynamic range: The HDR function can make the dynamic range of the photo larger by fusing multiple groups of exposure photos, which can clearly show the dark part and preserve the details of the bright part. Therefore, the details of objects or scenes can be better revealed, thereby improving image resolution and quality.

Improve Contrast: The HDR function can reduce the noise of the photo and the uneven light when shooting, making the image more contrasty, colorful and realistic.

Improved reliability: The HDR function provides clearer images in high-contrast shooting conditions, improving the reliability and accuracy of object recognition and detection. Therefore, in some industrial application scenarios that require high-precision detection and analysis, such as machine vision, automatic detection, etc., the HDR function is widely used.

Improve automation application efficiency: The HDR function can automatically control the shooting of multiple groups of exposures, thereby improving the efficiency and stability of industrial automation applications. This is very important for high-volume industrial production and rapid detection.

To sum up, the HDR function plays a very important role in confirming and detecting object recognition, resolution, and sharpness, so it is widely used in industrial applications.

Industrial application of Baumer industrial camera using HDR function

Industrial cameras using the HDR (High Dynamic Range) function have been widely used in many fields, the following are some of the main application areas:

Automobile industry: In the process of automobile manufacturing, due to its large volume, complex surface, and comprehensive quality control, the HDR function can be applied to automobile body inspection, wheel hub inspection, appearance inspection, etc.

Semiconductor industry: The semiconductor industry is very important for micron-level measurement, and the HDR function can help improve the detection accuracy in the semiconductor industry, including cutting, grinding, destroying, defect detection and other process stages.

Food industry: The food industry needs high-precision detection of the size, shape, color, and defects of food. The HDR function can help capture more realistic and detailed food images.

Intelligent manufacturing: In the field of intelligent manufacturing, the HDR function can be used for near-blind deformation calculation of high-speed motion systems, measurement of flatness, detection of surface plaques, video photography, 3D pose estimation, and pose estimation.

To sum up, the HDR function has been widely applied and used in the industrial field. This technology can help improve image quality and resolution, thereby improving the accuracy and reliability of detection, and has a wide range of application prospects in industrial manufacturing, safety detection, quality control, etc.

Guess you like

Origin blog.csdn.net/xianzuzhicai/article/details/131194679