Baumer industrial camera Baumer industrial camera uses the image callback function to save the image at full frame rate through BGAPISDK (C#)

Baumer industrial camera Baumer industrial camera uses the image callback function to save the image at full frame rate through BGAPISDK (C#)

  • Baumer industrial camera
  • Technical background of full frame rate preservation of Baumer industrial cameras
  • Baumer industrial camera uses camera image callback function through BGAPISDK
    • 1. Reference the appropriate class file
    • 2. Save at full frame rate in the camera image callback function through BGAPISDK
  • Advantages of saving images at full frame rate with Baumer industrial cameras
  • Industrial application of Baumer industrial cameras to save images at full frame rate

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 full frame rate storage of Baumer industrial cameras

Why do some applications need to use the full frame rate of industrial cameras to save images to hard disk space?

Because industrial cameras are designed to capture images with high speed and high resolution and are able to produce uncompressed images with high bit depth.

This allows detailed and high-quality images to be captured in real-time, which may be necessary in industries such as manufacturing and scientific research, where accurate and fast image data acquisition is critical.

Additionally, the use of industrial cameras ensures that there is no loss of image quality during image acquisition and storage, resulting in more reliable and consistent results.

This article here introduces the method of using the image callback function to save at full frame rate through BGAPISDK.

Baumer industrial camera uses the camera image callback function through BGAPISDK

The following describes how Baumer industrial cameras use the camera image callback function of BGAPISDK to save full frame rate images in C#.

1. Reference the appropriate class file

The code is as follows (example):

using System;
using System.Collections.Generic;
using System. ComponentModel;
using System.Data;
using System. Drawing;
using System. Linq;
using System. Text;
using System. Windows. Forms;
using BGAPI2;
using System.Runtime.InteropServices;
using System.IO;
using CSCameraDemo. Properties;
using System. Globalization;
using WindowsFormsApplication1;
using System. Threading. Tasks;
using System. Threading;
using System.Drawing.Imaging;

2. Save at full frame rate in the camera image callback function through BGAPISDK

int TestNum0 =0;
//camera image callback function
void mDataStream_NewBufferEvent(object sender, BGAPI2.Events.NewBufferEventArgs mDSEvent)
{<!-- -->
    try
    {<!-- -->
        BGAPI2.Buffer mBufferFilled = null;
        mBufferFilled = mDSEvent. BufferObj;
        if (mBufferFilled == null)
        {<!-- -->
            MessageBox. Show("Error: Buffer Timeout after 1000 ms!");
        }
        else if (mBufferFilled. IsIncomplete == true)
        {<!-- -->
            //MessageBox. Show("Error: Image is incomplete!");
            //queue buffer again
            mBufferFilled. QueueBuffer();
        }
        else
        {<!-- -->
            #region//Get the current FrameID
            FrameIDInt = (int)mBufferFilled.FrameID;
            #endregion
 
            //Convert the internal image memory data of the camera to bitmap data
            System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap((int)mBufferFilled.Width, (int)mBufferFilled.Height, (int)mBufferFilled.Width,
                System.Drawing.Imaging.PixelFormat.Format8bppIndexed, (IntPtr)((ulong)mBufferFilled.MemPtr + mBufferFilled.ImageOffset));
 
            #region//Mono image data conversion. Color image data conversion is different from this
            System.Drawing.Imaging.ColorPalette palette = bitmap.Palette;
            int nColors = 256;
            for (int ix = 0; ix < nColors; ix ++ )
            {<!-- -->
                uint Alpha = 0xFF;
                uint Intensity = (uint)(ix * 0xFF / (nColors - 1));
                palette.Entries[ix] = System.Drawing.Color.FromArgb((int)Alpha, (int)Intensity, (int)Intensity, (int)Intensity);
            }
            bitmap.Palette = palette;
            #endregion
 
 
            //Callback function to save the image function
            if (bSaveImg)
            {<!-- -->
                //Use bitmap's own function to save
                string strtime = DateTime.Now.ToString("yyyyMMddhhmmssfff");
                string saveimagepath = pImgFileDir + "" + strtime + FrameIDInt + ".jpg";
                bitmap.Save(saveimagepath, System.Drawing.Imaging.ImageFormat.Bmp);
                TestNum0 = TestNum0 + 1;
if(TestNum0==60)//Stop saving after the number of saved images reaches 60
{<!-- -->
bSaveImg = false;//Variable control single save image
}
               
            }
 
 
            mBufferFilled. QueueBuffer();
        }
    }
        
}

The rendering effect is as follows:

The above test results show that 60 pictures can be saved at full frame rate, and appropriate modification can realize customized requirements.

Advantages of saving images at full frame rate of Baumer industrial cameras

1. Capable of capturing fast-moving objects clearly and precisely, which is very important for industries such as manufacturing and sports.

2. Through high-speed shooting, industrial cameras can capture images of moving parts and products, so that defects and quality problems can be found.

3. This technology is also critical for analyzing the movement of athletes and animals, providing insights for trainers and coaches.

4. The high-speed shooting function allows slow-motion playback, enabling people to further analyze the captured images.

5. Including the ability to capture images of fast-moving objects without motion blur, improve the accuracy of measuring the speed and position of objects, and the ability to detect and analyze rapid processes and changes in real time.

6. These cameras can be useful in a variety of industries, including manufacturing, automation, robotics, and more.

7. High-speed imaging can provide valuable insights into processes and help companies optimize their operations for greater efficiency and productivity.

Industrial application of Baumer industrial cameras saving images at full frame rate

Machine Vision: Industrial cameras that save images at full frame rate can be used in machine vision applications to capture images of fast-moving objects or processes. This can be used in manufacturing, quality control or inspection applications.

Robotics: Industrial cameras that save images at full frame rate can be used in robotics applications to capture images of fast-moving objects or to track the motion of robots. This can be used in manufacturing, assembly or pick and place applications.

Medical Imaging: Industrial cameras that save images at full frame rate can be used in medical imaging applications to capture high-speed images of internal organs or to track the movement of surgical instruments. This can be used for minimally invasive surgery or diagnostic imaging.

Sports Analysis: Industrial cameras that save images at full frame rates can be used in sports analysis applications to capture high-speed images of athletes in motion. This can be used for training or sports broadcast applications.

Aerospace: Industrial cameras that save images at full frame rate are used in aerospace to capture images of high-speed events such as rocket launches or aircraft tests.

In conclusion, the full frame rate image saving function of industrial cameras is ideal for any application that requires high-speed image acquisition, efficient data transfer, and real-time image analysis.