Baumer工业相机堡盟相机如何使用偏振功能(偏振相机优点和行业应用)(C++)

简介: Baumer工业相机堡盟相机如何使用偏振功能(偏振相机优点和行业应用)(C++)

项目场景:

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


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


Baumer相机系列中偏振相机的特殊功能有助于在一些特殊应用场合使用。


技术背景

偏光工业相机相机旨在捕捉偏光,以提高图像质量,减少各种工业应用中的眩光。


这些相机的镜头中集成了偏振滤光片,可以帮助改善图像对比度,提高色彩饱和度,并减少闪亮表面的反射。


偏光工业相机的一些关键特征可能包括高分辨率、快速帧率、适用于工业环境的坚固设计,以及与不同照明条件的兼容性。


此外,它们可能具有触发、曝光控制和图像处理能力等功能,有助于为检查和分析目的捕获清晰和详细的图像。

7.png

6.png

5.png

代码分析

Baumer工业相机堡盟相机SDK示例中020_Polarized.cpp详细介绍了如何配置相机偏振功能。


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

4.png


Baumer工业相机系列中VCXU-50MP和VCXG-50MP为偏振工业相机。

image.png

该示例描述了如何使用所提供的堡盟GAPI API功能来配置相机并计算所需的偏振数据(AOL、DOP、ADOLP、Intensity)


代码整体结构相对简单,在相机初始化后进行相机的偏振功能使用,部分核心代码如下:

std::cout << std::endl;
std::cout << "POLARIZER CONFIGURATION" << std::endl;
std::cout << "#######################" << std::endl << std::endl;
try {
    // Enable or disable interpolation
    polarizer.EnableInterpolation(enableInterpolation);
    std::cout << "Interpolation " << (enableInterpolation ? "on" : "off") << std::endl;
    // Configure the polarizer to use the calibration values from the camera device
    polarizer.ReadCalibrationData(pDevice);
}
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;
}
// Enable requested polarisation formats and create image containers
try {
    for (std::set<std::string>::const_iterator component = sComponents.begin();
        component != sComponents.end(); component++) {
        std::map<std::string, BGAPI2::Polarizer::Formats>::const_iterator c = supportedComponents.find(*component);
        if (c == supportedComponents.end()) {
            std::cout << *component << ":" << " not supported" << std::endl;
            returncode = (returncode == 0) ? 1 : returncode;
        } else if (requestedComponents.find(c->second) == requestedComponents.end()) {
            polarizer.Enable(c->second, true);
            std::cout << *component << ":" << " enabled" << std::endl;
            requestedComponents.insert(
                std::pair<BGAPI2::Polarizer::Formats, BGAPI2::Image*>(c->second, imgProc.CreateImage()));
        }
    }
}
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 (returncode) {
    ReleaseAllResources(pSystem, pInterface, pDevice, pDataStream, &requestedComponents);
    return returncode;
}


下面是几个偏振相机常使用的函数方法代码:

