海康威视相机在QTcreate上的使用教程

文章目录

  • 前言:
  • 基础夯实:
  • 效果展示:
    • 图片展示:
    • 视频展示:
  • 参考的资料:
  • 遇到问题:
    • 问题1:int64 does not
    • 问题2:LNK2019
    • 配置思路(这个很重要)
    • 配置关键图片:
    • 配置具体过程:
  • 核心代码:
    • MvCamera.h
    • MvCamera.cpp
    • widget.cpp

前言:

海康威视的教程里面,关于C++的教程,编译环境是VS,所以想使用QTcreate对于海康威视的相机进行使用,包括查找设备,打开设备,关闭设备,开始采集,停止采集,软触发,触发一次,保存bmp,保存jpg,保存tiff,保存png,调节曝光,增益,帧率。

基础夯实:

在MVS中海康威视的相关教程:MVS链接
下载完成之后按照这个目录(我是下载的的D盘),可以找到VS的教程:D:\MVS\Development\Samples\VC\VS
如果你需要QT上的教程,请继续向下观看。

效果展示:

图片展示:

在这里插入图片描述

视频展示:

HKshow

参考的资料:

在这个过程中,我参考了很多的资料,包括VS里面的例程代码,但是我水平有限,不能直接搬运VS中的代码。
资料:参考资料1,参考资料2
简单对资料进行说明,介绍了环境的安装,包括opencv,sdk的头文件,库文件,二次封装的MvCamera.h和MvCamera.cpp文件。环境的安装是极其容易出错的过程,环境没问题,其他的才能正常的运行。

遇到问题:

问题1:int64 does not

在这里插入图片描述
这个是你mingw设置的opencv,但是你却用msvc打开了。这个编译环境必须一致。

问题2:LNK2019

在这里插入图片描述
你的opencv库没有连接好,路径问题或者camke问题,系统环境问题这都是有可能的。

配置思路(这个很重要)

首先你下载MVS之后,里面lib文件和头文件,头文件全要(参考配置图片),库文件只要一个(MvCameraControl.lib)。你需要把二次封装的函数导入你的QT下面里面,就是MvCamera.h和MvCamera.cpp这两个文件,如果你只进行导入也可以,因为你用到了opencv,不要纠结要不要使用opencv,直接用就行了,很方便,当时纠结了,想直接使用那两个文件,一直被卡。opencv按照教程按装就行了,按照mingw那个流程,在QT的pro文件中使用绝对路径,别使用相对路径(不使用导入库那个选项),因为我当时导入库就没成功。头文件直接包含,在直接的文件中导入一下,看一下有没有报错,没有保存说明导入成功。这里的MvCamera.cpp和MvCamera.h是不能直接使用的,需要在里面添加一些内容,直接使用也是会报错,原因就是你使用了opencv。最后,大佬使用的是导入.h文件,我需要ui文件,我就自己进行更改了,如果有需要ui文件的,评论区发qq邮箱,我源码或者ui可以私发你学习。基本上按照这个思路,成功搭建环境到运行应该是没有问题的。

配置关键图片:

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

配置具体过程:

海康威视相机在QTcreate上的环境配置教程(qt+opencv+海康SDK)

核心代码:

MvCamera.h

