Baumer Industrial Camera How Baumer Industrial Camera achieves high-speed image saving of the camera through NEOAPI SDK (C++)

Insert image description here


Baumer industrial cameras

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

Baumer's 10GbE 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 Camera NEOAPI SDK is the latest software development kit (SDK) for Baumer industrial cameras. It provides developers with a series of APIs and tools for communicating and controlling Baumer industrial cameras. The control method is extremely convenient, similar to Halcon's camera assistant control method.

When using industrial vision software to integrate industrial cameras, it is often necessary to integrate some functions in the industrial camera SDK into the image processing software to facilitate project advancement. Baumer industrial cameras are often used for high-speed synchronous acquisition due to their superior and stable performance and quality. fields that often use various image algorithms to improve the quality of the images they capture.

Note: This article is based on Baumer's NEOAPI SDK and uses C# language to implement camera disconnection reconnection.
NeoAPI can automatically disconnect and reconnect without requiring additional connection operations. The current status can be confirmed through the PnPEvent event.

Technical background of high-speed saving of images from Baumer industrial cameras

The high-speed image preservation of industrial cameras involves the rapid collection, transmission and storage of image data. Its technical background includes the following aspects:

  1. High-speed acquisition: Industrial cameras usually need to have high-speed image acquisition capabilities, which can quickly capture each frame of image and ensure image quality and stability.

  2. Data transmission interface: In order to achieve high-speed storage of images, industrial cameras are usually equipped with high-speed data transmission interfaces, such as GigE Vision, USB 3.0, Camera Link, etc., to ensure that image data can be transmitted to back-end data processing equipment at high speed and stably.

  3. Data processing capabilities: Industrial cameras need to have efficient image data processing capabilities and be able to process and encode raw image data in real time to reduce data traffic and improve transmission efficiency.

  4. Storage media: In order to quickly save image data, industrial cameras need to use high-speed storage media, such as solid-state drives (SSD) or storage devices specifically designed for high-speed data writing.

  5. Data compression technology: In order to reduce the storage space and transmission bandwidth of image data, industrial cameras usually use efficient data compression technology, such as JPEG, H.264, etc., to ensure high-speed storage while reducing storage and transmission costs.

  6. Driver and software support: Industrial cameras need to be equipped with efficient and stable drivers and software support to achieve high-speed saving and subsequent processing of image data.

To sum up, the technical background of high-speed storage of industrial camera images involves many aspects such as high-speed acquisition, data transmission interface, data processing capabilities, storage media, data compression technology, driver and software support, etc. These technical factors jointly ensure the industrial camera’s Stability, reliability and efficiency of high-speed image saving.

Baumer industrial cameras save images at high speed through NEOAPI SDK function

The following is the core C++ code for high-speed image saving in the NEOAPI routine, which has been optimized.

#include <iostream>
#include <thread>
#include "neoapi/neoapi.hpp" 

void CGigeDemoDlg::OnBnClickedMultisaveimages()
{
    
    
	int state = ((CButton *)GetDlgItem(IDC_MULTISAVEIMAGES))->GetCheck();		
	
	if (state == 1)
	{
    
    
		if (camera.IsConnected())
		{
    
    
			camera.f().AcquisitionStop.Execute();					// 相机停止采集			
			ContinueDisplay = false;								// 设置图像显示线程变量为False,让图像显示线程停止运行			
			::WaitForSingleObject(ShowImage_hThread1, INFINITE);	// 等待显示图像线程结束			
			::WaitForSingleObject(ShowFrame_hThread1, INFINITE);	// 等待显示帧率线程结束
			camera.f().TriggerMode = NeoAPI::TriggerMode::Off;		// 初始化相机时将触发模式设为Off
			camera.f().AcquisitionStart.Execute();					// 相机重新开始采集,FrameID将会从0开始计算
			GetDlgItem(IDC_MULTISAVEIMAGES)->EnableWindow(FALSE);	// 将复选框置为不可用状态
			AfxBeginThread(SaveFrame_hThread1, (void*)this);		// 线程高速采集当前图像(做参考)
		
		}
		
		
	}
	
}

Implement threaded high-speed image saving in NEOAPI SDK:

After the camera is connected, images can be saved at high speed through threads. The C++ calling code is as follows:

// 高速保存图像的线程
UINT CGigeDemoDlg::SaveFrame_hThread1(LPVOID pParam)
{
    
    
	CGigeDemoDlg *dlg = (CGigeDemoDlg *)pParam;
	dlg->SaveFrame();
	return 0;
}

