Baumer工业相机堡盟相机如何使用Sharpening图像锐化功能( Sharpening图像锐化功能的优点和行业应用)(C++)

简介: Baumer工业相机堡盟相机如何使用Sharpening图像锐化功能( Sharpening图像锐化功能的优点和行业应用)(C++)

项目场景

Baumer工业相机堡盟相机是一种高性能、高质量的工业相机,可用于各种应用场景,如物体检测、计数和识别、运动分析和图像处理。  


Baumer的万兆网相机拥有出色的图像处理性能,可以实时传输高分辨率图像。此外,该相机还具有快速数据传输、低功耗、易于集成以及高度可扩展性等特点。


Baumer工业相机堡盟相机中PixelTransformation功能由BGAPI SDK提供的ImageProcesser函数进行转换的,以方便各种场合所需要的不同格式图像。


技术背景

Baumer工业相机的图像锐化功能是一种数字信号处理技术,用于提高相机拍摄的图像的清晰度和锐度。


它涉及一系列的算法,分析图像并应用过滤器来增强细节和边缘。


锐化功能可以调整到不同的强度水平,使用户能够根据他们的具体需要定制输出。


这一功能对需要高精度和准确度的应用特别有用,如机器视觉检测或医疗成像。


总的来说,图像锐化功能是一个重要的工具,可以提高工业相机拍摄的图像质量,产生清晰、明确和准确的视觉输出。


代码分析

Baumer工业相机堡盟相机SDK示例中014_Sharpening.cpp详细介绍了如何配置在相机内部配置图像锐化功能。


软件SDK示例地址如下所示:Baumer_GAPI_SDK_2.12.0_win_x86_64_cpp\examples\src\0_Common\014_Sharpening\014_Sharpening.cpp

111.png