/************************************************************************/
/* 以C++接口为基础,对常用函数进行二次封装,方便用户使用                */
/************************************************************************/#ifndef _MV_CAMERA_H_
#define _MV_CAMERA_H_#include "MvCameraControl.h"
#include <string.h>#include "opencv2/opencv.hpp"//注意此处可能会跟系统函数定义冲突
using namespace cv;#ifndef MV_NULL
#define MV_NULL    0
#endifclass CMvCamera
{
public:CMvCamera();~CMvCamera();// ch:获取SDK版本号 | en:Get SDK Versionstatic int GetSDKVersion();// ch:枚举设备 | en:Enumerate Devicestatic int EnumDevices(unsigned int nTLayerType, MV_CC_DEVICE_INFO_LIST* pstDevList);// ch:判断设备是否可达 | en:Is the device accessiblestatic bool IsDeviceAccessible(MV_CC_DEVICE_INFO* pstDevInfo, unsigned int nAccessMode);// ch:打开设备 | en:Open Deviceint Open(MV_CC_DEVICE_INFO* pstDeviceInfo);// ch:关闭设备 | en:Close Deviceint Close();// ch:判断相机是否处于连接状态 | en:Is The Device Connectedbool IsDeviceConnected();// ch:注册图像数据回调 | en:Register Image Data CallBackint RegisterImageCallBack(void(__stdcall* cbOutput)(unsigned char * pData, MV_FRAME_OUT_INFO_EX* pFrameInfo, void* pUser), void* pUser);// ch:开启抓图 | en:Start Grabbingint StartGrabbing();// ch:停止抓图 | en:Stop Grabbingint StopGrabbing();// ch:主动获取一帧图像数据 | en:Get one frame initiativelyint GetImageBuffer(MV_FRAME_OUT* pFrame, int nMsec);// ch:释放图像缓存 | en:Free image bufferint FreeImageBuffer(MV_FRAME_OUT* pFrame);// ch:显示一帧图像 | en:Display one frame imageint DisplayOneFrame(MV_DISPLAY_FRAME_INFO* pDisplayInfo);// ch:设置SDK内部图像缓存节点个数 | en:Set the number of the internal image cache nodes in SDKint SetImageNodeNum(unsigned int nNum);// ch:获取设备信息 | en:Get device informationint GetDeviceInfo(MV_CC_DEVICE_INFO* pstDevInfo);// ch:获取GEV相机的统计信息 | en:Get detect info of GEV cameraint GetGevAllMatchInfo(MV_MATCH_INFO_NET_DETECT* pMatchInfoNetDetect);// ch:获取U3V相机的统计信息 | en:Get detect info of U3V cameraint GetU3VAllMatchInfo(MV_MATCH_INFO_USB_DETECT* pMatchInfoUSBDetect);// ch:获取和设置Int型参数,如 Width和Height,详细内容参考SDK安装目录下的 MvCameraNode.xlsx 文件// en:Get Int type parameters, such as Width and Height, for details please refer to MvCameraNode.xlsx file under SDK installation directoryint GetIntValue(IN const char* strKey, OUT MVCC_INTVALUE_EX *pIntValue);int SetIntValue(IN const char* strKey, IN int64_t nValue);// ch:获取和设置Enum型参数,如 PixelFormat,详细内容参考SDK安装目录下的 MvCameraNode.xlsx 文件// en:Get Enum type parameters, such as PixelFormat, for details please refer to MvCameraNode.xlsx file under SDK installation directoryint GetEnumValue(IN const char* strKey, OUT MVCC_ENUMVALUE *pEnumValue);int SetEnumValue(IN const char* strKey, IN unsigned int nValue);int SetEnumValueByString(IN const char* strKey, IN const char* sValue);int GetEnumEntrySymbolic(IN const char* strKey, IN MVCC_ENUMENTRY* pstEnumEntry);// ch:获取和设置Float型参数,如 ExposureTime和Gain,详细内容参考SDK安装目录下的 MvCameraNode.xlsx 文件// en:Get Float type parameters, such as ExposureTime and Gain, for details please refer to MvCameraNode.xlsx file under SDK installation directoryint GetFloatValue(IN const char* strKey, OUT MVCC_FLOATVALUE *pFloatValue);int SetFloatValue(IN const char* strKey, IN float fValue);// ch:获取和设置Bool型参数,如 ReverseX,详细内容参考SDK安装目录下的 MvCameraNode.xlsx 文件// en:Get Bool type parameters, such as ReverseX, for details please refer to MvCameraNode.xlsx file under SDK installation directoryint GetBoolValue(IN const char* strKey, OUT bool *pbValue);int SetBoolValue(IN const char* strKey, IN bool bValue);// ch:获取和设置String型参数,如 DeviceUserID,详细内容参考SDK安装目录下的 MvCameraNode.xlsx 文件UserSetSave// en:Get String type parameters, such as DeviceUserID, for details please refer to MvCameraNode.xlsx file under SDK installation directoryint GetStringValue(IN const char* strKey, MVCC_STRINGVALUE *pStringValue);int SetStringValue(IN const char* strKey, IN const char * strValue);// ch:执行一次Command型命令,如 UserSetSave,详细内容参考SDK安装目录下的 MvCameraNode.xlsx 文件// en:Execute Command once, such as UserSetSave, for details please refer to MvCameraNode.xlsx file under SDK installation directoryint CommandExecute(IN const char* strKey);// ch:探测网络最佳包大小(只对GigE相机有效) | en:Detection network optimal package size(It only works for the GigE camera)int GetOptimalPacketSize(unsigned int* pOptimalPacketSize);// ch:注册消息异常回调 | en:Register Message Exception CallBackint RegisterExceptionCallBack(void(__stdcall* cbException)(unsigned int nMsgType, void* pUser), void* pUser);// ch:注册单个事件回调 | en:Register Event CallBackint RegisterEventCallBack(const char* pEventName, void(__stdcall* cbEvent)(MV_EVENT_OUT_INFO * pEventInfo, void* pUser), void* pUser);// ch:强制IP | en:Force IPint ForceIp(unsigned int nIP, unsigned int nSubNetMask, unsigned int nDefaultGateWay);// ch:配置IP方式 | en:IP configuration methodint SetIpConfig(unsigned int nType);// ch:设置网络传输模式 | en:Set Net Transfer Modeint SetNetTransMode(unsigned int nType);// ch:像素格式转换 | en:Pixel format conversionint ConvertPixelType(MV_CC_PIXEL_CONVERT_PARAM* pstCvtParam);// ch:保存图片 | en:save imageint SaveImage(MV_SAVE_IMAGE_PARAM_EX* pstParam);// ch:保存图片为文件 | en:Save the image as a fileint SaveImageToFile(MV_SAVE_IMG_TO_FILE_PARAM* pstParam);// ch:绘制圆形辅助线 | en:Draw circle auxiliary lineint DrawCircle(MVCC_CIRCLE_INFO* pCircleInfo);// ch:绘制线形辅助线 | en:Draw lines auxiliary lineint DrawLines(MVCC_LINES_INFO* pLinesInfo);//读取bufferint ReadBuffer(Mat &image);private:void *m_hDevHandle;//用于保存图像的缓存unsigned int m_nBufSizeForSaveImage;};#endif//_MV_CAMERA_H_

MvCamera.cpp

#include "mvcamera.h"CMvCamera::CMvCamera()
{m_hDevHandle = MV_NULL;
}CMvCamera::~CMvCamera()
{if (m_hDevHandle){MV_CC_DestroyHandle(m_hDevHandle);m_hDevHandle = MV_NULL;}
}// ch:获取SDK版本号 | en:Get SDK Version
int CMvCamera::GetSDKVersion()
{return MV_CC_GetSDKVersion();
}// ch:枚举设备 | en:Enumerate Device
int CMvCamera::EnumDevices(unsigned int nTLayerType, MV_CC_DEVICE_INFO_LIST* pstDevList)
{return MV_CC_EnumDevices(nTLayerType, pstDevList);
}// ch:判断设备是否可达 | en:Is the device accessible
bool CMvCamera::IsDeviceAccessible(MV_CC_DEVICE_INFO* pstDevInfo, unsigned int nAccessMode)
{return MV_CC_IsDeviceAccessible(pstDevInfo, nAccessMode);
}// ch:打开设备 | en:Open Device
int CMvCamera::Open(MV_CC_DEVICE_INFO* pstDeviceInfo)
{if (MV_NULL == pstDeviceInfo){return MV_E_PARAMETER;}if (m_hDevHandle){return MV_E_CALLORDER;}int nRet  = MV_CC_CreateHandle(&m_hDevHandle, pstDeviceInfo);if (MV_OK != nRet){return nRet;}nRet = MV_CC_OpenDevice(m_hDevHandle);if (MV_OK != nRet){MV_CC_DestroyHandle(m_hDevHandle);m_hDevHandle = MV_NULL;}return nRet;
}// ch:关闭设备 | en:Close Device
int CMvCamera::Close()
{if (MV_NULL == m_hDevHandle){return MV_E_HANDLE;}MV_CC_CloseDevice(m_hDevHandle);int nRet = MV_CC_DestroyHandle(m_hDevHandle);m_hDevHandle = MV_NULL;return nRet;
}// ch:判断相机是否处于连接状态 | en:Is The Device Connected
bool CMvCamera::IsDeviceConnected()
{return MV_CC_IsDeviceConnected(m_hDevHandle);
}// ch:注册图像数据回调 | en:Register Image Data CallBack
int CMvCamera::RegisterImageCallBack(void(__stdcall* cbOutput)(unsigned char * pData, MV_FRAME_OUT_INFO_EX* pFrameInfo, void* pUser), void* pUser)
{return MV_CC_RegisterImageCallBackEx(m_hDevHandle, cbOutput, pUser);
}// ch:开启抓图 | en:Start Grabbing
int CMvCamera::StartGrabbing()
{return MV_CC_StartGrabbing(m_hDevHandle);
}// ch:停止抓图 | en:Stop Grabbing
int CMvCamera::StopGrabbing()
{return MV_CC_StopGrabbing(m_hDevHandle);
}// ch:主动获取一帧图像数据 | en:Get one frame initiatively
int CMvCamera::GetImageBuffer(MV_FRAME_OUT* pFrame, int nMsec)
{return MV_CC_GetImageBuffer(m_hDevHandle, pFrame, nMsec);
}// ch:释放图像缓存 | en:Free image buffer
int CMvCamera::FreeImageBuffer(MV_FRAME_OUT* pFrame)
{return MV_CC_FreeImageBuffer(m_hDevHandle, pFrame);
}// ch:设置显示窗口句柄 | en:Set Display Window Handle
int CMvCamera::DisplayOneFrame(MV_DISPLAY_FRAME_INFO* pDisplayInfo)
{return MV_CC_DisplayOneFrame(m_hDevHandle, pDisplayInfo);
}// ch:设置SDK内部图像缓存节点个数 | en:Set the number of the internal image cache nodes in SDK
int CMvCamera::SetImageNodeNum(unsigned int nNum)
{return MV_CC_SetImageNodeNum(m_hDevHandle, nNum);
}// ch:获取设备信息 | en:Get device information
int CMvCamera::GetDeviceInfo(MV_CC_DEVICE_INFO* pstDevInfo)
{return MV_CC_GetDeviceInfo(m_hDevHandle, pstDevInfo);
}// ch:获取GEV相机的统计信息 | en:Get detect info of GEV camera
int CMvCamera::GetGevAllMatchInfo(MV_MATCH_INFO_NET_DETECT* pMatchInfoNetDetect)
{if (MV_NULL == pMatchInfoNetDetect){return MV_E_PARAMETER;}MV_CC_DEVICE_INFO stDevInfo = {0};GetDeviceInfo(&stDevInfo);if (stDevInfo.nTLayerType != MV_GIGE_DEVICE){return MV_E_SUPPORT;}MV_ALL_MATCH_INFO struMatchInfo = {0};struMatchInfo.nType = MV_MATCH_TYPE_NET_DETECT;struMatchInfo.pInfo = pMatchInfoNetDetect;struMatchInfo.nInfoSize = sizeof(MV_MATCH_INFO_NET_DETECT);memset(struMatchInfo.pInfo, 0, sizeof(MV_MATCH_INFO_NET_DETECT));return MV_CC_GetAllMatchInfo(m_hDevHandle, &struMatchInfo);
}// ch:获取U3V相机的统计信息 | en:Get detect info of U3V camera
int CMvCamera::GetU3VAllMatchInfo(MV_MATCH_INFO_USB_DETECT* pMatchInfoUSBDetect)
{if (MV_NULL == pMatchInfoUSBDetect){return MV_E_PARAMETER;}MV_CC_DEVICE_INFO stDevInfo = {0};GetDeviceInfo(&stDevInfo);if (stDevInfo.nTLayerType != MV_USB_DEVICE){return MV_E_SUPPORT;}MV_ALL_MATCH_INFO struMatchInfo = {0};struMatchInfo.nType = MV_MATCH_TYPE_USB_DETECT;struMatchInfo.pInfo = pMatchInfoUSBDetect;struMatchInfo.nInfoSize = sizeof(MV_MATCH_INFO_USB_DETECT);memset(struMatchInfo.pInfo, 0, sizeof(MV_MATCH_INFO_USB_DETECT));return MV_CC_GetAllMatchInfo(m_hDevHandle, &struMatchInfo);
}// ch:获取和设置Int型参数,如 Width和Height,详细内容参考SDK安装目录下的 MvCameraNode.xlsx 文件
// en:Get Int type parameters, such as Width and Height, for details please refer to MvCameraNode.xlsx file under SDK installation directory
int CMvCamera::GetIntValue(IN const char* strKey, OUT MVCC_INTVALUE_EX *pIntValue)
{return MV_CC_GetIntValueEx(m_hDevHandle, strKey, pIntValue);
}int CMvCamera::SetIntValue(IN const char* strKey, IN int64_t nValue)
{return MV_CC_SetIntValueEx(m_hDevHandle, strKey, nValue);
}// ch:获取和设置Enum型参数,如 PixelFormat,详细内容参考SDK安装目录下的 MvCameraNode.xlsx 文件
// en:Get Enum type parameters, such as PixelFormat, for details please refer to MvCameraNode.xlsx file under SDK installation directory
int CMvCamera::GetEnumValue(IN const char* strKey, OUT MVCC_ENUMVALUE *pEnumValue)
{return MV_CC_GetEnumValue(m_hDevHandle, strKey, pEnumValue);
}int CMvCamera::SetEnumValue(IN const char* strKey, IN unsigned int nValue)
{return MV_CC_SetEnumValue(m_hDevHandle, strKey, nValue);
}int CMvCamera::SetEnumValueByString(IN const char* strKey, IN const char* sValue)
{return MV_CC_SetEnumValueByString(m_hDevHandle, strKey, sValue);
}int CMvCamera::GetEnumEntrySymbolic(IN const char* strKey, IN MVCC_ENUMENTRY* pstEnumEntry)
{return MV_CC_GetEnumEntrySymbolic(m_hDevHandle, strKey, pstEnumEntry);
}// ch:获取和设置Float型参数,如 ExposureTime和Gain,详细内容参考SDK安装目录下的 MvCameraNode.xlsx 文件
// en:Get Float type parameters, such as ExposureTime and Gain, for details please refer to MvCameraNode.xlsx file under SDK installation directory
int CMvCamera::GetFloatValue(IN const char* strKey, OUT MVCC_FLOATVALUE *pFloatValue)
{return MV_CC_GetFloatValue(m_hDevHandle, strKey, pFloatValue);
}int CMvCamera::SetFloatValue(IN const char* strKey, IN float fValue)
{return MV_CC_SetFloatValue(m_hDevHandle, strKey, fValue);
}// ch:获取和设置Bool型参数,如 ReverseX,详细内容参考SDK安装目录下的 MvCameraNode.xlsx 文件
// en:Get Bool type parameters, such as ReverseX, for details please refer to MvCameraNode.xlsx file under SDK installation directory
int CMvCamera::GetBoolValue(IN const char* strKey, OUT bool *pbValue)
{return MV_CC_GetBoolValue(m_hDevHandle, strKey, pbValue);
}int CMvCamera::SetBoolValue(IN const char* strKey, IN bool bValue)
{return MV_CC_SetBoolValue(m_hDevHandle, strKey, bValue);
}// ch:获取和设置String型参数,如 DeviceUserID,详细内容参考SDK安装目录下的 MvCameraNode.xlsx 文件UserSetSave
// en:Get String type parameters, such as DeviceUserID, for details please refer to MvCameraNode.xlsx file under SDK installation directory
int CMvCamera::GetStringValue(IN const char* strKey, MVCC_STRINGVALUE *pStringValue)
{return MV_CC_GetStringValue(m_hDevHandle, strKey, pStringValue);
}int CMvCamera::SetStringValue(IN const char* strKey, IN const char* strValue)
{return MV_CC_SetStringValue(m_hDevHandle, strKey, strValue);
}// ch:执行一次Command型命令,如 UserSetSave,详细内容参考SDK安装目录下的 MvCameraNode.xlsx 文件
// en:Execute Command once, such as UserSetSave, for details please refer to MvCameraNode.xlsx file under SDK installation directory
int CMvCamera::CommandExecute(IN const char* strKey)
{return MV_CC_SetCommandValue(m_hDevHandle, strKey);
}// ch:探测网络最佳包大小(只对GigE相机有效) | en:Detection network optimal package size(It only works for the GigE camera)
int CMvCamera::GetOptimalPacketSize(unsigned int* pOptimalPacketSize)
{if (MV_NULL == pOptimalPacketSize){return MV_E_PARAMETER;}int nRet = MV_CC_GetOptimalPacketSize(m_hDevHandle);if (nRet < MV_OK){return nRet;}*pOptimalPacketSize = (unsigned int)nRet;return MV_OK;
}// ch:注册消息异常回调 | en:Register Message Exception CallBack
int CMvCamera::RegisterExceptionCallBack(void(__stdcall* cbException)(unsigned int nMsgType, void* pUser),void* pUser)
{return MV_CC_RegisterExceptionCallBack(m_hDevHandle, cbException, pUser);
}// ch:注册单个事件回调 | en:Register Event CallBack
int CMvCamera::RegisterEventCallBack(const char* pEventName, void(__stdcall* cbEvent)(MV_EVENT_OUT_INFO * pEventInfo, void* pUser), void* pUser)
{return MV_CC_RegisterEventCallBackEx(m_hDevHandle, pEventName, cbEvent, pUser);
}// ch:强制IP | en:Force IP
int CMvCamera::ForceIp(unsigned int nIP, unsigned int nSubNetMask, unsigned int nDefaultGateWay)
{return MV_GIGE_ForceIpEx(m_hDevHandle, nIP, nSubNetMask, nDefaultGateWay);
}// ch:配置IP方式 | en:IP configuration method
int CMvCamera::SetIpConfig(unsigned int nType)
{return MV_GIGE_SetIpConfig(m_hDevHandle, nType);
}// ch:设置网络传输模式 | en:Set Net Transfer Mode
int CMvCamera::SetNetTransMode(unsigned int nType)
{return MV_GIGE_SetNetTransMode(m_hDevHandle, nType);
}// ch:像素格式转换 | en:Pixel format conversion
int CMvCamera::ConvertPixelType(MV_CC_PIXEL_CONVERT_PARAM* pstCvtParam)
{return MV_CC_ConvertPixelType(m_hDevHandle, pstCvtParam);
}// ch:保存图片 | en:save image
int CMvCamera::SaveImage(MV_SAVE_IMAGE_PARAM_EX* pstParam)
{return MV_CC_SaveImageEx2(m_hDevHandle, pstParam);
}// ch:保存图片为文件 | en:Save the image as a file
int CMvCamera::SaveImageToFile(MV_SAVE_IMG_TO_FILE_PARAM* pstSaveFileParam)
{return MV_CC_SaveImageToFile(m_hDevHandle, pstSaveFileParam);
}// ch:绘制圆形辅助线 | en:Draw circle auxiliary line
int CMvCamera::DrawCircle(MVCC_CIRCLE_INFO* pCircleInfo)
{return MV_CC_DrawCircle(m_hDevHandle, pCircleInfo);
}// ch:绘制线形辅助线 | en:Draw lines auxiliary line
int CMvCamera::DrawLines(MVCC_LINES_INFO* pLinesInfo)
{return MV_CC_DrawLines(m_hDevHandle, pLinesInfo);
}//读取相机中的图像
int CMvCamera::ReadBuffer(Mat &image)
{Mat* getImage = new Mat();unsigned int nRecvBufSize = 0;MVCC_INTVALUE stParam;memset(&stParam, 0, sizeof(MVCC_INTVALUE));int tempValue = MV_CC_GetIntValue(m_hDevHandle, "PayloadSize", &stParam);if (tempValue != 0){return -1;}nRecvBufSize = stParam.nCurValue;unsigned char* pDate;pDate=(unsigned char *)malloc(nRecvBufSize);MV_FRAME_OUT_INFO_EX stImageInfo = {0};tempValue= MV_CC_GetOneFrameTimeout(m_hDevHandle, pDate, nRecvBufSize, &stImageInfo, 700);if(tempValue!=0){return -1;}m_nBufSizeForSaveImage = stImageInfo.nWidth * stImageInfo.nHeight * 3 + 2048;unsigned char* m_pBufForSaveImage;m_pBufForSaveImage = (unsigned char*)malloc(m_nBufSizeForSaveImage);bool isMono;switch (stImageInfo.enPixelType){case PixelType_Gvsp_Mono8:case PixelType_Gvsp_Mono10:case PixelType_Gvsp_Mono10_Packed:case PixelType_Gvsp_Mono12:case PixelType_Gvsp_Mono12_Packed:isMono=true;break;default:isMono=false;break;}if(isMono){*getImage = Mat(stImageInfo.nHeight,stImageInfo.nWidth,CV_8UC1,pDate);//imwrite("d:\\测试opencv_Mono.tif", image);}else{//转换图像格式为BGR8MV_CC_PIXEL_CONVERT_PARAM stConvertParam = {0};memset(&stConvertParam, 0, sizeof(MV_CC_PIXEL_CONVERT_PARAM));stConvertParam.nWidth = stImageInfo.nWidth;                 //ch:图像宽 | en:image widthstConvertParam.nHeight = stImageInfo.nHeight;               //ch:图像高 | en:image height//stConvertParam.pSrcData = m_pBufForDriver;                  //ch:输入数据缓存 | en:input data bufferstConvertParam.pSrcData = pDate;                  //ch:输入数据缓存 | en:input data bufferstConvertParam.nSrcDataLen = stImageInfo.nFrameLen;         //ch:输入数据大小 | en:input data sizestConvertParam.enSrcPixelType = stImageInfo.enPixelType;    //ch:输入像素格式 | en:input pixel formatstConvertParam.enDstPixelType = PixelType_Gvsp_BGR8_Packed; //ch:输出像素格式 | en:output pixel format  适用于OPENCV的图像格式//stConvertParam.enDstPixelType = PixelType_Gvsp_RGB8_Packed; //ch:输出像素格式 | en:output pixel formatstConvertParam.pDstBuffer = m_pBufForSaveImage;                    //ch:输出数据缓存 | en:output data bufferstConvertParam.nDstBufferSize = m_nBufSizeForSaveImage;            //ch:输出缓存大小 | en:output buffer sizeMV_CC_ConvertPixelType(m_hDevHandle, &stConvertParam);*getImage = Mat(stImageInfo.nHeight,stImageInfo.nWidth,CV_8UC3,m_pBufForSaveImage);//imwrite("d:\\测试opencv_Color.tif", image);}(*getImage).copyTo(image);(*getImage).release();free(pDate);free(m_pBufForSaveImage);return 0;
}

widget.cpp

#include "widget.h"
#include "ui_widget.h"
#include<QMessageBox>
#include<QDebug>
Widget::Widget(QWidget *parent): QWidget(parent), ui(new Ui::Widget),m_bOpenDevice(false),m_nDeviceCombo(0),m_nTriggerMode(MV_TRIGGER_MODE_OFF),m_bStartGrabbing(false),m_pcMyCamera(NULL),m_pSaveImageBuf(NULL),m_nSaveImageBufSize(0),m_bSoftWareTriggerCheck(false), m_nTriggerSource(MV_TRIGGER_SOURCE_SOFTWARE),m_dExposureEdit(0),m_dGainEdit(0),m_dFrameRateEdit(0),m_isDeviceReady(false)
{m_WorkThread=new WorkThread(*this);ui->setupUi(this);setWindowTitle("海康相机");InitUi();connect(ui->searchDeviceBtn   ,SIGNAL(clicked()),this,SLOT(slot_searchDevice()));connect(ui->openDeviceBtn     ,SIGNAL(clicked()),this,SLOT(slot_openDevice()));connect(ui->closeDeviceBtn    ,SIGNAL(clicked()),this,SLOT(slot_closeDevice()));connect(ui->continusModeBtn   ,SIGNAL(clicked()),this,SLOT(slot_continusModeBtn()));connect(ui->triggerModeBtn    ,SIGNAL(clicked()),this,SLOT(slot_triggerModeBtn()));connect(ui->startGrabBtn      ,SIGNAL(clicked()),this,SLOT(slot_grabbingBtn()));connect(ui->softwareTriggerBtn,SIGNAL(stateChanged(int)),this,SLOT(slot_softwareTriggerBtn()));connect(ui->softwareOnceBtn   ,SIGNAL(clicked()),this,SLOT(slot_softwareoOnceBtn()));connect(ui->saveBmpBtn        ,SIGNAL(clicked()),this,SLOT(slot_saveBmpBtn()));connect(ui->saveJpgBtn        ,SIGNAL(clicked()),this,SLOT(slot_saveJpgBtn()));connect(ui->saveTiffBtn       ,SIGNAL(clicked()),this,SLOT(slot_saveTiffBtn()));connect(ui->savePngBtn        ,SIGNAL(clicked()),this,SLOT(slot_savePngBtn()));connect(ui->GetParamterBtn    ,SIGNAL(clicked()),this,SLOT(slot_getParameterBtn()));connect(ui->SetParameterBtn   ,SIGNAL(clicked()),this,SLOT(slot_setParameterBtn()));connect(ui->stopGrabBtn       ,SIGNAL(clicked()),this,SLOT(slot_stopGrbbingBtn()));
}void Widget::slot_setParameterBtn()
{bool bIsSetSucceed = true;int nRet = SetExposureTime();if (nRet != MV_OK){bIsSetSucceed = false;QMessageBox::critical(this,"Exposure","Set Exposure Time Fail");}nRet = SetGain();if (nRet != MV_OK){bIsSetSucceed = false;QMessageBox::critical(this,"Gain","Set Gain Fail");}nRet = SetFrameRate();if (nRet != MV_OK){bIsSetSucceed = false;QMessageBox::critical(this,"Frame","Set Frame Rate Fail");}if (true == bIsSetSucceed){QMessageBox::critical(this,"Parameter","Set Parameter Succeed");}
}void Widget::slot_stopGrbbingBtn()
{if (false == m_bOpenDevice || false == m_bStartGrabbing || NULL == m_pcMyCamera){return;}m_WorkThread->SetRun(false);bool f=m_WorkThread->isRun();if(f){m_WorkThread->quit();m_WorkThread->wait();m_WorkThread=NULL;}int nRet = m_pcMyCamera->StopGrabbing();if(MV_OK != nRet){QMessageBox::critical(this,"grabbing","Stop grabbing fail");return;}m_bStartGrabbing = false;
}int Widget::SetTriggerSource()
{int nRet = MV_OK;m_bSoftWareTriggerCheck=ui->softwareTriggerBtn->isChecked();if (m_bSoftWareTriggerCheck){m_nTriggerSource = MV_TRIGGER_SOURCE_SOFTWARE;nRet = m_pcMyCamera->SetEnumValue("TriggerSource", m_nTriggerSource);if (MV_OK != nRet){QMessageBox::critical(this,"Trigger","Set Software Trigger Fail");return nRet;}// GetDlgItem(IDC_SOFTWARE_ONCE_BUTTON )->EnableWindow(TRUE);}else{m_nTriggerSource = MV_TRIGGER_SOURCE_LINE0;nRet = m_pcMyCamera->SetEnumValue("TriggerSource", m_nTriggerSource);if (MV_OK != nRet){QMessageBox::critical(this,"Hardware","Set Hardware Trigger Fail");return nRet;}//GetDlgItem(IDC_SOFTWARE_ONCE_BUTTON )->EnableWindow(FALSE);}return nRet;
}int Widget::SetFrameRate()
{int nRet = m_pcMyCamera->SetBoolValue("AcquisitionFrameRateEnable", true);if (MV_OK != nRet){return nRet;}bool ok;float frameRate = ui->FrameRateLineEdit->text().toDouble(&ok);if (!ok) {// 处理转换失败的情况,可能需要返回错误代码或显示错误消息return -1; // 示例错误代码}return m_pcMyCamera->SetFloatValue("AcquisitionFrameRate", (float)frameRate);
}int Widget::SetGain()
{// 先尝试关闭自动增益m_pcMyCamera->SetEnumValue("GainAuto", 0);bool ok;float gain = ui->GainLineEdit->text().toDouble(&ok);if (!ok) {// 处理转换失败的情况return -1; // 示例错误代码}return m_pcMyCamera->SetFloatValue("Gain", (float)gain);
}int Widget::SetExposureTime()
{int nRet = m_pcMyCamera->SetEnumValue("ExposureMode", MV_EXPOSURE_MODE_TIMED);if (MV_OK != nRet){return nRet;}// 关闭自动曝光m_pcMyCamera->SetEnumValue("ExposureAuto", MV_EXPOSURE_AUTO_MODE_OFF);bool ok;float exposureTime = ui->ExposureLineEdit->text().toDouble(&ok);if (!ok) {// 处理转换失败的情况return -1; // 示例错误代码}return m_pcMyCamera->SetFloatValue("ExposureTime", (float)exposureTime);
}int Widget::SetTriggerMode()
{return m_pcMyCamera->SetEnumValue("TriggerMode", m_nTriggerMode);
}void Widget::slot_getParameterBtn()
{int nRet = GetTriggerMode();if (nRet != MV_OK){QMessageBox::critical(this,"Mode","Get Trigger Mode Fail");}nRet = GetExposureTime();if (nRet != MV_OK){QMessageBox::critical(this,"Mode","Get Exposure Time Fail");}ui->ExposureLineEdit->setText(QString("%1").arg(m_dExposureEdit));nRet = GetGain();if (nRet != MV_OK){QMessageBox::critical(this,"Gain","Get Gain Fail");}ui->GainLineEdit->setText(QString("%1").arg(m_dGainEdit));nRet = GetFrameRate();if (nRet != MV_OK){QMessageBox::critical(this,"Frame","Get Frame Rate Fail");}ui->FrameRateLineEdit->setText(QString("%1").arg(m_dFrameRateEdit));nRet = GetTriggerSource();if (nRet != MV_OK){QMessageBox::critical(this,"Trigger","Get Trigger Source Fail");}}int Widget::GetTriggerSource()
{MVCC_ENUMVALUE stEnumValue = {0};int nRet = m_pcMyCamera->GetEnumValue("TriggerSource", &stEnumValue);if (MV_OK != nRet){return nRet;}if ((unsigned int)MV_TRIGGER_SOURCE_SOFTWARE == stEnumValue.nCurValue){m_bSoftWareTriggerCheck = true;}else{m_bSoftWareTriggerCheck = false;}return MV_OK;
}int Widget::GetGain()
{MVCC_FLOATVALUE stFloatValue = {0};int nRet = m_pcMyCamera->GetFloatValue("Gain", &stFloatValue);if (MV_OK != nRet){return nRet;}m_dGainEdit = stFloatValue.fCurValue;return MV_OK;
}int Widget::GetFrameRate()
{MVCC_FLOATVALUE stFloatValue = {0};int nRet = m_pcMyCamera->GetFloatValue("ResultingFrameRate", &stFloatValue);if (MV_OK != nRet){return nRet;}m_dFrameRateEdit = stFloatValue.fCurValue;return MV_OK;
}int Widget::GetTriggerMode()
{MVCC_ENUMVALUE stEnumValue = {0};int nRet = m_pcMyCamera->GetEnumValue("TriggerMode", &stEnumValue);if(MV_OK != nRet){return nRet;}m_nTriggerMode = stEnumValue.nCurValue;EnableControls();return MV_OK;
}int Widget::GetExposureTime()
{MVCC_FLOATVALUE stFloatValue = {0};int nRet = m_pcMyCamera->GetFloatValue("ExposureTime", &stFloatValue);if(MV_OK != nRet){return nRet;}m_dExposureEdit = stFloatValue.fCurValue;return MV_OK;
}void Widget::slot_savePngBtn()
{int nRet = SaveImage(MV_Image_Png);if (MV_OK != nRet){QMessageBox::critical(this,"picture","Save Png fail");return;}QMessageBox::critical(this,"picture","Save Png succeed!");
}void Widget::slot_saveTiffBtn()
{int nRet = SaveImage(MV_Image_Tif);if (MV_OK != nRet){QMessageBox::critical(this,"picture","Save jpg fail");return;}QMessageBox::critical(this,"picture","Save jpg succeed!");
}void Widget::slot_saveJpgBtn()
{int nRet = SaveImage(MV_Image_Jpeg);if (MV_OK != nRet){QMessageBox::critical(this,"picture","Save jpg fail");return;}QMessageBox::critical(this,"picture","Save jpg succeed!");
}int Widget::SaveImage(MV_SAVE_IAMGE_TYPE enSaveImageType)
{MV_SAVE_IMG_TO_FILE_PARAM stSaveFileParam;memset(&stSaveFileParam, 0, sizeof(MV_SAVE_IMG_TO_FILE_PARAM));m_mutex.lock();if (m_pSaveImageBuf == NULL || m_stImageInfo.enPixelType == 0){m_mutex.unlock();return MV_E_NODATA;}if(RemoveCustomPixelFormats(m_stImageInfo.enPixelType)){m_mutex.unlock();return MV_E_SUPPORT;}stSaveFileParam.enImageType = enSaveImageType;              // ch:需要保存的图像类型 | en:Image format to savestSaveFileParam.enPixelType = m_stImageInfo.enPixelType;    // ch:相机对应的像素格式 | en:Camera pixel typestSaveFileParam.nWidth      = m_stImageInfo.nWidth;         // ch:相机对应的宽 | en:WidthstSaveFileParam.nHeight     = m_stImageInfo.nHeight;        // ch:相机对应的高 | en:HeightstSaveFileParam.nDataLen    = m_stImageInfo.nFrameLen;stSaveFileParam.pData       = m_pSaveImageBuf;stSaveFileParam.iMethodValue = 0;// ch:jpg图像质量范围为(50-99], png图像质量范围为[0-9] | en:jpg image nQuality range is (50-99], png image nQuality range is [0-9]if (MV_Image_Bmp == stSaveFileParam.enImageType){sprintf_s(stSaveFileParam.pImagePath, 256, "Image_w%d_h%d_fn%03d.bmp", stSaveFileParam.nWidth, stSaveFileParam.nHeight, m_stImageInfo.nFrameNum);}else if (MV_Image_Jpeg == stSaveFileParam.enImageType){stSaveFileParam.nQuality = 80;sprintf_s(stSaveFileParam.pImagePath, 256, "Image_w%d_h%d_fn%03d.jpg", stSaveFileParam.nWidth, stSaveFileParam.nHeight, m_stImageInfo.nFrameNum);}else if (MV_Image_Tif == stSaveFileParam.enImageType){sprintf_s(stSaveFileParam.pImagePath, 256, "Image_w%d_h%d_fn%03d.tif", stSaveFileParam.nWidth, stSaveFileParam.nHeight, m_stImageInfo.nFrameNum);}else if (MV_Image_Png == stSaveFileParam.enImageType){stSaveFileParam.nQuality = 8;sprintf_s(stSaveFileParam.pImagePath, 256, "Image_w%d_h%d_fn%03d.png", stSaveFileParam.nWidth, stSaveFileParam.nHeight, m_stImageInfo.nFrameNum);}int nRet = m_pcMyCamera->SaveImageToFile(&stSaveFileParam);m_mutex.unlock();return nRet;
}void Widget::slot_saveBmpBtn()
{int nRet = SaveImage(MV_Image_Bmp);if (MV_OK != nRet){QMessageBox::critical(this,"picture","Save bmp fail");return;}QMessageBox::critical(this,"picture","Save bmp succeed!");
}void Widget::slot_closeDevice()
{bool f=m_WorkThread->isRun();if (f){m_WorkThread->quit();m_WorkThread->wait();m_WorkThread->SetRun(false);}if(m_pcMyCamera){m_pcMyCamera->Close();delete m_pcMyCamera;m_pcMyCamera = NULL;}m_bStartGrabbing=false;m_bOpenDevice = false;if(m_pSaveImageBuf){free(m_pSaveImageBuf);m_pSaveImageBuf=NULL;}m_nSaveImageBufSize=0;EnableControls();
}void Widget::slot_continusModeBtn()
{m_nTriggerMode = MV_TRIGGER_MODE_OFF;m_pcMyCamera->SetEnumValue("TriggerMode", m_nTriggerMode);EnableControls();
}void Widget::slot_triggerModeBtn()
{m_nTriggerMode = MV_TRIGGER_MODE_ON;m_pcMyCamera->SetEnumValue("TriggerMode", m_nTriggerMode);EnableControls();
}void Widget::slot_grabbingBtn()
{if (false == m_bOpenDevice || true == m_bStartGrabbing || NULL == m_pcMyCamera){return;}memset(&m_stImageInfo, 0, sizeof(MV_FRAME_OUT_INFO_EX));m_WorkThread->SetRun(true);m_WorkThread->start();int nRet = m_pcMyCamera->StartGrabbing();if (MV_OK != nRet){m_WorkThread->SetRun(false);QMessageBox::information(this,"Device","Start grabbing fail");return;}m_bStartGrabbing = true;EnableControls();
}void Widget::slot_softwareTriggerBtn()
{int nRet = MV_OK;m_bSoftWareTriggerCheck=ui->softwareTriggerBtn->isChecked();if (m_bSoftWareTriggerCheck){m_nTriggerSource = MV_TRIGGER_SOURCE_SOFTWARE;nRet = m_pcMyCamera->SetEnumValue("TriggerSource", m_nTriggerSource);if (MV_OK != nRet){QMessageBox::information(this,"Device","Set Software Trigger Fail");return;}}else{m_nTriggerSource = MV_TRIGGER_SOURCE_LINE0;nRet = m_pcMyCamera->SetEnumValue("TriggerSource", m_nTriggerSource);if (MV_OK != nRet){QMessageBox::information(this,"Device","Set Hardware Trigger Fail");return;}}EnableControls();return;
}void Widget::slot_softwareoOnceBtn()
{if(true != m_bStartGrabbing){return;}m_pcMyCamera->CommandExecute("TriggerSoftware");
}void Widget::InitUi()
{memset(&m_stImageInfo, 0, sizeof(MV_FRAME_OUT_INFO_EX));m_WorkThread->SetRun(false);EnableControls();
}void  Widget::EnableControls()
{//如果查询到设备,开启打开设备按钮ui->openDeviceBtn->setEnabled(m_isDeviceReady?true:false);ui->closeDeviceBtn->setEnabled(m_bOpenDevice?true:false);ui->continusModeBtn->setEnabled(m_bOpenDevice?true:false);ui->triggerModeBtn->setEnabled(m_bOpenDevice?true:false);ui->startGrabBtn->setEnabled(m_bOpenDevice?true:false);ui->stopGrabBtn->setEnabled(m_bOpenDevice?true:false);//首先是否是在采集图像中,在采集图像的过程中,判断是否为触发模式,只有在触发模式下,才能开启软触发按钮。ui->softwareTriggerBtn->setEnabled(m_bStartGrabbing?((MV_TRIGGER_MODE_ON ==  m_nTriggerMode)?true:false):false);ui->softwareOnceBtn->setEnabled((MV_TRIGGER_MODE_OFF ==  m_nTriggerMode) ? false:(m_bSoftWareTriggerCheck?true:false) );ui->saveBmpBtn->setEnabled(m_bStartGrabbing?true:false);ui->saveJpgBtn->setEnabled(m_bStartGrabbing?true:false);ui->saveTiffBtn->setEnabled(m_bStartGrabbing?true:false);ui->savePngBtn->setEnabled(m_bStartGrabbing?true:false);ui->GetParamterBtn->setEnabled(m_bOpenDevice?true:false);ui->SetParameterBtn  ->setEnabled(m_bOpenDevice?true:false);ui->ExposureLineEdit->setEnabled(m_bOpenDevice?true:false);ui->GainLineEdit->setEnabled(m_bOpenDevice?true:false);ui->FrameRateLineEdit->setEnabled(m_bOpenDevice?true:false);
}bool Widget::RemoveCustomPixelFormats(MvGvspPixelType enPixelFormat)
{int nResult = enPixelFormat & MV_GVSP_PIX_CUSTOM;if(MV_GVSP_PIX_CUSTOM == nResult){return true;}else{return false;}
}void Widget::slot_openDevice()
{if (true == m_bOpenDevice || NULL != m_pcMyCamera){return;}int nIndex = m_nDeviceCombo;if ((nIndex < 0) | (nIndex >= MV_MAX_DEVICE_NUM)){QMessageBox::critical(this,"Device","Device index is error!");return;}// ch:由设备信息创建设备实例 | en:Device instance created by device informationif (NULL == m_stDevList.pDeviceInfo[nIndex]){QMessageBox::critical(this,"Device","Device does not exist!");return;}m_pcMyCamera = new CMvCamera;if (NULL == m_pcMyCamera){return;}int nRet = m_pcMyCamera->Open(m_stDevList.pDeviceInfo[nIndex]);if (MV_OK != nRet){delete m_pcMyCamera;m_pcMyCamera = NULL;QMessageBox::critical(this,"Device","Device Open error!");return;}// ch:探测网络最佳包大小(只对GigE相机有效) | en:Detection network optimal package size(It only works for the GigE camera)if (m_stDevList.pDeviceInfo[nIndex]->nTLayerType == MV_GIGE_DEVICE){unsigned int nPacketSize = 0;nRet = m_pcMyCamera->GetOptimalPacketSize(&nPacketSize);if (nRet == MV_OK){nRet = m_pcMyCamera->SetIntValue("GevSCPSPacketSize",nPacketSize);if(nRet != MV_OK){QMessageBox::critical(this,"Device","Warning: Set Packet Size fail!");}}else{QMessageBox::critical(this,"Device","Warning: Get Packet Size fail!");}}m_bOpenDevice = true;EnableControls();slot_getParameterBtn();
}void Widget::slot_searchDevice()
{QString strMsg;ui->comboBox->clear();memset(&m_stDevList, 0, sizeof(MV_CC_DEVICE_INFO_LIST));//ch:枚举子网内所有设备,将查询到的设备信息保存到m_stDevList列表中。int nRet   = CMvCamera::EnumDevices(MV_GIGE_DEVICE | MV_USB_DEVICE, &m_stDevList);if (MV_OK != nRet){QMessageBox::critical(this,"device","No device!");return;}// ch:将值加入到信息列表框中并显示出来 | en:Add value to the information list box and displayfor (unsigned int i = 0; i < m_stDevList.nDeviceNum; i++){MV_CC_DEVICE_INFO* pDeviceInfo = m_stDevList.pDeviceInfo[i];if (NULL == pDeviceInfo){continue;}if (pDeviceInfo->nTLayerType == MV_USB_DEVICE){char strUserName[256] = {0};sprintf_s(strUserName, 256, "%s %s (%s)", pDeviceInfo->SpecialInfo.stUsb3VInfo.chModelName,pDeviceInfo->SpecialInfo.stUsb3VInfo.chModelName,pDeviceInfo->SpecialInfo.stUsb3VInfo.chSerialNumber);QString  UserName(strUserName);QString strMsg = QString("USB %1").arg(QString::fromUtf8(reinterpret_cast<const char*>(pDeviceInfo->SpecialInfo.stUsb3VInfo.chSerialNumber)));ui->comboBox->addItem(strMsg);}}if (0 == m_stDevList.nDeviceNum){QMessageBox::critical(this,"device","No device!");return;}ui->comboBox->setCurrentIndex(0);m_isDeviceReady=true;                                 //设备已经打开EnableControls();
}Widget::~Widget()
{delete ui;slot_closeDevice();
}

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

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

相关文章

erlang学习: Mnesia Erlang数据库3

Mnesia数据库删除实现和事务处理 -module(test_mnesia). -include_lib("stdlib/include/qlc.hrl").-record(shop, {item, quantity, cost}). %% API -export([insert/3, select/0, select/1, delete/1, transaction/1,start/0, do_this_once/0]). start() ->mnes…

dp+观察,CF 1864 D. Matrix Cascade

目录 一、题目 1、题目描述 2、输入输出 2.1输入 2.2输出 3、原题链接 二、解题报告 1、思路分析 2、复杂度 3、代码详解 一、题目 1、题目描述 2、输入输出 2.1输入 2.2输出 3、原题链接 https://codeforces.com/problemset/problem/1864/D 二、解题报告 1、思路…

Python | Leetcode Python题解之第394题字符串解码

题目&#xff1a; 题解&#xff1a; class Solution:def decodeString(self, s: str) -> str:def dfs(s, i):res, multi "", 0while i < len(s):if 0 < s[i] < 9:multi multi * 10 int(s[i])elif s[i] [:i, tmp dfs(s, i 1)res multi * tmpmulti…

AI应用 | 超好玩的“汉语新解“ - 文末有Prompt

最近群里玩“汉语新解”的文字卡片贼多 感觉很新颖 本来AI是无法生成固定的图的 但是使用html格式&#xff0c;来生成固定图片的想法还是很不错的 看看效果 使用很简单 把提示词喂给Ai即可 随便一个大模型都可以&#xff0c;比如ChatGPT、通义千问、kimi等等 提示词(Prompt)如下…

基于SpringBoot+Vue+MySQL的房屋租赁管理系统

系统展示 用户前台界面 管理员后台界面 系统背景 二十一世纪互联网的出现&#xff0c;改变了几千年以来人们的生活&#xff0c;不仅仅是生活物资的丰富&#xff0c;还有精神层次的丰富。在互联网诞生之前&#xff0c;地域位置往往是人们思想上不可跨域的鸿沟&#xff0c;信息的…

基于SpringBoot+Vue的超市外卖管理系统

作者&#xff1a;计算机学姐 开发技术&#xff1a;SpringBoot、SSM、Vue、MySQL、JSP、ElementUI、Python、小程序等&#xff0c;“文末源码”。 专栏推荐&#xff1a;前后端分离项目源码、SpringBoot项目源码、SSM项目源码 系统展示 【2025最新】基于JavaSpringBootVueMySQL的…

8.Bug流程管理,禅道的使用(包含笔试/面试题)

一、bug的生命周期&#xff08;重点&#xff09; bug的生命周期就是从bug被发现到bug被关闭的整个过程。 1.bug生命周期&#xff1a; 新建&#xff08;提交bug&#xff09; - 指派 - 已解决 - 待验 - 关闭 new&#xff08;新建&#xff09; - assign额的&…

Python语言开发学习之使用Python预测天气

什么是wttr&#xff1f; 使用Python预测天气的第一步&#xff0c;我们要了解wttr是什么。wttr.in是一个面向控制台的天气预报服务&#xff0c;它支持各种信息表示方法&#xff0c;如面向终端的ANSI序列(用于控制台HTTP客户端(curl、httpie或wget))、HTML(用于web浏览器)或PNG(…

SprinBoot+Vue在线考试系统的设计与实现

目录 1 项目介绍2 项目截图3 核心代码3.1 Controller3.2 Service3.3 Dao3.4 application.yml3.5 SpringbootApplication3.5 Vue 4 数据库表设计5 文档参考6 计算机毕设选题推荐7 源码获取 1 项目介绍 博主个人介绍&#xff1a;CSDN认证博客专家&#xff0c;CSDN平台Java领域优质…

僵尸网络开发了新的攻击技术和基础设施

臭名昭著的 Quad7 僵尸网络&#xff08;也称为 7777 僵尸网络&#xff09;不断发展其运营&#xff0c;最近的发现表明其目标和攻击方法都发生了重大变化。 根据 Sekoia.io 的最新报告&#xff0c;Quad7 的运营商正在开发新的后门和基础设施&#xff0c;以增强僵尸网络的弹性&a…

【算法】链表相关

【ps】本篇有 5 道 leetcode OJ。 一、算法简介 链表是一种常见的线性数据结构&#xff0c;是一种在物理结构上非连续、非顺序的存储结构&#xff0c;其中的数据元素的逻辑顺序由其中的指针链接次序实现&#xff0c;指针链接的每一个结构体都是一个节点。 链表的结构多种多样&…

linux kernel 6.x 用户态地址空间探究

最近做个项目需要研究用户态虚拟地址划分情况&#xff0c;找到多个app的共有未使用区间。偶然发现6.1.49和6.8的kernel用户态虚拟地址划分似乎有些不一样。下面使用数据进行分析。 大家都知道linux应用空间的地址划分是&#xff1a; stack高地址开始&#xff0c;向下生长。mm…

换脸动漫转真人:ComfyUI无实物Cosplay

在数字艺术领域&#xff0c;将动漫角色转换为真人形象一直是艺术家的追求。现在&#xff0c;ComfyUI推出了无实物Cosplay功能&#xff0c;让你轻松实现换脸动漫转真人&#xff0c;开启你的二次元冒险之旅&#xff01; ComfyUI无实物Cosplay&#xff1a;换脸动漫转真人&#xf…

Elasticsearch 向量数据库本地部署 及操作方法

elasticsearch是个分布式向量数据库&#xff0c;支持多种查找模式。此外还拥有 Metadata、Filtering、Hybrid Search、Delete、Store Documents、Async等能力。本文仅是记录本地测试途中遇到的问题。 一&#xff0c;环境部署 下载软件 首先去官网&#xff0c;选择适合平台下…

黑龙江等保测评:保障数据安全的最佳选择,助力企业无忧发展!

在数字化时代&#xff0c;数据安全已成为企业发展的重中之重。尤其是在黑龙江&#xff0c;随着信息技术的快速发展&#xff0c;数据泄露和网络攻击的风险日益增加。为了帮助企业提升数据安全防护能力&#xff0c;黑龙江等保测评应运而生&#xff0c;成为保障数据安全的有力工具…

在代码平台怎么拉取对应分支的项目,并且创建属于自己的分支

1.找到对应的代码平台比如gitee,gogs 我这里是gogs 这里有一个网址,把他复制下来 2.打开你想放到的idea路径 输入cmd 输入 这是网上找的项目 git clone http://192.168.150.101:10880/tjxt/tianji.git -b lesson-init 这里的git clone是克隆,这里的-b是分隔符,lesson-ini…

论文120:Giga-SSL: Self-supervised learning for gigapixel images (2023, CVPR, 开源)

文章目录 1 要点2 方法2.1 算法设计2.2 设计选择 1 要点 题目&#xff1a;用于千兆像素图像的自监督学习 (Giga-SSL: Self-Supervised Learning for Gigapixel Images) 代码&#xff1a;https://github.com/trislaz/gigassl 研究目的&#xff1a; 现有的WSI分类方法依赖于有…

【Proteus51单片机仿真】YL-69湿度检测和继电器电机自启动

目录 一、主要功能 二、硬件资源 三、程序编程 四、实现现象 一、主要功能 基于AT89C51单片机&#xff0c;湿度检测模块通过ADC0832数模转换器&#xff0c;将模拟信号转换为数字信号给单片机&#xff0c;然后通过LCD1602显示屏显示出当前的湿度值&#xff0c;并判断当前湿度值是…

CSS 常用元素属性

CSS 属性有很多, 可以参考文档 CSS 参考手册 1. 字体属性 设置字体 多个字体之间使用逗号分隔. (从左到右查找字体, 如果都找不到, 会使用默认字体. )如果字体名有空格, 使用引号包裹.建议使用常见字体, 否则兼容性不好. <style>.one {font-family:"Microsoft Ya…

Machine Learning: A Probabilistic Perspective 机器学习:概率视角 PDF免费分享

下载链接在博客最底部&#xff01;&#xff01; 之前需要参考这本书&#xff0c;但是大多数博客都是收费才能下载本书。 在网上找了好久才找到免费的资源&#xff0c;浪费了不少时间&#xff0c;在此分享以节约大家的时间。 链接: https://pan.baidu.com/s/1erFsMcVR0A_xT4fx…