void GetSupportedComponents(BGAPI2::Polarizer* const polarizer,
    const bool is_color,
    std::string* const help) {
    BGAPI2::Polarizer::formatlist list;
    for (BGAPI2::Polarizer::formatlist::const_iterator it = list.begin(); it != list.end(); it++) {
        if (BGAPI2::Polarizer::IsFormatAvailable(*it, is_color)) {
            std::string componentName = polarizer->GetFormatString(*it).get();
            supportedComponents.insert(std::pair<std::string, BGAPI2::Polarizer::Formats>(componentName, *it));
            if (help->length() > 0) {
                *help += "/";
            }
            *help += componentName;
        }
    }
}
// Get the required components from the command line argument
void argumentComponent(const Argument& /*argument*/, const ArgumentMode mode, const char* const pParam) {
    static bool bClearComponents = true;
    if (mode == eArgumentInit) {
        sComponents.clear();
        const char* components[] = { "Intensity", "AOP", "DOLP", "POL", "UNPOL", "ADOLP" };
        for (unsigned int i = 0; i < sizeof(components) / sizeof(components[0]); i++) {
            if (supportedComponents.find(components[i]) != supportedComponents.end()) {
                sComponents.insert(components[i]);
            }
        }
        bClearComponents = true;
    } else {
        if (bClearComponents) {
            sComponents.clear();
            bClearComponents = false;
        }
        if (pParam != NULL) {
            if (sComponents.find(pParam) == sComponents.end()) {
                sComponents.insert(pParam);
            }
        }
    }
}
// Get the Angle Offset from the command line parameter (if provided) and use it for the calculation
void argumentAopOffset(const Argument& /*argument*/, const ArgumentMode mode, const char* const pParam) {
    if (mode == eArgumentInit) {
        g_aopOffset = 0.0;
        g_bAopOffset = false;
    } else {
        double value = 0.0;
        int ret_value = 0;
#if defined(_WIN32)
        ret_value = sscanf_s(pParam, "%lf", &value);
#else
        ret_value = sscanf(pParam, "%lf", &value);
#endif
        if ((pParam != NULL) && (ret_value == 1)) {
            g_aopOffset = value;
            g_bAopOffset = true;
        }
    }
}
// Helper to filter found cameras devices and select only polarization camera for this example
bool PolarizationDeviceFilter(BGAPI2::Device* const pDevice) {
    return BGAPI2::Polarizer::IsPolarized(pDevice, NULL);
}
int GetFirstDevice(DeviceMatch* const pMatch,
    bool(*pSystemFilter)(BGAPI2::System* pSystem),
    bool(*pInterfaceFilter)(BGAPI2::Interface* pInterface),
    bool(*pDeviceFilter)(BGAPI2::Device* pDevice),
    std::ostream* log) {
    int returncode = 0;
    *log << "SYSTEM LIST" << std::endl;
    *log << "###########" << std::endl << std::endl;
    try {
        BGAPI2::SystemList* pSystemList = BGAPI2::SystemList::GetInstance();
        // Counting available systems (TL producers)
        pSystemList->Refresh();
        *log << "5.1.2   Detected systems:  " << pSystemList->size() << std::endl;
        // System device information
        for (BGAPI2::SystemList::iterator sysIterator = pSystemList->begin();
            sysIterator != pSystemList->end();
            sysIterator++) {
            BGAPI2::System* const pSystem = *sysIterator;
            *log << "  5.2.1   System Name:     " << pSystem->GetFileName() << std::endl;
            *log << "          System Type:     " << pSystem->GetTLType() << std::endl;
            *log << "          System Version:  " << pSystem->GetVersion() << std::endl;
            *log << "          System PathName: " << pSystem->GetPathName() << std::endl << std::endl;
        }
        for (BGAPI2::SystemList::iterator sysIterator = pSystemList->begin();
            sysIterator != pSystemList->end();
            sysIterator++) {
            *log << "SYSTEM" << std::endl;
            *log << "######" << std::endl << std::endl;
            BGAPI2::System* const pSystem = *sysIterator;
            pMatch->pSystem = pSystem;
            try {
                pSystem->Open();
                *log << "5.1.3   Open next system " << std::endl;
                *log << "  5.2.1   System Name:     " << pSystem->GetFileName() << std::endl;
                *log << "          System Type:     " << pSystem->GetTLType() << std::endl;
                *log << "          System Version:  " << pSystem->GetVersion() << std::endl;
                *log << "          System PathName: " << pSystem->GetPathName() << std::endl << std::endl;
                *log << "        Opened system - NodeList Information " << std::endl;
                *log << "          GenTL Version:   " << pSystem->GetNode("GenTLVersionMajor")->GetValue() << "."
                    << pSystem->GetNode("GenTLVersionMinor")->GetValue() << std::endl << std::endl;
                const char* pCloseSystemReason = "???";
                if ((pSystemFilter != NULL) && (pSystemFilter(pSystem) == false)) {
                    pCloseSystemReason = "skipped";
                } else {
                    *log << "INTERFACE LIST" << std::endl;
                    *log << "##############" << std::endl << std::endl;
                    try {
                        BGAPI2::InterfaceList* pInterfaceList = pSystem->GetInterfaces();
                        // Count available interfaces
                        pInterfaceList->Refresh(100);  // timeout of 100 msec
                        *log << "5.1.4   Detected interfaces: " << pInterfaceList->size() << std::endl;
                        // Interface information
                        for (BGAPI2::InterfaceList::iterator ifIterator = pInterfaceList->begin();
                            ifIterator != pInterfaceList->end();
                            ifIterator++) {
                            BGAPI2::Interface* const pInterface = *ifIterator;
                            *log << "  5.2.2   Interface ID:      " << pInterface->GetID() << std::endl;
                            *log << "          Interface Type:    " << pInterface->GetTLType() << std::endl;
                            *log << "          Interface Name:    " << pInterface->GetDisplayName() << std::endl
                                << std::endl;
                        }
                        *log << "INTERFACE" << std::endl;
                        *log << "#########" << std::endl << std::endl;
                        for (BGAPI2::InterfaceList::iterator ifIterator = pInterfaceList->begin();
                            ifIterator != pInterfaceList->end();
                            ifIterator++) {
                            try {
                                // Open the next interface in the list
                                BGAPI2::Interface* const pInterface = *ifIterator;
                                pMatch->pInterface = pInterface;
                                *log << "5.1.5   Open interface " << std::endl;
                                *log << "  5.2.2   Interface ID:      " << pInterface->GetID() << std::endl;
                                *log << "          Interface Type:    " << pInterface->GetTLType() << std::endl;
                                *log << "          Interface Name:    " << pInterface->GetDisplayName() << std::endl;
                                pInterface->Open();
                                const char* pReason = "???";
                                if ((pInterfaceFilter != NULL) && (pInterfaceFilter(pInterface) == false)) {
                                    pReason = "skipped";
                                } else {
                                    // Search for any camera is connected to this interface
                                    BGAPI2::DeviceList* const pDeviceList = pInterface->GetDevices();
                                    pDeviceList->Refresh(100);
                                    if (pDeviceList->size() == 0) {
                                        pReason = "no camera found";
                                    } else {
                                        *log << "   " << std::endl;
                                        *log << "        Opened interface - NodeList Information " << std::endl;
                                        if (pInterface->GetTLType() == "GEV") {
                                            *log << "          GevInterfaceSubnetIPAddress: "
                                                << pInterface->GetNode("GevInterfaceSubnetIPAddress")->GetValue()
                                                << std::endl;
                                            *log << "          GevInterfaceSubnetMask:      "
                                                << pInterface->GetNode("GevInterfaceSubnetMask")->GetValue()
                                                << std::endl;
                                        }
                                        if (pInterface->GetTLType() == "U3V") {
                                            // log << "          NodeListCount:     "
                                            // << pInterface->GetNodeList()->GetNodeCount() << std::endl;
                                        }
                                        // Open the first matching camera in the list
                                        try {
                                            // Counting available cameras
                                            *log << "5.1.6   Detected devices:         "
                                                << pDeviceList->size() << std::endl;
                                            // Device information before opening
                                            for (BGAPI2::DeviceList::iterator devIterator = pDeviceList->begin();
                                                devIterator != pDeviceList->end();
                                                devIterator++) {
                                                BGAPI2::Device* const pDevice = *devIterator;
                                                *log << "  5.2.3   Device DeviceID:        "
                                                    << pDevice->GetID() << std::endl;
                                                *log << "          Device Model:           "
                                                    << pDevice->GetModel() << std::endl;
                                                *log << "          Device SerialNumber:    "
                                                    << pDevice->GetSerialNumber() << std::endl;
                                                *log << "          Device Vendor:          "
                                                    << pDevice->GetVendor() << std::endl;
                                                *log << "          Device TLType:          "
                                                    << pDevice->GetTLType() << std::endl;
                                                *log << "          Device AccessStatus:    "
                                                    << pDevice->GetAccessStatus() << std::endl;
                                                *log << "          Device UserID:          "
                                                    << pDevice->GetDisplayName() << std::endl << std::endl;
                                            }
                                            for (BGAPI2::DeviceList::iterator devIterator = pDeviceList->begin();
                                                devIterator != pDeviceList->end();
                                                devIterator++) {
                                                try {
                                                    BGAPI2::Device* const pDevice = *devIterator;
                                                    pMatch->pDevice = pDevice;
                                                    GetDeviceInfo(log, pDevice, true);
                                                    if ((pDeviceFilter == NULL) || (pDeviceFilter(pDevice) == true)) {
                                                        return returncode;
                                                    }
                                                    *log << "        Close device (skipped) "
                                                        << std::endl << std::endl;
                                                    pDevice->Close();
                                                    pMatch->pDevice = NULL;
                                                }
                                                catch (BGAPI2::Exceptions::ResourceInUseException& ex) {
                                                    returncode = (returncode == 0) ? 1 : returncode;
                                                    *log << " Device  " << devIterator->GetID() << " already opened "
                                                        << std::endl;
                                                    *log << " ResourceInUseException: " << ex.GetErrorDescription()
                                                        << std::endl;
                                                }
                                                catch (BGAPI2::Exceptions::AccessDeniedException& ex) {
                                                    returncode = (returncode == 0) ? 1 : returncode;
                                                    *log << " Device  " << devIterator->GetID() << " already opened "
                                                        << std::endl;
                                                    *log << " AccessDeniedException " << ex.GetErrorDescription()
                                                        << std::endl;
                                                }
                                            }
                                        }
                                        catch (BGAPI2::Exceptions::IException& ex) {
                                            returncode = (returncode == 0) ? 1 : returncode;
                                            *log << "ExceptionType:    " << ex.GetType() << std::endl;
                                            *log << "ErrorDescription: " << ex.GetErrorDescription() << std::endl;
                                            *log << "in function:      " << ex.GetFunctionName() << std::endl;
                                        }
                                        pReason = "no camera match";
                                    }
                                }
                                *log << "5.1.13   Close interface (" << pReason << ") " << std::endl << std::endl;
                                pInterface->Close();
                                pMatch->pInterface = NULL;
                            }
                            catch (BGAPI2::Exceptions::ResourceInUseException& ex) {
                                returncode = (returncode == 0) ? 1 : returncode;
                                *log << " Interface " << ifIterator->GetID() << " already opened " << std::endl;
                                *log << " ResourceInUseException: " << ex.GetErrorDescription() << std::endl;
                            }
                        }
                    }
                    catch (BGAPI2::Exceptions::IException& ex) {
                        returncode = (returncode == 0) ? 1 : returncode;
                        *log << "ExceptionType:    " << ex.GetType() << std::endl;
                        *log << "ErrorDescription: " << ex.GetErrorDescription() << std::endl;
                        *log << "in function:      " << ex.GetFunctionName() << std::endl;
                    }
                    pCloseSystemReason = "no camera match";
                }
                *log << "        Close system (" << pCloseSystemReason << ") " << std::endl << std::endl;
                pSystem->Close();
                pMatch->pSystem = NULL;
            }
            catch (BGAPI2::Exceptions::ResourceInUseException& ex) {
                returncode = (returncode == 0) ? 1 : returncode;
                *log << " System " << sysIterator->GetID() << " already opened " << std::endl;
                *log << " ResourceInUseException: " << ex.GetErrorDescription() << std::endl;
            }
        }
    }
    catch (BGAPI2::Exceptions::IException& ex) {
        returncode = (returncode == 0) ? 1 : returncode;
        *log << "ExceptionType:    " << ex.GetType() << std::endl;
        *log << "ErrorDescription: " << ex.GetErrorDescription() << std::endl;
        *log << "in function:      " << ex.GetFunctionName() << std::endl;
    }
    return returncode;
}
// Helper to Display various information of the camera
void GetDeviceInfo(std::ostream* log, BGAPI2::Device* const pDevice, const bool bOpen) {
    *log << "5.1.7   Open device " << std::endl;
    *log << "          Device DeviceID:        " << pDevice->GetID() << std::endl;
    *log << "          Device Model:           " << pDevice->GetModel() << std::endl;
    *log << "          Device SerialNumber:    " << pDevice->GetSerialNumber() << std::endl;
    *log << "          Device Vendor:          " << pDevice->GetVendor() << std::endl;
    *log << "          Device TLType:          " << pDevice->GetTLType() << std::endl;
    *log << "          Device AccessStatus:    " << pDevice->GetAccessStatus() << std::endl;
    *log << "          Device UserID:          " << pDevice->GetDisplayName() << std::endl << std::endl;
    if (bOpen)
        pDevice->Open();
    *log << "        Opened device - RemoteNodeList Information " << std::endl;
    *log << "          Device AccessStatus:    " << pDevice->GetAccessStatus() << std::endl;
    BGAPI2::NodeMap* const pRemoteNodeList = pDevice->GetRemoteNodeList();
    // Serial number
    if (pRemoteNodeList->GetNodePresent("DeviceSerialNumber")) {
        *log << "          DeviceSerialNumber:     "
            << pRemoteNodeList->GetNode("DeviceSerialNumber")->GetValue() << std::endl;
    } else if (pRemoteNodeList->GetNodePresent("DeviceID")) {
        *log << "          DeviceID (SN):          "
            << pRemoteNodeList->GetNode("DeviceID")->GetValue() << std::endl;
    } else {
        *log << "          SerialNumber:           Not Available " << std::endl;
    }
    // Display DeviceManufacturerInfo
    if (pRemoteNodeList->GetNodePresent("DeviceManufacturerInfo")) {
        *log << "          DeviceManufacturerInfo: "
            << pRemoteNodeList->GetNode("DeviceManufacturerInfo")->GetValue() << std::endl;
    }
    // Display DeviceFirmwareVersion or DeviceVersion
    if (pRemoteNodeList->GetNodePresent("DeviceFirmwareVersion")) {
        *log << "          DeviceFirmwareVersion:  "
            << pRemoteNodeList->GetNode("DeviceFirmwareVersion")->GetValue() << std::endl;
    } else if (pRemoteNodeList->GetNodePresent("DeviceVersion")) {
        *log << "          DeviceVersion:          "
            << pRemoteNodeList->GetNode("DeviceVersion")->GetValue() << std::endl;
    } else {
        *log << "          DeviceVersion:          Not Available " << std::endl;
    }
    if (pDevice->GetTLType() == "GEV") {
        *log << "          GevCCP:                 "
            << pRemoteNodeList->GetNode("GevCCP")->GetValue() << std::endl;
        *log << "          GevCurrentIPAddress:    "
            << pRemoteNodeList->GetNode("GevCurrentIPAddress")->GetValue() << std::endl;
        *log << "          GevCurrentSubnetMask:   "
            << pRemoteNodeList->GetNode("GevCurrentSubnetMask")->GetValue() << std::endl;
    }
    *log << std::endl;
}
// Release all allocated resources
int ReleaseAllResources(BGAPI2::System* pSystem,
    BGAPI2::Interface* pInterface,
    BGAPI2::Device* pDevice,
    BGAPI2::DataStream* pDataStream,
    std::map<BGAPI2::Polarizer::Formats, BGAPI2::Image*>* requestedComponents) {
    try {
        if (pDataStream) {
            pDataStream->Close();
        }
        if (pDevice) {
            pDevice->Close();
        }
        if (pInterface) {
            pInterface->Close();
        }
        if (pSystem) {
            pSystem->Close();
        }
        BGAPI2::SystemList::ReleaseInstance();
        for (std::map<BGAPI2::Polarizer::Formats, BGAPI2::Image*>::iterator it = requestedComponents->begin();
            it != requestedComponents->end(); it++) {
            if (it->second != NULL) {
                it->second->Release();
                it->second = NULL;
            }
        }
        requestedComponents->clear();
    }
    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;
        return 1;
    }
    return 0;
}