/* Copyright 2019-2020 Baumer Optronic */
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <set>
#include <vector>
#include <algorithm>
#include <string>
#include "bgapi2_genicam/bgapi2_genicam.hpp"
int Test() {
    // DECLARATIONS OF VARIABLES
    BGAPI2::SystemList *systemList = NULL;
    BGAPI2::System * pSystem = NULL;
    BGAPI2::String sSystemID;
    BGAPI2::InterfaceList *interfaceList = NULL;
    BGAPI2::Interface * pInterface = NULL;
    BGAPI2::String sInterfaceID;
    BGAPI2::DeviceList *deviceList = NULL;
    BGAPI2::Device * pDevice = NULL;
    BGAPI2::String sDeviceID;
    BGAPI2::DataStreamList *datastreamList = NULL;
    BGAPI2::DataStream * pDataStream = NULL;
    BGAPI2::String sDataStreamID;
    BGAPI2::BufferList *bufferList = NULL;
    BGAPI2::Buffer * pBuffer = NULL;
    int returncode = 0;
    std::cout << std::endl;
    std::cout << "######################" << std::endl;
    std::cout << "# 014_Sharpening.cpp #" << std::endl;
    std::cout << "######################" << std::endl;
    std::cout << std::endl << std::endl;
    std::cout << "SYSTEM LIST" << std::endl;
    std::cout << "###########" << std::endl << std::endl;
    // COUNTING AVAILABLE SYSTEMS (TL producers)
    try {
        systemList = BGAPI2::SystemList::GetInstance();
        systemList->Refresh();
        std::cout << "5.1.2   Detected systems:  " << systemList->size() << std::endl;
        // SYSTEM DEVICE INFORMATION
        for (BGAPI2::SystemList::iterator sysIterator = systemList->begin();
            sysIterator != systemList->end();
            sysIterator++) {
            std::cout << "  5.2.1   System Name:     " << sysIterator->GetFileName() << std::endl;
            std::cout << "          System Type:     " << sysIterator->GetTLType() << std::endl;
            std::cout << "          System Version:  " << sysIterator->GetVersion() << std::endl;
            std::cout << "          System PathName: " << sysIterator->GetPathName() << std::endl << std::endl;
        }
    }
    catch (BGAPI2::Exceptions::IException& ex) {
        returncode = (returncode == 0) ? 1 : returncode;
        std::cout << "ExceptionType:    " << ex.GetType() << std::endl;
        std::cout << "ErrorDescription: " << ex.GetErrorDescription() << std::endl;
        std::cout << "in function:      " << ex.GetFunctionName() << std::endl;
        return returncode;
    }
    try {
        for (BGAPI2::SystemList::iterator sysIterator = systemList->begin();
            sysIterator != systemList->end();
            sysIterator++) {
            std::cout << "SYSTEM" << std::endl;
            std::cout << "######" << std::endl << std::endl;
            try {
                sysIterator->Open();
                std::cout << "5.1.3   Open next system " << std::endl;
                std::cout << "  5.2.1   System Name:     " << sysIterator->GetFileName() << std::endl;
                std::cout << "          System Type:     " << sysIterator->GetTLType() << std::endl;
                std::cout << "          System Version:  " << sysIterator->GetVersion() << std::endl;
                std::cout << "          System PathName: " << sysIterator->GetPathName() << std::endl
                    << std::endl;
                sSystemID = sysIterator->GetID();
                std::cout << "        Opened system - NodeList Information " << std::endl;
                std::cout << "          GenTL Version:   "
                    << sysIterator->GetNode("GenTLVersionMajor")->GetValue() << "."
                    << sysIterator->GetNode("GenTLVersionMinor")->GetValue() << std::endl << std::endl;
                std::cout << "INTERFACE LIST" << std::endl;
                std::cout << "##############" << std::endl << std::endl;
                try {
                    interfaceList = sysIterator->GetInterfaces();
                    // COUNT AVAILABLE INTERFACES
                    interfaceList->Refresh(100);  // timeout of 100 msec
                    std::cout << "5.1.4   Detected interfaces: " << interfaceList->size() << std::endl;
                    // INTERFACE INFORMATION
                    for (BGAPI2::InterfaceList::iterator ifIterator = interfaceList->begin();
                        ifIterator != interfaceList->end();
                        ifIterator++) {
                        std::cout << "  5.2.2   Interface ID:      "
                            << ifIterator->GetID() << std::endl;
                        std::cout << "          Interface Type:    "
                            << ifIterator->GetTLType() << std::endl;
                        std::cout << "          Interface Name:    "
                            << ifIterator->GetDisplayName() << std::endl << std::endl;
                    }
                }
                catch (BGAPI2::Exceptions::IException& ex) {
                    returncode = (returncode == 0) ? 1 : returncode;
                    std::cout << "ExceptionType:    " << ex.GetType() << std::endl;
                    std::cout << "ErrorDescription: " << ex.GetErrorDescription() << std::endl;
                    std::cout << "in function:      " << ex.GetFunctionName() << std::endl;
                }
                std::cout << "INTERFACE" << std::endl;
                std::cout << "#########" << std::endl << std::endl;
                // OPEN THE NEXT INTERFACE IN THE LIST
                try {
                    for (BGAPI2::InterfaceList::iterator ifIterator = interfaceList->begin();
                        ifIterator != interfaceList->end();
                        ifIterator++) {
                        try {
                            std::cout << "5.1.5   Open interface " << std::endl;
                            std::cout << "  5.2.2   Interface ID:      "
                                << ifIterator->GetID() << std::endl;
                            std::cout << "          Interface Type:    "
                                << ifIterator->GetTLType() << std::endl;
                            std::cout << "          Interface Name:    "
                                << ifIterator->GetDisplayName() << std::endl;
                            ifIterator->Open();
                            // search for any camera is connetced to this interface
                            deviceList = ifIterator->GetDevices();
                            deviceList->Refresh(100);
                            if (deviceList->size() == 0) {
                                std::cout << "5.1.13   Close interface (" << deviceList->size() << " cameras found) "
                                    << std::endl << std::endl;
                                ifIterator->Close();
                            } else {
                                sInterfaceID = ifIterator->GetID();
                                std::cout << "   " << std::endl;
                                std::cout << "        Opened interface - NodeList Information" << std::endl;
                                if (ifIterator->GetTLType() == "GEV") {
                                    std::cout << "          GevInterfaceSubnetIPAddress: "
                                        << ifIterator->GetNode("GevInterfaceSubnetIPAddress")->GetValue()
                                        << std::endl;
                                    std::cout << "          GevInterfaceSubnetMask:      "
                                        << ifIterator->GetNode("GevInterfaceSubnetMask")->GetValue()
                                        << std::endl;
                                }
                                if (ifIterator->GetTLType() == "U3V") {
                                    // std::cout << "          NodeListCount:     "
                                    // << ifIterator->GetNodeList()->GetNodeCount() << std::endl;
                                }
                                std::cout << "  " << std::endl;
                                break;
                            }
                        }
                        catch (BGAPI2::Exceptions::ResourceInUseException& ex) {
                            returncode = (returncode == 0) ? 1 : returncode;
                            std::cout << " Interface " << ifIterator->GetID() << " already opened " << std::endl;
                            std::cout << " ResourceInUseException: " << ex.GetErrorDescription() << std::endl;
                        }
                    }
                }
                catch (BGAPI2::Exceptions::IException& ex) {
                    // returncode = (returncode == 0) ? 1 : returncode;
                    std::cout << "ExceptionType:    " << ex.GetType() << std::endl;
                    std::cout << "ErrorDescription: " << ex.GetErrorDescription() << std::endl;
                    std::cout << "in function:      " << ex.GetFunctionName() << std::endl;
                }
                // if a camera is connected to the system interface then leave the system loop
                if (sInterfaceID != "") {
                    break;
                }
            }
            catch (BGAPI2::Exceptions::ResourceInUseException& ex) {
                returncode = (returncode == 0) ? 1 : returncode;
                std::cout << " System " << sysIterator->GetID() << " already opened " << std::endl;
                std::cout << " ResourceInUseException: " << ex.GetErrorDescription() << std::endl;
            }
        }
    }
    catch (BGAPI2::Exceptions::IException& ex) {
        returncode = (returncode == 0) ? 1 : returncode;
        std::cout << "ExceptionType:    " << ex.GetType() << std::endl;
        std::cout << "ErrorDescription: " << ex.GetErrorDescription() << std::endl;
        std::cout << "in function:      " << ex.GetFunctionName() << std::endl;
    }
    if (sSystemID == "") {
        std::cout << " No System found " << std::endl;
        std::cout << std::endl << "End" << std::endl << "Input any number to close the program:";
        int endKey = 0;
        std::cin >> endKey;
        BGAPI2::SystemList::ReleaseInstance();
        return returncode;
    } else {
        pSystem = (*systemList)[sSystemID];
    }
    if (sInterfaceID == "") {
        std::cout << " No interface found " << std::endl;
        std::cout << std::endl << "End" << std::endl;
        pSystem->Close();
        BGAPI2::SystemList::ReleaseInstance();
        return returncode;
    } else {
        pInterface = (*interfaceList)[sInterfaceID];
    }
    std::cout << "DEVICE LIST" << std::endl;
    std::cout << "###########" << std::endl << std::endl;
    try {
        // COUNTING AVAILABLE CAMERAS
        deviceList = pInterface->GetDevices();
        deviceList->Refresh(100);
        std::cout << "5.1.6   Detected devices:         " << deviceList->size() << std::endl;
        // DEVICE INFORMATION BEFORE OPENING
        for (BGAPI2::DeviceList::iterator devIterator = deviceList->begin();
            devIterator != deviceList->end();
            devIterator++) {
            BGAPI2::Device* const pCurrentDevice = *devIterator;
            std::cout << "  5.2.3   Device DeviceID:        "
                << devIterator->GetID() << std::endl;
            std::cout << "          Device Model:           "
                << pCurrentDevice->GetModel() << std::endl;
            std::cout << "          Device SerialNumber:    "
                << pCurrentDevice->GetSerialNumber() << std::endl;
            std::cout << "          Device Vendor:          "
                << pCurrentDevice->GetVendor() << std::endl;
            std::cout << "          Device TLType:          "
                << pCurrentDevice->GetTLType() << std::endl;
            std::cout << "          Device AccessStatus:    "
                << pCurrentDevice->GetAccessStatus() << std::endl;
            std::cout << "          Device UserID:          "
                << pCurrentDevice->GetDisplayName() << 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;
    }
    std::cout << "DEVICE" << std::endl;
    std::cout << "######" << std::endl << std::endl;
    // OPEN THE FIRST CAMERA IN THE LIST
    try {
        for (BGAPI2::DeviceList::iterator devIterator = deviceList->begin();
            devIterator != deviceList->end();
            devIterator++) {
            BGAPI2::Device* const pCurrentDevice = *devIterator;
            try {
                std::cout << "5.1.7   Open first device " << std::endl;
                std::cout << "          Device DeviceID:        "
                    << devIterator->GetID() << std::endl;
                std::cout << "          Device Model:           "
                    << pCurrentDevice->GetModel() << std::endl;
                std::cout << "          Device SerialNumber:    "
                    << pCurrentDevice->GetSerialNumber() << std::endl;
                std::cout << "          Device Vendor:          "
                    << pCurrentDevice->GetVendor() << std::endl;
                std::cout << "          Device TLType:          "
                    << pCurrentDevice->GetTLType() << std::endl;
                std::cout << "          Device AccessStatus:    "
                    << pCurrentDevice->GetAccessStatus() << std::endl;
                std::cout << "          Device UserID:          "
                    << pCurrentDevice->GetDisplayName() << std::endl << std::endl;
                pCurrentDevice->Open();
                BGAPI2::NodeMap* const pDeviceRemoteNodeList = pCurrentDevice->GetRemoteNodeList();
                sDeviceID = devIterator->GetID();
                std::cout << "        Opened device - RemoteNodeList Information " << std::endl;
                std::cout << "          Device AccessStatus:    " << pCurrentDevice->GetAccessStatus() << std::endl;
                // SERIAL NUMBER
                if (pDeviceRemoteNodeList->GetNodePresent(SFNC_DEVICE_SERIALNUMBER)) {
                    std::cout << "          DeviceSerialNumber:     "
                        << pCurrentDevice->GetRemoteNode(SFNC_DEVICE_SERIALNUMBER)->GetValue() << std::endl;
                } else if (pDeviceRemoteNodeList->GetNodePresent(SFNC_DEVICE_ID)) {
                    std::cout << "          DeviceID (SN):          "
                        << pCurrentDevice->GetRemoteNode(SFNC_DEVICE_ID)->GetValue() << std::endl;
                } else {
                    std::cout << "          SerialNumber:           Not Available " << std::endl;
                }
                // DISPLAY DEVICEMANUFACTURERINFO
                if (pDeviceRemoteNodeList->GetNodePresent(SFNC_DEVICE_MANUFACTURERINFO)) {
                    std::cout << "          DeviceManufacturerInfo: "
                        << pCurrentDevice->GetRemoteNode(SFNC_DEVICE_MANUFACTURERINFO)->GetValue() << std::endl;
                }
                // DISPLAY DEVICEFIRMWAREVERSION OR DEVICEVERSION
                if (pDeviceRemoteNodeList->GetNodePresent(SFNC_DEVICE_FIRMWAREVERSION)) {
                    std::cout << "          DeviceFirmwareVersion:  "
                        << pCurrentDevice->GetRemoteNode(SFNC_DEVICE_FIRMWAREVERSION)->GetValue() << std::endl;
                } else if (pDeviceRemoteNodeList->GetNodePresent(SFNC_DEVICE_VERSION)) {
                    std::cout << "          DeviceVersion:          "
                        << pCurrentDevice->GetRemoteNode(SFNC_DEVICE_VERSION)->GetValue() << std::endl;
                } else {
                    std::cout << "          DeviceVersion:          Not Available " << std::endl;
                }
                if (pCurrentDevice->GetTLType() == "GEV") {
                    const bo_int64 iGevCurrentIpAddress =
                        pCurrentDevice->GetRemoteNode(SFNC_GEV_CURRENTIPADDRESS)->GetInt();
                    const bo_int64 iGevCurrentSubnetMask =
                        pCurrentDevice->GetRemoteNode(SFNC_GEV_CURRENTSUBNETMASK)->GetInt();
                    std::cout << "          GevCCP:                 "
                        << pCurrentDevice->GetRemoteNode(SFNC_GEV_CCP)->GetValue() << std::endl;
                    std::cout << "          GevCurrentIPAddress:    "
                        << ((iGevCurrentIpAddress & 0xff000000) >> 24) << "."
                        << ((iGevCurrentIpAddress & 0x00ff0000) >> 16) << "."
                        << ((iGevCurrentIpAddress & 0x0000ff00) >> 8) << "."
                        << (iGevCurrentIpAddress & 0x0000ff) << std::endl;
                    std::cout << "          GevCurrentSubnetMask:   "
                        << ((iGevCurrentSubnetMask & 0xff000000) >> 24) << "."
                        << ((iGevCurrentSubnetMask & 0x00ff0000) >> 16) << "."
                        << ((iGevCurrentSubnetMask & 0x0000ff00) >> 8) << "."
                        << (iGevCurrentSubnetMask & 0x0000ff) << std::endl;
                }
                std::cout << "  " << std::endl;
                break;
            }
            catch (BGAPI2::Exceptions::ResourceInUseException& ex) {
                returncode = (returncode == 0) ? 1 : returncode;
                std::cout << " Device  " << devIterator->GetID() << " already opened " << std::endl;
                std::cout << " ResourceInUseException: " << ex.GetErrorDescription() << std::endl;
            }
            catch (BGAPI2::Exceptions::AccessDeniedException& ex) {
                returncode = (returncode == 0) ? 1 : returncode;
                std::cout << " Device  " << devIterator->GetID() << " already opened " << std::endl;
                std::cout << " AccessDeniedException " << ex.GetErrorDescription() << std::endl;
            }
        }
    }
    catch (BGAPI2::Exceptions::IException& ex) {
        returncode = (returncode == 0) ? 1 : returncode;
        std::cout << "ExceptionType:    " << ex.GetType() << std::endl;
        std::cout << "ErrorDescription: " << ex.GetErrorDescription() << std::endl;
        std::cout << "in function:      " << ex.GetFunctionName() << std::endl;
    }
    if (sDeviceID == "") {
        std::cout << " No Device found " << std::endl;
        std::cout << std::endl << "End" << std::endl;
        pInterface->Close();
        pSystem->Close();
        BGAPI2::SystemList::ReleaseInstance();
        return returncode;
    } else {
        pDevice = (*deviceList)[sDeviceID];
    }
    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;
    }
    catch (BGAPI2::Exceptions::IException& ex) {
        returncode = (returncode == 0) ? 1 : returncode;
        std::cout << "ExceptionType:    " << ex.GetType() << std::endl;
        std::cout << "ErrorDescription: " << ex.GetErrorDescription() << std::endl;
        std::cout << "in function:      " << ex.GetFunctionName() << std::endl;
    }
    std::cout << "DATA STREAM LIST" << std::endl;
    std::cout << "################" << std::endl << std::endl;
    try {
        // COUNTING AVAILABLE DATASTREAMS
        datastreamList = pDevice->GetDataStreams();
        datastreamList->Refresh();
        std::cout << "5.1.8   Detected datastreams:     " << datastreamList->size() << std::endl;
        // DATASTREAM INFORMATION BEFORE OPENING
        for (BGAPI2::DataStreamList::iterator dstIterator = datastreamList->begin();
            dstIterator != datastreamList->end();
            dstIterator++) {
            std::cout << "  5.2.4   DataStream ID:          " << dstIterator->GetID() << std::endl << std::endl;
        }
    }
    catch (BGAPI2::Exceptions::IException& ex) {
        returncode = (returncode == 0) ? 1 : returncode;
        std::cout << "ExceptionType:    " << ex.GetType() << std::endl;
        std::cout << "ErrorDescription: " << ex.GetErrorDescription() << std::endl;
        std::cout << "in function:      " << ex.GetFunctionName() << std::endl;
    }
    std::cout << "DATA STREAM" << std::endl;
    std::cout << "###########" << std::endl << std::endl;
    // OPEN THE FIRST DATASTREAM IN THE LIST
    try {
        if (datastreamList->size() > 0) {
            pDataStream = (*datastreamList)[0];
            std::cout << "5.1.9   Open first datastream " << std::endl;
            std::cout << "          DataStream ID:          " << pDataStream->GetID() << std::endl << std::endl;
            pDataStream->Open();
            sDataStreamID = pDataStream->GetID();
            std::cout << "        Opened datastream - NodeList Information " << std::endl;
            std::cout << "          StreamAnnounceBufferMinimum:  "
                << pDataStream->GetNode("StreamAnnounceBufferMinimum")->GetValue() << std::endl;
            if (pDataStream->GetTLType() == "GEV") {
                std::cout << "          StreamDriverModel:            "
                    << pDataStream->GetNode("StreamDriverModel")->GetValue() << std::endl;
            }
            std::cout << "  " << std::endl;
        }
    }
    catch (BGAPI2::Exceptions::IException& ex) {
        returncode = (returncode == 0) ? 1 : returncode;
        std::cout << "ExceptionType:    " << ex.GetType() << std::endl;
        std::cout << "ErrorDescription: " << ex.GetErrorDescription() << std::endl;
        std::cout << "in function:      " << ex.GetFunctionName() << std::endl;
    }
    if (sDataStreamID == "") {
        std::cout << " No DataStream found" << std::endl;
        pDevice->Close();
        pInterface->Close();
        pSystem->Close();
        BGAPI2::SystemList::ReleaseInstance();
        return returncode;
    }
    std::cout << "BUFFER LIST" << std::endl;
    std::cout << "###########" << std::endl << std::endl;
    try {
        // BufferList
        bufferList = pDataStream->GetBufferList();
        // 4 buffers using internal buffer mode
        for (int i = 0; i < 4; i++) {
            pBuffer = new BGAPI2::Buffer();
            bufferList->Add(pBuffer);
        }
        std::cout << "5.1.10   Announced buffers:       " << bufferList->GetAnnouncedCount() << " using "
            << pBuffer->GetMemSize() * bufferList->GetAnnouncedCount() << " [bytes]" << std::endl;
    }
    catch (BGAPI2::Exceptions::IException& ex) {
        returncode = (returncode == 0) ? 1 : returncode;
        std::cout << "ExceptionType:    " << ex.GetType() << std::endl;
        std::cout << "ErrorDescription: " << ex.GetErrorDescription() << std::endl;
        std::cout << "in function:      " << ex.GetFunctionName() << std::endl;
    }
    try {
        for (BGAPI2::BufferList::iterator bufIterator = bufferList->begin();
            bufIterator != bufferList->end();
            bufIterator++) {
            bufIterator->QueueBuffer();
        }
        std::cout << "5.1.11   Queued buffers:          " << bufferList->GetQueuedCount() << std::endl;
    }
    catch (BGAPI2::Exceptions::IException& ex) {
        returncode = (returncode == 0) ? 1 : returncode;
        std::cout << "ExceptionType:    " << ex.GetType() << std::endl;
        std::cout << "ErrorDescription: " << ex.GetErrorDescription() << std::endl;
        std::cout << "in function:      " << ex.GetFunctionName() << std::endl;
    }
    std::cout << " " << std::endl;
    std::cout << "SUPPORTED DEVICE PIXEL FORMAT" << std::endl;
    std::cout << "#############################" << std::endl << std::endl;
    std::set<BGAPI2::String> devicePixelFormat;
    BGAPI2::Node* const pDevicePixelFormat = pDevice->GetRemoteNode(SFNC_PIXELFORMAT);
    BGAPI2::NodeMap* pNodeMap = pDevicePixelFormat->GetEnumNodeList();
    bo_uint64 count = pNodeMap->GetNodeCount();
    for (bo_uint64 i = 0; i < count; i++) {
        try {
            BGAPI2::Node* pNode = pNodeMap->GetNodeByIndex(i);
            if ((pNode->GetImplemented()) && (pNode->GetAvailable())) {
                BGAPI2::String sPixelFormat = pNode->GetValue();
                devicePixelFormat.insert(sPixelFormat);
                std::cout << " " << sPixelFormat << std::endl;
            }
        }
        catch (BGAPI2::Exceptions::IException& ex) {
            returncode = (returncode == 0) ? 1 : returncode;
            std::cout << "ExceptionType:    " << ex.GetType() << std::endl;
            std::cout << "ErrorDescription: " << ex.GetErrorDescription() << std::endl;
            std::cout << "in function:      " << ex.GetFunctionName() << std::endl;
        }
    }
    std::cout << std::endl;
    BGAPI2::Node* pDemosaicingMethod = NULL;
    BGAPI2::Node* pSharpeningMode = NULL;
    BGAPI2::Node* pSharpeningFactor = NULL;
    BGAPI2::Node* pSharpeningSensitivityThreshold = NULL;
    BGAPI2::Node* pSharpeningSupportedPixelFormatIndex = NULL;
    BGAPI2::Node* pSharpeningSupportedPixelFormatValue = NULL;
    BGAPI2::Node* pSharpeningDemosaicingMethodIndex = NULL;
    BGAPI2::Node* pSharpeningDemosaicingMethodValue = NULL;
    BGAPI2::ImageProcessor* pImageProcessor = new BGAPI2::ImageProcessor();
    if (pImageProcessor != NULL) {
        try {
            BGAPI2::NodeMap* pImgProcNodeMap = pImageProcessor->GetNodeList();
            if (pImgProcNodeMap != NULL) {
                if (pImgProcNodeMap->GetNodePresent("DemosaicingMethod")) {
                    pDemosaicingMethod = pImageProcessor->GetNode("DemosaicingMethod");
                }
                if (pImgProcNodeMap->GetNodePresent("SharpeningMode")) {
                    pSharpeningMode = pImgProcNodeMap->GetNode("SharpeningMode");
                }
                if (pImgProcNodeMap->GetNodePresent("SharpeningFactor")) {
                    pSharpeningFactor = pImgProcNodeMap->GetNode("SharpeningFactor");
                }
                if (pImgProcNodeMap->GetNodePresent("SharpeningSensitivityThreshold")) {
                    pSharpeningSensitivityThreshold = pImgProcNodeMap->GetNode("SharpeningSensitivityThreshold");
                }
                if (pImgProcNodeMap->GetNodePresent("SharpeningSupportedPixelFormatIndex")) {
                    pSharpeningSupportedPixelFormatIndex = pImgProcNodeMap->GetNode("SharpeningSupportedPixelFormatIndex");
                }
                if (pImgProcNodeMap->GetNodePresent("SharpeningSupportedPixelFormatValue")) {
                    pSharpeningSupportedPixelFormatValue = pImgProcNodeMap->GetNode("SharpeningSupportedPixelFormatValue");
                }
                if (pImgProcNodeMap->GetNodePresent("SharpeningDemosaicingMethodIndex")) {
                    pSharpeningDemosaicingMethodIndex = pImgProcNodeMap->GetNode("SharpeningDemosaicingMethodIndex");
                }
                if (pImgProcNodeMap->GetNodePresent("SharpeningDemosaicingMethodValue")) {
                    pSharpeningDemosaicingMethodValue = pImgProcNodeMap->GetNode("SharpeningDemosaicingMethodValue");
                }
            }
        }
        catch (BGAPI2::Exceptions::IException& ex) {
            returncode = (returncode == 0) ? 1 : returncode;
            std::cout << "ExceptionType:    " << ex.GetType() << std::endl;
            std::cout << "ErrorDescription: " << ex.GetErrorDescription() << std::endl;
            std::cout << "in function:      " << ex.GetFunctionName() << std::endl;
        }
    }
    BGAPI2::String sPixelFormatSrc = "";
    BGAPI2::String sPixelFormatDst = "";
    if ((pSharpeningSupportedPixelFormatIndex != NULL) && (pSharpeningSupportedPixelFormatValue != NULL)) {
        std::cout << "SUPPORTED SHARPENING PIXEL FORMAT" << std::endl;
        std::cout << "#################################" << std::endl << std::endl;
        try {
            BGAPI2::String sBayerFormat = "";
            bo_int64 iIndexMin = pSharpeningSupportedPixelFormatIndex->GetIntMin();
            bo_int64 iIndexMax = pSharpeningSupportedPixelFormatIndex->GetIntMax();
            for (bo_int64 iIndex = iIndexMin; iIndex <= iIndexMax; iIndex++) {
                pSharpeningSupportedPixelFormatIndex->SetInt(iIndex);
                BGAPI2::String sPixelFormat = pSharpeningSupportedPixelFormatValue->GetString();
                if (devicePixelFormat.find(sPixelFormat) != devicePixelFormat.end()) {
                    std::cout << " " << sPixelFormat << std::endl;
                    std::string sName = sPixelFormat.get();
                    if (sBayerFormat == "") {
                        if (sName.find("Bayer") != std::string::npos) {
                            sBayerFormat = sPixelFormat;
                        } else if (sPixelFormatSrc == "") {
                            sPixelFormatSrc = sPixelFormat;
                            sPixelFormatDst = "Mono8";
                        }
                    }
                }
            }
            if (sBayerFormat != "") {
                sPixelFormatSrc = sBayerFormat;
                sPixelFormatDst = "BGR8";
            }
        }
        catch (BGAPI2::Exceptions::IException& ex) {
            returncode = (returncode == 0) ? 1 : returncode;
            std::cout << "ExceptionType:    " << ex.GetType() << std::endl;
            std::cout << "ErrorDescription: " << ex.GetErrorDescription() << std::endl;
            std::cout << "in function:      " << ex.GetFunctionName() << std::endl;
        }
        std::cout << std::endl;
    }
    BGAPI2::String sSharpeningDemosaicingMethod = "";
    if (pDemosaicingMethod != NULL) {
        BGAPI2::NodeMap* pDemosaicingMethodList = pDemosaicingMethod->GetEnumNodeList();
        bo_uint64 demosaicingMethodCount = pDemosaicingMethodList->GetNodeCount();
        for (bo_uint64 i = 0; i < demosaicingMethodCount; i++) {
            try {
                BGAPI2::Node* pNode = pDemosaicingMethodList->GetNodeByIndex(i);
                if ((pNode->GetImplemented()) && (pNode->GetAvailable())) {
                    BGAPI2::String sPixelFormat = pNode->GetValue();
                    std::cout << " " << sPixelFormat << std::endl;
                }
            }
            catch (BGAPI2::Exceptions::IException& ex) {
                returncode = (returncode == 0) ? 1 : returncode;
                std::cout << "ExceptionType:    " << ex.GetType() << std::endl;
                std::cout << "ErrorDescription: " << ex.GetErrorDescription() << std::endl;
                std::cout << "in function:      " << ex.GetFunctionName() << std::endl;
            }
        }
    }
    if ((pSharpeningDemosaicingMethodIndex != NULL) && (pSharpeningDemosaicingMethodValue != NULL)) {
        std::cout << "SHARPENING DEMOSAICING METHODS" << std::endl;
        std::cout << "##############################" << std::endl << std::endl;
        try {
            bo_int64 iIndexMin = pSharpeningDemosaicingMethodIndex->GetIntMin();
            bo_int64 iIndexMax = pSharpeningDemosaicingMethodIndex->GetIntMax();
            for (bo_int64 iIndex = iIndexMin; iIndex <= iIndexMax; iIndex++) {
                pSharpeningDemosaicingMethodIndex->SetInt(iIndex);
                BGAPI2::String sMethod = pSharpeningDemosaicingMethodValue->GetString();
                std::cout << " " << sMethod << std::endl;
                if (sSharpeningDemosaicingMethod == "") {
                    sSharpeningDemosaicingMethod = sMethod;
                }
            }
        }
        catch (BGAPI2::Exceptions::IException& ex) {
            returncode = (returncode == 0) ? 1 : returncode;
            std::cout << "ExceptionType:    " << ex.GetType() << std::endl;
            std::cout << "ErrorDescription: " << ex.GetErrorDescription() << std::endl;
            std::cout << "in function:      " << ex.GetFunctionName() << std::endl;
        }
        std::cout << std::endl;
    }
    BGAPI2::String sSharpeningMode = "";
    std::vector<BGAPI2::String> sharpeningModes;
    if (pSharpeningMode != NULL) {
        std::cout << "SHARPENING MODES" << std::endl;
        std::cout << "################" << std::endl << std::endl;
        try {
            BGAPI2::NodeMap* pSharpeningModeList = pSharpeningMode->GetEnumNodeList();
            bo_uint64 sharpeningModeCount = pSharpeningModeList->GetNodeCount();
            for (bo_uint64 i = 0; i < sharpeningModeCount; i++) {
                BGAPI2::Node* pNode = pSharpeningModeList->GetNodeByIndex(i);
                if ((pNode->GetImplemented()) && (pNode->GetAvailable())) {
                    BGAPI2::String sMode = pNode->GetValue();
                    std::cout << " " << sMode << std::endl;
                    sharpeningModes.push_back(sMode);
                    if (sSharpeningMode == "") {
                        sSharpeningMode = sMode;
                    }
                }
            }
            std::cout << " current: " << pSharpeningMode->GetValue() << std::endl;
        }
        catch (BGAPI2::Exceptions::IException& ex) {
            returncode = (returncode == 0) ? 1 : returncode;
            std::cout << "ExceptionType:    " << ex.GetType() << std::endl;
            std::cout << "ErrorDescription: " << ex.GetErrorDescription() << std::endl;
            std::cout << "in function:      " << ex.GetFunctionName() << std::endl;
        }
        std::cout << std::endl;
    }
    bo_int64 sharpeningFactorMin = 0;
    bo_int64 sharpeningFactorMax = 0;
    bo_int64 sharpeningFactor = 0;
    if (pSharpeningFactor != NULL) {
        std::cout << "SHARPENING FACTOR" << std::endl;
        std::cout << "#################" << std::endl << std::endl;
        try {
            sharpeningFactorMin = pSharpeningFactor->GetIntMin();
            sharpeningFactorMax = pSharpeningFactor->GetIntMax();
            sharpeningFactor = pSharpeningFactor->GetInt();
            std::cout << " min:     " << sharpeningFactorMin << std::endl;
            std::cout << " max:     " << sharpeningFactorMax << std::endl;
            std::cout << " current: " << sharpeningFactor << std::endl;
        }
        catch (BGAPI2::Exceptions::IException& ex) {
            returncode = (returncode == 0) ? 1 : returncode;
            std::cout << "ExceptionType:    " << ex.GetType() << std::endl;
            std::cout << "ErrorDescription: " << ex.GetErrorDescription() << std::endl;
            std::cout << "in function:      " << ex.GetFunctionName() << std::endl;
        }
        std::cout << std::endl;
    }
    bo_int64 sharpeningSensitivityThresholdMin = 0;
    bo_int64 sharpeningSensitivityThresholdMax = 0;
    bo_int64 sharpeningSensitivityThreshold = 0;
    if (pSharpeningSensitivityThreshold != NULL) {
        std::cout << "SHARPENING SENSITIVITY THRESHOLD" << std::endl;
        std::cout << "################################" << std::endl << std::endl;
        try {
            sharpeningSensitivityThresholdMin = pSharpeningSensitivityThreshold->GetIntMin();
            sharpeningSensitivityThresholdMax = pSharpeningSensitivityThreshold->GetIntMax();
            sharpeningSensitivityThreshold = pSharpeningSensitivityThreshold->GetInt();
            std::cout << " min:     " << sharpeningSensitivityThresholdMin << std::endl;
            std::cout << " max:     " << sharpeningSensitivityThresholdMax << std::endl;
            std::cout << " current: " << sharpeningSensitivityThreshold << std::endl;
        }
        catch (BGAPI2::Exceptions::IException& ex) {
            returncode = (returncode == 0) ? 1 : returncode;
            std::cout << "ExceptionType:    " << ex.GetType() << std::endl;
            std::cout << "ErrorDescription: " << ex.GetErrorDescription() << std::endl;
            std::cout << "in function:      " << ex.GetFunctionName() << std::endl;
        }
        std::cout << std::endl;
    }
    if (pDemosaicingMethod != NULL) {
        std::cout << "SET DEMOSAICING METHOD" << std::endl;
        std::cout << "#######################" << std::endl << std::endl;
        pDemosaicingMethod->SetString(sSharpeningDemosaicingMethod);
        std::cout << " " << pDemosaicingMethod->GetString() << std::endl;
        std::cout << std::endl;
    }
    const bo_uint64 uGetFilledBufferTimeout = 5000;
    // SEARCH FOR 'AcquisitionAbort'
    BGAPI2::Node* pDeviceAcquisitionAbort = NULL;
    if (pDevice->GetRemoteNodeList()->GetNodePresent(SFNC_ACQUISITION_ABORT)) {
        pDeviceAcquisitionAbort = pDevice->GetRemoteNode(SFNC_ACQUISITION_ABORT);
    }
    BGAPI2::Node* const pDeviceAcquisitionStart = pDevice->GetRemoteNode(SFNC_ACQUISITION_START);
    BGAPI2::Node* const pDeviceAcquisitionStop = pDevice->GetRemoteNode(SFNC_ACQUISITION_STOP);
    // ENSURE CAMERA IS STOPPED TO SET PIXEL FORMAT
    try {
        if (pDeviceAcquisitionAbort) {
            pDeviceAcquisitionAbort->Execute();
            std::cout << "5.1.12   " << pDevice->GetModel() << " aborted " << std::endl;
        }
        pDeviceAcquisitionStop->Execute();
        std::cout << "5.1.12   " << pDevice->GetModel() << " stopped " << std::endl;
        std::cout << std::endl;
    }
    catch (BGAPI2::Exceptions::IException& ex) {
        returncode = (returncode == 0) ? 1 : returncode;
        std::cout << "ExceptionType:    " << ex.GetType() << std::endl;
        std::cout << "ErrorDescription: " << ex.GetErrorDescription() << std::endl;
        std::cout << "in function:      " << ex.GetFunctionName() << std::endl;
    }
    std::cout << std::endl;
    std::cout << "CAMERA START" << std::endl;
    std::cout << "############" << std::endl << std::endl;
    // SET PIXEL FORMAT
    std::cout << "         Set Pixel Format to " << sPixelFormatSrc << std::endl;
    pDevicePixelFormat->SetString(sPixelFormatSrc);
    std::cout << std::endl;
    // START DataStream acquisition
    try {
        pDataStream->StartAcquisitionContinuous();
        std::cout << "5.1.12   DataStream started " << std::endl;
    }
    catch (BGAPI2::Exceptions::IException& ex) {
        returncode = (returncode == 0) ? 1 : returncode;
        std::cout << "ExceptionType:    " << ex.GetType() << std::endl;
        std::cout << "ErrorDescription: " << ex.GetErrorDescription() << std::endl;
        std::cout << "in function:      " << ex.GetFunctionName() << std::endl;
    }
    std::cout << std::endl;
    // START CAMERA
    try {
        std::cout << "5.1.12   " << pDevice->GetModel() << " started " << std::endl << std::endl;
        pDeviceAcquisitionStart->Execute();
    }
    catch (BGAPI2::Exceptions::IException& ex) {
        returncode = (returncode == 0) ? 1 : returncode;
        std::cout << "ExceptionType:    " << ex.GetType() << std::endl;
        std::cout << "ErrorDescription: " << ex.GetErrorDescription() << std::endl;
        std::cout << "in function:      " << ex.GetFunctionName() << std::endl;
    }
    // CAPTURE <n> IMAGES
    std::cout << " " << std::endl;
    std::cout << "CAPTURE " << sharpeningModes.size() << " IMAGES" << std::endl;
    std::cout << "################" << std::endl << std::endl;
    try {
        size_t sharpeningMode = 0;
        BGAPI2::Image* pImageSrc = NULL;
        bo_uchar* pMemDst = NULL;
        bo_uint64 memSizeDst = 0;
        for (size_t i = 0; i < sharpeningModes.size(); i++) {
            // WAIT FOR IMAGE
            BGAPI2::Buffer* pBufferFilled = pDataStream->GetFilledBuffer(uGetFilledBufferTimeout);  // timeout <n> msec
            if (pBufferFilled == NULL) {
                std::cout << "Error: Buffer Timeout after " << uGetFilledBufferTimeout << "msec" << std::endl;
            } else {
                if (pBufferFilled->GetIsIncomplete() == true) {
                    std::cout << "Error: Image is incomplete" << std::endl;
                } else {
                    const bo_uint w = static_cast<bo_uint>(pBufferFilled->GetWidth());
                    const bo_uint h = static_cast<bo_uint>(pBufferFilled->GetHeight());
                    void* const pMemSrc = pBufferFilled->GetMemPtr();
                    BGAPI2::String sBufferPixelFormat = pBufferFilled->GetPixelFormat();
                    const bo_uint64 memSizeSrc = pBufferFilled->GetMemSize();
                    std::cout << " Image " << std::setw(5) << pBufferFilled->GetFrameID()
                        << " received in memory address " << std::hex << pMemSrc
                        << std::dec << " [" << sBufferPixelFormat << "]" << std::endl;
                    if (pImageSrc == NULL) {
                        pImageSrc = pImageProcessor->CreateImage(w, h, sBufferPixelFormat, pMemSrc, memSizeSrc);
                    } else {
                        pImageSrc->Init(w, h, sBufferPixelFormat, pMemSrc, memSizeSrc);
                    }
                    if (pImageSrc != NULL) {
                        bo_uint64 bufferLength = pImageSrc->GetTransformBufferLength(sPixelFormatDst);
                        if (bufferLength > memSizeDst) {
                            if (pMemDst != NULL) {
                                delete[] pMemDst;
                                pMemDst = NULL;
                                memSizeDst = 0;
                            }
                            pMemDst = new bo_uchar[static_cast<size_t>(bufferLength)];
                            memSizeDst = bufferLength;
                        }
                        if (sharpeningMode >= sharpeningModes.size()) {
                            sharpeningMode = 0;
                        }
                        std::cout << " convert to " << sPixelFormatDst << " - sharpening mode: "
                            << sharpeningModes[sharpeningMode] << std::endl;
                        pSharpeningMode->SetValue(sharpeningModes[sharpeningMode]);
                        pImageProcessor->TransformImageToBuffer(pImageSrc, sPixelFormatDst, pMemDst, bufferLength);
                        sharpeningMode++;
                    }
                }
                // queue buffer again
                pBufferFilled->QueueBuffer();
            }
        }
        if (pImageSrc != NULL) {
            pImageSrc->Release();
        }
        if (pMemDst != NULL) {
            delete[] pMemDst;
        }
    }
    catch (BGAPI2::Exceptions::IException& ex) {
        returncode = (returncode == 0) ? 1 : returncode;
        std::cout << "ExceptionType:    " << ex.GetType() << std::endl;
        std::cout << "ErrorDescription: " << ex.GetErrorDescription() << std::endl;
        std::cout << "in function:      " << ex.GetFunctionName() << std::endl;
    }
    std::cout << " " << std::endl;
    std::cout << "CAMERA STOP" << std::endl;
    std::cout << "###########" << std::endl << std::endl;
    // STOP CAMERA
    try {
        if (pDeviceAcquisitionAbort) {
            pDeviceAcquisitionAbort->Execute();
            std::cout << "5.1.12   " << pDevice->GetModel() << " aborted " << std::endl;
        }
        pDeviceAcquisitionStop->Execute();
        std::cout << "5.1.12   " << pDevice->GetModel() << " stopped " << std::endl;
        std::cout << std::endl;
    }
    catch (BGAPI2::Exceptions::IException& ex) {
        returncode = (returncode == 0) ? 1 : returncode;
        std::cout << "ExceptionType:    " << ex.GetType() << std::endl;
        std::cout << "ErrorDescription: " << ex.GetErrorDescription() << std::endl;
        std::cout << "in function:      " << ex.GetFunctionName() << std::endl;
    }
    // STOP DataStream acquisition
    try {
        // DataStream Statistic
        BGAPI2::NodeMap* const pNodeList = pDataStream->GetNodeList();
        std::cout << "         DataStream Statistics " << std::endl;
        std::cout << "           GoodFrames:            "
            << pNodeList->GetNode("GoodFrames")->GetInt() << std::endl;
        std::cout << "           CorruptedFrames:       "
            << pNodeList->GetNode("CorruptedFrames")->GetInt() << std::endl;
        std::cout << "           LostFrames:            "
            << pNodeList->GetNode("LostFrames")->GetInt() << std::endl;
        if (pDataStream->GetTLType() == "GEV") {
            std::cout << "           ResendRequests:        "
                << pNodeList->GetNode("ResendRequests")->GetInt() << std::endl;
            std::cout << "           ResendPackets:         "
                << pNodeList->GetNode("ResendPackets")->GetInt() << std::endl;
            std::cout << "           LostPackets:           "
                << pNodeList->GetNode("LostPackets")->GetInt() << std::endl;
            std::cout << "           Bandwidth:             "
                << pNodeList->GetNode("Bandwidth")->GetInt() << std::endl;
        }
        std::cout << std::endl;
        pDataStream->StopAcquisition();
        std::cout << "5.1.12   DataStream stopped " << std::endl;
        bufferList->FlushAllToInputQueue();
    }
    catch (BGAPI2::Exceptions::IException& ex) {
        returncode = (returncode == 0) ? 1 : returncode;
        std::cout << "ExceptionType:    " << ex.GetType() << std::endl;
        std::cout << "ErrorDescription: " << ex.GetErrorDescription() << std::endl;
        std::cout << "in function:      " << ex.GetFunctionName() << std::endl;
    }
    std::cout << std::endl;
    std::cout << "RELEASE" << std::endl;
    std::cout << "#######" << std::endl << std::endl;
    // Release buffers
    std::cout << "5.1.13   Releasing the resources " << std::endl;
    try {
        bufferList->DiscardAllBuffers();
        while (bufferList->size() > 0) {
            pBuffer = *(bufferList->begin());
            bufferList->RevokeBuffer(pBuffer);
            delete pBuffer;
        }
        std::cout << "         buffers after revoke:    " << bufferList->size() << std::endl;
        pDataStream->Close();
        pDevice->Close();
        pInterface->Close();
        pSystem->Close();
        BGAPI2::SystemList::ReleaseInstance();
        if (pImageProcessor != NULL) {
            delete pImageProcessor;
        }
    }
    catch (BGAPI2::Exceptions::IException& ex) {
        returncode = (returncode == 0) ? 1 : returncode;
        std::cout << "ExceptionType:    " << ex.GetType() << std::endl;
        std::cout << "ErrorDescription: " << ex.GetErrorDescription() << std::endl;
        std::cout << "in function:      " << ex.GetFunctionName() << std::endl;
    }
    std::cout << std::endl;
    std::cout << "End" << std::endl << std::endl;
    return returncode;
}
int main() {
    try {
        Test();
    }
    catch (BGAPI2::Exceptions::IException& e) {
        std::cout << "unhandled BGAPI exception \"" << e.GetType() << "\" " << e.GetFunctionName() << " "
            << e.GetErrorDescription() << "\n";
    }
    catch (const std::exception& e) {
        std::cout << "unhandled exception: \"" << e.what() << "\"\n";
    }
    catch (...) {
        std::cout << "unhandled exception\n";
    }
    std::cout << "Input any number to close the program:";
    int endKey = 0;
    std::cin >> endKey;
    return 0;
}

