海康威视相机-LINUX SDK 开发

硬件与环境

mvs

相机: MV-CS020-10GC
系统:UBUNTU 22.04
语言:C++
工具:cmake
海康官网下载SDK
在这里插入图片描述

在这里插入图片描述
运行下面的命令进行安装

sudo dpkg -i  MVSXXX.deb

安装完成后从在/opt/MVS 路径下就有了相关的库,实际上我们开发的时候只需要lib和include。有兴趣的同学也可以尝试以下Samples的例子。make一下就能生成可执行文件。如果make报错,可能环境变量没有设置好,到bin文件夹下把那几个设置环境变量的shell脚本运行一下再试一试。

make

在这里插入图片描述
这里是我运行了/opt/MVS/Samples/64/Display下的例子。

在这里插入图片描述

开发

实际上我们开发的时候只需要目录/opt/MVS/lib和/opt/MVS/include下的文件。他们是海康提供的链接库。所以我们在写程序的时候链接到海康的库,我们就能调用海康官方的接口了。

我将海康的库放在我工程的3rdPartys下,这样就移植到其他电脑上会比较方便。

add_library(cameraAPISHARED
)
# Define preprocessor macro for exporting symbols on Windowsif(WIN32)target_compile_definitions(cameraAPI PRIVATE cameraAPI_EXPORTS)
endif()message( target name: cameraAPI )target_include_directories(cameraAPI  PRIVATE${OpenCV_INCLUDE_DIRS}./include./3rdPartys/mvsinclude
)target_sources(cameraAPI PRIVATE./src/edge_camera.cpp
)target_link_directories(cameraAPI  PUBLIC${OpenCV_LIBS}./3rdPartys/mvslib/64
)target_link_libraries(cameraAPI  PRIVATE${OpenCV_LIBS}MvCameraControlpthread
)

主要的程序