偏振功能的优点

1、减少闪亮或光亮表面的眩光和反射,提高对比度以更好地检测缺陷或表面特征,并加强颜色区分。


2、它们还可以帮助提高汽车、电子和制造业等行业的自动检测和质量控制过程的准确性和速度。


3、偏振照相机在户外应用中很有用,因为那里有大量的阳光或大气雾霾,否则可能会干扰图像的清晰度。


偏振工业相机相对于普通工业相机的优势


偏光工业相机与普通工业相机相比有几个优点。


1、它们使用偏振滤光片来捕捉在单一方向上振动的光波,减少眩光和闪亮表面的反射。这导致了更清晰和更精确的图像,使其更容易识别高反射表面的缺陷或异常情况。


2、偏光相机还提供更好的对比度和颜色精度,允许精确的颜色测量和分析。


3、偏光相机可以在恶劣的环境条件下使用,并能捕捉到普通相机难以看到的物体的图像。


Baumer偏振相机的行业应用

偏光工业相机通常用于各种工业应用,如质量控制、缺陷检查、材料分析和表面检查。


它们有助于消除眩光和反射,提高玻璃、塑料、金属等各种材料的图像对比度和准确性。


偏光工业相机在检测隐藏的缺陷或污染物、识别材料中的应力点和检查隐藏结构方面也很有用。它们通常用于汽车、航空航天、电子和制造业等行业。