通过这种方法,相机在内部可以将锐化后的图像之间传递给处理器,减少了图像处理软件的工作,有效地提高了效率


Sharpening图像锐化功能的优点

Baumer工业相机的图像锐化功能通过改善图像的清晰度、细节和锐度来提高整体图像质量。使用这一功能的一些好处包括。


1. 更高的图像分辨率。图像锐化功能通过增强图像的边缘、纹理和细节来提高图像的分辨率,从而使图像更清晰、更锐利。


2. 改善图像对比度。锐化功能还增强了图像的对比度,使之更容易区分图像中的不同物体和结构。


3. 减少图像噪音:工业相机经常产生带有噪音或颗粒的图像,这会降低清晰度和细节。图像锐化功能可以减少这种噪音,产生一个更干净、更清晰的图像。


4. 更好的检测和分析。更清晰的图像使机器视觉算法更容易检测和分析图像中的物体和结构,从而获得更好的准确性和可靠性。


总的来说,图像锐化功能可以显著提高工业相机产生的图像质量,从而提高各种工业应用的性能和生产率。


Sharpening图像锐化功能的行业应用

Baumer工业相机 的图像锐化功能有几种情况下是有实用价值的。


1. 制造业。在制造过程中,需要捕捉产品的图像以进行质量控制。图像锐化功能可用于增强产品图像的边缘,使其更容易发现缺陷,并确保产品的生产符合要求的规格。


