Baumer工业相机堡盟相机如何使用PixelTransformation像素转换功能(像素转换功能的使用和优点以及行业应用)(C#)

news2024/11/24 20:46:03

项目场景 

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

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

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


技术背景

 Baumer工业相机 SDK开发工具包中的像素转换功能通常用于将来自相机传感器的数据转换成可由计算机处理的格式。该功能将原始像素数据(通常表示为一系列数字)转换为可在计算机屏幕上显示或用于进一步分析和处理的图像。

这个功能的具体细节取决于具体的SDK和正在使用的相机,可能有所不同。不过,一般来说,像素转换功能会考虑到相机传感器的颜色深度、用于传输数据的任何压缩或编码,以及可能影响原始像素数据表示方式的任何其他因素。

总的来说,像素转换功能是任何工业相机SDK开发工具包的一个重要组成部分,因为它允许用户以对广泛的应用有用和实用的方式处理相机产生的数据。

 Baumer工业相机 从环境中捕捉图像并将其转换为数字数据。像素转换功能是在模拟信号转换为数字信号的过程中发生的,其中每个像素的特征被修改,以优化所产生的图像的质量。

在mono8和mono12像素格式的情况下,该数字表示每个像素的比特深度。单8相机捕获的灰度图像有256级亮度,而单12相机捕获的灰度图像有4096级亮度。

在转换过程中,像素值根据各种算法进行转换,包括伽玛校正、色彩校正和数字增益,以确保图像准确地表现所拍摄的场景。例如,伽马校正,调整每个像素的亮度值,以补偿相机响应的非线性。


CameraExplorer使用像素转换功能


Baumer BGAPI SDK使用像素转换功能

 Baumer工业相机 堡盟相机SDK示例中005_PixelTransformation.cs详细介绍了如何配置像素转换功能。

软件SDK示例地址如下所示:Baumer_GAPI_SDK_2.12.0_win_x86_64_cs\examples\src\0_Common\005_PixelTransformation\005_PixelTransformation.cs

下面代码Demo演示如何通过 Baumer工业相机SDK中的Buffer转换Mono8和彩色像素转换为BGR8。本文将着重描述Baumer工业相机如何使用BGAPI SDK在C#的环境里完成图像像素的转换。

如下所示为C#的部分核心代码:

/*
  This example describes the FIRST STEPS of handling Baumer-GAPI SDK.
  The given source code applies to handling one system, one camera and eight images.
  Please see "Baumer-GAPI SDK Programmer's Guide" chapter 5.5
*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices; // Marshal.Copy()

namespace _005_PixelTransformation
{
    class Program
    {
        static int Main(string[] args)
        {
            //DECLARATIONS OF VARIABLES
            BGAPI2.ImageProcessor imgProcessor = null;
            byte[] imageBufferCopy;
            byte[] transformImageBufferCopy;

            BGAPI2.SystemList systemList = null;
            BGAPI2.System mSystem = null;
            string sSystemID = "";

            BGAPI2.InterfaceList interfaceList = null;
            BGAPI2.Interface mInterface = null;
            string sInterfaceID = "";

            BGAPI2.DeviceList deviceList = null;
            BGAPI2.Device mDevice = null;
            string sDeviceID = "";

            BGAPI2.DataStreamList datastreamList = null;
            BGAPI2.DataStream mDataStream = null;
            string sDataStreamID = "";

            BGAPI2.BufferList bufferList = null;
            BGAPI2.Buffer mBuffer = null;
            int returnCode = 0;

            System.Console.Write("\r\n");
            System.Console.Write("#########################################################\r\n");
            System.Console.Write("# PROGRAMMER'S GUIDE Example 005_PixelTransformation.cs #\r\n");
            System.Console.Write("#########################################################\r\n");
            System.Console.Write("\r\n\r\n");

            //LOAD IMAGE PROCESSOR
            try
            {
                imgProcessor = new BGAPI2.ImageProcessor();
                System.Console.Write("ImageProcessor version:    {0} \r\n", imgProcessor.GetVersion());
                if (imgProcessor.NodeList.GetNodePresent("DemosaicingMethod") == true)
                {
                    imgProcessor.NodeList["DemosaicingMethod"].Value = "NearestNeighbor"; // NearestNeighbor, Bilinear3x3, Baumer5x5
                    System.Console.Write("    Demosaicing method:    {0} \r\n", (string)imgProcessor.NodeList["DemosaicingMethod"].Value);
                }
                System.Console.Write("\r\n");
            }
            catch (BGAPI2.Exceptions.IException ex)
            {
                System.Console.Write("ExceptionType:    {0} \r\n", ex.GetType());
                System.Console.Write("ErrorDescription: {0} \r\n", ex.GetErrorDescription());
                System.Console.Write("in function:      {0} \r\n", ex.GetFunctionName());
            }


            System.Console.Write("SYSTEM LIST\r\n");
            System.Console.Write("###########\r\n\r\n");

            //COUNTING AVAILABLE SYSTEMS (TL producers)
            try
            {
                systemList = BGAPI2.SystemList.Instance;
                systemList.Refresh();
                System.Console.Write("5.1.2   Detected systems:  {0}\r\n", systemList.Count);

                //SYSTEM DEVICE INFORMATION
                foreach (KeyValuePair<string, BGAPI2.System> sys_pair in BGAPI2.SystemList.Instance)
                {
                    System.Console.Write("  5.2.1   System Name:     {0}\r\n", sys_pair.Value.FileName);
                    System.Console.Write("          System Type:     {0}\r\n", sys_pair.Value.TLType);
                    System.Console.Write("          System Version:  {0}\r\n", sys_pair.Value.Version);
                    System.Console.Write("          System PathName: {0}\r\n\r\n", sys_pair.Value.PathName);
                }
            }
            catch (BGAPI2.Exceptions.IException ex)
            {
                returnCode = (0 == returnCode) ? 1 : returnCode;
                System.Console.Write("ExceptionType:    {0} \r\n", ex.GetType());
                System.Console.Write("ErrorDescription: {0} \r\n", ex.GetErrorDescription());
                System.Console.Write("in function:      {0} \r\n", ex.GetFunctionName());
            }


            //OPEN THE FIRST SYSTEM IN THE LIST WITH A CAMERA CONNECTED
            try
            {
                foreach (KeyValuePair<string, BGAPI2.System> sys_pair in BGAPI2.SystemList.Instance)
                {
                    System.Console.Write("SYSTEM\r\n");
                    System.Console.Write("######\r\n\r\n");

                    try
                    {
                        sys_pair.Value.Open();
                        System.Console.Write("5.1.3   Open next system \r\n");
                        System.Console.Write("  5.2.1   System Name:     {0}\r\n", sys_pair.Value.FileName);
                        System.Console.Write("          System Type:     {0}\r\n", sys_pair.Value.TLType);
                        System.Console.Write("          System Version:  {0}\r\n", sys_pair.Value.Version);
                        System.Console.Write("          System PathName: {0}\r\n\r\n", sys_pair.Value.PathName);
                        sSystemID = sys_pair.Key;
                        System.Console.Write("        Opened system - NodeList Information \r\n");
                        System.Console.Write("          GenTL Version:   {0}.{1}\r\n\r\n", (long)sys_pair.Value.NodeList["GenTLVersionMajor"].Value, (long)sys_pair.Value.NodeList["GenTLVersionMinor"].Value);


                        System.Console.Write("INTERFACE LIST\r\n");
                        System.Console.Write("##############\r\n\r\n");

                        try
                        {
                            interfaceList = sys_pair.Value.Interfaces;
                            //COUNT AVAILABLE INTERFACES
                            interfaceList.Refresh(100); // timeout of 100 msec
                            System.Console.Write("5.1.4   Detected interfaces: {0}\r\n", interfaceList.Count);

                            //INTERFACE INFORMATION
                            foreach (KeyValuePair<string, BGAPI2.Interface> ifc_pair in interfaceList)
                            {
                                System.Console.Write("  5.2.2   Interface ID:      {0}\r\n", ifc_pair.Value.Id);
                                System.Console.Write("          Interface Type:    {0}\r\n", ifc_pair.Value.TLType);
                                System.Console.Write("          Interface Name:    {0}\r\n\r\n", ifc_pair.Value.DisplayName);
                            }
                        }
                        catch (BGAPI2.Exceptions.IException ex)
                        {
                            returnCode = (0 == returnCode) ? 1 : returnCode;
                            System.Console.Write("ExceptionType:    {0} \r\n", ex.GetType());
                            System.Console.Write("ErrorDescription: {0} \r\n", ex.GetErrorDescription());
                            System.Console.Write("in function:      {0} \r\n", ex.GetFunctionName());
                        }


                        System.Console.Write("INTERFACE\r\n");
                        System.Console.Write("#########\r\n\r\n");

                        //OPEN THE NEXT INTERFACE IN THE LIST
                        try
                        {
                            foreach (KeyValuePair<string, BGAPI2.Interface> ifc_pair in interfaceList)
                            {
                                try
                                {
                                    System.Console.Write("5.1.5   Open interface \r\n");
                                    System.Console.Write("  5.2.2   Interface ID:      {0}\r\n", ifc_pair.Key);
                                    System.Console.Write("          Interface Type:    {0}\r\n", ifc_pair.Value.TLType);
                                    System.Console.Write("          Interface Name:    {0}\r\n", ifc_pair.Value.DisplayName);
                                    ifc_pair.Value.Open();
                                    //search for any camera is connetced to this interface
                                    deviceList = ifc_pair.Value.Devices;
                                    deviceList.Refresh(100);
                                    if (deviceList.Count == 0)
                                    {
                                        System.Console.Write("5.1.13   Close interface ({0} cameras found) \r\n\r\n", deviceList.Count);
                                        ifc_pair.Value.Close();
                                    }
                                    else
                                    {
                                        sInterfaceID = ifc_pair.Key;
                                        System.Console.Write("  \r\n");
                                        System.Console.Write("        Opened interface - NodeList Information \r\n");
                                        if (ifc_pair.Value.TLType == "GEV")
                                        {
                                            long iIPAddress = (long)ifc_pair.Value.NodeList["GevInterfaceSubnetIPAddress"].Value;
                                            System.Console.Write("          GevInterfaceSubnetIPAddress: {0}.{1}.{2}.{3}\r\n", (iIPAddress & 0xff000000) >> 24,
                                                                                                                            (iIPAddress & 0x00ff0000) >> 16,
                                                                                                                            (iIPAddress & 0x0000ff00) >> 8,
                                                                                                                            (iIPAddress & 0x000000ff));
                                            long iSubnetMask = (long)ifc_pair.Value.NodeList["GevInterfaceSubnetMask"].Value;
                                            System.Console.Write("          GevInterfaceSubnetMask:      {0}.{1}.{2}.{3}\r\n", (iSubnetMask & 0xff000000) >> 24,
                                                                                                                            (iSubnetMask & 0x00ff0000) >> 16,
                                                                                                                            (iSubnetMask & 0x0000ff00) >> 8,
                                                                                                                            (iSubnetMask & 0x000000ff));
                                        }
                                        if (ifc_pair.Value.TLType == "U3V")
                                        {
                                            //System.Console.Write("          NodeListCount:               {0}\r\n", ifc_pair.Value.NodeList.Count);
                                        }
                                        System.Console.Write("  \r\n");
                                        break;
                                    }
                                }
                                catch (BGAPI2.Exceptions.ResourceInUseException ex)
                                {
                                    returnCode = (0 == returnCode) ? 1 : returnCode;
                                    System.Console.Write(" Interface {0} already opened \r\n", ifc_pair.Key);
                                    System.Console.Write(" ResourceInUseException {0} \r\n", ex.GetErrorDescription());
                                }
                            }
                        }
                        catch (BGAPI2.Exceptions.IException ex)
                        {
                            returnCode = (0 == returnCode) ? 1 : returnCode;
                            System.Console.Write("ExceptionType:    {0} \r\n", ex.GetType());
                            System.Console.Write("ErrorDescription: {0} \r\n", ex.GetErrorDescription());
                            System.Console.Write("in function:      {0} \r\n", ex.GetFunctionName());
                        }

                        //if a camera is connected to the system interface then leave the system loop
                        if (sInterfaceID != "")
                        {
                            break;
                        }
                    }
                    catch (BGAPI2.Exceptions.ResourceInUseException ex)
                    {
                        returnCode = (0 == returnCode) ? 1 : returnCode;
                        System.Console.Write(" System {0} already opened \r\n", sys_pair.Key);
                        System.Console.Write(" ResourceInUseException {0} \r\n", ex.GetErrorDescription());
                    }
                }
            }
            catch (BGAPI2.Exceptions.IException ex)
            {
                returnCode = (0 == returnCode) ? 1 : returnCode;
                System.Console.Write("ExceptionType:    {0} \r\n", ex.GetType());
                System.Console.Write("ErrorDescription: {0} \r\n", ex.GetErrorDescription());
                System.Console.Write("in function:      {0} \r\n", ex.GetFunctionName());
            }

            if (sSystemID == "")
            {
                System.Console.Write(" No System found \r\n");
                System.Console.Write(" Input any number to close the program:\r\n");
                Console.Read();
                return returnCode;
            }
            else
            {
                mSystem = systemList[sSystemID];
            }


            if (sInterfaceID == "")
            {
                System.Console.Write(" No Interface of TLType 'GEV' found \r\n");
                System.Console.Write("\r\nEnd\r\nInput any number to close the program:\r\n");
                Console.Read();
                mSystem.Close();
                return returnCode;
            }
            else
            {
                mInterface = interfaceList[sInterfaceID];
            }


            System.Console.Write("DEVICE LIST\r\n");
            System.Console.Write("###########\r\n\r\n");

            try
            {
                //COUNTING AVAILABLE CAMERAS
                deviceList = mInterface.Devices;
                deviceList.Refresh(100);
                System.Console.Write("5.1.6   Detected devices:         {0}\r\n", deviceList.Count);

                //DEVICE INFORMATION BEFORE OPENING
                foreach (KeyValuePair<string, BGAPI2.Device> dev_pair in deviceList)
                {
                    System.Console.Write("  5.2.3   Device DeviceID:        {0}\r\n", dev_pair.Key);
                    System.Console.Write("          Device Model:           {0}\r\n", dev_pair.Value.Model);
                    System.Console.Write("          Device SerialNumber:    {0}\r\n", dev_pair.Value.SerialNumber);
                    System.Console.Write("          Device Vendor:          {0}\r\n", dev_pair.Value.Vendor);
                    System.Console.Write("          Device TLType:          {0}\r\n", dev_pair.Value.TLType);
                    System.Console.Write("          Device AccessStatus:    {0}\r\n", dev_pair.Value.AccessStatus);
                    System.Console.Write("          Device UserID:          {0}\r\n\r\n", dev_pair.Value.DisplayName);
                }
            }
            catch (BGAPI2.Exceptions.IException ex)
            {
                returnCode = (0 == returnCode) ? 1 : returnCode;
                System.Console.Write("ExceptionType:    {0} \r\n", ex.GetType());
                System.Console.Write("ErrorDescription: {0} \r\n", ex.GetErrorDescription());
                System.Console.Write("in function:      {0} \r\n", ex.GetFunctionName());
            }


            System.Console.Write("DEVICE\r\n");
            System.Console.Write("######\r\n\r\n");

            //OPEN THE FIRST CAMERA IN THE LIST
            try
            {
                foreach (KeyValuePair<string, BGAPI2.Device> dev_pair in deviceList)
                {
                    try
                    {
                        System.Console.Write("5.1.7   Open first device \r\n");
                        System.Console.Write("          Device DeviceID:        {0}\r\n", dev_pair.Value.Id);
                        System.Console.Write("          Device Model:           {0}\r\n", dev_pair.Value.Model);
                        System.Console.Write("          Device SerialNumber:    {0}\r\n", dev_pair.Value.SerialNumber);
                        System.Console.Write("          Device Vendor:          {0}\r\n", dev_pair.Value.Vendor);
                        System.Console.Write("          Device TLType:          {0}\r\n", dev_pair.Value.TLType);
                        System.Console.Write("          Device AccessStatus:    {0}\r\n", dev_pair.Value.AccessStatus);
                        System.Console.Write("          Device UserID:          {0}\r\n\r\n", dev_pair.Value.DisplayName);
                        dev_pair.Value.Open();
                        sDeviceID = dev_pair.Key;
                        System.Console.Write("        Opened device - RemoteNodeList Information \r\n");
                        System.Console.Write("          Device AccessStatus:    {0}\r\n", dev_pair.Value.AccessStatus);

                        //SERIAL NUMBER
                        if (dev_pair.Value.RemoteNodeList.GetNodePresent("DeviceSerialNumber") == true)
                            System.Console.Write("          DeviceSerialNumber:     {0}\r\n", (string)dev_pair.Value.RemoteNodeList["DeviceSerialNumber"].Value);
                        else if (dev_pair.Value.RemoteNodeList.GetNodePresent("DeviceID") == true)
                            System.Console.Write("          DeviceID (SN):          {0}\r\n", (string)dev_pair.Value.RemoteNodeList["DeviceID"].Value);
                        else
                            System.Console.Write("          SerialNumber:           Not Available \r\n");

                        //DISPLAY DEVICEMANUFACTURERINFO
                        if (dev_pair.Value.RemoteNodeList.GetNodePresent("DeviceManufacturerInfo") == true)
                            System.Console.Write("          DeviceManufacturerInfo: {0}\r\n", (string)dev_pair.Value.RemoteNodeList["DeviceManufacturerInfo"].Value);

                        //DISPLAY DEVICEFIRMWAREVERSION OR DEVICEVERSION
                        if (dev_pair.Value.RemoteNodeList.GetNodePresent("DeviceFirmwareVersion") == true)
                            System.Console.Write("          DeviceFirmwareVersion:  {0}\r\n", (string)dev_pair.Value.RemoteNodeList["DeviceFirmwareVersion"].Value);
                        else if (dev_pair.Value.RemoteNodeList.GetNodePresent("DeviceVersion") == true)
                            System.Console.Write("          DeviceVersion:          {0}\r\n", (string)dev_pair.Value.RemoteNodeList["DeviceVersion"].Value);
                        else
                            System.Console.Write("          DeviceVersion:          Not Available \r\n");

                        if (dev_pair.Value.TLType == "GEV")
                        {
                            System.Console.Write("          GevCCP:                 {0}\r\n", (string)dev_pair.Value.RemoteNodeList["GevCCP"].Value);
                            System.Console.Write("          GevCurrentIPAddress:    {0}.{1}.{2}.{3}\r\n", ((long)dev_pair.Value.RemoteNodeList["GevCurrentIPAddress"].Value & 0xff000000) >> 24, ((long)dev_pair.Value.RemoteNodeList["GevCurrentIPAddress"].Value & 0x00ff0000) >> 16, ((long)dev_pair.Value.RemoteNodeList["GevCurrentIPAddress"].Value & 0x0000ff00) >> 8, ((long)dev_pair.Value.RemoteNodeList["GevCurrentIPAddress"].Value & 0x000000ff));
                            System.Console.Write("          GevCurrentSubnetMask:   {0}.{1}.{2}.{3}\r\n", ((long)dev_pair.Value.RemoteNodeList["GevCurrentSubnetMask"].Value & 0xff000000) >> 24, ((long)dev_pair.Value.RemoteNodeList["GevCurrentSubnetMask"].Value & 0x00ff0000) >> 16, ((long)dev_pair.Value.RemoteNodeList["GevCurrentSubnetMask"].Value & 0x0000ff00) >> 8, ((long)dev_pair.Value.RemoteNodeList["GevCurrentSubnetMask"].Value & 0x000000ff));
                        }
                        System.Console.Write("          \r\n");
                        break;
                    }
                    catch (BGAPI2.Exceptions.ResourceInUseException ex)
                    {
                        returnCode = (0 == returnCode) ? 1 : returnCode;
                        System.Console.Write(" Device {0} already opened  \r\n", dev_pair.Key);
                        System.Console.Write(" ResourceInUseException {0} \r\n", ex.GetErrorDescription());
                    }
                    catch (BGAPI2.Exceptions.AccessDeniedException ex)
                    {
                        returnCode = (0 == returnCode) ? 1 : returnCode;
                        System.Console.Write(" Device {0} already opened \r\n", dev_pair.Key);
                        System.Console.Write(" AccessDeniedException {0} \r\n", ex.GetErrorDescription());
                    }
                }
            }
            catch (BGAPI2.Exceptions.IException ex)
            {
                returnCode = (0 == returnCode) ? 1 : returnCode;
                System.Console.Write("ExceptionType:    {0} \r\n", ex.GetType());
                System.Console.Write("ErrorDescription: {0} \r\n", ex.GetErrorDescription());
                System.Console.Write("in function:      {0} \r\n", ex.GetFunctionName());
            }

            if (sDeviceID == "")
            {
                System.Console.Write(" No Device found \r\n");
                System.Console.Write("\r\nEnd\r\nInput any number to close the program:\r\n");
                Console.Read();
                mInterface.Close();
                mSystem.Close();
                return returnCode;
            }
            else
            {
                mDevice = deviceList[sDeviceID];
            }


            System.Console.Write("DEVICE PARAMETER SETUP\r\n");
            System.Console.Write("######################\r\n\r\n");

            try
            {
                //SET TRIGGER MODE OFF (FreeRun)
                mDevice.RemoteNodeList["TriggerMode"].Value = "Off";
                System.Console.Write("         TriggerMode:             {0}\r\n", (string)mDevice.RemoteNodeList["TriggerMode"].Value);
                System.Console.Write("  \r\n");
            }
            catch (BGAPI2.Exceptions.IException ex)
            {
                returnCode = (0 == returnCode) ? 1 : returnCode;
                System.Console.Write("ExceptionType:    {0} \r\n", ex.GetType());
                System.Console.Write("ErrorDescription: {0} \r\n", ex.GetErrorDescription());
                System.Console.Write("in function:      {0} \r\n", ex.GetFunctionName());
            }


            System.Console.Write("DATA STREAM LIST\r\n");
            System.Console.Write("################\r\n\r\n");

            try
            {
                //COUNTING AVAILABLE DATASTREAMS
                datastreamList = mDevice.DataStreams;
                datastreamList.Refresh();
                System.Console.Write("5.1.8   Detected datastreams:     {0}\r\n", datastreamList.Count);

                //DATASTREAM INFORMATION BEFORE OPENING
                foreach (KeyValuePair<string, BGAPI2.DataStream> dst_pair in datastreamList)
                {
                    System.Console.Write("  5.2.4   DataStream ID:          {0}\r\n\r\n", dst_pair.Key);
                }
            }
            catch (BGAPI2.Exceptions.IException ex)
            {
                returnCode = (0 == returnCode) ? 1 : returnCode;
                System.Console.Write("ExceptionType:    {0} \r\n", ex.GetType());
                System.Console.Write("ErrorDescription: {0} \r\n", ex.GetErrorDescription());
                System.Console.Write("in function:      {0} \r\n", ex.GetFunctionName());
            }


            System.Console.Write("DATA STREAM\r\n");
            System.Console.Write("###########\r\n\r\n");

            //OPEN THE FIRST DATASTREAM IN THE LIST
            try
            {
                foreach (KeyValuePair<string, BGAPI2.DataStream> dst_pair in datastreamList)
                {
                    System.Console.Write("5.1.9   Open first datastream \r\n");
                    System.Console.Write("          DataStream ID:          {0}\r\n\r\n", dst_pair.Key);
                    dst_pair.Value.Open();
                    sDataStreamID = dst_pair.Key;
                    System.Console.Write("        Opened datastream - NodeList Information \r\n");
                    System.Console.Write("          StreamAnnounceBufferMinimum:  {0}\r\n", dst_pair.Value.NodeList["StreamAnnounceBufferMinimum"].Value);
                    if (dst_pair.Value.TLType == "GEV")
                    {
                        System.Console.Write("          StreamDriverModel:            {0}\r\n", dst_pair.Value.NodeList["StreamDriverModel"].Value);
                    }
                    System.Console.Write("  \r\n");
                    break;
                }
            }
            catch (BGAPI2.Exceptions.IException ex)
            {
                returnCode = (0 == returnCode) ? 1 : returnCode;
                System.Console.Write("ExceptionType:    {0} \r\n", ex.GetType());
                System.Console.Write("ErrorDescription: {0} \r\n", ex.GetErrorDescription());
                System.Console.Write("in function:      {0} \r\n", ex.GetFunctionName());
            }

            if (sDataStreamID == "")
            {
                System.Console.Write(" No DataStream found \r\n");
                System.Console.Write("\r\nEnd\r\nInput any number to close the program:\r\n");
                Console.Read();
                mDevice.Close();
                mInterface.Close();
                mSystem.Close();
                return returnCode;
            }
            else
            {
                mDataStream = datastreamList[sDataStreamID];
            }


            System.Console.Write("BUFFER LIST\r\n");
            System.Console.Write("###########\r\n\r\n");

            try
            {
                //BufferList
                bufferList = mDataStream.BufferList;

                // 4 buffers using internal buffer mode
                for (int i = 0; i < 4; i++)
                {
                    mBuffer = new BGAPI2.Buffer();
                    bufferList.Add(mBuffer);
                }
                System.Console.Write("5.1.10   Announced buffers:       {0} using {1} [bytes]\r\n", bufferList.AnnouncedCount, mBuffer.MemSize * bufferList.AnnouncedCount);
            }
            catch (BGAPI2.Exceptions.IException ex)
            {
                returnCode = (0 == returnCode) ? 1 : returnCode;
                System.Console.Write("ExceptionType:    {0} \r\n", ex.GetType());
                System.Console.Write("ErrorDescription: {0} \r\n", ex.GetErrorDescription());
                System.Console.Write("in function:      {0} \r\n", ex.GetFunctionName());
            }


            try
            {
                foreach (KeyValuePair<string, BGAPI2.Buffer> buf_pair in bufferList)
                {
                    buf_pair.Value.QueueBuffer();
                }
                System.Console.Write("5.1.11   Queued buffers:          {0}\r\n", bufferList.QueuedCount);
            }
            catch (BGAPI2.Exceptions.IException ex)
            {
                returnCode = (0 == returnCode) ? 1 : returnCode;
                System.Console.Write("ExceptionType:    {0} \r\n", ex.GetType());
                System.Console.Write("ErrorDescription: {0} \r\n", ex.GetErrorDescription());
                System.Console.Write("in function:      {0} \r\n", ex.GetFunctionName());
            }
            System.Console.Write("\r\n");


            System.Console.Write("CAMERA START\r\n");
            System.Console.Write("############\r\n\r\n");

            //START DATASTREAM ACQUISITION
            try
            {
                mDataStream.StartAcquisition(4);
                System.Console.Write("5.1.12   DataStream started \r\n");
            }
            catch (BGAPI2.Exceptions.IException ex)
            {
                returnCode = (0 == returnCode) ? 1 : returnCode;
                System.Console.Write("ExceptionType:    {0} \r\n", ex.GetType());
                System.Console.Write("ErrorDescription: {0} \r\n", ex.GetErrorDescription());
                System.Console.Write("in function:      {0} \r\n", ex.GetFunctionName());
            }

            //START CAMERA
            try
            {
                mDevice.RemoteNodeList["AcquisitionStart"].Execute();
                System.Console.Write("5.1.12   {0} started \r\n", mDevice.Model);
            }
            catch (BGAPI2.Exceptions.IException ex)
            {
                returnCode = (0 == returnCode) ? 1 : returnCode;
                System.Console.Write("ExceptionType:    {0} \r\n", ex.GetType());
                System.Console.Write("ErrorDescription: {0} \r\n", ex.GetErrorDescription());
                System.Console.Write("in function:      {0} \r\n", ex.GetFunctionName());
            }

            //CAPTURE 8 IMAGES
            System.Console.Write("\r\n");
            System.Console.Write("CAPTURE & TRANSFORM 4 IMAGES\r\n");
            System.Console.Write("############################\r\n\r\n");

            BGAPI2.Buffer mBufferFilled = null;
            try
            {
                BGAPI2.Node pixelFormatInfoSelector = imgProcessor.NodeList["PixelFormatInfoSelector"];
                BGAPI2.Node bytesPerPixel = imgProcessor.NodeList["BytesPerPixel"];

                BGAPI2.Image mImage = imgProcessor.CreateImage();
                for (int i = 0; i < 4; i++)
                {
                    mBufferFilled = mDataStream.GetFilledBuffer(1000); // image polling timeout 1000 msec
                    if (mBufferFilled == null)
                    {
                        System.Console.Write("Error: Buffer Timeout after 1000 msec\r\n");
                    }
                    else if (mBuffer.IsIncomplete == true)
                    {
                        System.Console.Write("Error: Image is incomplete\r\n");
                        // queue buffer again
                        mBufferFilled.QueueBuffer();
                    }
                    else
                    {
                        System.Console.Write(" Image {0, 5:d} received in memory address {1:X}\r\n", mBufferFilled.FrameID, (ulong)mBufferFilled.MemPtr);

                        //create an image object from the filled buffer and convert it
                        BGAPI2.Image mTransformImage = null;
                        mImage.Init(mBufferFilled);
                        System.Console.Write("  mImage.Pixelformat:             {0}\r\n", mImage.PixelFormat);
                        System.Console.Write("  mImage.Width:                   {0}\r\n", mImage.Width);
                        System.Console.Write("  mImage.Height:                  {0}\r\n", mImage.Height);
                        System.Console.Write("  mImage.Buffer:                  {0:X8}\r\n", (ulong)mImage.Buffer);

                        pixelFormatInfoSelector.Value = mBufferFilled.PixelFormat;
                        double fBytesPerPixel = bytesPerPixel.IsAvailable ? bytesPerPixel.Value.ToDouble() : 0.0;

                        System.Console.Write("  Bytes per image:                {0}\r\n", (long)((uint)mImage.Width * (uint)mImage.Height * fBytesPerPixel));
                        System.Console.Write("  Bytes per pixel:                {0}\r\n", fBytesPerPixel);

                        //COPY UNMANAGED IMAGEBUFFER TO A MANAGED BYTE ARRAY
                        imageBufferCopy = new byte[(uint)((uint)mImage.Width * (uint)mImage.Height * fBytesPerPixel)];
                        Marshal.Copy(mImage.Buffer, imageBufferCopy, 0, (int)((int)mImage.Width * (int)mImage.Height * fBytesPerPixel));
                        ulong imageBufferAddress = (ulong)mImage.Buffer;

                        // display first 6 pixel values of first 6 lines of the image
                        //========================================================================
                        System.Console.Write("  Address\r\n");
                        for (int j = 0; j < 6; j++) // first 6 lines
                        {
                            imageBufferAddress = (ulong)mImage.Buffer + (ulong)((int)mImage.Width * (int)j * fBytesPerPixel);
                            System.Console.Write("  {0:X8} ", imageBufferAddress);
                            for (int k = 0; k < (int)(6 * fBytesPerPixel); k++) // bytes of first 6 pixels of that line
                            {
                                System.Console.Write(" {0:X2}", imageBufferCopy[(uint)(mImage.Width * j * fBytesPerPixel) + k]); // byte
                            }
                            System.Console.Write(" ...\r\n");
                        }

                        if ((string)mImage.PixelFormat.Substring(0, 4) == "Mono")  // if pixel format starts with "Mono"
                        {
                            //transform to Mono8
                            mTransformImage = imgProcessor.CreateTransformedImage(mImage, "Mono8");
                            System.Console.Write(" Image {0, 5:d} transformed to Mono8\r\n", mBufferFilled.FrameID);
                            System.Console.Write("  mTransformImage.Pixelformat:    {0}\r\n", mTransformImage.PixelFormat);
                            System.Console.Write("  mTransformImage.Width:          {0}\r\n", mTransformImage.Width);
                            System.Console.Write("  mTransformImage.Height:         {0}\r\n", mTransformImage.Height);
                            System.Console.Write("  mTransformImage.Buffer:         {0:X8}\r\n", (ulong)mTransformImage.Buffer);
                            System.Console.Write("  Bytes per image:                {0}\r\n", (long)((uint)mTransformImage.Width * (uint)mTransformImage.Height * 1.0));
                            System.Console.Write("  Bytes per pixel:                {0}\r\n", 1.0);

                            transformImageBufferCopy = new byte[(uint)((uint)mTransformImage.Width * (uint)mTransformImage.Height * 1.0)];
                            Marshal.Copy(mTransformImage.Buffer, transformImageBufferCopy, 0, (int)((int)mTransformImage.Width * (int)mTransformImage.Height * 1.0));
                            ulong transformImageBufferAddress = (ulong)mTransformImage.Buffer;

                            // display first 6 pixel values of first 6 lines of the transformed image
                            //========================================================================
                            System.Console.Write("  Address    Y  Y  Y  Y  Y  Y \r\n");
                            for (int j = 0; j < 6; j++) // first 6 lines
                            {
                                transformImageBufferAddress = (ulong)mTransformImage.Buffer + (ulong)((int)mTransformImage.Width * (int)j * 1.0);
                                System.Console.Write("  {0:X8} ", transformImageBufferAddress);
                                for (int k = 0; k < 6; k++) // bytes of first 6 pixels of that line
                                {
                                    System.Console.Write(" {0:X2}", transformImageBufferCopy[(uint)mBufferFilled.Width * j + k]); // byte
                                }
                                System.Console.Write(" ...\r\n");
                            }
                        }
                        else // if color format
                        {
                            //transform to BGR8
                            mTransformImage = imgProcessor.CreateTransformedImage(mImage, "BGR8");
                            System.Console.Write(" Image {0, 5:d} transformed to BGR8\r\n", mBufferFilled.FrameID);
                            System.Console.Write("  mTransformImage.Pixelformat:    {0}\r\n", mTransformImage.PixelFormat);
                            System.Console.Write("  mTransformImage.Width:          {0}\r\n", mTransformImage.Width);
                            System.Console.Write("  mTransformImage.Height:         {0}\r\n", mTransformImage.Height);
                            System.Console.Write("  mTransformImage.Buffer:         {0:X8}\r\n", (ulong)mTransformImage.Buffer);
                            System.Console.Write("  Bytes per image:                {0}\r\n", (long)((uint)mTransformImage.Width * (uint)mTransformImage.Height * 3.0));
                            System.Console.Write("  Bytes per pixel:                {0}\r\n", 3.0);

                            transformImageBufferCopy = new byte[(uint)((uint)mTransformImage.Width * (uint)mTransformImage.Height * 3.0)];
                            Marshal.Copy(mTransformImage.Buffer, transformImageBufferCopy, 0, (int)((int)mTransformImage.Width * (int)mTransformImage.Height * 3.0));
                            ulong transformImageBufferAddress = (ulong)mTransformImage.Buffer;

                            // display first 6 pixel values of first 6 lines of the transformed image
                            //========================================================================
                            System.Console.Write("  Address    B  G  R  B  G  R  B  G  R  B  G  R  B  G  R  B  G  R\r\n");
                            for (int j = 0; j < 6; j++) // first 6 lines
                            {
                                transformImageBufferAddress = (ulong)mTransformImage.Buffer + (ulong)((int)mTransformImage.Width * (int)j * 3.0);
                                System.Console.Write("  {0:X8} ", transformImageBufferAddress);
                                for (int k = 0; k < 6; k++) // bytes of first 6 pixels of that line
                                {
                                    System.Console.Write(" {0:X2}", transformImageBufferCopy[(uint)mTransformImage.Width * 3 * j + k * 3 + 0]); // Blue value of pixel
                                    System.Console.Write(" {0:X2}", transformImageBufferCopy[(uint)mTransformImage.Width * 3 * j + k * 3 + 1]); // Green value of pixel
                                    System.Console.Write(" {0:X2}", transformImageBufferCopy[(uint)mTransformImage.Width * 3 * j + k * 3 + 2]); // Red value of pixel
                                }
                                System.Console.Write(" ...\r\n");
                            }
                        }
                        System.Console.Write(" \r\n");
                        if (mTransformImage != null) mTransformImage.Release();

                        // queue buffer again
                        mBufferFilled.QueueBuffer();
                    }
                }
                if (mImage != null) mImage.Release();
            }
            catch (BGAPI2.Exceptions.IException ex)
            {
                returnCode = (0 == returnCode) ? 1 : returnCode;
                System.Console.Write("ExceptionType:    {0} \r\n", ex.GetType());
                System.Console.Write("ErrorDescription: {0} \r\n", ex.GetErrorDescription());
                System.Console.Write("in function:      {0} \r\n", ex.GetFunctionName());
            }
            System.Console.Write("\r\n");


            System.Console.Write("CAMERA STOP\r\n");
            System.Console.Write("###########\r\n\r\n");

            //STOP CAMERA
            try
            {
                if (mDevice.RemoteNodeList.GetNodePresent("AcquisitionAbort") == true)
                {
                    mDevice.RemoteNodeList["AcquisitionAbort"].Execute();
                    System.Console.Write("5.1.12   {0} aborted\r\n", mDevice.Model);
                }

                mDevice.RemoteNodeList["AcquisitionStop"].Execute();
                System.Console.Write("5.1.12   {0} stopped\r\n", mDevice.Model);
                System.Console.Write("\r\n");

                String sExposureNodeName = "";
                if (mDevice.GetRemoteNodeList().GetNodePresent("ExposureTime"))
                {
                    sExposureNodeName = "ExposureTime";
                }
                else if (mDevice.GetRemoteNodeList().GetNodePresent("ExposureTimeAbs"))
                {
                    sExposureNodeName = "ExposureTimeAbs";
                }

                System.Console.Write("         ExposureTime:                   {0} [{1}]\r\n", (double)mDevice.RemoteNodeList[sExposureNodeName].Value, (string)mDevice.RemoteNodeList[sExposureNodeName].Unit);
                if (mDevice.TLType == "GEV")
                {
                    if (mDevice.RemoteNodeList.GetNodePresent("DeviceStreamChannelPacketSize") == true)
                        System.Console.Write("         DeviceStreamChannelPacketSize:  {0} [bytes]\r\n", (long)mDevice.RemoteNodeList["DeviceStreamChannelPacketSize"].Value);
                    else
                        System.Console.Write("         GevSCPSPacketSize:              {0} [bytes]\r\n", (long)mDevice.RemoteNodeList["GevSCPSPacketSize"].Value);
                    System.Console.Write("         GevSCPD (PacketDelay):          {0} [tics]\r\n", (long)mDevice.RemoteNodeList["GevSCPD"].Value);
                }
                System.Console.Write("\r\n");
            }
            catch (BGAPI2.Exceptions.IException ex)
            {
                returnCode = (0 == returnCode) ? 1 : returnCode;
                System.Console.Write("ExceptionType:    {0} \r\n", ex.GetType());
                System.Console.Write("ErrorDescription: {0} \r\n", ex.GetErrorDescription());
                System.Console.Write("in function:      {0} \r\n", ex.GetFunctionName());
            }


            //STOP DataStream acquisition & release buffers
            try
            {
                if (mDataStream.TLType == "GEV")
                {
                    //DataStream Statistics
                    System.Console.Write("         DataStream Statistics \r\n");
                    System.Console.Write("           DataBlockComplete:              {0}\r\n", (long)mDataStream.NodeList["DataBlockComplete"].Value);
                    System.Console.Write("           DataBlockInComplete:            {0}\r\n", (long)mDataStream.NodeList["DataBlockInComplete"].Value);
                    System.Console.Write("           DataBlockMissing:               {0}\r\n", (long)mDataStream.NodeList["DataBlockMissing"].Value);
                    System.Console.Write("           PacketResendRequestSingle:      {0}\r\n", (long)mDataStream.NodeList["PacketResendRequestSingle"].Value);
                    System.Console.Write("           PacketResendRequestRange:       {0}\r\n", (long)mDataStream.NodeList["PacketResendRequestRange"].Value);
                    System.Console.Write("           PacketResendReceive:            {0}\r\n", (long)mDataStream.NodeList["PacketResendReceive"].Value);
                    System.Console.Write("           DataBlockDroppedBufferUnderrun: {0}\r\n", (long)mDataStream.NodeList["DataBlockDroppedBufferUnderrun"].Value);
                    System.Console.Write("           Bitrate:                        {0}\r\n", (double)mDataStream.NodeList["Bitrate"].Value);
                    System.Console.Write("           Throughput:                     {0}\r\n", (double)mDataStream.NodeList["Throughput"].Value);
                    System.Console.Write("\r\n");
                }
                if (mDataStream.TLType == "U3V")
                {
                    //DataStream Statistics
                    System.Console.Write("         DataStream Statistics \r\n");
                    System.Console.Write("           GoodFrames:            {0}\r\n", (long)mDataStream.NodeList["GoodFrames"].Value);
                    System.Console.Write("           CorruptedFrames:       {0}\r\n", (long)mDataStream.NodeList["CorruptedFrames"].Value);
                    System.Console.Write("           LostFrames:            {0}\r\n", (long)mDataStream.NodeList["LostFrames"].Value);
                    System.Console.Write("\r\n");
                }
                mDataStream.StopAcquisition();
                System.Console.Write("5.1.12   DataStream stopped \r\n");
                bufferList.DiscardAllBuffers();
            }
            catch (BGAPI2.Exceptions.IException ex)
            {
                returnCode = (0 == returnCode) ? 1 : returnCode;
                System.Console.Write("ExceptionType:    {0} \r\n", ex.GetType());
                System.Console.Write("ErrorDescription: {0} \r\n", ex.GetErrorDescription());
                System.Console.Write("in function:      {0} \r\n", ex.GetFunctionName());
            }
            System.Console.Write("\r\n");


            System.Console.Write("RELEASE\r\n");
            System.Console.Write("#######\r\n\r\n");

            //Release buffers
            System.Console.Write("5.1.13   Releasing the resources\r\n");
            try
            {
                while (bufferList.Count > 0)
                {
                    mBuffer = (BGAPI2.Buffer)bufferList.Values.First();
                    bufferList.RevokeBuffer(mBuffer);
                }
                System.Console.Write("         buffers after revoke:    {0}\r\n", bufferList.Count);

                mDataStream.Close();
                mDevice.Close();
                mInterface.Close();
                mSystem.Close();
            }
            catch (BGAPI2.Exceptions.IException ex)
            {
                returnCode = (0 == returnCode) ? 1 : returnCode;
                System.Console.Write("ExceptionType:    {0} \r\n", ex.GetType());
                System.Console.Write("ErrorDescription: {0} \r\n", ex.GetErrorDescription());
                System.Console.Write("in function:      {0} \r\n", ex.GetFunctionName());
            }

            System.Console.Write("\r\nEnd\r\n\r\n");
            System.Console.Write("Input any number to close the program:\r\n");
            Console.Read();
            return returnCode;
        }
    }
}


 Baumer工业相机 图像转换的优势

 Baumer工业相机 的像素变换功能有几个优点,例如。

1. 提高图像质量。像素变换有助于纠正图像的失真和非线性,从而使图像更清晰、明确。

2. 提高准确性和精确性。通过纠正图像的失真和非线性,像素变换有助于提高测量和分析的准确性和精确度。

3. 不同相机之间的一致性。像素变换可用于校准不同的相机,从而产生一致和准确的结果。

4.  提高效率。通过校正失真和非线性,像素转换消除了对额外的后处理步骤的需要,节省了时间和精力。

5. 更大的灵活性。像素转换可以定制,以适应特定的应用,使图像采集和分析更加的灵活和便捷。


 Baumer工业相机 图像转换的行业应用

 Baumer工业相机 的像素转换功能可用于各种场景,如。

1. 图像校正。像素变换功能可用于纠正图像失真和其他由相机镜头引起的缺陷,如色差、晕影和透视变形。

2. 色彩校正。该功能可用于调整图像的色彩平衡、饱和度和其他与色彩有关的参数。

3. 图像增强。该功能可用于增强图像的对比度、锐度和其他视觉特征,以提高图像的质量。

4. 图像处理。该功能可用于转换图像格式或数据类型,调整图像大小,裁剪图像,或应用其他图像处理技术。

5. 机器视觉。该函数可用于预处理图像数据,然后再将其输入计算机视觉算法,用于物体检测、识别、跟踪或其他机器视觉任务。

总的来说,像素变换函数在图像处理和分析中起着至关重要的作用,它在制造业、机器人、汽车、医疗和其他行业的应用非常广泛。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/478656.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

2023年,web前端工程师20道Vue面试题及解析

本文章列出了20道关于Vue.js的面试题&#xff0c;包括基础和进阶问题&#xff0c;并提供了问题的答案及解析&#xff0c;以帮助读者更好地准备面试。从指令、生命周期函数到组件间通信和路由等各方面都作了涉及。 1. 什么是Vue.js&#xff1f;它有哪些特点&#xff1f; 答案&…

Git服务器集成(一)

本篇文章旨在分享本人在学习Git时的随笔记&#x1f929; 文章目录 Git 远程服务器1、下载 Git 软件&#xff08;linux版本&#xff09;2、安装 Git 软件2.1 解压 Git2.2 安装依赖2.3 删除旧版 Git2.4 编译、安装 Git2.5 配置环境变量2.6 建立链接文件2.7 测试安装 3、创建 Git …

使用Selenium控制Chrome浏览器 --工作自动化

使用Selenium控制Chrome浏览器 --工作自动化 背景&#xff1a; 最近朋友在用秒账做帐时&#xff0c;由于销售单量很大&#xff0c;重复录入工作一天一录就近五个小时&#xff0c;寻求帮助&#xff0c;问能不能把这重复劳动减少些&#xff0c;看后分析&#xff0c;使用web自动…

为网站的中文和英文使用不同的字体

CSS为网站的中文和英文使用不同的字体 前言 最近我在搭建个人网站&#xff0c;在这个过程中遇到很多的问题&#xff0c;不过chatGPT3.5帮助了很多&#xff0c;这是我使用的咒语&#xff1a; 我正在搭建一个个人网站&#xff0c;使用python Flask框架&#xff0c;CSS采用Boots…

linux网络设置与维护命令

文章目录 一、linux网络设置与维护命令总结 一、linux网络设置与维护命令 Linux ifconfig命令:配置或显示网络接口信息 Linux netstat命令:显示网络状态 Linux ip命令:执行网络管理任务 Linux ping命令:测试主机间网络连通性 Linux wall命令:发送广播 Linux finger命令:查找并…

ShardingJDBC的实核心流程和商户商家订单的分片实现

一、ShardingJDBC的核心流程 ShardingJDBC的核心流程主要分成六个步骤&#xff0c;分别是&#xff1a;SQL解析->SQL优化->SQL路由->SQL改写->SQL执行->结果归并&#xff0c;流程图如下: 4.1、SQL解析 分为词法解析和语法解析。 先通过词法解析器将SQL拆分为一…

基于ESP32 蓝牙游戏手柄设计

使用 ESP32 并通过 BLE 通信的 DIY 手持游戏手柄 这个项目中使用的东西 硬件组件 esp32 1 ws2812b 6 操纵杆 2 角度按钮 2 按钮 8 18560电池和电池座 2 3路拨动开关 1 TP4056带保…

【从0到1了解Libarchive】带你了解Libarchive Libarchive的用途意义以及成功入门Libarchive

目录 0 如果你还不知道Libarchive是什么请一定要先看一下 1 简介 1.1 为什么实现Libarchive 1.2 到底都有谁在用呢&#xff1f; 1.3 Libarchive都有哪些功能 1.4 我们可以通过这些获取更多信息 1.5 如何贡献 2 Libarchive归档与压缩 3 Libarchive编译 4 Libarchive简…

ApplicationContext 和 BeanFactory 的区别

✏️作者&#xff1a;银河罐头 &#x1f4cb;系列专栏&#xff1a;JavaEE &#x1f332;“种一棵树最好的时间是十年前&#xff0c;其次是现在” 目录 ApplicationContext 和 BeanFactory 的区别 ApplicationContext 和 BeanFactory 的区别 那么这 2 种获取 Spring 上下文对象…

搭建electron-vue上

electron-vue 准备工作修改package.jsonappveyor.yml.travis.yml.gitignore.eslintrc.js.eslintignore.babelrcsrc/renderer/main.jssrc/renderer/App.vuesrc/renderer/store/index.jssrc/renderer/store/modules/Counter.jssrc/renderer/store/modules/Counter.jssrc/renderer…

渗透测试 | 目录扫描

0x00 免责声明 本文仅限于学习讨论与技术知识的分享&#xff0c;不得违反当地国家的法律法规。对于传播、利用文章中提供的信息而造成的任何直接或者间接的后果及损失&#xff0c;均由使用者本人负责&#xff0c;本文作者不为此承担任何责任&#xff0c;一旦造成后果请自行承担…

BUUCTF ciscn_2019_n_8

小白垃圾做题笔记而已&#xff0c;不建议阅读观看。 看到保护后我………………傻眼了。这保护全看根本无从下手嘛。 看到源程序后我依然有点迷茫。 我是小白&#xff0c;直到看到了大佬的wp&#xff0c;我才有有点头绪。 这里&#xff0c;var[13]里的不能为0 并且里边存储的还…

Java 基础入门篇(六)——— String 类详解

文章目录 一、String 类概述二、String 创建对象的方式2.1 创建对象的两种方式2.2 面试&#xff1a;两种方式的区别 ★2.3 常见面试题 ★ 三、String 类常用方法3.1 字符串内容比较3.2 常用 API&#xff1a;遍历、截取、替换、分割 一、String 类概述 java.lang.String 类代表…

R语言 | 日期和时间的处理

目录 一、日期的设定与使用 1.1 as.Date()函数 1.2 weekdays()函数 1.3 months()函数 1.4 quarters()函数 1.5 Sys.localeconv()函数 1.6 Sys.Date()函数 1.7 再谈seq()函数 1.8 使用不同格式表示日期 二、时间的设定与使用 2.1 Sys.time()函数 2.2 as.POSIXct()函数…

ChatGPT学习企业产品、服务内容、往期方案,处理所输入的客户需求,定制化生成解决方案

该场景对应的关键词库&#xff08;6个&#xff09;&#xff1a; 企业产品和服务内容、客户需求和参数、营销方案和推广策略、数据处理和模型训练、客户满意度和营销效率、往期营销方案 提问模板&#xff1a; 场景产品问题 模板1&#xff1a; 场景&#xff1a;某家电公司生产的…

【Redis】Redis单线程和多线程

Redis单线程 Redis为什么是单线程 Redis的版本很多&#xff0c;比如3.x、4.x、6.x等&#xff0c;版本不同&#xff0c;架构不同&#xff1a; 3.x版本&#xff0c;最早的版本&#xff0c;单线程4.x版本&#xff0c;严格意义上来说不是单线程&#xff0c;负责处理客户端请求的…

使用Vue+axios+Vuex实现登录后前端数据本地化存储实战

前言 这已经是《Vue + SpringBoot前后端分离项目实战》专栏的前端部分第8篇博客了,服务端部分由天哥(天哥主页)负责,目前专栏目录如下: Vue + SpringBoot前后端分离项目实战 - 前端部分1. 手把手带你做一套毕业设计-征程开启2. 我应该把毕业设计做到什么程度才能过关?3.…

cpp: read and write utf-8 text file using vs 2022

/*****************************************************************//*** \file geovindu.h* \brief 业务操作方法** \author geovindu,Geovin Du* \date 2023-04-22 ***********************************************************************/ /*** https://learn.mi…

【Linux】如何创建进程?

&#x1f525;&#x1f525; 欢迎来到小林的博客&#xff01;&#xff01;       &#x1f6f0;️博客主页&#xff1a;✈️林 子       &#x1f6f0;️博客专栏&#xff1a;✈️ 小林的Linux之路       &#x1f6f0;️社区 :✈️ 进步学堂       &a…

【技术】《Netty》从零开始学netty源码(四十八)之缓存池ObjectPool

目录 ObjectPool创建对象池获取对象get()从本地池中获取对象claim()回收对象 ObjectPool 在分析PooledByteBuf的时候我们遇到了recycleHandler类&#xff0c;该类用于回收已经使用完毕的缓存对象并将其放回池中供下次循环利用&#xff0c;Netty的对象池工作过程大体如下&#…