下面简单介绍几个能体现出偏振特性的行业应用:

3.png

2.png

1.png

目录
相关文章
|
1月前
|
存储 C++ UED
【实战指南】4步实现C++插件化编程,轻松实现功能定制与扩展
本文介绍了如何通过四步实现C++插件化编程,实现功能定制与扩展。主要内容包括引言、概述、需求分析、设计方案、详细设计、验证和总结。通过动态加载功能模块,实现软件的高度灵活性和可扩展性,支持快速定制和市场变化响应。具体步骤涉及配置文件构建、模块编译、动态库入口实现和主程序加载。验证部分展示了模块加载成功的日志和配置信息。总结中强调了插件化编程的优势及其在多个方面的应用。
227 64
|
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
|
3月前
|
JSON Android开发 C++
Android c++ core guideline checker 应用
Android c++ core guideline checker 应用
|
6天前
|
存储 编译器 C++
【c++】类和对象(中)(构造函数、析构函数、拷贝构造、赋值重载)
本文深入探讨了C++类的默认成员函数,包括构造函数、析构函数、拷贝构造函数和赋值重载。构造函数用于对象的初始化,析构函数用于对象销毁时的资源清理,拷贝构造函数用于对象的拷贝,赋值重载用于已存在对象的赋值。文章详细介绍了每个函数的特点、使用方法及注意事项,并提供了代码示例。这些默认成员函数确保了资源的正确管理和对象状态的维护。
29 4
|
7天前
|
存储 编译器 Linux
【c++】类和对象(上)(类的定义格式、访问限定符、类域、类的实例化、对象的内存大小、this指针)
本文介绍了C++中的类和对象,包括类的概念、定义格式、访问限定符、类域、对象的创建及内存大小、以及this指针。通过示例代码详细解释了类的定义、成员函数和成员变量的作用,以及如何使用访问限定符控制成员的访问权限。此外,还讨论了对象的内存分配规则和this指针的使用场景,帮助读者深入理解面向对象编程的核心概念。
25 4