2. 检查。图像锐化功能在需要分析物体的纹理和表面细节的检测应用中非常有用。这可能包括检测裂缝、缺口或其他肉眼难以看到的缺陷。


3. 医学成像。图像锐化功能用于医学成像,以增强X射线或核磁共振等扫描的细节。这可以帮助医生和放射科医生确定在没有图像增强的情况下可能难以发现的疾病或异常情况。


4. 安全。在安全系统中,图像锐化功能可用于提高监控录像的质量,使其更容易识别个人和跟踪他们的行动。


5. 电子元件检查。图像锐化功能在电子元件检测中非常有用,因为元件的边缘非常重要。使用锐化算法,更容易准确地突出这些边缘。


总的来说,工业相机的图像锐化功能在不同行业有广泛的应用,提高了图像的质量和准确性,有助于实现流程自动化。

目录
相关文章
|
1月前
|
存储 C++ UED
【实战指南】4步实现C++插件化编程,轻松实现功能定制与扩展
本文介绍了如何通过四步实现C++插件化编程,实现功能定制与扩展。主要内容包括引言、概述、需求分析、设计方案、详细设计、验证和总结。通过动态加载功能模块,实现软件的高度灵活性和可扩展性,支持快速定制和市场变化响应。具体步骤涉及配置文件构建、模块编译、动态库入口实现和主程序加载。验证部分展示了模块加载成功的日志和配置信息。总结中强调了插件化编程的优势及其在多个方面的应用。
227 64
|
3月前
|
算法框架/工具 C++ Python
根据相机旋转矩阵求解三个轴的旋转角/欧拉角/姿态角 或 旋转矩阵与欧拉角(Euler Angles)之间的相互转换,以及python和C++代码实现
根据相机旋转矩阵求解三个轴的旋转角/欧拉角/姿态角 或 旋转矩阵与欧拉角(Euler Angles)之间的相互转换,以及python和C++代码实现
229 0
|
21天前
|
存储 并行计算 安全
C++多线程应用
【10月更文挑战第29天】C++ 中的多线程应用广泛,常见场景包括并行计算、网络编程中的并发服务器和图形用户界面(GUI)应用。通过多线程可以显著提升计算速度和响应能力。示例代码展示了如何使用 `pthread` 库创建和管理线程。注意事项包括数据同步与互斥、线程间通信和线程安全的类设计,以确保程序的正确性和稳定性。
|
1月前
|
存储 编译器 C++
【C++篇】揭开 C++ STL list 容器的神秘面纱:从底层设计到高效应用的全景解析(附源码)
【C++篇】揭开 C++ STL list 容器的神秘面纱:从底层设计到高效应用的全景解析(附源码)
53 2
|
2月前
|
编译器 C++
【C++核心】函数的应用和提高详解
这篇文章详细讲解了C++函数的定义、调用、值传递、常见样式、声明、分文件编写以及函数提高的内容,包括函数默认参数、占位参数、重载等高级用法。
22 3
|
3月前
|
存储 算法 C++
C++ STL应用宝典:高效处理数据的艺术与实战技巧大揭秘!
【8月更文挑战第22天】C++ STL(标准模板库)是一组高效的数据结构与算法集合,极大提升编程效率与代码可读性。它包括容器、迭代器、算法等组件。例如,统计文本中单词频率可用`std::map`和`std::ifstream`实现;对数据排序及找极值则可通过`std::vector`结合`std::sort`、`std::min/max_element`完成;而快速查找字符串则适合使用`std::set`配合其内置的`find`方法。这些示例展示了STL的强大功能,有助于编写简洁高效的代码。
48 2
|
2月前
|
图形学 C++ C#
Unity插件开发全攻略:从零起步教你用C++扩展游戏功能,解锁Unity新玩法的详细步骤与实战技巧大公开
【8月更文挑战第31天】Unity 是一款功能强大的游戏开发引擎,支持多平台发布并拥有丰富的插件生态系统。本文介绍 Unity 插件开发基础,帮助读者从零开始编写自定义插件以扩展其功能。插件通常用 C++ 编写,通过 Mono C# 运行时调用,需在不同平台上编译。文中详细讲解了开发环境搭建、简单插件编写及在 Unity 中调用的方法,包括创建 C# 封装脚本和处理跨平台问题,助力开发者提升游戏开发效率。
200 0
|
3月前
|
存储 编译器 C++
C++多态实现的原理:深入探索与实战应用
【8月更文挑战第21天】在C++的浩瀚宇宙中,多态性(Polymorphism)无疑是一颗璀璨的星辰,它赋予了程序高度的灵活性和可扩展性。多态允许我们通过基类指针或引用来调用派生类的成员函数,而具体调用哪个函数则取决于指针或引用所指向的对象的实际类型。本文将深入探讨C++多态实现的原理,并结合工作学习中的实际案例,分享其技术干货。
74 0
|
6天前
|
存储 编译器 C++
【c++】类和对象(中)(构造函数、析构函数、拷贝构造、赋值重载)
本文深入探讨了C++类的默认成员函数,包括构造函数、析构函数、拷贝构造函数和赋值重载。构造函数用于对象的初始化,析构函数用于对象销毁时的资源清理,拷贝构造函数用于对象的拷贝,赋值重载用于已存在对象的赋值。文章详细介绍了每个函数的特点、使用方法及注意事项,并提供了代码示例。这些默认成员函数确保了资源的正确管理和对象状态的维护。
29 4
|
7天前
|
存储 编译器 Linux
【c++】类和对象(上)(类的定义格式、访问限定符、类域、类的实例化、对象的内存大小、this指针)
本文介绍了C++中的类和对象,包括类的概念、定义格式、访问限定符、类域、对象的创建及内存大小、以及this指针。通过示例代码详细解释了类的定义、成员函数和成员变量的作用,以及如何使用访问限定符控制成员的访问权限。此外,还讨论了对象的内存分配规则和this指针的使用场景,帮助读者深入理解面向对象编程的核心概念。
25 4