// 高速保存图像的线程的实现
void CGigeDemoDlg::SaveFrame()
{
    
    
	try
	{
    
    
		bool m_bRun0 = true;
		while (m_bRun0)
		{
    
    
			if (camera.IsConnected())
			{
    
    
				// 获取设置保存的图像数量
				int SaveImageSetNum = 0;
				GetDlgItem(IDC_EDTSAENUM)->GetWindowText(m_SaveNums);
				SaveImageSetNum = _ttoi(m_SaveNums);
				int SaveError = 0;
				// 循环采集和保存对应图像
				for (int count = 0; count < SaveImageSetNum; ++count)
				{
    
    
					NeoAPI::Image image = camera.GetImage();
					if (!m_strDirectory.IsEmpty())
					{
    
    
						// 设置保存的图像的名称:电脑时间戳+图像FrameID
						CTime time = CTime::GetCurrentTime();
						CString strtime;
						strtime.Format(_T("\\%4d%2d%2d%2d%2d%2d"), time.GetYear(), time.GetMonth(), time.GetDay(), time.GetHour(), time.GetMinute(), time.GetSecond());
						CString  strpath = m_strDirectory + strtime + "-";
						CString  strpath2;
						strpath2.Format(_T("%s%d"), strpath, image.GetImageID());
						// 转换图像名称为NeoAPI::NeoString格式,然后保存对应路径
						USES_CONVERSION;
						std::string strpath2str(W2A(strpath2));
						const char* strpath2str2 = strpath2str.c_str();
						NeoAPI::NeoString strpath3 = strpath2str2;
						image.Save(strpath3);

					}
					else
					{
    
    
						AfxMessageBox(_T("可保存路径为空!"));
						SaveError = SaveError + 1;
						break;
					}

				}
				// 将复选框置恢复为可用状态
				GetDlgItem(IDC_MULTISAVEIMAGES)->EnableWindow(TRUE);
				m_bRun0 = false;
				if(SaveError == 0)
					AfxMessageBox(_T("高速保存已完成!"));
				if (SaveImageSetNum == 0)
					AfxMessageBox(_T("设置图像保存数量为0!"));
				
			}
			else
			{
    
    
				AfxMessageBox(_T("相机未正常连接!"));
				m_bRun0 = false;
				// 将复选框置恢复为可用状态
				GetDlgItem(IDC_MULTISAVEIMAGES)->EnableWindow(TRUE);
			}


		}

	}
	catch (int e)
	{
    
    
		MessageBox(_T("Camera SetShowimage Error"));

	}
}


Industrial camera high-speed image saving test demonstration diagram

The test of using NEOAPI to achieve high-speed image saving of industrial cameras is as follows:
Insert image description here

Insert image description here

Baumer industrial cameras realize the advantages of camera high-speed image saving through NEOAPI SDK

Using the NEOAPI SDK to achieve high-speed image saving for cameras has many advantages, including but not limited to:

  1. High-performance optimization: NEOAPI SDK has undergone targeted high-performance optimization to achieve high-speed image acquisition and saving operations. This means you can quickly capture and save image data, enabling efficient production processes and real-time data processing needs.

  2. Rich features and tools: NEOAPI SDK provides rich features and tools, allowing users to take full advantage of the high-speed image saving capabilities of industrial cameras. This includes flexible setup and control options to meet the needs of a variety of application scenarios.

  3. Stable image quality: NEOAPI SDK can ensure the stability and quality of image saving, whether during high-speed acquisition or high-speed saving. This is critical for applications that require high-precision image data.

  4. Strong compatibility: NEOAPI SDK is compatible with a variety of operating systems and development environments, including operating systems such as Windows and Linux, and development environments such as C++ and C#. This means you can flexibly deploy and integrate your camera's high-speed image saving capabilities on a variety of platforms.

  5. Real-time image processing support: NEOAPI SDK provides rich image processing and analysis functions, which can help users perform real-time data processing and analysis after high-speed image saving, thereby meeting the needs of real-time monitoring and control.

In summary, high-speed camera image saving through the NEOAPI SDK can obtain many advantages such as high-performance optimization, rich functions and tools, stable image quality, strong compatibility, and real-time image processing support, providing high-speed image saving for industrial cameras. Strong technical support and solutions.

Baumer industrial cameras implement industrial applications of camera high-speed image saving through NEOAPI SDK

Industrial cameras realize camera high-speed image saving through NEOAPI SDK and have a wide range of applications in many industries, including but not limited to the following fields:

  1. Manufacturing industry: In the manufacturing industry, industrial cameras realize camera high-speed image saving through NEOAPI SDK, which can be used for product quality control, production process monitoring and defect detection. With high-speed image saving, manufacturers can quickly capture and analyze product image data to ensure product quality and production efficiency.

  2. Medical field: Industrial cameras realize high-speed camera image storage through NEOAPI SDK and can be applied to medical imaging equipment, medical image analysis and other fields. The medical industry has a very high demand for real-time high-quality image data. Fast and accurate collection and storage of medical imaging data can be achieved through high-speed image saving technology.

  3. Intelligent transportation: In the field of intelligent transportation, industrial cameras realize high-speed image saving of cameras through NEOAPI SDK, which can be used for applications such as traffic monitoring, vehicle identification, and intelligent parking. Quickly saving image data helps monitor road traffic conditions in real time, identify vehicle information, and improve the efficiency of intelligent traffic management.

  4. Agriculture: In the agricultural field, high-speed image preservation technology can be applied to crop growth monitoring, agricultural product quality inspection and other scenarios to help farmers quickly collect and save large amounts of agricultural image data, thereby realizing intelligent agricultural production and management.

  5. Scientific research: In the field of scientific research, industrial cameras realize high-speed camera image storage through NEOAPI SDK and can be used in laboratory experiments, astronomical observations, biological image collection and other fields. High-speed preservation of image data helps scientific researchers quickly record and analyze experimental data and promote the progress of scientific research.

In summary, the high-speed image storage of industrial cameras through the NEOAPI SDK has important application value in many industries such as manufacturing, medical care, intelligent transportation, agriculture, and scientific research, providing efficient and accurate images for these industries. Data collection and storage solutions.

Guess you like

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