项目场景
Baumer工业相机堡盟相机是一种高性能、高质量的工业相机,可用于各种应用场景,如物体检测、计数和识别、运动分析和图像处理。
Baumer的万兆网相机拥有出色的图像处理性能,可以实时传输高分辨率图像。此外,该相机还具有快速数据传输、低功耗、易于集成以及高度可扩展性等特点。
Baumer工业相机堡盟相机中ROI功能是一种可以直接设置在图像芯片中进行区域设置感兴趣的区域的功能,然后在相机内部对图像进行部分扫描的剪切然后再传输到处理器中,可以在一定程度上提供工业相机的的采集帧率。
技术背景
Baumer工业相机中的ROI(感兴趣区域)功能允许用户选择图像中他们想重点分析或处理的特定部分。这可以提高图像处理系统的效率,因为它可以排除多余的或不必要的数据。
ROI功能的工作原理是在较大的图像框架内选择一个矩形区域。然后相机只对这个较小的区域应用所有后续的图像处理算法。这可以提高图像分析的速度和准确性,因为它减少了需要处理的数据量。
总的来说,工业相机的ROI功能可以减少处理时间,提高图像分析的准确性,使其成为各种工业应用中的有用工具。
代码分析
Baumer工业相机堡盟相机SDK示例中004_PartialScan_ExternalBuffer.cpp详细介绍了如何配置相机ROI功能。
软件SDK示例地址如下所示:Baumer_GAPI_SDK_2.12.0_win_x86_64_cpp\examples\src\0_Common\004_PartialScan_ExternalBuffer\004_PartialScan_ExternalBuffer.cpp
std::cout << "DEVICE PARAMETER SETUP" << std::endl; std::cout << "######################" << std::endl << std::endl; try { // SET TRIGGER MODE OFF (FreeRun) pDevice->GetRemoteNode("TriggerMode")->SetString("Off"); std::cout << " TriggerMode: " << pDevice->GetRemoteNode("TriggerMode")->GetValue() << std::endl; std::cout << std::endl; // SET A PARTIAL SCAN (ROI...REGION OF INTEREST) IN THE RIGHT BOTTOM AREA OF THE IMAGE // ==================================================================================== std::cout << " Set ROI parameters to the right bottom quarter of the sensor" << std::endl << std::endl; // IMAGE WIDTH // =========== std::cout << " Width" << std::endl; std::cout << " description: " << pDevice->GetRemoteNode("Width")->GetDescription() << std::endl; std::cout << " interface type: " << pDevice->GetRemoteNode("Width")->GetInterface() << std::endl; bo_int64 iImageWidth = 0; bo_int64 iImageWidthMin = 0; bo_int64 iImageWidthMax = 0; bo_int64 iImageWidthInc = 0; // get current value and limits iImageWidth = pDevice->GetRemoteNode("Width")->GetInt(); iImageWidthMin = pDevice->GetRemoteNode("Width")->GetIntMin(); iImageWidthMax = pDevice->GetRemoteNode("Width")->GetIntMax(); iImageWidthInc = pDevice->GetRemoteNode("Width")->GetIntInc(); std::cout << " current value: " << iImageWidth << std::endl; std::cout << " possible value range: " << iImageWidthMin << " to " << iImageWidthMax << " with increment of " << iImageWidthInc << std::endl; // set new width value same to the half value of sensor width // find number to match the increment bo_int64 widthvalue = pDevice->GetRemoteNode("SensorWidth")->GetInt() / 2 / iImageWidthInc * iImageWidthInc; // check new value is within range if (widthvalue < iImageWidthMin) widthvalue = iImageWidthMin; if (widthvalue > iImageWidthMax) widthvalue = iImageWidthMax; pDevice->GetRemoteNode("Width")->SetInt(widthvalue); // recheck new width is set std::cout << " set value to: " << pDevice->GetRemoteNode("Width")->GetInt() << " is half value of the sensor width: " << pDevice->GetRemoteNode("SensorWidth")->GetInt() << std::endl << std::endl; // IMAGE OFFSET X // ============== std::cout << " OffsetX" << std::endl; std::cout << " description: " << pDevice->GetRemoteNode("OffsetX")->GetDescription() << std::endl; std::cout << " interface type: " << pDevice->GetRemoteNode("OffsetX")->GetInterface() << std::endl; bo_int64 iImageOffsetX = 0; bo_int64 iImageOffsetXMin = 0; bo_int64 iImageOffsetXMax = 0; bo_int64 iImageOffsetXInc = 0; // get current value and limits iImageOffsetX = pDevice->GetRemoteNode("OffsetX")->GetInt(); iImageOffsetXMin = pDevice->GetRemoteNode("OffsetX")->GetIntMin(); iImageOffsetXMax = pDevice->GetRemoteNode("OffsetX")->GetIntMax(); iImageOffsetXInc = pDevice->GetRemoteNode("OffsetX")->GetIntInc(); std::cout << " current value: " << iImageOffsetX << std::endl; std::cout << " possible value range: " << iImageOffsetXMin << " to " << iImageOffsetXMax << " with increment of " << iImageOffsetXInc << std::endl; // set new OffsetX value to the half value of the sensor width // find number to match the increment bo_int64 offsetX = pDevice->GetRemoteNode("SensorWidth")->GetInt() / 2 / iImageOffsetXInc * iImageOffsetXInc; // check new value is within range if (offsetX < iImageOffsetXMin) offsetX = iImageOffsetXMin; if (offsetX > iImageOffsetXMax) offsetX = iImageOffsetXMax; pDevice->GetRemoteNode("OffsetX")->SetInt(offsetX); // recheck new OffsetX is set std::cout << " set value to: " << pDevice->GetRemoteNode("OffsetX")->GetInt() << " is half value of the sensor width: " << pDevice->GetRemoteNode("SensorWidth")->GetInt() << std::endl << std::endl; // IMAGE HEIGHT // ============= std::cout << " Height" << std::endl; std::cout << " description: " << pDevice->GetRemoteNode("Height")->GetDescription() << std::endl; std::cout << " interface type: " << pDevice->GetRemoteNode("Height")->GetInterface() << std::endl; bo_int64 iImageHeight = 0; bo_int64 iImageHeightMin = 0; bo_int64 iImageHeightMax = 0; bo_int64 iImageHeightInc = 0; // get current value and limits iImageHeight = pDevice->GetRemoteNode("Height")->GetInt(); iImageHeightMin = pDevice->GetRemoteNode("Height")->GetIntMin(); iImageHeightMax = pDevice->GetRemoteNode("Height")->GetIntMax(); iImageHeightInc = pDevice->GetRemoteNode("Height")->GetIntInc(); std::cout << " current value: " << iImageHeight << std::endl; std::cout << " possible value range: " << iImageHeightMin << " to " << iImageHeightMax << " with increment of " << iImageHeightInc << std::endl; // set new height value same to the half value of sensor height // find number to match the increment bo_int64 heightval = pDevice->GetRemoteNode("SensorHeight")->GetInt() / 2 / iImageHeightInc * iImageHeightInc; // check new value is within range if (heightval < iImageHeightMin) heightval = iImageHeightMin; if (heightval > iImageHeightMax) heightval = iImageHeightMax; pDevice->GetRemoteNode("Height")->SetInt(heightval); // recheck new height is set std::cout << " set value to: " << pDevice->GetRemoteNode("Height")->GetInt() << " is half value of the sensor height: " << pDevice->GetRemoteNode("SensorHeight")->GetInt() << std::endl << std::endl; // IMAGE OFFSET Y // =============== std::cout << " OffsetY" << std::endl; std::cout << " description: " << pDevice->GetRemoteNode("OffsetY")->GetDescription() << std::endl; std::cout << " interface type: " << pDevice->GetRemoteNode("OffsetY")->GetInterface() << std::endl; bo_int64 iImageOffY = 0; bo_int64 iImageOffYMin = 0; bo_int64 iImageOffYMax = 0; bo_int64 iImageOffYInc = 0; // get current value and limits iImageOffY = pDevice->GetRemoteNode("OffsetY")->GetInt(); iImageOffYMin = pDevice->GetRemoteNode("OffsetY")->GetIntMin(); iImageOffYMax = pDevice->GetRemoteNode("OffsetY")->GetIntMax(); iImageOffYInc = pDevice->GetRemoteNode("OffsetY")->GetIntInc(); std::cout << " current value: " << iImageOffY << std::endl; std::cout << " possible value range: " << iImageOffYMin << " to " << iImageOffYMax << " with increment of " << iImageOffYInc << std::endl; // set new OffsetY value to the half value of the sensor height // find number to match the increment bo_int64 OffsetYvalue = pDevice->GetRemoteNode("SensorHeight")->GetInt() / 2 / iImageOffYInc * iImageOffYInc; // check new value is within range if (OffsetYvalue < iImageOffYMin) OffsetYvalue = iImageOffYMin; if (OffsetYvalue > iImageOffYMax) OffsetYvalue = iImageOffYMax; pDevice->GetRemoteNode("OffsetY")->SetInt(OffsetYvalue); // recheck new OffsetY is set std::cout << " set value to: " << pDevice->GetRemoteNode("OffsetY")->GetInt() << " is half value of the sensor height: " << pDevice->GetRemoteNode("SensorHeight")->GetInt() << std::endl << std::endl; } catch (BGAPI2::Exceptions::IException& ex) { std::cout << "ExceptionType: " << ex.GetType() << std::endl; std::cout << "ErrorDescription: " << ex.GetErrorDescription() << std::endl; std::cout << "in function: " << ex.GetFunctionName() << std::endl; }
工业相机ROI图像功能的优势
工业相机的ROI(感兴趣区域)功能具有显著的优势,包括。
1. 提高精度:通过突出图像中的特定感兴趣区域,ROI功能可以使测量和分析更加精确和准确。
2. 减少了处理时间。通过将处理能力集中在图像的特定区域,ROI功能减少了需要处理的数据量,从而使分析和处理时间更快。
3. 提高图像质量。ROI功能可用于裁剪掉图像中不需要的区域,从而获得更高的分辨率和更好的图像质量。
4. 增加灵活性。ROI功能允许用户实时定制感兴趣的区域,能够更有效地监测和分析感兴趣的特定区域。
5. 提高动态范围。ROI功能还可用于提高图像的动态范围,因为它使用户能够调整图像内特定区域的曝光设置。
总的来说,工业相机的ROI功能可以在广泛的工业应用中显著提高成像和分析的准确性、速度和效率。
工业相机ROI功能的行业应用
工业相机的ROI(感兴趣区域)功能可以有各种场景应用。下面是几个例子。
1. 质量控制和检查。ROI功能可用于聚焦于产品或样品中的某一感兴趣的区域,并捕获高质量的图像进行分析。
2. 机器视觉。在自动化制造过程中,ROI功能可以帮助识别生产线上的特定零件或部件,以便进行检查和分析。
3. 监视和安全。投资回报率功能可用于放大监控视频画面中的特定区域,确保高清晰度地捕捉到任何可疑的活动。
4. 科学研究。在生物技术或材料科学等领域,ROI功能可以帮助研究人员捕捉样品、细胞或材料的详细图像进行分析。
总的来说,ROI功能使工业相机能够捕捉和ROI的特定区域,使其成为各行业的宝贵工具。