//
// Created by zc on 8/24/23.
//
#include "edge_camera.h"EDGE_CAMERA::EDGE_CAMERA() {std::cout<<"EDGE_CAMERA BEGIN!"<<std::endl;
}EDGE_CAMERA::~EDGE_CAMERA(){std::cout<<"EDGE_CAMERA FINISH!"<<std::endl;
}// print the discovered devices' information
void EDGE_CAMERA::PrintDeviceInfo(MV_CC_DEVICE_INFO* pstMVDevInfo)
{if (nullptr == pstMVDevInfo){printf("    NULL info.\n\n");return;}if (MV_GIGE_DEVICE == pstMVDevInfo->nTLayerType){unsigned int nIp1 = ((pstMVDevInfo->SpecialInfo.stGigEInfo.nCurrentIp & 0xff000000) >> 24);unsigned int nIp2 = ((pstMVDevInfo->SpecialInfo.stGigEInfo.nCurrentIp & 0x00ff0000) >> 16);unsigned int nIp3 = ((pstMVDevInfo->SpecialInfo.stGigEInfo.nCurrentIp & 0x0000ff00) >> 8);unsigned int nIp4 = (pstMVDevInfo->SpecialInfo.stGigEInfo.nCurrentIp & 0x000000ff);// en:Print current ip and user defined nameprintf("    IP: %d.%d.%d.%d\n" , nIp1, nIp2, nIp3, nIp4);printf("    UserDefinedName: %s\n" , pstMVDevInfo->SpecialInfo.stGigEInfo.chUserDefinedName);printf("    Device Model Name: %s\n\n", pstMVDevInfo->SpecialInfo.stGigEInfo.chModelName);}else if (MV_USB_DEVICE == pstMVDevInfo->nTLayerType){printf("    UserDefinedName: %s\n", pstMVDevInfo->SpecialInfo.stUsb3VInfo.chUserDefinedName);printf("    Device Model Name: %s\n\n", pstMVDevInfo->SpecialInfo.stUsb3VInfo.chModelName);}else{printf("    Not support.\n\n");}
}//  en:Convert pixel arrangement from RGB to BGR
void EDGE_CAMERA::RGB2BGR( unsigned char* pRgbData, unsigned int nWidth, unsigned int nHeight )
{if ( nullptr == pRgbData ){return;}// RGB TO BGRfor (unsigned int j = 0; j < nHeight; j++){for (unsigned int i = 0; i < nWidth; i++){unsigned char red = pRgbData[j * (nWidth * 3) + i * 3];pRgbData[j * (nWidth * 3) + i * 3]     = pRgbData[j * (nWidth * 3) + i * 3 + 2];pRgbData[j * (nWidth * 3) + i * 3 + 2] = red;}}
}// en:Convert data stream to Mat format then save image
bool EDGE_CAMERA::Convert2Mat(MV_FRAME_OUT_INFO_EX *pstImageInfo, unsigned char *pData, cv::Mat &img)
{if (nullptr == pstImageInfo || nullptr == pData){printf("NULL info or data.\n");return false;}cv::Mat srcImage;if ( PixelType_Gvsp_Mono8 == pstImageInfo->enPixelType )                // Mono8{srcImage = cv::Mat(pstImageInfo->nHeight, pstImageInfo->nWidth, CV_8UC1, pData);}else if ( PixelType_Gvsp_RGB8_Packed == pstImageInfo->enPixelType )     // RGB8{RGB2BGR(pData, pstImageInfo->nWidth, pstImageInfo->nHeight);srcImage = cv::Mat(pstImageInfo->nHeight, pstImageInfo->nWidth, CV_8UC3, pData);}else if(PixelType_Gvsp_BayerRG8 == pstImageInfo->enPixelType)           // BayerRG8{printf("pPixelType_Gvsp_BayerRG8 type is converted to Mat\n");//RGB2BGR(pData, pstImageInfo->nWidth, pstImageInfo->nHeight);srcImage = cv::Mat(pstImageInfo->nHeight, pstImageInfo->nWidth, CV_8UC1, pData);// srcImage.create(srcImage.rows,srcImage.cols,CV_8UC3);cvtColor(srcImage, srcImage, cv::COLOR_BayerRG2RGB);}else{printf("Unsupported pixel format\n");return false;}if ( nullptr == srcImage.data ){printf("Creat Mat failed.\n");return false;}try{// en:Save converted image in a local fileimg = srcImage;cv::imwrite("Image_Mat.bmp", srcImage);}catch (cv::Exception& ex){fprintf(stderr, "Exception in saving mat image: %s\n", ex.what());}srcImage.release();return true;
}// en:Convert data stream in Ipl format then save image
bool EDGE_CAMERA::Convert2Ipl(MV_FRAME_OUT_INFO_EX* pstImageInfo, unsigned char * pData)
{if (nullptr == pstImageInfo || nullptr == pData){printf("NULL info or data.\n");return false;}IplImage* srcImage = nullptr;if ( PixelType_Gvsp_Mono8 == pstImageInfo->enPixelType )                // Mono8????{srcImage = cvCreateImage(cvSize(pstImageInfo->nWidth, pstImageInfo->nHeight), IPL_DEPTH_8U, 1);}else if ( PixelType_Gvsp_RGB8_Packed == pstImageInfo->enPixelType )     // RGB8????{RGB2BGR(pData, pstImageInfo->nWidth, pstImageInfo->nHeight);srcImage = cvCreateImage(cvSize(pstImageInfo->nWidth, pstImageInfo->nHeight), IPL_DEPTH_8U, 3);}else{printf("Unsupported pixel format\n");return false;}if ( nullptr == srcImage ){printf("Creat IplImage failed.\n");return false;}srcImage->imageData = (char *)pData;try{// en:Save converted image in a local filecv::Mat cConvertImage = cv::cvarrToMat(srcImage);cv::imwrite("Image_Ipl.bmp", cConvertImage);cConvertImage.release();}catch (cv::Exception& ex){fprintf(stderr, "Exception in saving IplImage: %s\n", ex.what());}cvReleaseImage(&srcImage);return true;
}void EDGE_CAMERA::findCameras(){int nRet = MV_OK;//void* handle = nullptr;//unsigned char * pData = nullptr;//MV_CC_DEVICE_INFO_LIST _stDeviceList;memset(&_stDeviceList, 0, sizeof(MV_CC_DEVICE_INFO_LIST));// en:Enum devicedo {nRet = MV_CC_EnumDevices(MV_GIGE_DEVICE | MV_USB_DEVICE, &_stDeviceList);if (MV_OK != nRet) {printf("Enum Devices fail! nRet [0x%x]\n", nRet);break;}// en:Show devicesif (_stDeviceList.nDeviceNum > 0) {for (unsigned int i = 0; i < _stDeviceList.nDeviceNum; i++) {printf("[device %d]:\n", i);MV_CC_DEVICE_INFO *pDeviceInfo = _stDeviceList.pDeviceInfo[i];if (nullptr == pDeviceInfo) {break;}PrintDeviceInfo(pDeviceInfo);}} else {printf("Find No Devices!\n");break;}}while(false);
}void EDGE_CAMERA::connectCameras(){for(int device = 0; device < _stDeviceList.nDeviceNum; device++){if (!MV_CC_IsDeviceAccessible(_stDeviceList.pDeviceInfo[device], MV_ACCESS_Exclusive)){PrintDeviceInfo(_stDeviceList.pDeviceInfo[device]);printf("Can't connect %u! ", _stDeviceList.pDeviceInfo[device]->nMacAddrLow);continue;}else{void *handle;PrintDeviceInfo(_stDeviceList.pDeviceInfo[device]);printf("connect %10u!\n", _stDeviceList.pDeviceInfo[device]->nMacAddrLow);int nRet = MV_CC_CreateHandle(&handle, _stDeviceList.pDeviceInfo[device]);_handlesCameraInfos.push_back({handle,nRet}); //save the handle to handlesCameraInfosif (MV_OK != nRet){printf("Create Handle fail! nRet [0x%x]\n", nRet);}}}
}void EDGE_CAMERA::initCamera(void *handle, int createRetStatus, unsigned int cameraIndex) {int nRet;unsigned char * pData = nullptr;do{if (createRetStatus != MV_OK)break;handle = handle;// en:Open devicenRet = MV_CC_OpenDevice(handle);if (MV_OK != nRet) {printf("Open Device fail! nRet [0x%x]\n", nRet);break;}// en:Detection network optimal package size(It only works for the GigE camera)if (MV_GIGE_DEVICE == _stDeviceList.pDeviceInfo[cameraIndex]->nTLayerType) {int nPacketSize = MV_CC_GetOptimalPacketSize(handle);if (nPacketSize > 0) {nRet = MV_CC_SetIntValue(handle, "GevSCPSPacketSize", nPacketSize);if (MV_OK != nRet) {printf("Warning: Set Packet Size fail! nRet [0x%x]!", nRet);}} else {printf("Warning: Get Packet Size fail! nRet [0x%x]!", nPacketSize);}}//en:Set trigger mode as offnRet = MV_CC_SetEnumValue(handle, "TriggerMode", 0);if (MV_OK != nRet) {printf("Set Trigger Mode fail! nRet [0x%x]\n", nRet);break;}// en:Get payload sizeMVCC_INTVALUE stParam;memset(&stParam, 0, sizeof(MVCC_INTVALUE));nRet = MV_CC_GetIntValue(handle, "PayloadSize", &stParam);if (MV_OK != nRet) {printf("Get PayloadSize fail! nRet [0x%x]\n", nRet);break;}unsigned int nPayloadSize = stParam.nCurValue;// en:Init image infoMV_FRAME_OUT_INFO_EX stImageInfo = {0};memset(&stImageInfo, 0, sizeof(MV_FRAME_OUT_INFO_EX));pData = (unsigned char *) malloc(sizeof(unsigned char) * (nPayloadSize));if (nullptr == pData) {printf("Allocate memory failed.\n");break;}memset(pData, 0, sizeof(pData));//  en:Start grab imagenRet = MV_CC_StartGrabbing(handle);if (MV_OK != nRet) {printf("Start Grabbing fail! nRet [0x%x]\n", nRet);break;}_camerasDatas.push_back({handle,pData,nPayloadSize,stImageInfo});// en:Get one frame from camera with timeout=1000ms/*    while (true) {nRet = MV_CC_GetOneFrameTimeout(handle, pData, nPayloadSize, &stImageInfo, 1000);if (MV_OK == nRet) {printf("Get One Frame: Width[%d], Height[%d], FrameNum[%d]\n",stImageInfo.nWidth, stImageInfo.nHeight, stImageInfo.nFrameNum);} else {printf("Get Frame fail! nRet [0x%x]\n", nRet);break;}//  en:Convert image databool bConvertRet = false;cv::Mat img;bConvertRet = Convert2Mat(&stImageInfo, pData, img);cv::namedWindow("img", cv::WINDOW_NORMAL);cv::resizeWindow("img", cv::Size(900, 600));imshow("img", img);cv::waitKey(20);}*/}while(false);/* // en:Stop grab imagenRet = MV_CC_StopGrabbing(handle);if (MV_OK != nRet){printf("Stop Grabbing fail! nRet [0x%x]\n", nRet);break;}// en:Close devicenRet = MV_CC_CloseDevice(handle);if (MV_OK != nRet){printf("ClosDevice fail! nRet [0x%x]\n", nRet);break;}//  en:Input the format to convertprintf("\n[0] OpenCV_Mat\n");printf("[1] OpenCV_IplImage\n");int nFormat = 0;*/}void EDGE_CAMERA::initAllCameras(){unsigned int nCameraIndex = _handlesCameraInfos.size();unsigned int cameraIndex = 0;for(auto handlesCameraInfo:_handlesCameraInfos){initCamera(handlesCameraInfo.handle, handlesCameraInfo.createRetStatus, cameraIndex);cameraIndex++;}
}void EDGE_CAMERA::disPlay() {//initCamera(_handlesCameraInfos[0].handle, _handlesCameraInfos[0].createRetStatus, 0);std::string winName = "img";cv::namedWindow(winName, cv::WINDOW_NORMAL);cv::resizeWindow(winName, cv::Size(900, 600));while (cv::waitKey(50) != 'q') {unsigned int cameraIndex = 0;int nRet = MV_CC_GetOneFrameTimeout(_camerasDatas[0].handle, _camerasDatas[0].pData, _camerasDatas[0].nPayloadSize, &_camerasDatas[0].stImageInfo, 1000);if (MV_OK == nRet) {printf("Get One Frame: Width[%d], Height[%d], FrameNum[%d]\n",_camerasDatas[0].stImageInfo.nWidth, _camerasDatas[0].stImageInfo.nHeight, _camerasDatas[0].stImageInfo.nFrameNum);} else {printf("Get Frame fail! nRet [0x%x]\n", nRet);break;}//  en:Convert image databool bConvertRet = false;cv::Mat img;bConvertRet = Convert2Mat(&_camerasDatas[0].stImageInfo, _camerasDatas[0].pData, img);imshow(winName, img);cv::waitKey(20);}}bool EDGE_CAMERA::getAndProcessImg() {int nRet = MV_OK;void* handle = nullptr;unsigned char * pData = nullptr;do{MV_CC_DEVICE_INFO_LIST stDeviceList;memset(&stDeviceList, 0, sizeof(MV_CC_DEVICE_INFO_LIST));// en:Enum devicenRet = MV_CC_EnumDevices(MV_GIGE_DEVICE | MV_USB_DEVICE, &stDeviceList);if (MV_OK != nRet){printf("Enum Devices fail! nRet [0x%x]\n", nRet);break;}// en:Show devicesif (stDeviceList.nDeviceNum > 0){for (unsigned int i = 0; i < stDeviceList.nDeviceNum; i++){printf("[device %d]:\n", i);MV_CC_DEVICE_INFO* pDeviceInfo = stDeviceList.pDeviceInfo[i];if (nullptr == pDeviceInfo){break;}PrintDeviceInfo(pDeviceInfo);}}else{printf("Find No Devices!\n");break;}// en:Select deviceunsigned int nIndex = 0;while (true){printf("Please Input camera index(0-%d): ", stDeviceList.nDeviceNum - 1);if (1 == scanf("%d", &nIndex)){while (getchar() != '\n'){;}if (nIndex >= 0 && nIndex < stDeviceList.nDeviceNum){if (!MV_CC_IsDeviceAccessible(stDeviceList.pDeviceInfo[nIndex], MV_ACCESS_Exclusive)){printf("Can't connect! ");continue;}break;}}else{while (getchar() != '\n'){;}}}// en:Create handlenRet = MV_CC_CreateHandle(&handle, stDeviceList.pDeviceInfo[nIndex]);if (MV_OK != nRet){printf("Create Handle fail! nRet [0x%x]\n", nRet);break;}// en:Open devicenRet = MV_CC_OpenDevice(handle);if (MV_OK != nRet){printf("Open Device fail! nRet [0x%x]\n", nRet);break;}// en:Detection network optimal package size(It only works for the GigE camera)if (MV_GIGE_DEVICE == stDeviceList.pDeviceInfo[nIndex]->nTLayerType){int nPacketSize = MV_CC_GetOptimalPacketSize(handle);if (nPacketSize > 0){nRet = MV_CC_SetIntValue(handle, "GevSCPSPacketSize", nPacketSize);if (MV_OK != nRet){printf("Warning: Set Packet Size fail! nRet [0x%x]!", nRet);}}else{printf("Warning: Get Packet Size fail! nRet [0x%x]!", nPacketSize);}}//en:Set trigger mode as offnRet = MV_CC_SetEnumValue(handle, "TriggerMode", 0);if (MV_OK != nRet){printf("Set Trigger Mode fail! nRet [0x%x]\n", nRet);break;}// en:Get payload sizeMVCC_INTVALUE stParam;memset(&stParam, 0, sizeof(MVCC_INTVALUE));nRet = MV_CC_GetIntValue(handle, "PayloadSize", &stParam);if (MV_OK != nRet){printf("Get PayloadSize fail! nRet [0x%x]\n", nRet);break;}unsigned int nPayloadSize = stParam.nCurValue;// en:Init image infoMV_FRAME_OUT_INFO_EX stImageInfo = { 0 };memset(&stImageInfo, 0, sizeof(MV_FRAME_OUT_INFO_EX));pData = (unsigned char *)malloc(sizeof(unsigned char)* (nPayloadSize));if (nullptr == pData){printf("Allocate memory failed.\n");break;}memset(pData, 0, sizeof(pData));//  en:Start grab imagenRet = MV_CC_StartGrabbing(handle);if (MV_OK != nRet){printf("Start Grabbing fail! nRet [0x%x]\n", nRet);break;}// en:Get one frame from camera with timeout=1000msnRet = MV_CC_GetOneFrameTimeout(handle, pData, nPayloadSize, &stImageInfo, 1000);if (MV_OK == nRet){printf("Get One Frame: Width[%d], Height[%d], FrameNum[%d]\n",stImageInfo.nWidth, stImageInfo.nHeight, stImageInfo.nFrameNum);}else{printf("Get Frame fail! nRet [0x%x]\n", nRet);break;}// en:Stop grab imagenRet = MV_CC_StopGrabbing(handle);if (MV_OK != nRet){printf("Stop Grabbing fail! nRet [0x%x]\n", nRet);break;}// en:Close devicenRet = MV_CC_CloseDevice(handle);if (MV_OK != nRet){printf("ClosDevice fail! nRet [0x%x]\n", nRet);break;}//  en:Input the format to convertprintf("\n[0] OpenCV_Mat\n");printf("[1] OpenCV_IplImage\n");int nFormat = 0;while (1){printf("Please Input Format to convert: ");if (1 == scanf("%d", &nFormat)){if (0 == nFormat || 1 == nFormat){break;}}while (getchar() != '\n'){;}}//  en:Convert image databool bConvertRet = false;cv::Mat img;if (OpenCV_Mat == nFormat){bConvertRet = Convert2Mat(&stImageInfo, pData, img);}else if (OpenCV_IplImage == nFormat){bConvertRet = Convert2Ipl(&stImageInfo, pData);}//  en:Print resultif (bConvertRet){printf("OpenCV format convert finished.\n");}else{printf("OpenCV format convert failed.\n");}} while (0);// en:Destroy handleif (handle){MV_CC_DestroyHandle(handle);handle = nullptr;}// en:Free memeryif (pData){free(pData);pData = nullptr;}return true;
}void EDGE_CAMERA::saveImg(std::string path,unsigned int cameraIndex){}

Main函数

int main(int argc, char **argv){EDGE_CAMERA camera;camera.findCameras();camera.connectCameras();camera.initAllCameras();camera.disPlay();}

执行效果

在这里插入图片描述

注意

我是编译了一个动态库cameraAPI,main函数是链接的camkeraAPI。上面是把最重要的代码给贴出来了。不是完整的工程哈。

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

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

相关文章

专业制造一体化ERP系统,专注于制造工厂生产管理信息化,可定制-亿发

制造业是国民经济的支柱产业&#xff0c;对于经济发展和竞争力至关重要。在数字化和智能化趋势的推动下&#xff0c;制造业正处于升级的关键时期。而ERP系统&#xff0c;即企业资源计划系统&#xff0c;能够将企业的各个业务环节整合起来&#xff0c;实现资源的有效管理和信息的…

攻击与防御实战经验分享:分析真实的攻击事件和入侵行为,讨论防御方法和实践经验

章节 1: 前言 作为IT领域的从业者&#xff0c;我们时刻都面临着网络安全的挑战。攻击者不断寻找漏洞&#xff0c;而防御者则需要时刻保持警惕&#xff0c;采取最佳实践来保护系统和数据。在本文中&#xff0c;我们将分享一些真实的攻击事件和入侵行为&#xff0c;并探讨针对这…

LInux之chrony服务器

目录 场景 重要性 LInux的两个时钟 硬件时钟 系统时钟 NTP协议 Chrony介绍 定义 组成 --- chronyd和chronyc 安装与配置 安装 Chrony配置文件分析 同步时间服务器 chronyc命令 chronyc sources输出分析 其它命令 查看时间服务器的状态 查看时间服务器是否在线 …

如何解决索引分裂问题?

索引分裂 索引块快写满时就会发生索引分裂&#xff0c;索引分裂分为两种情况&#xff0c;55和91&#xff1a; 索引分裂和enq: TX - index contension等待事件的区别 无论是55还是91&#xff0c;都是数据增多后索引的正常行为&#xff0c;索引分裂是业务数据量增大导致索引增大…

③matlab向量和矩阵

目录 手动输入数组 创建等间距向量 数组创建函数 手动输入数组 1.背景 单个称为标量的数值实际上是一个 11 数组&#xff0c;也即它包含 1 行 1 列。 任务 创建一个名为 x 并且值为 4 的变量。 2.您可以使用方括号创建包含多个元素的数组。 x [3 5] x 3 5 任务 …

华为云Stack的学习(二)

三、华为云Stack产品组件 FunsionSphere CPS 提供云平台的基础管理和业务资源&#xff08;包括计算资源和存储资源&#xff09;。采用物理服务器方式部署在管理节点。可以做集群的配置&#xff0c;扩容和运维管理。 Service OM 提供云服务的运维能力&#xff0c;采用虚拟化方…

数字孪生:重塑制造、医疗和能源等领域的未来

数字孪生技术&#xff0c;作为虚拟仿真的重要领域&#xff0c;正以其强大的能力在各个行业中创造前所未有的创新。本文带大家一起深入探讨数字孪生技术在不同领域的广泛应用场景&#xff0c;展示其在实现效率、可靠性和智能化方面的积极影响。 制造业与工业领域 数字孪生技术在…

MyBatis分页插件PageHelper的使用及MyBatis的特殊符号---详细介绍

一&#xff0c;分页的概念 分页是一种将大量数据或内容分割成多个页面以便逐页显示的方式。在分页中&#xff0c;数据被分割成一定数量的页&#xff0c;每页显示一部分数据或内容&#xff0c;用户可以通过翻页或跳分页是一种将大量数据或内容分割成多个页面以便逐页显示的方式。…

JavaScript—DOM(文档对象模型)

目录 DOM是什么&#xff1f; DOM有什么作用&#xff1f; 一、事件 理解事件 事件怎么写&#xff08;要做什么就写什么&#xff09;&#xff1f; 实战演练 1、页面加载完毕以后&#xff0c;打印一句话 2、如果有一个a标签&#xff0c;并给其添加一个点击事件 3、事件默…

1、监测数据采集物联网应用开发步骤(1)

项目介绍 本文章编写目的针对下图中《。。。解决方案》所涉及的开发资料&#xff1b; 监测数据采集物联网应用解决方案_yong427的博客-CSDN博客 开发步骤实现从0开始搭建软件框架&#xff0c;该开发步骤基于python3.0语言及相关工具实现&#xff0c;阅读本文章之前请先初步百…

特斯拉启动墨西哥建厂计划,引发台厂竞逐 | 百能云芯

特斯拉&#xff08;Tesla&#xff09;在墨西哥新工厂计划备受瞩目&#xff0c;据外媒报道&#xff0c;墨西哥的超级工厂似乎正在迈出实质性的步伐。包括鸿海集团、广达&#xff08;Foxconn&#xff09;、和大在墨西哥和美墨边境都计划扩大电动车零配件生产基地。 市场对特斯拉在…

LeetCode-406-根据身高重建队列

题目描述&#xff1a; 假设有打乱顺序的一群人站成一个队列&#xff0c;数组 people 表示队列中一些人的属性&#xff08;不一定按顺序&#xff09;。每个 people[i] [hi, ki] 表示第 i 个人的身高为 hi &#xff0c;前面 正好 有 ki 个身高大于或等于 hi 的人。 请你重新构造…

MySQL中的free链表,flush链表,LRU链表

一、free链表 1、概述 free链表是一个双向链表数据结构&#xff0c;这个free链表里&#xff0c;每个节点就是一个空闲的缓存页的描述数据块的地址&#xff0c;也就是说&#xff0c;只要你一个缓存页是空闲的&#xff0c;那么他的描述数据块就会被放入这个free链表中。 刚开始数…

Markdown 扩展语法练习

风无痕 August 26, 2023 Markdown 指南中文版 Markdown 入门指南Markdown 基本语法Markdown 扩展语法Markdown 基本语法练习Markdown 扩展语法练习 代码 <h3 id"table">表格</h3>| Syntax | Description | | --- | --- | | Header | Title | | Paragrap…

【高阶数据结构】map和set的介绍和使用 {关联式容器;键值对;map和set;multimap和multiset;OJ练习}

map和set的介绍和使用 一、关联式容器 关联式容器和序列式容器是C STL中的两种不同类型的容器。 关联式容器是基于键值对的容器&#xff0c;其中每个元素都有一个唯一的键值&#xff0c;可以通过键值来访问元素。关联式容器包括set、multiset、map和multimap。 序列式容器是…

单核cpu是怎么处理多线程的

首先&#xff0c;要先了解几个概念&#xff1a; 1、线程是CPU调度和分配的基本单位。 2、进程是操作系统进行资源分配&#xff08;包括cpu、内存、磁盘IO等&#xff09;的最小单位 。 3、一个进程可以包括多个线程。 4、CPU的时间片是由计算机的操作系统OS里的调度器分配的. …

NFTScan | 08.21~08.27 NFT 市场热点汇总

欢迎来到由 NFT 基础设施 NFTScan 出品的 NFT 生态热点事件每周汇总。周期&#xff1a;2023.08.21~ 2023.08.27 NFT Hot News 01/ NFT 品牌体验平台 Recur 将于 11 月 16 日彻底关闭&#xff0c;此前曾获 5000 万美元融资 8 月 21 日&#xff0c;NFT 品牌体验平台 Recur 在 X…

Oracle创建控制列表ACL(Access Control List)

Oracle创建控制列表ACL&#xff08;Access Control List&#xff09; Oracle ACL简介一、先登陆163邮箱设置开启SMTP。二、Oracle ACL控制列表处理&#xff08;一&#xff09;创建ACL&#xff08;create_acl&#xff09;&#xff08;二&#xff09;添加ACL权限&#xff08;add_…

【算法专题突破】双指针 - 盛最多水的容器(4)

目录 1. 题目解析 2. 算法原理 3. 代码编写 写在最后&#xff1a; 1. 题目解析 题目链接&#xff1a;11. 盛最多水的容器 - 力扣&#xff08;Leetcode&#xff09; 这道题目也不难理解&#xff0c; 两边的柱子的盛水量是根据短的那边的柱子决定的&#xff0c; 而盛水量…

开源项目的测试和质量保证

&#x1f337;&#x1f341; 博主猫头虎 带您 Go to New World.✨&#x1f341; &#x1f984; 博客首页——猫头虎的博客&#x1f390; &#x1f433;《面试题大全专栏》 文章图文并茂&#x1f995;生动形象&#x1f996;简单易学&#xff01;欢迎大家来踩踩~&#x1f33a; &a…