厂家提供原始代码

This commit is contained in:
jianbin.chang常健彬 2025-07-17 08:39:15 +08:00
commit ce734d1af1
4650 changed files with 495952 additions and 0 deletions

4
ButtonDelegate.h Normal file
View File

@ -0,0 +1,4 @@
#ifndef BUTTONDELEGATE_H
#define BUTTONDELEGATE_H
#endif // BUTTONDELEGATE_H

674
CammerWidget.cpp Normal file
View File

@ -0,0 +1,674 @@
#include "cammer.h"
#include "ui_cammer.h"
#define DEFAULT_SHOW_RATE (30) // 默认显示帧率 | defult display frequency
#define DEFAULT_ERROR_STRING ("N/A")
#define MAX_FRAME_STAT_NUM (50)
#define MIN_LEFT_LIST_NUM (2)
#define MAX_STATISTIC_INTERVAL (5000000000) // List的更新时与最新一帧的时间最大间隔 | The maximum time interval between the update of list and the latest frame
// 取流回调函数
// get frame callback function
static void FrameCallback(IMV_Frame* pFrame, void* pUser)
{
cammer* pcammer = (cammer*)pUser;
if (!pcammer)
{
printf("pcammer is NULL!\n");
return;
}
CFrameInfo frameInfo;
frameInfo.m_nWidth = (int)pFrame->frameInfo.width;
frameInfo.m_nHeight = (int)pFrame->frameInfo.height;
frameInfo.m_nBufferSize = (int)pFrame->frameInfo.size;
frameInfo.m_nPaddingX = (int)pFrame->frameInfo.paddingX;
frameInfo.m_nPaddingY = (int)pFrame->frameInfo.paddingY;
frameInfo.m_ePixelType = pFrame->frameInfo.pixelFormat;
frameInfo.m_pImageBuf = (unsigned char *)malloc(sizeof(unsigned char) * frameInfo.m_nBufferSize);
frameInfo.m_nTimeStamp = pFrame->frameInfo.timeStamp;
// 内存申请失败,直接返回
// memory application failed, return directly
if (frameInfo.m_pImageBuf != NULL)
{
memcpy(frameInfo.m_pImageBuf, pFrame->pData, frameInfo.m_nBufferSize);
if (pcammer->m_qDisplayFrameQueue.size() > 16)
{
CFrameInfo frameOld;
if (pcammer->m_qDisplayFrameQueue.get(frameOld))
{
free(frameOld.m_pImageBuf);
frameOld.m_pImageBuf = NULL;
}
}
pcammer->m_qDisplayFrameQueue.push_back(frameInfo);
}
pcammer->recvNewFrame(pFrame->frameInfo.size);
}
// 显示线程
// display thread
static unsigned int __stdcall displayThread(void* pUser)
{
cammer* pcammer = (cammer*)pUser;
if (!pcammer)
{
printf("pcammer is NULL!\n");
return -1;
}
pcammer->display();
return 0;
}
cammer::cammer(QWidget *parent) :
QWidget(parent)
,ui(new Ui::cammer)
, m_currentCameraKey("")
, handle(NULL)
, m_nDisplayInterval(0)
, m_nFirstFrameTime(0)
, m_nLastFrameTime(0)
, m_bNeedUpdate(true)
, m_nTotalFrameCount(0)
, m_isExitDisplayThread(false)
, m_threadHandle(NULL)
{
ui->setupUi(this);
qRegisterMetaType<uint64_t>("uint64_t");
connect(this, SIGNAL(signalShowImage(unsigned char*, int, int, uint64_t)), this, SLOT(ShowImage(unsigned char*, int, int, uint64_t)));
// 默认显示30帧
// defult display 30 frames
setDisplayFPS(DEFAULT_SHOW_RATE);
m_elapsedTimer.start();
// 启动显示线程
// start display thread
m_threadHandle = (HANDLE)_beginthreadex(NULL,
0,
displayThread,
this,
CREATE_SUSPENDED,
NULL);
if (!m_threadHandle)
{
printf("Failed to create display thread!\n");
}
else
{
ResumeThread(m_threadHandle);
m_isExitDisplayThread = false;
}
}
cammer::~cammer()
{
// 关闭显示线程
// close display thread
m_isExitDisplayThread = true;
WaitForSingleObject(m_threadHandle, INFINITE);
CloseHandle(m_threadHandle);
delete ui;
}
// 设置曝光
// set exposeTime
bool cammer::SetExposeTime(double dExposureTime)
{
int ret = IMV_OK;
ret = IMV_SetDoubleFeatureValue(handle, "ExposureTime", dExposureTime);
if (IMV_OK != ret)
{
printf("set ExposureTime value = %0.2f fail, ErrorCode[%d]\n", dExposureTime, ret);
return false;
}
return true;
}
// 设置增益
// set gain
bool cammer::SetAdjustPlus(double dGainRaw)
{
int ret = IMV_OK;
ret = IMV_SetDoubleFeatureValue(handle, "GainRaw", dGainRaw);
if (IMV_OK != ret)
{
printf("set GainRaw value = %0.2f fail, ErrorCode[%d]\n", dGainRaw, ret);
return false;
}
return true;
}
// 打开相机
// open camera
bool cammer::CameraOpen(void)
{
int ret = IMV_OK;
if (m_currentCameraKey.length() == 0)
{
printf("open camera fail. No camera.\n");
return false;
}
if (handle)
{
printf("handle is already been create!\n");
return false;
}
QByteArray cameraKeyArray = m_currentCameraKey.toLocal8Bit();
char* cameraKey = cameraKeyArray.data();
ret = IMV_CreateHandle(&handle, modeByCameraKey, (void*)cameraKey);
if (IMV_OK != ret)
{
printf("create devHandle failed! cameraKey[%s], ErrorCode[%d]\n", cameraKey, ret);
return false;
}
// 打开相机
// Open camera
ret = IMV_Open(handle);
if (IMV_OK != ret)
{
printf("open camera failed! ErrorCode[%d]\n", ret);
return false;
}
return true;
}
// 关闭相机
// close camera
bool cammer::CameraClose(void)
{
int ret = IMV_OK;
if (!handle)
{
printf("close camera fail. No camera.\n");
return false;
}
if (false == IMV_IsOpen(handle))
{
printf("camera is already close.\n");
return false;
}
ret = IMV_Close(handle);
if (IMV_OK != ret)
{
printf("close camera failed! ErrorCode[%d]\n", ret);
return false;
}
ret = IMV_DestroyHandle(handle);
if (IMV_OK != ret)
{
printf("destroy devHandle failed! ErrorCode[%d]\n", ret);
return false;
}
handle = NULL;
return true;
}
// 开始采集
// start grabbing
bool cammer::CameraStart()
{
int ret = IMV_OK;
if (IMV_IsGrabbing(handle))
{
printf("camera is already grebbing.\n");
return false;
}
ret = IMV_AttachGrabbing(handle, FrameCallback, this);
if (IMV_OK != ret)
{
printf("Attach grabbing failed! ErrorCode[%d]\n", ret);
return false;
}
ret = IMV_StartGrabbing(handle);
if (IMV_OK != ret)
{
printf("start grabbing failed! ErrorCode[%d]\n", ret);
return false;
}
return true;
}
// 停止采集
// stop grabbing
bool cammer::CameraStop()
{
int ret = IMV_OK;
if (!IMV_IsGrabbing(handle))
{
printf("camera is already stop grebbing.\n");
return false;
}
ret = IMV_StopGrabbing(handle);
if (IMV_OK != ret)
{
printf("Stop grabbing failed! ErrorCode[%d]\n", ret);
return false;
}
// 清空显示队列
// clear display queue
CFrameInfo frameOld;
while (m_qDisplayFrameQueue.get(frameOld))
{
free(frameOld.m_pImageBuf);
frameOld.m_pImageBuf = NULL;
}
m_qDisplayFrameQueue.clear();
return true;
}
// 切换采集方式、触发方式 (连续采集、外部触发、软件触发)
// Switch acquisition mode and triggering mode (continuous acquisition, external triggering and software triggering)
bool cammer::CameraChangeTrig(ETrigType trigType)
{
int ret = IMV_OK;
if (trigContinous == trigType)
{
// 设置触发模式
// set trigger mode
ret = IMV_SetEnumFeatureSymbol(handle, "TriggerMode", "Off");
if (IMV_OK != ret)
{
printf("set TriggerMode value = Off fail, ErrorCode[%d]\n", ret);
return false;
}
}
else if (trigSoftware == trigType)
{
// 设置触发器
// set trigger
ret = IMV_SetEnumFeatureSymbol(handle, "TriggerSelector", "FrameStart");
if (IMV_OK != ret)
{
printf("set TriggerSelector value = FrameStart fail, ErrorCode[%d]\n", ret);
return false;
}
// 设置触发模式
// set trigger mode
ret = IMV_SetEnumFeatureSymbol(handle, "TriggerMode", "On");
if (IMV_OK != ret)
{
printf("set TriggerMode value = On fail, ErrorCode[%d]\n", ret);
return false;
}
// 设置触发源为软触发
// set triggerSource as software trigger
ret = IMV_SetEnumFeatureSymbol(handle, "TriggerSource", "Software");
if (IMV_OK != ret)
{
printf("set TriggerSource value = Software fail, ErrorCode[%d]\n", ret);
return false;
}
}
else if (trigLine == trigType)
{
// 设置触发器
// set trigger
ret = IMV_SetEnumFeatureSymbol(handle, "TriggerSelector", "FrameStart");
if (IMV_OK != ret)
{
printf("set TriggerSelector value = FrameStart fail, ErrorCode[%d]\n", ret);
return false;
}
// 设置触发模式
// set trigger mode
ret = IMV_SetEnumFeatureSymbol(handle, "TriggerMode", "On");
if (IMV_OK != ret)
{
printf("set TriggerMode value = On fail, ErrorCode[%d]\n", ret);
return false;
}
// 设置触发源为Line1触发
// set trigggerSource as Line1 trigger
ret = IMV_SetEnumFeatureSymbol(handle, "TriggerSource", "Line1");
if (IMV_OK != ret)
{
printf("set TriggerSource value = Line1 fail, ErrorCode[%d]\n", ret);
return false;
}
}
return true;
}
// 执行一次软触发
// execute one software trigger
bool cammer::ExecuteSoftTrig(void)
{
int ret = IMV_OK;
ret = IMV_ExecuteCommandFeature(handle, "TriggerSoftware");
if (IMV_OK != ret)
{
printf("ExecuteSoftTrig fail, ErrorCode[%d]\n", ret);
return false;
}
printf("ExecuteSoftTrig success.\n");
return true;
}
// 设置当前相机
// set current camera
void cammer::SetCamera(const QString& strKey)
{
m_currentCameraKey = strKey;
}
// 显示
// diaplay
bool cammer::ShowImage(unsigned char* pRgbFrameBuf, int nWidth, int nHeight, uint64_t nPixelFormat)
{
QImage image;
if (NULL == pRgbFrameBuf ||
nWidth == 0 ||
nHeight == 0)
{
printf("%s image is invalid.\n", __FUNCTION__);
return false;
}
if (gvspPixelMono8 == nPixelFormat)
{
image = QImage(pRgbFrameBuf, nWidth, nHeight, QImage::Format_Grayscale8);
}
else
{
image = QImage(pRgbFrameBuf,nWidth, nHeight, QImage::Format_RGB888);
}
// 将QImage的大小收缩或拉伸与label的大小保持一致。这样label中能显示完整的图片
// Shrink or stretch the size of Qimage to match the size of the label. In this way, the complete image can be displayed in the label
QImage imageScale = image.scaled(QSize(ui->label_Pixmap->width(), ui->label_Pixmap->height()));
QPixmap pixmap = QPixmap::fromImage(imageScale);
ui->label_Pixmap->setPixmap(pixmap);
free(pRgbFrameBuf);
return true;
}
// 显示线程
// display thread
void cammer::display()
{
while (!m_isExitDisplayThread)
{
CFrameInfo frameInfo;
if (false == m_qDisplayFrameQueue.get(frameInfo))
{
Sleep(1);
continue;
}
// 判断是否要显示。超过显示上限30帧就不做转码、显示处理
// Judge whether to display. If the upper display limit (30 frames) is exceeded, transcoding and display processing will not be performed
if (!isTimeToDisplay())
{
// 释放内存
// release memory
free(frameInfo.m_pImageBuf);
continue;
}
// mono8格式可不做转码直接显示其他格式需要经过转码才能显示
// mono8 format can be displayed directly without transcoding. Other formats can be displayed only after transcoding
if (gvspPixelMono8 == frameInfo.m_ePixelType)
{
// 显示线程中发送显示信号,在主线程中显示图像
// Send display signal in display thread and display image in main thread
emit signalShowImage(frameInfo.m_pImageBuf, (int)frameInfo.m_nWidth, (int)frameInfo.m_nHeight, (uint64_t)frameInfo.m_ePixelType);
}
else
{
// 转码
unsigned char* pRGBbuffer = NULL;
int nRgbBufferSize = 0;
nRgbBufferSize = frameInfo.m_nWidth * frameInfo.m_nHeight * 3;
pRGBbuffer = (unsigned char*)malloc(nRgbBufferSize);
if (pRGBbuffer == NULL)
{
// 释放内存
// release memory
free(frameInfo.m_pImageBuf);
printf("RGBbuffer malloc failed.\n");
continue;
}
IMV_PixelConvertParam stPixelConvertParam;
stPixelConvertParam.nWidth = frameInfo.m_nWidth;
stPixelConvertParam.nHeight = frameInfo.m_nHeight;
stPixelConvertParam.ePixelFormat = frameInfo.m_ePixelType;
stPixelConvertParam.pSrcData = frameInfo.m_pImageBuf;
stPixelConvertParam.nSrcDataLen = frameInfo.m_nBufferSize;
stPixelConvertParam.nPaddingX = frameInfo.m_nPaddingX;
stPixelConvertParam.nPaddingY = frameInfo.m_nPaddingY;
stPixelConvertParam.eBayerDemosaic = demosaicNearestNeighbor;
stPixelConvertParam.eDstPixelFormat = gvspPixelRGB8;
stPixelConvertParam.pDstBuf = pRGBbuffer;
stPixelConvertParam.nDstBufSize = nRgbBufferSize;
int ret = IMV_PixelConvert(handle, &stPixelConvertParam);
if (IMV_OK != ret)
{
// 释放内存
// release memory
printf("image convert to RGB failed! ErrorCode[%d]\n", ret);
free(frameInfo.m_pImageBuf);
free(pRGBbuffer);
continue;
}
// 释放内存
// release memory
free(frameInfo.m_pImageBuf);
// 显示线程中发送显示信号,在主线程中显示图像
// Send display signal in display thread and display image in main thread
emit signalShowImage(pRGBbuffer, (int)stPixelConvertParam.nWidth, (int)stPixelConvertParam.nHeight, (uint64_t)stPixelConvertParam.eDstPixelFormat);
}
}
}
bool cammer::isTimeToDisplay()
{
m_mxTime.lock();
// 不显示
// don't display
if (m_nDisplayInterval <= 0)
{
m_mxTime.unlock();
return false;
}
// 第一帧必须显示
// the frist frame must be displayed
if (m_nFirstFrameTime == 0 || m_nLastFrameTime == 0)
{
m_nFirstFrameTime = m_elapsedTimer.nsecsElapsed();
m_nLastFrameTime = m_nFirstFrameTime;
m_mxTime.unlock();
return true;
}
// 当前帧和上一帧的间隔如果大于显示间隔就显示
// display if the interval between the current frame and the previous frame is greater than the display interval
uint64_t nCurTimeTmp = m_elapsedTimer.nsecsElapsed();
uint64_t nAcquisitionInterval = nCurTimeTmp - m_nLastFrameTime;
if (nAcquisitionInterval > m_nDisplayInterval)
{
m_nLastFrameTime = nCurTimeTmp;
m_mxTime.unlock();
return true;
}
// 当前帧相对于第一帧的时间间隔
// Time interval between the current frame and the first frame
uint64_t nPre = (m_nLastFrameTime - m_nFirstFrameTime) % m_nDisplayInterval;
if (nPre + nAcquisitionInterval > m_nDisplayInterval)
{
m_nLastFrameTime = nCurTimeTmp;
m_mxTime.unlock();
return true;
}
m_mxTime.unlock();
return false;
}
// 设置显示频率
// set display frequency
void cammer::setDisplayFPS(int nFPS)
{
m_mxTime.lock();
if (nFPS > 0)
{
m_nDisplayInterval = 1000 * 1000 * 1000.0 / nFPS;
}
else
{
m_nDisplayInterval = 0;
}
m_mxTime.unlock();
}
// 窗口关闭响应函数
// window close response function
void cammer::closeEvent(QCloseEvent * event)
{
IMV_DestroyHandle(handle);
handle = NULL;
}
// 状态栏统计信息 开始
// Status bar statistics begin
void cammer::resetStatistic()
{
QMutexLocker locker(&m_mxStatistic);
m_nTotalFrameCount = 0;
m_listFrameStatInfo.clear();
m_bNeedUpdate = true;
}
QString cammer::getStatistic()
{
if (m_mxStatistic.tryLock(30))
{
if (m_bNeedUpdate)
{
updateStatistic();
}
m_mxStatistic.unlock();
return m_strStatistic;
}
return "";
}
void cammer::updateStatistic()
{
size_t nFrameCount = m_listFrameStatInfo.size();
QString strFPS = DEFAULT_ERROR_STRING;
QString strSpeed = DEFAULT_ERROR_STRING;
if (nFrameCount > 1)
{
quint64 nTotalSize = 0;
FrameList::const_iterator it = m_listFrameStatInfo.begin();
if (m_listFrameStatInfo.size() == 2)
{
nTotalSize = m_listFrameStatInfo.back().m_nFrameSize;
}
else
{
for (++it; it != m_listFrameStatInfo.end(); ++it)
{
nTotalSize += it->m_nFrameSize;
}
}
const FrameStatInfo& first = m_listFrameStatInfo.front();
const FrameStatInfo& last = m_listFrameStatInfo.back();
qint64 nsecs = last.m_nPassTime - first.m_nPassTime;
if (nsecs > 0)
{
double dFPS = (nFrameCount - 1) * ((double)1000000000.0 / nsecs);
double dSpeed = nTotalSize * ((double)1000000000.0 / nsecs) / (1000.0) / (1000.0) * (8.0);
strFPS = QString::number(dFPS, 'f', 2);
strSpeed = QString::number(dSpeed, 'f', 2);
}
}
m_strStatistic = QString("Stream: %1 images %2 FPS %3 Mbps")
.arg(m_nTotalFrameCount)
.arg(strFPS)
.arg(strSpeed);
m_bNeedUpdate = false;
}
void cammer::recvNewFrame(quint32 frameSize)
{
QMutexLocker locker(&m_mxStatistic);
if (m_listFrameStatInfo.size() >= MAX_FRAME_STAT_NUM)
{
m_listFrameStatInfo.pop_front();
}
m_listFrameStatInfo.push_back(FrameStatInfo(frameSize, m_elapsedTimer.nsecsElapsed()));
++m_nTotalFrameCount;
if (m_listFrameStatInfo.size() > MIN_LEFT_LIST_NUM)
{
FrameStatInfo infoFirst = m_listFrameStatInfo.front();
FrameStatInfo infoLast = m_listFrameStatInfo.back();
while (m_listFrameStatInfo.size() > MIN_LEFT_LIST_NUM && infoLast.m_nPassTime - infoFirst.m_nPassTime > MAX_STATISTIC_INTERVAL)
{
m_listFrameStatInfo.pop_front();
infoFirst = m_listFrameStatInfo.front();
}
}
m_bNeedUpdate = true;
}
// 状态栏统计信息 end
// Status bar statistics ending

164
CammerWidget.h Normal file
View File

@ -0,0 +1,164 @@
#ifndef CAMMERWIDGET_H
#define CAMMERWIDGET_H
#include <windows.h>
#include <process.h>
#include <QWidget>
#include "IMVApi.h"
#include "MessageQue.h"
#include <QElapsedTimer>
#include <QMutex>
// 状态栏统计信息
// Status bar statistics
struct FrameStatInfo
{
quint32 m_nFrameSize; // 帧大小, 单位: 字节 | frame size ,length :byte
qint64 m_nPassTime; // 接收到该帧时经过的纳秒数 | The number of nanoseconds passed when the frame was received
FrameStatInfo(int nSize, qint64 nTime) : m_nFrameSize(nSize), m_nPassTime(nTime)
{
}
};
// 帧信息
// frame imformation
class CFrameInfo
{
public:
CFrameInfo()
{
m_pImageBuf = NULL;
m_nBufferSize = 0;
m_nWidth = 0;
m_nHeight = 0;
m_ePixelType = gvspPixelMono8;
m_nPaddingX = 0;
m_nPaddingY = 0;
m_nTimeStamp = 0;
}
~CFrameInfo()
{
}
public:
unsigned char* m_pImageBuf;
int m_nBufferSize;
int m_nWidth;
int m_nHeight;
IMV_EPixelType m_ePixelType;
int m_nPaddingX;
int m_nPaddingY;
uint64_t m_nTimeStamp;
};
namespace Ui {
class CammerWidget;
}
class CammerWidget : public QWidget
{
Q_OBJECT
public:
explicit CammerWidget(QWidget *parent = 0);
~CammerWidget();
// 枚举触发方式
// Enumeration trigger mode
enum ETrigType
{
trigContinous = 0, // 连续拉流 | continue grabbing
trigSoftware = 1, // 软件触发 | software trigger
trigLine = 2, // 外部触发 | external trigger
};
// 打开相机
// open cmaera
bool CameraOpen(void);
// 关闭相机
// close camera
bool CameraClose(void);
// 开始采集
// start grabbing
bool CameraStart(void);
// 停止采集
// stop grabbing
bool CameraStop(void);
// 切换采集方式、触发方式 (连续采集、外部触发、软件触发)
// Switch acquisition mode and triggering mode (continuous acquisition, external triggering and software triggering)
bool CameraChangeTrig(ETrigType trigType = trigContinous);
// 执行一次软触发
// Execute a soft trigger
bool ExecuteSoftTrig(void);
// 设置曝光
// set exposuse time
bool SetExposeTime(double dExposureTime);
// 设置增益
// set gain
bool SetAdjustPlus(double dGainRaw);
// 设置当前相机
// set current camera
void SetCamera(const QString& strKey);
// 状态栏统计信息
// Status bar statistics
void recvNewFrame(quint32 frameSize);
void resetStatistic();
QString getStatistic();
void updateStatistic();
void display();
private:
// 设置显示频率默认一秒钟显示30帧
// Set the display frequency to display 30 frames in one second by default
void setDisplayFPS(int nFPS);
// 计算该帧是否显示
// Calculate whether the frame is displayed
bool isTimeToDisplay();
// 窗口关闭响应函数
// Window close response function
void closeEvent(QCloseEvent * event);
private slots:
// 显示一帧图像
// display a frame image
bool ShowImage(unsigned char* pRgbFrameBuf, int nWidth, int nHeight, uint64_t nPixelFormat);
signals:
// 显示图像的信号在displayThread中发送该信号在主线程中显示
// Display the signal of the image, send the signal in displaythread, and display it in the main thread
bool signalShowImage(unsigned char* pRgbFrameBuf, int nWidth, int nHeight, uint64_t nPixelFormat);
public:
TMessageQue<CFrameInfo> m_qDisplayFrameQueue; // 显示队列 | diaplay queue
private:
Ui::CammerWidget *ui;
QString m_currentCameraKey; // 当前相机key | current camera key
IMV_HANDLE handle; // 相机句柄 | camera handle
// 控制显示帧率 | Control display frame rate
QMutex m_mxTime;
int m_nDisplayInterval; // 显示间隔 | diaplay time internal
uint64_t m_nFirstFrameTime; // 第一帧的时间戳 | Time stamp of the first frame
uint64_t m_nLastFrameTime; // 上一帧的时间戳 | Timestamp of previous frame
QElapsedTimer m_elapsedTimer; // 用来计时,控制显示帧率 | Used to time and control the display frame rate
// 状态栏统计信息
// Status bar statistics
typedef std::list<FrameStatInfo> FrameList;
FrameList m_listFrameStatInfo;
QMutex m_mxStatistic;
quint64 m_nTotalFrameCount; // 收到的总帧数 | recieve all frames
QString m_strStatistic; // 统计信息, 不包括错误 | Statistics, excluding errors
bool m_bNeedUpdate;
bool m_isExitDisplayThread;
HANDLE m_threadHandle;
};
#endif // CAMMERWIDGET_H

1126
IMVApi.h Normal file

File diff suppressed because it is too large Load Diff

941
IMVDefines.h Normal file
View File

@ -0,0 +1,941 @@
#ifdef __cplusplus
extern "C" {
#endif
#include "stdint.h"
extern int vendor_app_handle(void);
#ifdef __cplusplus
}
#endif
#ifndef __IMV_DEFINES_H__
#define __IMV_DEFINES_H__
#ifdef WIN32
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#else
#include <stdint.h>
#endif
#ifndef IN
#define IN ///< \~chinese 输入型参数 \~english Input param
#endif
#ifndef OUT
#define OUT ///< \~chinese 输出型参数 \~english Output param
#endif
#ifndef IN_OUT
#define IN_OUT ///< \~chinese 输入/输出型参数 \~english Input/Output param
#endif
#ifndef __cplusplus
typedef char bool;
#define true 1
#define false 0
#endif
/// \~chinese
/// \brief 错误码
/// \~english
/// \brief Error code
#define IMV_OK 0 ///< \~chinese 成功,无错误 \~english Successed, no error
#define IMV_ERROR -101 ///< \~chinese 通用的错误 \~english Generic error
#define IMV_INVALID_HANDLE -102 ///< \~chinese 错误或无效的句柄 \~english Error or invalid handle
#define IMV_INVALID_PARAM -103 ///< \~chinese 错误的参数 \~english Incorrect parameter
#define IMV_INVALID_FRAME_HANDLE -104 ///< \~chinese 错误或无效的帧句柄 \~english Error or invalid frame handle
#define IMV_INVALID_FRAME -105 ///< \~chinese 无效的帧 \~english Invalid frame
#define IMV_INVALID_RESOURCE -106 ///< \~chinese 相机/事件/流等资源无效 \~english Camera/Event/Stream and so on resource invalid
#define IMV_INVALID_IP -107 ///< \~chinese 设备与主机的IP网段不匹配 \~english Device's and PC's subnet is mismatch
#define IMV_NO_MEMORY -108 ///< \~chinese 内存不足 \~english Malloc memery failed
#define IMV_INSUFFICIENT_MEMORY -109 ///< \~chinese 传入的内存空间不足 \~english Insufficient memory
#define IMV_ERROR_PROPERTY_TYPE -110 ///< \~chinese 属性类型错误 \~english Property type error
#define IMV_INVALID_ACCESS -111 ///< \~chinese 属性不可访问、或不能读/写、或读/写失败 \~english Property not accessible, or not be read/written, or read/written failed
#define IMV_INVALID_RANGE -112 ///< \~chinese 属性值超出范围、或者不是步长整数倍 \~english The property's value is out of range, or is not integer multiple of the step
#define IMV_NOT_SUPPORT -113 ///< \~chinese 设备不支持的功能 \~english Device not supported function
#define IMV_RESTORE_STREAM -114 ///< \~chinese 取图恢复中 \~english Device restore stream
#define IMV_RECONNECT_DEVICE -115 ///< \~chinese 重连恢复中 \~english Device reconnect
#define IMV_NOT_AVAILABLE -116 ///< \~chinese 连接不可达 \~english Connect not available
#define IMV_NOT_GRABBING -117 ///< \~chinese 相机已停止取图 \~english The camera already stop grabbing
#define IMV_NOT_CONNECTED -118 ///< \~chinese 设备未连接 \~english Not connect device
#define IMV_TIMEOUT -119 ///< \~chinese 超时 \~english Timeout
#define IMV_IS_CONNECTED -120 ///< \~chinese 设备已连接 \~english Device is connected
#define IMV_IS_GRABBING -121 ///< \~chinese 设备正在取图 \~english The device is grabbing
#define IMV_INVOCATION_ERROR -122 ///< \~chinese 调用时序错误 \~english The timing of the call is incorrect
#define IMV_SYSTEM_ERROR -123 ///< \~chinese 系统接口返回错误 \~english The operating system returns an error
#define IMV_OPENFILE_ERROR -124 ///< \~chinese 打开文件出现错误 \~english Open file error
#define IMV_MAX_DEVICE_ENUM_NUM 100 ///< \~chinese 支持设备最大个数 \~english The maximum number of supported devices
#define IMV_MAX_STRING_LENTH 256 ///< \~chinese 字符串最大长度 \~english The maximum length of string
#define IMV_MAX_ERROR_LIST_NUM 128 ///< \~chinese 失败属性列表最大长度 \~english The maximum size of failed properties list
typedef void* IMV_HANDLE; ///< \~chinese 设备句柄 \~english Device handle
typedef void* IMV_FRAME_HANDLE; ///< \~chinese 帧句柄 \~english Frame handle
/// \~chinese
///枚举:属性类型
/// \~english
///Enumeration: property type
typedef enum _IMV_EFeatureType
{
featureInt = 0x10000000, ///< \~chinese 整型数 \~english Integer
featureFloat = 0x20000000, ///< \~chinese 浮点数 \~english Float
featureEnum = 0x30000000, ///< \~chinese 枚举 \~english Enumeration
featureBool = 0x40000000, ///< \~chinese 布尔 \~english Bool
featureString = 0x50000000, ///< \~chinese 字符串 \~english String
featureCommand = 0x60000000, ///< \~chinese 命令 \~english Command
featureGroup = 0x70000000, ///< \~chinese 分组节点 \~english Group Node
featureReg = 0x80000000, ///< \~chinese 寄存器节点 \~english Register Node
featureUndefined = 0x90000000 ///< \~chinese 未定义 \~english Undefined
}IMV_EFeatureType;
/// \~chinese
///枚举:接口类型
/// \~english
///Enumeration: interface type
typedef enum _IMV_EInterfaceType
{
interfaceTypeGige = 0x00000001, ///< \~chinese 网卡接口类型 \~english NIC type
interfaceTypeUsb3 = 0x00000002, ///< \~chinese USB3.0接口类型 \~english USB3.0 interface type
interfaceTypeCL = 0x00000004, ///< \~chinese CAMERALINK接口类型 \~english Cameralink interface type
interfaceTypePCIe = 0x00000008, ///< \~chinese PCIe接口类型 \~english PCIe interface type
interfaceTypeAll = 0x00000000, ///< \~chinese 忽略接口类型CAMERALINK接口除外 \~english All types interface typeExcluding CAMERALINK
interfaceInvalidType = 0xFFFFFFFF ///< \~chinese 无效接口类型 \~english Invalid interface type
}IMV_EInterfaceType;
/// \~chinese
///枚举:设备类型
/// \~english
///Enumeration: device type
typedef enum _IMV_ECameraType
{
typeGigeCamera = 0, ///< \~chinese GIGE相机 \~english GigE Vision Camera
typeU3vCamera = 1, ///< \~chinese USB3.0相机 \~english USB3.0 Vision Camera
typeCLCamera = 2, ///< \~chinese CAMERALINK 相机 \~english Cameralink camera
typePCIeCamera = 3, ///< \~chinese PCIe相机 \~english PCIe Camera
typeUndefinedCamera = 255 ///< \~chinese 未知类型 \~english Undefined Camera
}IMV_ECameraType;
/// \~chinese
///枚举:创建句柄方式
/// \~english
///Enumeration: Create handle mode
typedef enum _IMV_ECreateHandleMode
{
modeByIndex = 0, ///< \~chinese 通过已枚举设备的索引(从0开始比如 0, 1, 2...) \~english By index of enumerated devices (Start from 0, such as 0, 1, 2...)
modeByCameraKey, ///< \~chinese 通过设备键"厂商:序列号" \~english By device's key "vendor:serial number"
modeByDeviceUserID, ///< \~chinese 通过设备自定义名 \~english By device userID
modeByIPAddress, ///< \~chinese 通过设备IP地址 \~english By device IP address.
}IMV_ECreateHandleMode;
/// \~chinese
///枚举:访问权限
/// \~english
///Enumeration: access permission
typedef enum _IMV_ECameraAccessPermission
{
accessPermissionOpen = 0, ///< \~chinese GigE相机没有被连接 \~english The GigE vision device isn't connected to any application.
accessPermissionExclusive, ///< \~chinese 独占访问权限 \~english Exclusive Access Permission
accessPermissionControl, ///< \~chinese 非独占控制权限,其他App允许读取所有寄存器 \~english Non-Exclusive Control Permission, allows other APP reading all registers
accessPermissionControlWithSwitchover, ///< \~chinese 切换控制访问权限 \~english Control access with switchover enabled.
accessPermissionMonitor, ///< \~chinese 非独占访问权限,以读的模式打开设备 \~english Non-Exclusive Read Permission, open device with read mode
accessPermissionUnknown = 254, ///< \~chinese 无法确定 \~english Value not known; indeterminate.
accessPermissionUndefined ///< \~chinese 未定义访问权限 \~english Undefined Access Permission
}IMV_ECameraAccessPermission;
/// \~chinese
///枚举:抓图策略
/// \~english
///Enumeration: grab strartegy
typedef enum _IMV_EGrabStrategy
{
grabStrartegySequential = 0, ///< \~chinese 按到达顺序处理图片 \~english The images are processed in the order of their arrival
grabStrartegyLatestImage = 1, ///< \~chinese 获取最新的图片 \~english Get latest image
grabStrartegyUpcomingImage = 2, ///< \~chinese 等待获取下一张图片(只针对GigE相机) \~english Waiting for next image(GigE only)
grabStrartegyUndefined ///< \~chinese 未定义 \~english Undefined
}IMV_EGrabStrategy;
/// \~chinese
///枚举:流事件状态
/// \~english
/// Enumeration:stream event status
typedef enum _IMV_EEventStatus
{
streamEventNormal = 1, ///< \~chinese 正常流事件 \~english Normal stream event
streamEventLostFrame = 2, ///< \~chinese 丢帧事件 \~english Lost frame event
streamEventLostPacket = 3, ///< \~chinese 丢包事件 \~english Lost packet event
streamEventImageError = 4, ///< \~chinese 图像错误事件 \~english Error image event
streamEventStreamChannelError = 5, ///< \~chinese 取流错误事件 \~english Stream channel error event
streamEventTooManyConsecutiveResends = 6, ///< \~chinese 太多连续重传 \~english Too many consecutive resends event
streamEventTooManyLostPacket = 7 ///< \~chinese 太多丢包 \~english Too many lost packet event
}IMV_EEventStatus;
/// \~chinese
///枚举图像转换Bayer格式所用的算法
/// \~english
/// Enumeration:alorithm used for Bayer demosaic
typedef enum _IMV_EBayerDemosaic
{
demosaicNearestNeighbor, ///< \~chinese 最近邻 \~english Nearest neighbor
demosaicBilinear, ///< \~chinese 双线性 \~english Bilinear
demosaicEdgeSensing, ///< \~chinese 边缘检测 \~english Edge sensing
demosaicNotSupport = 255, ///< \~chinese 不支持 \~english Not support
}IMV_EBayerDemosaic;
/// \~chinese
///枚举:事件类型
/// \~english
/// Enumeration:event type
typedef enum _IMV_EVType
{
offLine, ///< \~chinese 设备离线通知 \~english device offline notification
onLine ///< \~chinese 设备在线通知 \~english device online notification
}IMV_EVType;
/// \~chinese
///枚举:视频格式
/// \~english
/// Enumeration:Video format
typedef enum _IMV_EVideoType
{
typeVideoFormatAVI = 0, ///< \~chinese AVI格式 \~english AVI format
typeVideoFormatNotSupport = 255 ///< \~chinese 不支持 \~english Not support
}IMV_EVideoType;
/// \~chinese
///枚举:图像翻转类型
/// \~english
/// Enumeration:Image flip type
typedef enum _IMV_EFlipType
{
typeFlipVertical, ///< \~chinese 垂直(Y轴)翻转 \~english Vertical(Y-axis) flip
typeFlipHorizontal ///< \~chinese 水平(X轴)翻转 \~english Horizontal(X-axis) flip
}IMV_EFlipType;
/// \~chinese
///枚举:顺时针旋转角度
/// \~english
/// Enumeration:Rotation angle clockwise
typedef enum _IMV_ERotationAngle
{
rotationAngle90, ///< \~chinese 顺时针旋转90度 \~english Rotate 90 degree clockwise
rotationAngle180, ///< \~chinese 顺时针旋转180度 \~english Rotate 180 degree clockwise
rotationAngle270, ///< \~chinese 顺时针旋转270度 \~english Rotate 270 degree clockwise
}IMV_ERotationAngle;
#define IMV_GVSP_PIX_MONO 0x01000000
#define IMV_GVSP_PIX_RGB 0x02000000
#define IMV_GVSP_PIX_COLOR 0x02000000
#define IMV_GVSP_PIX_CUSTOM 0x80000000
#define IMV_GVSP_PIX_COLOR_MASK 0xFF000000
// Indicate effective number of bits occupied by the pixel (including padding).
// This can be used to compute amount of memory required to store an image.
#define IMV_GVSP_PIX_OCCUPY1BIT 0x00010000
#define IMV_GVSP_PIX_OCCUPY2BIT 0x00020000
#define IMV_GVSP_PIX_OCCUPY4BIT 0x00040000
#define IMV_GVSP_PIX_OCCUPY8BIT 0x00080000
#define IMV_GVSP_PIX_OCCUPY12BIT 0x000C0000
#define IMV_GVSP_PIX_OCCUPY16BIT 0x00100000
#define IMV_GVSP_PIX_OCCUPY24BIT 0x00180000
#define IMV_GVSP_PIX_OCCUPY32BIT 0x00200000
#define IMV_GVSP_PIX_OCCUPY36BIT 0x00240000
#define IMV_GVSP_PIX_OCCUPY48BIT 0x00300000
/// \~chinese
///枚举:图像格式
/// \~english
/// Enumeration:image format
typedef enum _IMV_EPixelType
{
// Undefined pixel type
gvspPixelTypeUndefined = -1,
// Mono Format
gvspPixelMono1p = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY1BIT | 0x0037),
gvspPixelMono2p = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY2BIT | 0x0038),
gvspPixelMono4p = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY4BIT | 0x0039),
gvspPixelMono8 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY8BIT | 0x0001),
gvspPixelMono8S = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY8BIT | 0x0002),
gvspPixelMono10 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY16BIT | 0x0003),
gvspPixelMono10Packed = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY12BIT | 0x0004),
gvspPixelMono12 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY16BIT | 0x0005),
gvspPixelMono12Packed = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY12BIT | 0x0006),
gvspPixelMono14 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY16BIT | 0x0025),
gvspPixelMono16 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY16BIT | 0x0007),
// Bayer Format
gvspPixelBayGR8 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY8BIT | 0x0008),
gvspPixelBayRG8 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY8BIT | 0x0009),
gvspPixelBayGB8 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY8BIT | 0x000A),
gvspPixelBayBG8 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY8BIT | 0x000B),
gvspPixelBayGR10 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY16BIT | 0x000C),
gvspPixelBayRG10 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY16BIT | 0x000D),
gvspPixelBayGB10 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY16BIT | 0x000E),
gvspPixelBayBG10 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY16BIT | 0x000F),
gvspPixelBayGR12 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY16BIT | 0x0010),
gvspPixelBayRG12 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY16BIT | 0x0011),
gvspPixelBayGB12 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY16BIT | 0x0012),
gvspPixelBayBG12 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY16BIT | 0x0013),
gvspPixelBayGR10Packed = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY12BIT | 0x0026),
gvspPixelBayRG10Packed = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY12BIT | 0x0027),
gvspPixelBayGB10Packed = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY12BIT | 0x0028),
gvspPixelBayBG10Packed = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY12BIT | 0x0029),
gvspPixelBayGR12Packed = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY12BIT | 0x002A),
gvspPixelBayRG12Packed = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY12BIT | 0x002B),
gvspPixelBayGB12Packed = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY12BIT | 0x002C),
gvspPixelBayBG12Packed = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY12BIT | 0x002D),
gvspPixelBayGR16 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY16BIT | 0x002E),
gvspPixelBayRG16 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY16BIT | 0x002F),
gvspPixelBayGB16 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY16BIT | 0x0030),
gvspPixelBayBG16 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY16BIT | 0x0031),
// RGB Format
gvspPixelRGB8 = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY24BIT | 0x0014),
gvspPixelBGR8 = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY24BIT | 0x0015),
gvspPixelRGBA8 = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY32BIT | 0x0016),
gvspPixelBGRA8 = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY32BIT | 0x0017),
gvspPixelRGB10 = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY48BIT | 0x0018),
gvspPixelBGR10 = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY48BIT | 0x0019),
gvspPixelRGB12 = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY48BIT | 0x001A),
gvspPixelBGR12 = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY48BIT | 0x001B),
gvspPixelRGB16 = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY48BIT | 0x0033),
gvspPixelRGB10V1Packed = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY32BIT | 0x001C),
gvspPixelRGB10P32 = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY32BIT | 0x001D),
gvspPixelRGB12V1Packed = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY36BIT | 0X0034),
gvspPixelRGB565P = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY16BIT | 0x0035),
gvspPixelBGR565P = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY16BIT | 0X0036),
// YVR Format
gvspPixelYUV411_8_UYYVYY = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY12BIT | 0x001E),
gvspPixelYUV422_8_UYVY = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY16BIT | 0x001F),
gvspPixelYUV422_8 = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY16BIT | 0x0032),
gvspPixelYUV8_UYV = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY24BIT | 0x0020),
gvspPixelYCbCr8CbYCr = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY24BIT | 0x003A),
gvspPixelYCbCr422_8 = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY16BIT | 0x003B),
gvspPixelYCbCr422_8_CbYCrY = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY16BIT | 0x0043),
gvspPixelYCbCr411_8_CbYYCrYY = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY12BIT | 0x003C),
gvspPixelYCbCr601_8_CbYCr = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY24BIT | 0x003D),
gvspPixelYCbCr601_422_8 = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY16BIT | 0x003E),
gvspPixelYCbCr601_422_8_CbYCrY = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY16BIT | 0x0044),
gvspPixelYCbCr601_411_8_CbYYCrYY = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY12BIT | 0x003F),
gvspPixelYCbCr709_8_CbYCr = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY24BIT | 0x0040),
gvspPixelYCbCr709_422_8 = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY16BIT | 0x0041),
gvspPixelYCbCr709_422_8_CbYCrY = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY16BIT | 0x0045),
gvspPixelYCbCr709_411_8_CbYYCrYY = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY12BIT | 0x0042),
// RGB Planar
gvspPixelRGB8Planar = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY24BIT | 0x0021),
gvspPixelRGB10Planar = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY48BIT | 0x0022),
gvspPixelRGB12Planar = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY48BIT | 0x0023),
gvspPixelRGB16Planar = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY48BIT | 0x0024),
//BayerRG10p和BayerRG12p格式针对特定项目临时添加,请不要使用
//BayerRG10p and BayerRG12p, currently used for specific project, please do not use them
gvspPixelBayRG10p = 0x010A0058,
gvspPixelBayRG12p = 0x010c0059,
//mono1c格式自定义格式
//mono1c, customized image format, used for binary output
gvspPixelMono1c = 0x012000FF,
//mono1e格式自定义格式用来显示连通域
//mono1e, customized image format, used for displaying connected domain
gvspPixelMono1e = 0x01080FFF
}IMV_EPixelType;
/// \~chinese
/// \brief 传输模式(gige)
/// \~english
/// \brief Transmission type (gige)
typedef enum _IMV_TransmissionType
{
transTypeUnicast, ///< \~chinese 单播模式 \~english Unicast Mode
transTypeMulticast ///< \~chinese 组播模式 \~english Multicast Mode
}IMV_TransmissionType;
/// \~chinese
/// \brief 字符串信息
/// \~english
/// \brief String information
typedef struct _IMV_String
{
char str[IMV_MAX_STRING_LENTH]; ///< \~chinese 字符串.长度不超过256 \~english Strings and the maximum length of strings is 255.
}IMV_String;
/// \~chinese
/// \brief GigE网卡信息
/// \~english
/// \brief GigE interface information
typedef struct _IMV_GigEInterfaceInfo
{
char description[IMV_MAX_STRING_LENTH]; ///< \~chinese 网卡描述信息 \~english Network card description
char macAddress[IMV_MAX_STRING_LENTH]; ///< \~chinese 网卡Mac地址 \~english Network card MAC Address
char ipAddress[IMV_MAX_STRING_LENTH]; ///< \~chinese 设备Ip地址 \~english Device ip Address
char subnetMask[IMV_MAX_STRING_LENTH]; ///< \~chinese 子网掩码 \~english SubnetMask
char defaultGateWay[IMV_MAX_STRING_LENTH]; ///< \~chinese 默认网关 \~english Default GateWay
char chReserved[5][IMV_MAX_STRING_LENTH]; ///< 保留 \~english Reserved field
}IMV_GigEInterfaceInfo;
/// \~chinese
/// \brief USB接口信息
/// \~english
/// \brief USB interface information
typedef struct _IMV_UsbInterfaceInfo
{
char description[IMV_MAX_STRING_LENTH]; ///< \~chinese USB接口描述信息 \~english USB interface description
char vendorID[IMV_MAX_STRING_LENTH]; ///< \~chinese USB接口Vendor ID \~english USB interface Vendor ID
char deviceID[IMV_MAX_STRING_LENTH]; ///< \~chinese USB接口设备ID \~english USB interface Device ID
char subsystemID[IMV_MAX_STRING_LENTH]; ///< \~chinese USB接口Subsystem ID \~english USB interface Subsystem ID
char revision[IMV_MAX_STRING_LENTH]; ///< \~chinese USB接口Revision \~english USB interface Revision
char speed[IMV_MAX_STRING_LENTH]; ///< \~chinese USB接口speed \~english USB interface speed
char chReserved[4][IMV_MAX_STRING_LENTH]; ///< 保留 \~english Reserved field
}IMV_UsbInterfaceInfo;
/// \~chinese
/// \brief GigE设备信息
/// \~english
/// \brief GigE device information
typedef struct _IMV_GigEDeviceInfo
{
/// \~chinese
/// 设备支持的IP配置选项\n
/// value:4 相机只支持LLA\n
/// value:5 相机支持LLA和Persistent IP\n
/// value:6 相机支持LLA和DHCP\n
/// value:7 相机支持LLA、DHCP和Persistent IP\n
/// value:0 获取失败
/// \~english
/// Supported IP configuration options of device\n
/// value:4 Device supports LLA \n
/// value:5 Device supports LLA and Persistent IP\n
/// value:6 Device supports LLA and DHCP\n
/// value:7 Device supports LLA, DHCP and Persistent IP\n
/// value:0 Get fail
unsigned int nIpConfigOptions;
/// \~chinese
/// 设备当前的IP配置选项\n
/// value:4 LLA处于活动状态\n
/// value:5 LLA和Persistent IP处于活动状态\n
/// value:6 LLA和DHCP处于活动状态\n
/// value:7 LLA、DHCP和Persistent IP处于活动状态\n
/// value:0 获取失败
/// \~english
/// Current IP Configuration options of device\n
/// value:4 LLA is active\n
/// value:5 LLA and Persistent IP are active\n
/// value:6 LLA and DHCP are active\n
/// value:7 LLA, DHCP and Persistent IP are active\n
/// value:0 Get fail
unsigned int nIpConfigCurrent;
unsigned int nReserved[3]; ///< \~chinese 保留 \~english Reserved field
char macAddress[IMV_MAX_STRING_LENTH]; ///< \~chinese 设备Mac地址 \~english Device MAC Address
char ipAddress[IMV_MAX_STRING_LENTH]; ///< \~chinese 设备Ip地址 \~english Device ip Address
char subnetMask[IMV_MAX_STRING_LENTH]; ///< \~chinese 子网掩码 \~english SubnetMask
char defaultGateWay[IMV_MAX_STRING_LENTH]; ///< \~chinese 默认网关 \~english Default GateWay
char protocolVersion[IMV_MAX_STRING_LENTH]; ///< \~chinese 网络协议版本 \~english Net protocol version
/// \~chinese
/// Ip配置有效性\n
/// Ip配置有效时字符串值"Valid"\n
/// Ip配置无效时字符串值"Invalid On This Interface"
/// \~english
/// IP configuration valid\n
/// String value is "Valid" when ip configuration valid\n
/// String value is "Invalid On This Interface" when ip configuration invalid
char ipConfiguration[IMV_MAX_STRING_LENTH];
char chReserved[6][IMV_MAX_STRING_LENTH]; ///< \~chinese 保留 \~english Reserved field
}IMV_GigEDeviceInfo;
/// \~chinese
/// \brief Usb设备信息
/// \~english
/// \brief Usb device information
typedef struct _IMV_UsbDeviceInfo
{
bool bLowSpeedSupported; ///< \~chinese true支持false不支持其他值 非法。 \~english true support,false not supported,other invalid
bool bFullSpeedSupported; ///< \~chinese true支持false不支持其他值 非法。 \~english true support,false not supported,other invalid
bool bHighSpeedSupported; ///< \~chinese true支持false不支持其他值 非法。 \~english true support,false not supported,other invalid
bool bSuperSpeedSupported; ///< \~chinese true支持false不支持其他值 非法。 \~english true support,false not supported,other invalid
bool bDriverInstalled; ///< \~chinese true安装false未安装其他值 非法。 \~english true support,false not supported,other invalid
bool boolReserved[3]; ///< \~chinese 保留
unsigned int Reserved[4]; ///< \~chinese 保留 \~english Reserved field
char configurationValid[IMV_MAX_STRING_LENTH]; ///< \~chinese 配置有效性 \~english Configuration Valid
char genCPVersion[IMV_MAX_STRING_LENTH]; ///< \~chinese GenCP 版本 \~english GenCP Version
char u3vVersion[IMV_MAX_STRING_LENTH]; ///< \~chinese U3V 版本号 \~english U3v Version
char deviceGUID[IMV_MAX_STRING_LENTH]; ///< \~chinese 设备引导号 \~english Device guid number
char familyName[IMV_MAX_STRING_LENTH]; ///< \~chinese 设备系列号 \~english Device serial number
char u3vSerialNumber[IMV_MAX_STRING_LENTH]; ///< \~chinese 设备序列号 \~english Device SerialNumber
char speed[IMV_MAX_STRING_LENTH]; ///< \~chinese 设备传输速度 \~english Device transmission speed
char maxPower[IMV_MAX_STRING_LENTH]; ///< \~chinese 设备最大供电量 \~english Maximum power supply of device
char chReserved[4][IMV_MAX_STRING_LENTH]; ///< \~chinese 保留 \~english Reserved field
}IMV_UsbDeviceInfo;
/// \~chinese
/// \brief 设备通用信息
/// \~english
/// \brief Device general information
typedef struct _IMV_DeviceInfo
{
IMV_ECameraType nCameraType; ///< \~chinese 设备类别 \~english Camera type
int nCameraReserved[5]; ///< \~chinese 保留 \~english Reserved field
char cameraKey[IMV_MAX_STRING_LENTH]; ///< \~chinese 厂商:序列号 \~english Camera key
char cameraName[IMV_MAX_STRING_LENTH]; ///< \~chinese 用户自定义名 \~english UserDefinedName
char serialNumber[IMV_MAX_STRING_LENTH]; ///< \~chinese 设备序列号 \~english Device SerialNumber
char vendorName[IMV_MAX_STRING_LENTH]; ///< \~chinese 厂商 \~english Camera Vendor
char modelName[IMV_MAX_STRING_LENTH]; ///< \~chinese 设备型号 \~english Device model
char manufactureInfo[IMV_MAX_STRING_LENTH]; ///< \~chinese 设备制造信息 \~english Device ManufactureInfo
char deviceVersion[IMV_MAX_STRING_LENTH]; ///< \~chinese 设备版本 \~english Device Version
char cameraReserved[5][IMV_MAX_STRING_LENTH]; ///< \~chinese 保留 \~english Reserved field
union
{
IMV_GigEDeviceInfo gigeDeviceInfo; ///< \~chinese Gige设备信息 \~english Gige Device Information
IMV_UsbDeviceInfo usbDeviceInfo; ///< \~chinese Usb设备信息 \~english Usb Device Information
}DeviceSpecificInfo;
IMV_EInterfaceType nInterfaceType; ///< \~chinese 接口类别 \~english Interface type
int nInterfaceReserved[5]; ///< \~chinese 保留 \~english Reserved field
char interfaceName[IMV_MAX_STRING_LENTH]; ///< \~chinese 接口名 \~english Interface Name
char interfaceReserved[5][IMV_MAX_STRING_LENTH]; ///< \~chinese 保留 \~english Reserved field
union
{
IMV_GigEInterfaceInfo gigeInterfaceInfo; ///< \~chinese GigE网卡信息 \~english Gige interface Information
IMV_UsbInterfaceInfo usbInterfaceInfo; ///< \~chinese Usb接口信息 \~english Usb interface Information
}InterfaceInfo;
}IMV_DeviceInfo;
/// \~chinese
/// \brief 网络传输模式
/// \~english
/// \brief Transmission type
typedef struct _IMV_TRANSMISSION_TYPE
{
IMV_TransmissionType eTransmissionType; ///< \~chinese 传输模式 \~english Transmission type
unsigned int nDesIp; ///< \~chinese 目标ip地址 \~english Destination IP address
unsigned short nDesPort; ///< \~chinese 目标端口号 \~english Destination port
unsigned int nReserved[32]; ///< \~chinese 预留位 \~english Reserved field
}IMV_TRANSMISSION_TYPE;
/// \~chinese
/// \brief 加载失败的属性信息
/// \~english
/// \brief Load failed properties information
typedef struct _IMV_ErrorList
{
unsigned int nParamCnt; ///< \~chinese 加载失败的属性个数 \~english The count of load failed properties
IMV_String paramNameList[IMV_MAX_ERROR_LIST_NUM]; ///< \~chinese 加载失败的属性集合上限128 \~english Array of load failed properties, up to 128
}IMV_ErrorList;
/// \~chinese
/// \brief 设备信息列表
/// \~english
/// \brief Device information list
typedef struct _IMV_DeviceList
{
unsigned int nDevNum; ///< \~chinese 设备数量 \~english Device Number
IMV_DeviceInfo* pDevInfo; ///< \~chinese 设备息列表(SDK内部缓存)最多100设备 \~english Device information list(cached within the SDK), up to 100
}IMV_DeviceList;
/// \~chinese
/// \brief 连接事件信息
/// \~english
/// \brief connection event information
typedef struct _IMV_SConnectArg
{
IMV_EVType event; ///< \~chinese 事件类型 \~english event type
unsigned int nReserve[10]; ///< \~chinese 预留字段 \~english Reserved field
}IMV_SConnectArg;
/// \~chinese
/// \brief 参数更新事件信息
/// \~english
/// \brief Updating parameters event information
typedef struct _IMV_SParamUpdateArg
{
bool isPoll; ///< \~chinese 是否是定时更新,true:表示是定时更新false:表示非定时更新 \~english Update periodically or not. true:update periodically, true:not update periodically
unsigned int nReserve[10]; ///< \~chinese 预留字段 \~english Reserved field
unsigned int nParamCnt; ///< \~chinese 更新的参数个数 \~english The number of parameters which need update
IMV_String* pParamNameList; ///< \~chinese 更新的参数名称集合(SDK内部缓存) \~english Array of parameter's name which need to be updated(cached within the SDK)
}IMV_SParamUpdateArg;
/// \~chinese
/// \brief 流事件信息
/// \~english
/// \brief Stream event information
typedef struct _IMV_SStreamArg
{
unsigned int channel; ///< \~chinese 流通道号 \~english Channel no.
uint64_t blockId; ///< \~chinese 流数据BlockID \~english Block ID of stream data
uint64_t timeStamp; ///< \~chinese 时间戳 \~english Event time stamp
IMV_EEventStatus eStreamEventStatus; ///< \~chinese 流事件状态码 \~english Stream event status code
unsigned int status; ///< \~chinese 事件状态错误码 \~english Status error code
unsigned int nReserve[9]; ///< \~chinese 预留字段 \~english Reserved field
}IMV_SStreamArg;
/// \~chinese
/// 消息通道事件ID列表
/// \~english
/// message channel event id list
#define IMV_MSG_EVENT_ID_EXPOSURE_END 0x9001
#define IMV_MSG_EVENT_ID_FRAME_TRIGGER 0x9002
#define IMV_MSG_EVENT_ID_FRAME_START 0x9003
#define IMV_MSG_EVENT_ID_ACQ_START 0x9004
#define IMV_MSG_EVENT_ID_ACQ_TRIGGER 0x9005
#define IMV_MSG_EVENT_ID_DATA_READ_OUT 0x9006
/// \~chinese
/// \brief 消息通道事件信息
/// \~english
/// \brief Message channel event information
typedef struct _IMV_SMsgChannelArg
{
unsigned short eventId; ///< \~chinese 事件Id \~english Event id
unsigned short channelId; ///< \~chinese 消息通道号 \~english Channel id
uint64_t blockId; ///< \~chinese 流数据BlockID \~english Block ID of stream data
uint64_t timeStamp; ///< \~chinese 时间戳 \~english Event timestamp
unsigned int nReserve[8]; ///< \~chinese 预留字段 \~english Reserved field
unsigned int nParamCnt; ///< \~chinese 参数个数 \~english The number of parameters which need update
IMV_String* pParamNameList; ///< \~chinese 事件相关的属性名列集合(SDK内部缓存) \~english Array of parameter's name which is related(cached within the SDK)
}IMV_SMsgChannelArg;
/// \~chinese
/// \brief 消息通道事件信息(通用)
/// \~english
/// \brief Message channel event information(Common)
typedef struct _IMV_SMsgEventArg
{
unsigned short eventId; ///< \~chinese 事件Id \~english Event id
unsigned short channelId; ///< \~chinese 消息通道号 \~english Channel id
uint64_t blockId; ///< \~chinese 流数据BlockID \~english Block ID of stream data
uint64_t timeStamp; ///< \~chinese 时间戳 \~english Event timestamp
void* pEventData; ///< \~chinese 事件数据,内部缓存,需要及时进行数据处理 \~english Event data, internal buffer, need to be processed in time
unsigned int nEventDataSize; ///< \~chinese 事件数据长度 \~english Event data size
unsigned int reserve[8]; ///< \~chinese 预留字段 \~english Reserved field
}IMV_SMsgEventArg;
/// \~chinese
/// \brief Chunk数据信息
/// \~english
/// \brief Chunk data information
typedef struct _IMV_ChunkDataInfo
{
unsigned int chunkID; ///< \~chinese ChunkID \~english ChunkID
unsigned int nParamCnt; ///< \~chinese 属性名个数 \~english The number of paramNames
IMV_String* pParamNameList; ///< \~chinese Chunk数据对应的属性名集合(SDK内部缓存) \~english ParamNames Corresponding property name of chunk data(cached within the SDK)
}IMV_ChunkDataInfo;
/// \~chinese
/// \brief 帧图像信息
/// \~english
/// \brief The frame image information
typedef struct _IMV_FrameInfo
{
uint64_t blockId; ///< \~chinese 帧Id(仅对GigE/Usb/PCIe相机有效) \~english The block ID(GigE/Usb/PCIe camera only)
unsigned int status; ///< \~chinese 数据帧状态(0是正常状态) \~english The status of frame(0 is normal status)
unsigned int width; ///< \~chinese 图像宽度 \~english The width of image
unsigned int height; ///< \~chinese 图像高度 \~english The height of image
unsigned int size; ///< \~chinese 图像大小 \~english The size of image
IMV_EPixelType pixelFormat; ///< \~chinese 图像像素格式 \~english The pixel format of image
uint64_t timeStamp; ///< \~chinese 图像时间戳(仅对GigE/Usb/PCIe相机有效) \~english The timestamp of image(GigE/Usb/PCIe camera only)
unsigned int chunkCount; ///< \~chinese 帧数据中包含的Chunk个数(仅对GigE/Usb相机有效) \~english The number of chunk in frame data(GigE/Usb Camera Only)
unsigned int paddingX; ///< \~chinese 图像paddingX(仅对GigE/Usb/PCIe相机有效) \~english The paddingX of image(GigE/Usb/PCIe camera only)
unsigned int paddingY; ///< \~chinese 图像paddingY(仅对GigE/Usb/PCIe相机有效) \~english The paddingY of image(GigE/Usb/PCIe camera only)
unsigned int recvFrameTime; ///< \~chinese 图像在网络传输所用的时间(单位:微秒,非GigE相机该值为0) \~english The time taken for the image to be transmitted over the network(unit:us, The value is 0 for non-GigE camera)
unsigned int nReserved[19]; ///< \~chinese 预留字段 \~english Reserved field
}IMV_FrameInfo;
/// \~chinese
/// \brief 帧图像数据信息
/// \~english
/// \brief Frame image data information
typedef struct _IMV_Frame
{
IMV_FRAME_HANDLE frameHandle; ///< \~chinese 帧图像句柄(SDK内部帧管理用) \~english Frame image handle(used for managing frame within the SDK)
unsigned char* pData; ///< \~chinese 帧图像数据的内存首地址 \~english The starting address of memory of image data
IMV_FrameInfo frameInfo; ///< \~chinese 帧信息 \~english Frame information
unsigned int nReserved[10]; ///< \~chinese 预留字段 \~english Reserved field
}IMV_Frame;
/// \~chinese
/// \brief PCIE设备统计流信息
/// \~english
/// \brief PCIE device stream statistics information
typedef struct _IMV_PCIEStreamStatsInfo
{
unsigned int imageError; ///< \~chinese 图像错误的帧数 \~english Number of images error frames
unsigned int lostPacketBlock; ///< \~chinese 丢包的帧数 \~english Number of frames lost
unsigned int nReserved0[10]; ///< \~chinese 预留 \~english Reserved field
unsigned int imageReceived; ///< \~chinese 正常获取的帧数 \~english Number of frames acquired
double fps; ///< \~chinese 帧率 \~english Frame rate
double bandwidth; ///< \~chinese 带宽(Mbps) \~english Bandwidth(Mbps)
unsigned int nReserved[8]; ///< \~chinese 预留 \~english Reserved field
}IMV_PCIEStreamStatsInfo;
/// \~chinese
/// \brief U3V设备统计流信息
/// \~english
/// \brief U3V device stream statistics information
typedef struct _IMV_U3VStreamStatsInfo
{
unsigned int imageError; ///< \~chinese 图像错误的帧数 \~english Number of images error frames
unsigned int lostPacketBlock; ///< \~chinese 丢包的帧数 \~english Number of frames lost
unsigned int nReserved0[10]; ///< \~chinese 预留 \~english Reserved field
unsigned int imageReceived; ///< \~chinese 正常获取的帧数 \~english Number of images error frames
double fps; ///< \~chinese 帧率 \~english Frame rate
double bandwidth; ///< \~chinese 带宽(Mbps) \~english Bandwidth(Mbps)
unsigned int nReserved[8]; ///< \~chinese 预留 \~english Reserved field
}IMV_U3VStreamStatsInfo;
/// \~chinese
/// \brief Gige设备统计流信息
/// \~english
/// \brief Gige device stream statistics information
typedef struct _IMV_GigEStreamStatsInfo
{
unsigned int nReserved0[10]; ///< \~chinese 预留 \~english Reserved field
unsigned int imageError; ///< \~chinese 图像错误的帧数 \~english Number of image error frames
unsigned int lostPacketBlock; ///< \~chinese 丢包的帧数 \~english Number of frames lost
unsigned int nReserved1[4]; ///< \~chinese 预留 \~english Reserved field
unsigned int nReserved2[5]; ///< \~chinese 预留 \~english Reserved field
unsigned int imageReceived; ///< \~chinese 正常获取的帧数 \~english Number of frames acquired
double fps; ///< \~chinese 帧率 \~english Frame rate
double bandwidth; ///< \~chinese 带宽(Mbps) \~english Bandwidth(Mbps)
unsigned int nReserved[4]; ///< \~chinese 预留 \~english Reserved field
}IMV_GigEStreamStatsInfo;
/// \~chinese
/// \brief 统计流信息
/// \~english
/// \brief Stream statistics information
typedef struct _IMV_StreamStatisticsInfo
{
IMV_ECameraType nCameraType; ///< \~chinese 设备类型 \~english Device type
union
{
IMV_PCIEStreamStatsInfo pcieStatisticsInfo; ///< \~chinese PCIE设备统计信息 \~english PCIE device statistics information
IMV_U3VStreamStatsInfo u3vStatisticsInfo; ///< \~chinese U3V设备统计信息 \~english U3V device statistics information
IMV_GigEStreamStatsInfo gigeStatisticsInfo; ///< \~chinese Gige设备统计信息 \~english GIGE device statistics information
};
}IMV_StreamStatisticsInfo;
/// \~chinese
/// \brief 枚举属性的枚举值信息
/// \~english
/// \brief Enumeration property 's enumeration value information
typedef struct _IMV_EnumEntryInfo
{
uint64_t value; ///< \~chinese 枚举值 \~english Enumeration value
char name[IMV_MAX_STRING_LENTH]; ///< \~chinese symbol名 \~english Symbol name
}IMV_EnumEntryInfo;
/// \~chinese
/// \brief 枚举属性的可设枚举值列表信息
/// \~english
/// \brief Enumeration property 's settable enumeration value list information
typedef struct _IMV_EnumEntryList
{
unsigned int nEnumEntryBufferSize; ///< \~chinese 存放枚举值内存大小 \~english The size of saving enumeration value
IMV_EnumEntryInfo* pEnumEntryInfo; ///< \~chinese 存放可设枚举值列表(调用者分配缓存) \~english Save the list of settable enumeration value(allocated cache by the caller)
}IMV_EnumEntryList;
/// \~chinese
/// \brief 像素转换结构体
/// \~english
/// \brief Pixel convert structure
typedef struct _IMV_PixelConvertParam
{
unsigned int nWidth; ///< [IN] \~chinese 图像宽 \~english Width
unsigned int nHeight; ///< [IN] \~chinese 图像高 \~english Height
IMV_EPixelType ePixelFormat; ///< [IN] \~chinese 像素格式 \~english Pixel format
unsigned char* pSrcData; ///< [IN] \~chinese 输入图像数据 \~english Input image data
unsigned int nSrcDataLen; ///< [IN] \~chinese 输入图像长度 \~english Input image length
unsigned int nPaddingX; ///< [IN] \~chinese 图像宽填充 \~english Padding X
unsigned int nPaddingY; ///< [IN] \~chinese 图像高填充 \~english Padding Y
IMV_EBayerDemosaic eBayerDemosaic; ///< [IN] \~chinese 转换Bayer格式算法 \~english Alorithm used for Bayer demosaic
IMV_EPixelType eDstPixelFormat; ///< [IN] \~chinese 目标像素格式 \~english Destination pixel format
unsigned char* pDstBuf; ///< [OUT] \~chinese 输出数据缓存(调用者分配缓存) \~english Output data buffer(allocated cache by the caller)
unsigned int nDstBufSize; ///< [IN] \~chinese 提供的输出缓冲区大小 \~english Provided output buffer size
unsigned int nDstDataLen; ///< [OUT] \~chinese 输出数据长度 \~english Output data length
unsigned int nReserved[8]; ///< \~chinese 预留 \~english Reserved field
}IMV_PixelConvertParam;
/// \~chinese
/// \brief 录像结构体
/// \~english
/// \brief Record structure
typedef struct _IMV_RecordParam
{
unsigned int nWidth; ///< [IN] \~chinese 图像宽 \~english Width
unsigned int nHeight; ///< [IN] \~chinese 图像高 \~english Height
float fFameRate; ///< [IN] \~chinese 帧率(大于0) \~english Frame rate(greater than 0)
unsigned int nQuality; ///< [IN] \~chinese 视频质量(1-100) \~english Video quality(1-100)
IMV_EVideoType recordFormat; ///< [IN] \~chinese 视频格式 \~english Video format
const char* pRecordFilePath; ///< [IN] \~chinese 保存视频路径 \~english Save video path
unsigned int nReserved[5]; ///< \~chinese 预留 \~english Reserved
}IMV_RecordParam;
/// \~chinese
/// \brief 录像用帧信息结构体
/// \~english
/// \brief Frame information for recording structure
typedef struct _IMV_RecordFrameInfoParam
{
unsigned char* pData; ///< [IN] \~chinese 图像数据 \~english Image data
unsigned int nDataLen; ///< [IN] \~chinese 图像数据长度 \~english Image data length
unsigned int nPaddingX; ///< [IN] \~chinese 图像宽填充 \~english Padding X
unsigned int nPaddingY; ///< [IN] \~chinese 图像高填充 \~english Padding Y
IMV_EPixelType ePixelFormat; ///< [IN] \~chinese 像素格式 \~english Pixel format
unsigned int nReserved[5]; ///< \~chinese 预留 \~english Reserved
}IMV_RecordFrameInfoParam;
/// \~chinese
/// \brief 图像翻转结构体
/// \~english
/// \brief Flip image structure
typedef struct _IMV_FlipImageParam
{
unsigned int nWidth; ///< [IN] \~chinese 图像宽 \~english Width
unsigned int nHeight; ///< [IN] \~chinese 图像高 \~english Height
IMV_EPixelType ePixelFormat; ///< [IN] \~chinese 像素格式 \~english Pixel format
IMV_EFlipType eFlipType; ///< [IN] \~chinese 翻转类型 \~english Flip type
unsigned char* pSrcData; ///< [IN] \~chinese 输入图像数据 \~english Input image data
unsigned int nSrcDataLen; ///< [IN] \~chinese 输入图像长度 \~english Input image length
unsigned char* pDstBuf; ///< [OUT] \~chinese 输出数据缓存(调用者分配缓存) \~english Output data buffer(allocated cache by the caller)
unsigned int nDstBufSize; ///< [IN] \~chinese 提供的输出缓冲区大小 \~english Provided output buffer size
unsigned int nDstDataLen; ///< [OUT] \~chinese 输出数据长度 \~english Output data length
unsigned int nReserved[8]; ///< \~chinese 预留 \~english Reserved
}IMV_FlipImageParam;
/// \~chinese
/// \brief 图像旋转结构体
/// \~english
/// \brief Rotate image structure
typedef struct _IMV_RotateImageParam
{
unsigned int nWidth; ///< [IN][OUT] \~chinese 图像宽 \~english Width
unsigned int nHeight; ///< [IN][OUT] \~chinese 图像高 \~english Height
IMV_EPixelType ePixelFormat; ///< [IN] \~chinese 像素格式 \~english Pixel format
IMV_ERotationAngle eRotationAngle; ///< [IN] \~chinese 旋转角度 \~english Rotation angle
unsigned char* pSrcData; ///< [IN] \~chinese 输入图像数据 \~english Input image data
unsigned int nSrcDataLen; ///< [IN] \~chinese 输入图像长度 \~english Input image length
unsigned char* pDstBuf; ///< [OUT] \~chinese 输出数据缓存(调用者分配缓存) \~english Output data buffer(allocated cache by the caller)
unsigned int nDstBufSize; ///< [IN] \~chinese 提供的输出缓冲区大小 \~english Provided output buffer size
unsigned int nDstDataLen; ///< [OUT] \~chinese 输出数据长度 \~english Output data length
unsigned int nReserved[8]; ///< \~chinese 预留 \~english Reserved
}IMV_RotateImageParam;
/// \~chinese
/// \brief 枚举:图像保存格式
/// \~english
/// \brief Enumeration:image save format
typedef enum _IMV_ESaveFileType
{
typeSaveBmp = 0, ///< \~chinese BMP图像格式 \~english BMP Image Type
typeSaveJpeg = 1, ///< \~chinese JPEG图像格式 \~english Jpeg Image Type
typeSavePng = 2, ///< \~chinese PNG图像格式 \~english Png Image Type
typeSaveTiff = 3, ///< \~chinese TIFF图像格式 \~english TIFF Image Type
typeSaveUndefined = 255, ///< \~chinese 未定义的图像格式 \~english Undefined Image Type
}IMV_ESaveFileType;
/// \~chinese
/// \brief 保存图像结构体
/// \~english
/// \brief Save image structure
typedef struct _IMV_SaveImageToFileParam
{
unsigned int nWidth; ///< [IN] \~chinese 图像宽 \~english Width
unsigned int nHeight; ///< [IN] \~chinese 图像高 \~english Height
IMV_EPixelType ePixelFormat; ///< [IN] \~chinese 输入数据的像素格式 \~english Pixel format
unsigned char* pSrcData; ///< [IN] \~chinese 输入图像数据 \~english Input image data
unsigned int nSrcDataLen; ///< [IN] \~chinese 输入数据大小 \~english Input image length
IMV_ESaveFileType eImageType; ///< [IN] \~chinese 输入保存图片格式 \~english Input image save format
char* pImagePath; ///< [IN] \~chinese 输入文件路径 \~english Input image save path
unsigned int nQuality; ///< [IN] \~chinese JPG编码质量(50-99]PNG编码质量[0-9] \~english Encoding quality
IMV_EBayerDemosaic eBayerDemosaic; ///< [IN] \~chinese 转换Bayer格式算法 \~english Alorithm used for Bayer demosaic
unsigned int nReserved[8]; ///< \~chinese 预留 \~english Reserved
}IMV_SaveImageToFileParam;
/// \~chinese
/// \brief 设备连接状态事件回调函数声明
/// \param pParamUpdateArg [in] 回调时主动推送的设备连接状态事件信息
/// \param pUser [in] 用户自定义数据
/// \~english
/// \brief Call back function declaration of device connection status event
/// \param pStreamArg [in] The device connection status event which will be active pushed out during the callback
/// \param pUser [in] User defined data
typedef void(*IMV_ConnectCallBack)(const IMV_SConnectArg* pConnectArg, void* pUser);
/// \~chinese
/// \brief 参数更新事件回调函数声明
/// \param pParamUpdateArg [in] 回调时主动推送的参数更新事件信息
/// \param pUser [in] 用户自定义数据
/// \~english
/// \brief Call back function declaration of parameter update event
/// \param pStreamArg [in] The parameter update event which will be active pushed out during the callback
/// \param pUser [in] User defined data
typedef void(*IMV_ParamUpdateCallBack)(const IMV_SParamUpdateArg* pParamUpdateArg, void* pUser);
/// \~chinese
/// \brief 流事件回调函数声明
/// \param pStreamArg [in] 回调时主动推送的流事件信息
/// \param pUser [in] 用户自定义数据
/// \~english
/// \brief Call back function declaration of stream event
/// \param pStreamArg [in] The stream event which will be active pushed out during the callback
/// \param pUser [in] User defined data
typedef void(*IMV_StreamCallBack)(const IMV_SStreamArg* pStreamArg, void* pUser);
/// \~chinese
/// \brief 消息通道事件回调函数声明Gige专用
/// \param pMsgChannelArg [in] 回调时主动推送的消息通道事件信息
/// \param pUser [in] 用户自定义数据
/// \~english
/// \brief Call back function declaration of message channel event(Gige Only)
/// \param pMsgChannelArg [in] The message channel event which will be active pushed out during the callback
/// \param pUser [in] User defined data
typedef void(*IMV_MsgChannelCallBack)(const IMV_SMsgChannelArg* pMsgChannelArg, void* pUser);
/// \~chinese
/// \brief 消息通道事件回调函数声明(通用)
/// \param pMsgChannelArg [in] 回调时主动推送的消息通道事件信息
/// \param pUser [in] 用户自定义数据
/// \~english
/// \brief Call back function declaration of message channel event(Common)
/// \param pMsgChannelArg [in] The message channel event which will be active pushed out during the callback
/// \param pUser [in] User defined data
typedef void(*IMV_MsgChannelCallBackEx)(const IMV_SMsgEventArg* pMsgChannelArg, void* pUser);
/// \~chinese
/// \brief 帧数据信息回调函数声明
/// \param pFrame [in] 回调时主动推送的帧信息
/// \param pUser [in] 用户自定义数据
/// \~english
/// \brief Call back function declaration of frame data information
/// \param pFrame [in] The frame information which will be active pushed out during the callback
/// \param pUser [in] User defined data
typedef void(*IMV_FrameCallBack)(IMV_Frame* pFrame, void* pUser);
#endif // __IMV_DEFINES_H__

148
MIC_main.py Normal file
View File

@ -0,0 +1,148 @@
import numpy as np
import pandas as pd
from MIC2 import search_medicine_name, search_MIC_position, search_MIC, show_MIC, explain_MIC, \
translation_medicine_name, search_interpretation_criteria, update_location
def main_function(excel_drag, excel_standard, excel_ecv, input_image_path, output_image_path, fungus, bacteria,
crop_x=200, crop_y=240, crop_width=500, crop_height=330, draw_width=260, draw_height=260):
"""
:param excel_drag: 路径药敏板分布的 excel表格
:param excel_standard: 路径判断标准的 excel表格
:param excel_ecv: 路径折点信息的 excel表格
:param input_image_path: 路径待检验的药敏板图片
:param output_image_path: 路径初次标注后的药敏板图片
:param fungus: string菌属珠菌属隐球菌属表示曲霉属
:param bacteria: string菌种中文名
:param crop_x: int裁剪图片的 x值
:param crop_y: int裁剪图片的 y值
:param crop_width: int裁剪图片的宽度为 (图片的宽度 - crop_width)
:param crop_height: int裁剪图片的高度为 (图片的高度 - crop_height)
:param draw_width: int画框的宽度
:param draw_height: int画框的高度
:return: medicine_name_list_chinese 药物的中文名字 [str, str, ..., str]
medicine_name_list_english 药物的英文名字 [str, str, ..., str]
show_MIC_list 展示的MIC信息 [str, str, ..., str]
final_explain MIC对应的解释信息 [str, str, ..., str]
MIC_position_list 初次拍照画框的位置 [(int, int), (int, int), ..., (int, int)]
"""
# --读取药敏板药品信息--
drug_sensitivity_plate = pd.read_excel(excel_drag)
drug_sensitivity_plate.drop(drug_sensitivity_plate.index[0], axis=0, inplace=True) # 删除第一行标题
drug_sensitivity_plate.drop(drug_sensitivity_plate.columns[0], axis=1, inplace=True) # 删除第一列序号
medicine_concentration = drug_sensitivity_plate.iloc[0:8, 0:12] # 得到 药品信息 + 浓度对应表
medicine_information = drug_sensitivity_plate.iloc[:, 13:16] # 得到 药品名称 缩写 + 英文 + 中文 对应表
# --找到药敏板中每一种药的名字(缩写)--
medicine_name_list = search_medicine_name(medicine_concentration)
# --找到药敏板药品对应的中文名字、英文名字--
medicine_name_list_chinese, medicine_name_list_english = translation_medicine_name(medicine_information,
medicine_name_list)
# --找到菌属 + 药品对应的判读方法--
interpretation_criteria = pd.read_excel(excel_standard)
judge_standard = search_interpretation_criteria(interpretation_criteria, medicine_name_list_chinese, fungus)
# --对应输入图片,根据不同菌属的判读方法,找到满足颜色需求的微孔,标记出来,保存下标记后的图片,并记下标记坐标--
MIC_position_list = search_MIC_position(input_image_path, output_image_path, judge_standard,
crop_x, crop_y, crop_width, crop_height,
draw_width, draw_height)
# --对应药敏板信息,找到对应药品的 MIC值--
medicine_MIC_list = search_MIC(medicine_concentration, MIC_position_list)
#--对应规则找到最后展示出来的 MIC信息--
show_MIC_list = show_MIC(medicine_MIC_list, MIC_position_list)
#--对应折点信息表,找到药品对应的 MIC解释信息如果没有解释信息返回"-1",最后不解释--
vertices_ecv = pd.read_excel(excel_ecv)
final_explain = explain_MIC(vertices_ecv, fungus, bacteria, medicine_name_list_chinese, medicine_MIC_list)
return medicine_name_list_chinese, medicine_name_list_english, show_MIC_list, final_explain, MIC_position_list
# Todo: 输入像素位置,找到对应的组,然后替换掉坐标位置,加框,按照新的坐标重新找 MIC最终显示的 MIC解释信息
def add_position(excel_drag, excel_ecv, input_image_path, output_image_path,
location, location_list, fungus, bacteria,
crop_x=200, crop_y=240, crop_width=500, crop_height=330, draw_width=260, draw_height=260):
"""
:param excel_drag: 路径药敏板分布的 excel表格
:param excel_ecv: 路径折点信息的 excel表格
:param input_image_path: 图片路径已经经过标记过的图像
:param output_image_path: 图片路径手动点击添加框后的图像
:param location: tuple(height, width)新加点的位置
:param location_list: list, 原画框列表位置
:param fungus: str, 菌属
:param bacteria: str, 菌种
:param crop_x: int裁剪图片的 x值
:param crop_y: int裁剪图片的 y值
:param crop_width: int裁剪图片的宽度为 (图片的宽度 - crop_width)
:param crop_height: int裁剪图片的高度为 (图片的高度 - crop_height)
:param draw_width: int画框的宽度
:param draw_height: int画框的高度
:return: medicine_name_list_chinese 药物的中文名字 [str, str, ..., str]
medicine_name_list_english 药物的英文名字 [str, str, ..., str]
show_MIC_list 新的展示的MIC信息 [str, str, ..., str]
final_explain 新的MIC对应的解释信息 [str, str, ..., str]
new_location_list 新的画框位置同一组药品内计入新画框的位置
"""
# --读取药敏板药品信息--
drug_sensitivity_plate = pd.read_excel(excel_drag)
drug_sensitivity_plate.drop(drug_sensitivity_plate.index[0], axis=0, inplace=True) # 删除第一行标题
drug_sensitivity_plate.drop(drug_sensitivity_plate.columns[0], axis=1, inplace=True) # 删除第一列序号
medicine_concentration = drug_sensitivity_plate.iloc[0:8, 0:12] # 得到 药品信息 + 浓度对应表
medicine_information = drug_sensitivity_plate.iloc[:, 13:16] # 得到 药品名称 缩写 + 英文 + 中文 对应表
# --找到药敏板中每一种药的名字(缩写)--
medicine_name_list = search_medicine_name(drug_sensitivity_plate)
# --找到药敏板药品对应的中文名字、英文名字--
medicine_name_list_chinese, medicine_name_list_english = translation_medicine_name(medicine_information,
medicine_name_list)
#--更新位置--
new_location_list = update_location(input_image_path, output_image_path, location, location_list,
crop_x, crop_y, crop_width, crop_height, draw_width, draw_height)
# --对应药敏板信息,找到对应药品的 MIC值--
medicine_MIC_list = search_MIC(medicine_concentration, new_location_list)
#--对应规则找到最后展示出来的 MIC信息--
show_MIC_list = show_MIC(medicine_MIC_list, new_location_list)
#--对应折点信息表,找到药品对应的 MIC解释信息如果没有解释信息返回"-1",最后不解释--
vertices_ecv = pd.read_excel(excel_ecv)
final_explain = explain_MIC(vertices_ecv, fungus, bacteria, medicine_name_list_chinese, medicine_MIC_list)
return medicine_name_list_chinese, medicine_name_list_english, show_MIC_list, final_explain, new_location_list
if __name__ == '__main__':
chinese_name, english_name, mic, explain, pos_li = main_function(
"C:\\Users\\Liao\\Desktop\\MXK\\丹娜\\MIC\\药敏板药物信息示例\\药敏板药物信息示例.xlsx",
"C:\\Users\\Liao\\Desktop\\MXK\\丹娜\\MIC\\药敏板药物信息示例\\药敏板药品判读规则表格.xlsx",
"C:\\Users\\Liao\\Desktop\\MXK\\丹娜\\MIC\\药敏板药物信息示例\\MIC解释标准及ECV值.xlsx",
"./data/念珠结果判读/2.jpg",
"./data/res/test2_0.jpg",
"隐球菌属",
"新生隐球菌VN")
print(chinese_name)
print(english_name)
print(mic)
print(explain)
print(pos_li)
print("------新增框------")
# 按照目前图片进行裁剪,可根据如下范围设定新加的孔在哪里
# [200, 558, 916, 1274, 1632, 1990, 2348, 2706, 3064]
# [240, 598, 956, 1314, 1672, 2030, 2388, 2746, 3104, 3462, 3820, 4178, 4536]
# 比如(210, 250)就应该对应的是(1, 1)这个位置,(2780, 3900)对应的就是(8, 11)这个位置
chinese_name_new, english_name_new, mic_new, explain_new, pos_new = add_position(
"C:\\Users\\Liao\\Desktop\\MXK\\丹娜\\MIC\\药敏板药物信息示例\\药敏板药物信息示例.xlsx",
"C:\\Users\\Liao\\Desktop\\MXK\\丹娜\\MIC\\药敏板药物信息示例\\MIC解释标准及ECV值.xlsx",
"./data/res/test2_0.jpg",
"./data/res/add_test2_0.jpg",
(1500, 2500), pos_li,
"隐球菌属",
"新生隐球菌VN"
)
print(chinese_name_new)
print(english_name_new)
print(mic_new)
print(explain_new)
print(pos_new)

55
MessageQue.h Normal file
View File

@ -0,0 +1,55 @@
#ifndef __MESSAGE_QUE_H__
#define __MESSAGE_QUE_H__
#include <list>
#include <QMutex>
template<typename T>
class TMessageQue
{
public:
void push_back(T const& msg)
{
m_mutex.lock();
m_list.push_back(msg);
m_mutex.unlock();
}
bool get(T& msg)
{
bool nRet = false;
m_mutex.lock();
if (!m_list.empty())
{
msg = m_list.front();
m_list.pop_front();
nRet = true;
}
m_mutex.unlock();
return nRet;
}
int size()
{
m_mutex.lock();
int size = (int)m_list.size();
m_mutex.unlock();
return size;
}
void clear()
{
m_mutex.lock();
m_list.clear();
m_mutex.unlock();
}
private:
QMutex m_mutex;
std::list<T> m_list;
};
#endif //__MESSAGE_QUE_H__

1
README.md Normal file
View File

@ -0,0 +1 @@
#danna_shangweiji

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,923 @@
#ifndef __IMV_DEFINES_H__
#define __IMV_DEFINES_H__
#ifdef WIN32
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#else
#include <stdint.h>
#endif
#ifndef IN
#define IN ///< \~chinese 输入型参数 \~english Input param
#endif
#ifndef OUT
#define OUT ///< \~chinese 输出型参数 \~english Output param
#endif
#ifndef IN_OUT
#define IN_OUT ///< \~chinese 输入/输出型参数 \~english Input/Output param
#endif
#ifndef __cplusplus
typedef char bool;
#define true 1
#define false 0
#endif
/// \~chinese
/// \brief 错误码
/// \~english
/// \brief Error code
#define IMV_OK 0 ///< \~chinese 成功,无错误 \~english Successed, no error
#define IMV_ERROR -101 ///< \~chinese 通用的错误 \~english Generic error
#define IMV_INVALID_HANDLE -102 ///< \~chinese 错误或无效的句柄 \~english Error or invalid handle
#define IMV_INVALID_PARAM -103 ///< \~chinese 错误的参数 \~english Incorrect parameter
#define IMV_INVALID_FRAME_HANDLE -104 ///< \~chinese 错误或无效的帧句柄 \~english Error or invalid frame handle
#define IMV_INVALID_FRAME -105 ///< \~chinese 无效的帧 \~english Invalid frame
#define IMV_INVALID_RESOURCE -106 ///< \~chinese 相机/事件/流等资源无效 \~english Camera/Event/Stream and so on resource invalid
#define IMV_INVALID_IP -107 ///< \~chinese 设备与主机的IP网段不匹配 \~english Device's and PC's subnet is mismatch
#define IMV_NO_MEMORY -108 ///< \~chinese 内存不足 \~english Malloc memery failed
#define IMV_INSUFFICIENT_MEMORY -109 ///< \~chinese 传入的内存空间不足 \~english Insufficient memory
#define IMV_ERROR_PROPERTY_TYPE -110 ///< \~chinese 属性类型错误 \~english Property type error
#define IMV_INVALID_ACCESS -111 ///< \~chinese 属性不可访问、或不能读/写、或读/写失败 \~english Property not accessible, or not be read/written, or read/written failed
#define IMV_INVALID_RANGE -112 ///< \~chinese 属性值超出范围、或者不是步长整数倍 \~english The property's value is out of range, or is not integer multiple of the step
#define IMV_NOT_SUPPORT -113 ///< \~chinese 设备不支持的功能 \~english Device not supported function
#define IMV_RESTORE_STREAM -114 ///< \~chinese 取图恢复中 \~english Device restore stream
#define IMV_RECONNECT_DEVICE -115 ///< \~chinese 重连恢复中 \~english Device reconnect
#define IMV_NOT_AVAILABLE -116 ///< \~chinese 连接不可达 \~english Connect not available
#define IMV_NOT_GRABBING -117 ///< \~chinese 相机已停止取图 \~english The camera already stop grabbing
#define IMV_NOT_CONNECTED -118 ///< \~chinese 设备未连接 \~english Not connect device
#define IMV_TIMEOUT -119 ///< \~chinese 超时 \~english Timeout
#define IMV_IS_CONNECTED -120 ///< \~chinese 设备已连接 \~english Device is connected
#define IMV_IS_GRABBING -121 ///< \~chinese 设备正在取图 \~english The device is grabbing
#define IMV_INVOCATION_ERROR -122 ///< \~chinese 调用时序错误 \~english The timing of the call is incorrect
#define IMV_SYSTEM_ERROR -123 ///< \~chinese 系统接口返回错误 \~english The operating system returns an error
#define IMV_OPENFILE_ERROR -124 ///< \~chinese 打开文件出现错误 \~english Open file error
#define IMV_MAX_DEVICE_ENUM_NUM 100 ///< \~chinese 支持设备最大个数 \~english The maximum number of supported devices
#define IMV_MAX_STRING_LENTH 256 ///< \~chinese 字符串最大长度 \~english The maximum length of string
#define IMV_MAX_ERROR_LIST_NUM 128 ///< \~chinese 失败属性列表最大长度 \~english The maximum size of failed properties list
typedef void* IMV_HANDLE; ///< \~chinese 设备句柄 \~english Device handle
typedef void* IMV_FRAME_HANDLE; ///< \~chinese 帧句柄 \~english Frame handle
/// \~chinese
///枚举:属性类型
/// \~english
///Enumeration: property type
typedef enum _IMV_EFeatureType
{
featureInt = 0x10000000, ///< \~chinese 整型数 \~english Integer
featureFloat = 0x20000000, ///< \~chinese 浮点数 \~english Float
featureEnum = 0x30000000, ///< \~chinese 枚举 \~english Enumeration
featureBool = 0x40000000, ///< \~chinese 布尔 \~english Bool
featureString = 0x50000000, ///< \~chinese 字符串 \~english String
featureCommand = 0x60000000, ///< \~chinese 命令 \~english Command
featureGroup = 0x70000000, ///< \~chinese 分组节点 \~english Group Node
featureReg = 0x80000000, ///< \~chinese 寄存器节点 \~english Register Node
featureUndefined = 0x90000000 ///< \~chinese 未定义 \~english Undefined
}IMV_EFeatureType;
/// \~chinese
///枚举:接口类型
/// \~english
///Enumeration: interface type
typedef enum _IMV_EInterfaceType
{
interfaceTypeGige = 0x00000001, ///< \~chinese 网卡接口类型 \~english NIC type
interfaceTypeUsb3 = 0x00000002, ///< \~chinese USB3.0接口类型 \~english USB3.0 interface type
interfaceTypeCL = 0x00000004, ///< \~chinese CAMERALINK接口类型 \~english Cameralink interface type
interfaceTypePCIe = 0x00000008, ///< \~chinese PCIe接口类型 \~english PCIe interface type
interfaceTypeAll = 0x00000000, ///< \~chinese 忽略接口类型CAMERALINK接口除外 \~english All types interface typeExcluding CAMERALINK
interfaceInvalidType = 0xFFFFFFFF ///< \~chinese 无效接口类型 \~english Invalid interface type
}IMV_EInterfaceType;
/// \~chinese
///枚举:设备类型
/// \~english
///Enumeration: device type
typedef enum _IMV_ECameraType
{
typeGigeCamera = 0, ///< \~chinese GIGE相机 \~english GigE Vision Camera
typeU3vCamera = 1, ///< \~chinese USB3.0相机 \~english USB3.0 Vision Camera
typeCLCamera = 2, ///< \~chinese CAMERALINK 相机 \~english Cameralink camera
typePCIeCamera = 3, ///< \~chinese PCIe相机 \~english PCIe Camera
typeUndefinedCamera = 255 ///< \~chinese 未知类型 \~english Undefined Camera
}IMV_ECameraType;
/// \~chinese
///枚举:创建句柄方式
/// \~english
///Enumeration: Create handle mode
typedef enum _IMV_ECreateHandleMode
{
modeByIndex = 0, ///< \~chinese 通过已枚举设备的索引(从0开始比如 0, 1, 2...) \~english By index of enumerated devices (Start from 0, such as 0, 1, 2...)
modeByCameraKey, ///< \~chinese 通过设备键"厂商:序列号" \~english By device's key "vendor:serial number"
modeByDeviceUserID, ///< \~chinese 通过设备自定义名 \~english By device userID
modeByIPAddress, ///< \~chinese 通过设备IP地址 \~english By device IP address.
}IMV_ECreateHandleMode;
/// \~chinese
///枚举:访问权限
/// \~english
///Enumeration: access permission
typedef enum _IMV_ECameraAccessPermission
{
accessPermissionOpen = 0, ///< \~chinese GigE相机没有被连接 \~english The GigE vision device isn't connected to any application.
accessPermissionExclusive, ///< \~chinese 独占访问权限 \~english Exclusive Access Permission
accessPermissionControl, ///< \~chinese 非独占控制权限,其他App允许读取所有寄存器 \~english Non-Exclusive Control Permission, allows other APP reading all registers
accessPermissionControlWithSwitchover, ///< \~chinese 切换控制访问权限 \~english Control access with switchover enabled.
accessPermissionMonitor, ///< \~chinese 非独占访问权限,以读的模式打开设备 \~english Non-Exclusive Read Permission, open device with read mode
accessPermissionUnknown = 254, ///< \~chinese 无法确定 \~english Value not known; indeterminate.
accessPermissionUndefined ///< \~chinese 未定义访问权限 \~english Undefined Access Permission
}IMV_ECameraAccessPermission;
/// \~chinese
///枚举:抓图策略
/// \~english
///Enumeration: grab strartegy
typedef enum _IMV_EGrabStrategy
{
grabStrartegySequential = 0, ///< \~chinese 按到达顺序处理图片 \~english The images are processed in the order of their arrival
grabStrartegyLatestImage = 1, ///< \~chinese 获取最新的图片 \~english Get latest image
grabStrartegyUpcomingImage = 2, ///< \~chinese 等待获取下一张图片(只针对GigE相机) \~english Waiting for next image(GigE only)
grabStrartegyUndefined ///< \~chinese 未定义 \~english Undefined
}IMV_EGrabStrategy;
/// \~chinese
///枚举:流事件状态
/// \~english
/// Enumeration:stream event status
typedef enum _IMV_EEventStatus
{
streamEventNormal = 1, ///< \~chinese 正常流事件 \~english Normal stream event
streamEventLostFrame = 2, ///< \~chinese 丢帧事件 \~english Lost frame event
streamEventLostPacket = 3, ///< \~chinese 丢包事件 \~english Lost packet event
streamEventImageError = 4, ///< \~chinese 图像错误事件 \~english Error image event
streamEventStreamChannelError = 5, ///< \~chinese 取流错误事件 \~english Stream channel error event
streamEventTooManyConsecutiveResends = 6, ///< \~chinese 太多连续重传 \~english Too many consecutive resends event
streamEventTooManyLostPacket = 7 ///< \~chinese 太多丢包 \~english Too many lost packet event
}IMV_EEventStatus;
/// \~chinese
///枚举图像转换Bayer格式所用的算法
/// \~english
/// Enumeration:alorithm used for Bayer demosaic
typedef enum _IMV_EBayerDemosaic
{
demosaicNearestNeighbor, ///< \~chinese 最近邻 \~english Nearest neighbor
demosaicBilinear, ///< \~chinese 双线性 \~english Bilinear
demosaicEdgeSensing, ///< \~chinese 边缘检测 \~english Edge sensing
demosaicNotSupport = 255, ///< \~chinese 不支持 \~english Not support
}IMV_EBayerDemosaic;
/// \~chinese
///枚举:事件类型
/// \~english
/// Enumeration:event type
typedef enum _IMV_EVType
{
offLine, ///< \~chinese 设备离线通知 \~english device offline notification
onLine ///< \~chinese 设备在线通知 \~english device online notification
}IMV_EVType;
/// \~chinese
///枚举:视频格式
/// \~english
/// Enumeration:Video format
typedef enum _IMV_EVideoType
{
typeVideoFormatAVI = 0, ///< \~chinese AVI格式 \~english AVI format
typeVideoFormatNotSupport = 255 ///< \~chinese 不支持 \~english Not support
}IMV_EVideoType;
/// \~chinese
///枚举:图像翻转类型
/// \~english
/// Enumeration:Image flip type
typedef enum _IMV_EFlipType
{
typeFlipVertical, ///< \~chinese 垂直(Y轴)翻转 \~english Vertical(Y-axis) flip
typeFlipHorizontal ///< \~chinese 水平(X轴)翻转 \~english Horizontal(X-axis) flip
}IMV_EFlipType;
/// \~chinese
///枚举:顺时针旋转角度
/// \~english
/// Enumeration:Rotation angle clockwise
typedef enum _IMV_ERotationAngle
{
rotationAngle90, ///< \~chinese 顺时针旋转90度 \~english Rotate 90 degree clockwise
rotationAngle180, ///< \~chinese 顺时针旋转180度 \~english Rotate 180 degree clockwise
rotationAngle270, ///< \~chinese 顺时针旋转270度 \~english Rotate 270 degree clockwise
}IMV_ERotationAngle;
#define IMV_GVSP_PIX_MONO 0x01000000
#define IMV_GVSP_PIX_RGB 0x02000000
#define IMV_GVSP_PIX_COLOR 0x02000000
#define IMV_GVSP_PIX_CUSTOM 0x80000000
#define IMV_GVSP_PIX_COLOR_MASK 0xFF000000
// Indicate effective number of bits occupied by the pixel (including padding).
// This can be used to compute amount of memory required to store an image.
#define IMV_GVSP_PIX_OCCUPY1BIT 0x00010000
#define IMV_GVSP_PIX_OCCUPY2BIT 0x00020000
#define IMV_GVSP_PIX_OCCUPY4BIT 0x00040000
#define IMV_GVSP_PIX_OCCUPY8BIT 0x00080000
#define IMV_GVSP_PIX_OCCUPY12BIT 0x000C0000
#define IMV_GVSP_PIX_OCCUPY16BIT 0x00100000
#define IMV_GVSP_PIX_OCCUPY24BIT 0x00180000
#define IMV_GVSP_PIX_OCCUPY32BIT 0x00200000
#define IMV_GVSP_PIX_OCCUPY36BIT 0x00240000
#define IMV_GVSP_PIX_OCCUPY48BIT 0x00300000
/// \~chinese
///枚举:图像格式
/// \~english
/// Enumeration:image format
typedef enum _IMV_EPixelType
{
// Undefined pixel type
gvspPixelTypeUndefined = -1,
// Mono Format
gvspPixelMono1p = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY1BIT | 0x0037),
gvspPixelMono2p = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY2BIT | 0x0038),
gvspPixelMono4p = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY4BIT | 0x0039),
gvspPixelMono8 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY8BIT | 0x0001),
gvspPixelMono8S = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY8BIT | 0x0002),
gvspPixelMono10 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY16BIT | 0x0003),
gvspPixelMono10Packed = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY12BIT | 0x0004),
gvspPixelMono12 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY16BIT | 0x0005),
gvspPixelMono12Packed = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY12BIT | 0x0006),
gvspPixelMono14 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY16BIT | 0x0025),
gvspPixelMono16 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY16BIT | 0x0007),
// Bayer Format
gvspPixelBayGR8 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY8BIT | 0x0008),
gvspPixelBayRG8 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY8BIT | 0x0009),
gvspPixelBayGB8 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY8BIT | 0x000A),
gvspPixelBayBG8 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY8BIT | 0x000B),
gvspPixelBayGR10 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY16BIT | 0x000C),
gvspPixelBayRG10 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY16BIT | 0x000D),
gvspPixelBayGB10 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY16BIT | 0x000E),
gvspPixelBayBG10 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY16BIT | 0x000F),
gvspPixelBayGR12 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY16BIT | 0x0010),
gvspPixelBayRG12 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY16BIT | 0x0011),
gvspPixelBayGB12 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY16BIT | 0x0012),
gvspPixelBayBG12 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY16BIT | 0x0013),
gvspPixelBayGR10Packed = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY12BIT | 0x0026),
gvspPixelBayRG10Packed = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY12BIT | 0x0027),
gvspPixelBayGB10Packed = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY12BIT | 0x0028),
gvspPixelBayBG10Packed = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY12BIT | 0x0029),
gvspPixelBayGR12Packed = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY12BIT | 0x002A),
gvspPixelBayRG12Packed = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY12BIT | 0x002B),
gvspPixelBayGB12Packed = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY12BIT | 0x002C),
gvspPixelBayBG12Packed = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY12BIT | 0x002D),
gvspPixelBayGR16 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY16BIT | 0x002E),
gvspPixelBayRG16 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY16BIT | 0x002F),
gvspPixelBayGB16 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY16BIT | 0x0030),
gvspPixelBayBG16 = (IMV_GVSP_PIX_MONO | IMV_GVSP_PIX_OCCUPY16BIT | 0x0031),
// RGB Format
gvspPixelRGB8 = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY24BIT | 0x0014),
gvspPixelBGR8 = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY24BIT | 0x0015),
gvspPixelRGBA8 = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY32BIT | 0x0016),
gvspPixelBGRA8 = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY32BIT | 0x0017),
gvspPixelRGB10 = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY48BIT | 0x0018),
gvspPixelBGR10 = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY48BIT | 0x0019),
gvspPixelRGB12 = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY48BIT | 0x001A),
gvspPixelBGR12 = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY48BIT | 0x001B),
gvspPixelRGB16 = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY48BIT | 0x0033),
gvspPixelRGB10V1Packed = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY32BIT | 0x001C),
gvspPixelRGB10P32 = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY32BIT | 0x001D),
gvspPixelRGB12V1Packed = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY36BIT | 0X0034),
gvspPixelRGB565P = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY16BIT | 0x0035),
gvspPixelBGR565P = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY16BIT | 0X0036),
// YVR Format
gvspPixelYUV411_8_UYYVYY = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY12BIT | 0x001E),
gvspPixelYUV422_8_UYVY = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY16BIT | 0x001F),
gvspPixelYUV422_8 = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY16BIT | 0x0032),
gvspPixelYUV8_UYV = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY24BIT | 0x0020),
gvspPixelYCbCr8CbYCr = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY24BIT | 0x003A),
gvspPixelYCbCr422_8 = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY16BIT | 0x003B),
gvspPixelYCbCr422_8_CbYCrY = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY16BIT | 0x0043),
gvspPixelYCbCr411_8_CbYYCrYY = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY12BIT | 0x003C),
gvspPixelYCbCr601_8_CbYCr = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY24BIT | 0x003D),
gvspPixelYCbCr601_422_8 = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY16BIT | 0x003E),
gvspPixelYCbCr601_422_8_CbYCrY = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY16BIT | 0x0044),
gvspPixelYCbCr601_411_8_CbYYCrYY = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY12BIT | 0x003F),
gvspPixelYCbCr709_8_CbYCr = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY24BIT | 0x0040),
gvspPixelYCbCr709_422_8 = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY16BIT | 0x0041),
gvspPixelYCbCr709_422_8_CbYCrY = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY16BIT | 0x0045),
gvspPixelYCbCr709_411_8_CbYYCrYY = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY12BIT | 0x0042),
// RGB Planar
gvspPixelRGB8Planar = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY24BIT | 0x0021),
gvspPixelRGB10Planar = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY48BIT | 0x0022),
gvspPixelRGB12Planar = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY48BIT | 0x0023),
gvspPixelRGB16Planar = (IMV_GVSP_PIX_COLOR | IMV_GVSP_PIX_OCCUPY48BIT | 0x0024),
//BayerRG10p和BayerRG12p格式针对特定项目临时添加,请不要使用
//BayerRG10p and BayerRG12p, currently used for specific project, please do not use them
gvspPixelBayRG10p = 0x010A0058,
gvspPixelBayRG12p = 0x010c0059,
//mono1c格式自定义格式
//mono1c, customized image format, used for binary output
gvspPixelMono1c = 0x012000FF,
//mono1e格式自定义格式用来显示连通域
//mono1e, customized image format, used for displaying connected domain
gvspPixelMono1e = 0x01080FFF
}IMV_EPixelType;
/// \~chinese
/// \brief 传输模式(gige)
/// \~english
/// \brief Transmission type (gige)
typedef enum _IMV_TransmissionType
{
transTypeUnicast, ///< \~chinese 单播模式 \~english Unicast Mode
transTypeMulticast ///< \~chinese 组播模式 \~english Multicast Mode
}IMV_TransmissionType;
/// \~chinese
/// \brief 字符串信息
/// \~english
/// \brief String information
typedef struct _IMV_String
{
char str[IMV_MAX_STRING_LENTH]; ///< \~chinese 字符串.长度不超过256 \~english Strings and the maximum length of strings is 255.
}IMV_String;
/// \~chinese
/// \brief GigE网卡信息
/// \~english
/// \brief GigE interface information
typedef struct _IMV_GigEInterfaceInfo
{
char description[IMV_MAX_STRING_LENTH]; ///< \~chinese 网卡描述信息 \~english Network card description
char macAddress[IMV_MAX_STRING_LENTH]; ///< \~chinese 网卡Mac地址 \~english Network card MAC Address
char ipAddress[IMV_MAX_STRING_LENTH]; ///< \~chinese 设备Ip地址 \~english Device ip Address
char subnetMask[IMV_MAX_STRING_LENTH]; ///< \~chinese 子网掩码 \~english SubnetMask
char defaultGateWay[IMV_MAX_STRING_LENTH]; ///< \~chinese 默认网关 \~english Default GateWay
char chReserved[5][IMV_MAX_STRING_LENTH]; ///< 保留 \~english Reserved field
}IMV_GigEInterfaceInfo;
/// \~chinese
/// \brief USB接口信息
/// \~english
/// \brief USB interface information
typedef struct _IMV_UsbInterfaceInfo
{
char description[IMV_MAX_STRING_LENTH]; ///< \~chinese USB接口描述信息 \~english USB interface description
char vendorID[IMV_MAX_STRING_LENTH]; ///< \~chinese USB接口Vendor ID \~english USB interface Vendor ID
char deviceID[IMV_MAX_STRING_LENTH]; ///< \~chinese USB接口设备ID \~english USB interface Device ID
char subsystemID[IMV_MAX_STRING_LENTH]; ///< \~chinese USB接口Subsystem ID \~english USB interface Subsystem ID
char revision[IMV_MAX_STRING_LENTH]; ///< \~chinese USB接口Revision \~english USB interface Revision
char speed[IMV_MAX_STRING_LENTH]; ///< \~chinese USB接口speed \~english USB interface speed
char chReserved[4][IMV_MAX_STRING_LENTH]; ///< 保留 \~english Reserved field
}IMV_UsbInterfaceInfo;
/// \~chinese
/// \brief GigE设备信息
/// \~english
/// \brief GigE device information
typedef struct _IMV_GigEDeviceInfo
{
/// \~chinese
/// 设备支持的IP配置选项\n
/// value:4 相机只支持LLA\n
/// value:5 相机支持LLA和Persistent IP\n
/// value:6 相机支持LLA和DHCP\n
/// value:7 相机支持LLA、DHCP和Persistent IP\n
/// value:0 获取失败
/// \~english
/// Supported IP configuration options of device\n
/// value:4 Device supports LLA \n
/// value:5 Device supports LLA and Persistent IP\n
/// value:6 Device supports LLA and DHCP\n
/// value:7 Device supports LLA, DHCP and Persistent IP\n
/// value:0 Get fail
unsigned int nIpConfigOptions;
/// \~chinese
/// 设备当前的IP配置选项\n
/// value:4 LLA处于活动状态\n
/// value:5 LLA和Persistent IP处于活动状态\n
/// value:6 LLA和DHCP处于活动状态\n
/// value:7 LLA、DHCP和Persistent IP处于活动状态\n
/// value:0 获取失败
/// \~english
/// Current IP Configuration options of device\n
/// value:4 LLA is active\n
/// value:5 LLA and Persistent IP are active\n
/// value:6 LLA and DHCP are active\n
/// value:7 LLA, DHCP and Persistent IP are active\n
/// value:0 Get fail
unsigned int nIpConfigCurrent;
unsigned int nReserved[3]; ///< \~chinese 保留 \~english Reserved field
char macAddress[IMV_MAX_STRING_LENTH]; ///< \~chinese 设备Mac地址 \~english Device MAC Address
char ipAddress[IMV_MAX_STRING_LENTH]; ///< \~chinese 设备Ip地址 \~english Device ip Address
char subnetMask[IMV_MAX_STRING_LENTH]; ///< \~chinese 子网掩码 \~english SubnetMask
char defaultGateWay[IMV_MAX_STRING_LENTH]; ///< \~chinese 默认网关 \~english Default GateWay
char protocolVersion[IMV_MAX_STRING_LENTH]; ///< \~chinese 网络协议版本 \~english Net protocol version
/// \~chinese
/// Ip配置有效性\n
/// Ip配置有效时字符串值"Valid"\n
/// Ip配置无效时字符串值"Invalid On This Interface"
/// \~english
/// IP configuration valid\n
/// String value is "Valid" when ip configuration valid\n
/// String value is "Invalid On This Interface" when ip configuration invalid
char ipConfiguration[IMV_MAX_STRING_LENTH];
char chReserved[6][IMV_MAX_STRING_LENTH]; ///< \~chinese 保留 \~english Reserved field
}IMV_GigEDeviceInfo;
/// \~chinese
/// \brief Usb设备信息
/// \~english
/// \brief Usb device information
typedef struct _IMV_UsbDeviceInfo
{
bool bLowSpeedSupported; ///< \~chinese true支持false不支持其他值 非法。 \~english true support,false not supported,other invalid
bool bFullSpeedSupported; ///< \~chinese true支持false不支持其他值 非法。 \~english true support,false not supported,other invalid
bool bHighSpeedSupported; ///< \~chinese true支持false不支持其他值 非法。 \~english true support,false not supported,other invalid
bool bSuperSpeedSupported; ///< \~chinese true支持false不支持其他值 非法。 \~english true support,false not supported,other invalid
bool bDriverInstalled; ///< \~chinese true安装false未安装其他值 非法。 \~english true support,false not supported,other invalid
bool boolReserved[3]; ///< \~chinese 保留
unsigned int Reserved[4]; ///< \~chinese 保留 \~english Reserved field
char configurationValid[IMV_MAX_STRING_LENTH]; ///< \~chinese 配置有效性 \~english Configuration Valid
char genCPVersion[IMV_MAX_STRING_LENTH]; ///< \~chinese GenCP 版本 \~english GenCP Version
char u3vVersion[IMV_MAX_STRING_LENTH]; ///< \~chinese U3V 版本号 \~english U3v Version
char deviceGUID[IMV_MAX_STRING_LENTH]; ///< \~chinese 设备引导号 \~english Device guid number
char familyName[IMV_MAX_STRING_LENTH]; ///< \~chinese 设备系列号 \~english Device serial number
char u3vSerialNumber[IMV_MAX_STRING_LENTH]; ///< \~chinese 设备序列号 \~english Device SerialNumber
char speed[IMV_MAX_STRING_LENTH]; ///< \~chinese 设备传输速度 \~english Device transmission speed
char maxPower[IMV_MAX_STRING_LENTH]; ///< \~chinese 设备最大供电量 \~english Maximum power supply of device
char chReserved[4][IMV_MAX_STRING_LENTH]; ///< \~chinese 保留 \~english Reserved field
}IMV_UsbDeviceInfo;
/// \~chinese
/// \brief 设备通用信息
/// \~english
/// \brief Device general information
typedef struct _IMV_DeviceInfo
{
IMV_ECameraType nCameraType; ///< \~chinese 设备类别 \~english Camera type
int nCameraReserved[5]; ///< \~chinese 保留 \~english Reserved field
char cameraKey[IMV_MAX_STRING_LENTH]; ///< \~chinese 厂商:序列号 \~english Camera key
char cameraName[IMV_MAX_STRING_LENTH]; ///< \~chinese 用户自定义名 \~english UserDefinedName
char serialNumber[IMV_MAX_STRING_LENTH]; ///< \~chinese 设备序列号 \~english Device SerialNumber
char vendorName[IMV_MAX_STRING_LENTH]; ///< \~chinese 厂商 \~english Camera Vendor
char modelName[IMV_MAX_STRING_LENTH]; ///< \~chinese 设备型号 \~english Device model
char manufactureInfo[IMV_MAX_STRING_LENTH]; ///< \~chinese 设备制造信息 \~english Device ManufactureInfo
char deviceVersion[IMV_MAX_STRING_LENTH]; ///< \~chinese 设备版本 \~english Device Version
char cameraReserved[5][IMV_MAX_STRING_LENTH]; ///< \~chinese 保留 \~english Reserved field
union
{
IMV_GigEDeviceInfo gigeDeviceInfo; ///< \~chinese Gige设备信息 \~english Gige Device Information
IMV_UsbDeviceInfo usbDeviceInfo; ///< \~chinese Usb设备信息 \~english Usb Device Information
}DeviceSpecificInfo;
IMV_EInterfaceType nInterfaceType; ///< \~chinese 接口类别 \~english Interface type
int nInterfaceReserved[5]; ///< \~chinese 保留 \~english Reserved field
char interfaceName[IMV_MAX_STRING_LENTH]; ///< \~chinese 接口名 \~english Interface Name
char interfaceReserved[5][IMV_MAX_STRING_LENTH]; ///< \~chinese 保留 \~english Reserved field
union
{
IMV_GigEInterfaceInfo gigeInterfaceInfo; ///< \~chinese GigE网卡信息 \~english Gige interface Information
IMV_UsbInterfaceInfo usbInterfaceInfo; ///< \~chinese Usb接口信息 \~english Usb interface Information
}InterfaceInfo;
}IMV_DeviceInfo;
/// \~chinese
/// \brief 网络传输模式
/// \~english
/// \brief Transmission type
typedef struct _IMV_TRANSMISSION_TYPE
{
IMV_TransmissionType eTransmissionType; ///< \~chinese 传输模式 \~english Transmission type
unsigned int nDesIp; ///< \~chinese 目标ip地址 \~english Destination IP address
unsigned short nDesPort; ///< \~chinese 目标端口号 \~english Destination port
unsigned int nReserved[32]; ///< \~chinese 预留位 \~english Reserved field
}IMV_TRANSMISSION_TYPE;
/// \~chinese
/// \brief 加载失败的属性信息
/// \~english
/// \brief Load failed properties information
typedef struct _IMV_ErrorList
{
unsigned int nParamCnt; ///< \~chinese 加载失败的属性个数 \~english The count of load failed properties
IMV_String paramNameList[IMV_MAX_ERROR_LIST_NUM]; ///< \~chinese 加载失败的属性集合上限128 \~english Array of load failed properties, up to 128
}IMV_ErrorList;
/// \~chinese
/// \brief 设备信息列表
/// \~english
/// \brief Device information list
typedef struct _IMV_DeviceList
{
unsigned int nDevNum; ///< \~chinese 设备数量 \~english Device Number
IMV_DeviceInfo* pDevInfo; ///< \~chinese 设备息列表(SDK内部缓存)最多100设备 \~english Device information list(cached within the SDK), up to 100
}IMV_DeviceList;
/// \~chinese
/// \brief 连接事件信息
/// \~english
/// \brief connection event information
typedef struct _IMV_SConnectArg
{
IMV_EVType event; ///< \~chinese 事件类型 \~english event type
unsigned int nReserve[10]; ///< \~chinese 预留字段 \~english Reserved field
}IMV_SConnectArg;
/// \~chinese
/// \brief 参数更新事件信息
/// \~english
/// \brief Updating parameters event information
typedef struct _IMV_SParamUpdateArg
{
bool isPoll; ///< \~chinese 是否是定时更新,true:表示是定时更新false:表示非定时更新 \~english Update periodically or not. true:update periodically, true:not update periodically
unsigned int nReserve[10]; ///< \~chinese 预留字段 \~english Reserved field
unsigned int nParamCnt; ///< \~chinese 更新的参数个数 \~english The number of parameters which need update
IMV_String* pParamNameList; ///< \~chinese 更新的参数名称集合(SDK内部缓存) \~english Array of parameter's name which need to be updated(cached within the SDK)
}IMV_SParamUpdateArg;
/// \~chinese
/// \brief 流事件信息
/// \~english
/// \brief Stream event information
typedef struct _IMV_SStreamArg
{
unsigned int channel; ///< \~chinese 流通道号 \~english Channel no.
uint64_t blockId; ///< \~chinese 流数据BlockID \~english Block ID of stream data
uint64_t timeStamp; ///< \~chinese 时间戳 \~english Event time stamp
IMV_EEventStatus eStreamEventStatus; ///< \~chinese 流事件状态码 \~english Stream event status code
unsigned int status; ///< \~chinese 事件状态错误码 \~english Status error code
unsigned int nReserve[9]; ///< \~chinese 预留字段 \~english Reserved field
}IMV_SStreamArg;
/// \~chinese
/// 消息通道事件ID列表
/// \~english
/// message channel event id list
#define IMV_MSG_EVENT_ID_EXPOSURE_END 0x9001
#define IMV_MSG_EVENT_ID_FRAME_TRIGGER 0x9002
#define IMV_MSG_EVENT_ID_FRAME_START 0x9003
#define IMV_MSG_EVENT_ID_ACQ_START 0x9004
#define IMV_MSG_EVENT_ID_ACQ_TRIGGER 0x9005
#define IMV_MSG_EVENT_ID_DATA_READ_OUT 0x9006
/// \~chinese
/// \brief 消息通道事件信息
/// \~english
/// \brief Message channel event information
typedef struct _IMV_SMsgChannelArg
{
unsigned short eventId; ///< \~chinese 事件Id \~english Event id
unsigned short channelId; ///< \~chinese 消息通道号 \~english Channel id
uint64_t blockId; ///< \~chinese 流数据BlockID \~english Block ID of stream data
uint64_t timeStamp; ///< \~chinese 时间戳 \~english Event timestamp
unsigned int nReserve[8]; ///< \~chinese 预留字段 \~english Reserved field
unsigned int nParamCnt; ///< \~chinese 参数个数 \~english The number of parameters which need update
IMV_String* pParamNameList; ///< \~chinese 事件相关的属性名列集合(SDK内部缓存) \~english Array of parameter's name which is related(cached within the SDK)
}IMV_SMsgChannelArg;
/// \~chinese
/// \brief 消息通道事件信息(通用)
/// \~english
/// \brief Message channel event information(Common)
typedef struct _IMV_SMsgEventArg
{
unsigned short eventId; ///< \~chinese 事件Id \~english Event id
unsigned short channelId; ///< \~chinese 消息通道号 \~english Channel id
uint64_t blockId; ///< \~chinese 流数据BlockID \~english Block ID of stream data
uint64_t timeStamp; ///< \~chinese 时间戳 \~english Event timestamp
void* pEventData; ///< \~chinese 事件数据,内部缓存,需要及时进行数据处理 \~english Event data, internal buffer, need to be processed in time
unsigned int nEventDataSize; ///< \~chinese 事件数据长度 \~english Event data size
unsigned int reserve[8]; ///< \~chinese 预留字段 \~english Reserved field
}IMV_SMsgEventArg;
/// \~chinese
/// \brief Chunk数据信息
/// \~english
/// \brief Chunk data information
typedef struct _IMV_ChunkDataInfo
{
unsigned int chunkID; ///< \~chinese ChunkID \~english ChunkID
unsigned int nParamCnt; ///< \~chinese 属性名个数 \~english The number of paramNames
IMV_String* pParamNameList; ///< \~chinese Chunk数据对应的属性名集合(SDK内部缓存) \~english ParamNames Corresponding property name of chunk data(cached within the SDK)
}IMV_ChunkDataInfo;
/// \~chinese
/// \brief 帧图像信息
/// \~english
/// \brief The frame image information
typedef struct _IMV_FrameInfo
{
uint64_t blockId; ///< \~chinese 帧Id(仅对GigE/Usb/PCIe相机有效) \~english The block ID(GigE/Usb/PCIe camera only)
unsigned int status; ///< \~chinese 数据帧状态(0是正常状态) \~english The status of frame(0 is normal status)
unsigned int width; ///< \~chinese 图像宽度 \~english The width of image
unsigned int height; ///< \~chinese 图像高度 \~english The height of image
unsigned int size; ///< \~chinese 图像大小 \~english The size of image
IMV_EPixelType pixelFormat; ///< \~chinese 图像像素格式 \~english The pixel format of image
uint64_t timeStamp; ///< \~chinese 图像时间戳(仅对GigE/Usb/PCIe相机有效) \~english The timestamp of image(GigE/Usb/PCIe camera only)
unsigned int chunkCount; ///< \~chinese 帧数据中包含的Chunk个数(仅对GigE/Usb相机有效) \~english The number of chunk in frame data(GigE/Usb Camera Only)
unsigned int paddingX; ///< \~chinese 图像paddingX(仅对GigE/Usb/PCIe相机有效) \~english The paddingX of image(GigE/Usb/PCIe camera only)
unsigned int paddingY; ///< \~chinese 图像paddingY(仅对GigE/Usb/PCIe相机有效) \~english The paddingY of image(GigE/Usb/PCIe camera only)
unsigned int recvFrameTime; ///< \~chinese 图像在网络传输所用的时间(单位:微秒,非GigE相机该值为0) \~english The time taken for the image to be transmitted over the network(unit:us, The value is 0 for non-GigE camera)
unsigned int nReserved[19]; ///< \~chinese 预留字段 \~english Reserved field
}IMV_FrameInfo;
/// \~chinese
/// \brief 帧图像数据信息
/// \~english
/// \brief Frame image data information
typedef struct _IMV_Frame
{
IMV_FRAME_HANDLE frameHandle; ///< \~chinese 帧图像句柄(SDK内部帧管理用) \~english Frame image handle(used for managing frame within the SDK)
unsigned char* pData; ///< \~chinese 帧图像数据的内存首地址 \~english The starting address of memory of image data
IMV_FrameInfo frameInfo; ///< \~chinese 帧信息 \~english Frame information
unsigned int nReserved[10]; ///< \~chinese 预留字段 \~english Reserved field
}IMV_Frame;
/// \~chinese
/// \brief PCIE设备统计流信息
/// \~english
/// \brief PCIE device stream statistics information
typedef struct _IMV_PCIEStreamStatsInfo
{
unsigned int imageError; ///< \~chinese 图像错误的帧数 \~english Number of images error frames
unsigned int lostPacketBlock; ///< \~chinese 丢包的帧数 \~english Number of frames lost
unsigned int nReserved0[10]; ///< \~chinese 预留 \~english Reserved field
unsigned int imageReceived; ///< \~chinese 正常获取的帧数 \~english Number of frames acquired
double fps; ///< \~chinese 帧率 \~english Frame rate
double bandwidth; ///< \~chinese 带宽(Mbps) \~english Bandwidth(Mbps)
unsigned int nReserved[8]; ///< \~chinese 预留 \~english Reserved field
}IMV_PCIEStreamStatsInfo;
/// \~chinese
/// \brief U3V设备统计流信息
/// \~english
/// \brief U3V device stream statistics information
typedef struct _IMV_U3VStreamStatsInfo
{
unsigned int imageError; ///< \~chinese 图像错误的帧数 \~english Number of images error frames
unsigned int lostPacketBlock; ///< \~chinese 丢包的帧数 \~english Number of frames lost
unsigned int nReserved0[10]; ///< \~chinese 预留 \~english Reserved field
unsigned int imageReceived; ///< \~chinese 正常获取的帧数 \~english Number of images error frames
double fps; ///< \~chinese 帧率 \~english Frame rate
double bandwidth; ///< \~chinese 带宽(Mbps) \~english Bandwidth(Mbps)
unsigned int nReserved[8]; ///< \~chinese 预留 \~english Reserved field
}IMV_U3VStreamStatsInfo;
/// \~chinese
/// \brief Gige设备统计流信息
/// \~english
/// \brief Gige device stream statistics information
typedef struct _IMV_GigEStreamStatsInfo
{
unsigned int nReserved0[10]; ///< \~chinese 预留 \~english Reserved field
unsigned int imageError; ///< \~chinese 图像错误的帧数 \~english Number of image error frames
unsigned int lostPacketBlock; ///< \~chinese 丢包的帧数 \~english Number of frames lost
unsigned int nReserved1[4]; ///< \~chinese 预留 \~english Reserved field
unsigned int nReserved2[5]; ///< \~chinese 预留 \~english Reserved field
unsigned int imageReceived; ///< \~chinese 正常获取的帧数 \~english Number of frames acquired
double fps; ///< \~chinese 帧率 \~english Frame rate
double bandwidth; ///< \~chinese 带宽(Mbps) \~english Bandwidth(Mbps)
unsigned int nReserved[4]; ///< \~chinese 预留 \~english Reserved field
}IMV_GigEStreamStatsInfo;
/// \~chinese
/// \brief 统计流信息
/// \~english
/// \brief Stream statistics information
typedef struct _IMV_StreamStatisticsInfo
{
IMV_ECameraType nCameraType; ///< \~chinese 设备类型 \~english Device type
union
{
IMV_PCIEStreamStatsInfo pcieStatisticsInfo; ///< \~chinese PCIE设备统计信息 \~english PCIE device statistics information
IMV_U3VStreamStatsInfo u3vStatisticsInfo; ///< \~chinese U3V设备统计信息 \~english U3V device statistics information
IMV_GigEStreamStatsInfo gigeStatisticsInfo; ///< \~chinese Gige设备统计信息 \~english GIGE device statistics information
};
}IMV_StreamStatisticsInfo;
/// \~chinese
/// \brief 枚举属性的枚举值信息
/// \~english
/// \brief Enumeration property 's enumeration value information
typedef struct _IMV_EnumEntryInfo
{
uint64_t value; ///< \~chinese 枚举值 \~english Enumeration value
char name[IMV_MAX_STRING_LENTH]; ///< \~chinese symbol名 \~english Symbol name
}IMV_EnumEntryInfo;
/// \~chinese
/// \brief 枚举属性的可设枚举值列表信息
/// \~english
/// \brief Enumeration property 's settable enumeration value list information
typedef struct _IMV_EnumEntryList
{
unsigned int nEnumEntryBufferSize; ///< \~chinese 存放枚举值内存大小 \~english The size of saving enumeration value
IMV_EnumEntryInfo* pEnumEntryInfo; ///< \~chinese 存放可设枚举值列表(调用者分配缓存) \~english Save the list of settable enumeration value(allocated cache by the caller)
}IMV_EnumEntryList;
/// \~chinese
/// \brief 像素转换结构体
/// \~english
/// \brief Pixel convert structure
typedef struct _IMV_PixelConvertParam
{
unsigned int nWidth; ///< [IN] \~chinese 图像宽 \~english Width
unsigned int nHeight; ///< [IN] \~chinese 图像高 \~english Height
IMV_EPixelType ePixelFormat; ///< [IN] \~chinese 像素格式 \~english Pixel format
unsigned char* pSrcData; ///< [IN] \~chinese 输入图像数据 \~english Input image data
unsigned int nSrcDataLen; ///< [IN] \~chinese 输入图像长度 \~english Input image length
unsigned int nPaddingX; ///< [IN] \~chinese 图像宽填充 \~english Padding X
unsigned int nPaddingY; ///< [IN] \~chinese 图像高填充 \~english Padding Y
IMV_EBayerDemosaic eBayerDemosaic; ///< [IN] \~chinese 转换Bayer格式算法 \~english Alorithm used for Bayer demosaic
IMV_EPixelType eDstPixelFormat; ///< [IN] \~chinese 目标像素格式 \~english Destination pixel format
unsigned char* pDstBuf; ///< [OUT] \~chinese 输出数据缓存(调用者分配缓存) \~english Output data buffer(allocated cache by the caller)
unsigned int nDstBufSize; ///< [IN] \~chinese 提供的输出缓冲区大小 \~english Provided output buffer size
unsigned int nDstDataLen; ///< [OUT] \~chinese 输出数据长度 \~english Output data length
unsigned int nReserved[8]; ///< \~chinese 预留 \~english Reserved field
}IMV_PixelConvertParam;
/// \~chinese
/// \brief 录像结构体
/// \~english
/// \brief Record structure
typedef struct _IMV_RecordParam
{
unsigned int nWidth; ///< [IN] \~chinese 图像宽 \~english Width
unsigned int nHeight; ///< [IN] \~chinese 图像高 \~english Height
float fFameRate; ///< [IN] \~chinese 帧率(大于0) \~english Frame rate(greater than 0)
unsigned int nQuality; ///< [IN] \~chinese 视频质量(1-100) \~english Video quality(1-100)
IMV_EVideoType recordFormat; ///< [IN] \~chinese 视频格式 \~english Video format
const char* pRecordFilePath; ///< [IN] \~chinese 保存视频路径 \~english Save video path
unsigned int nReserved[5]; ///< \~chinese 预留 \~english Reserved
}IMV_RecordParam;
/// \~chinese
/// \brief 录像用帧信息结构体
/// \~english
/// \brief Frame information for recording structure
typedef struct _IMV_RecordFrameInfoParam
{
unsigned char* pData; ///< [IN] \~chinese 图像数据 \~english Image data
unsigned int nDataLen; ///< [IN] \~chinese 图像数据长度 \~english Image data length
unsigned int nPaddingX; ///< [IN] \~chinese 图像宽填充 \~english Padding X
unsigned int nPaddingY; ///< [IN] \~chinese 图像高填充 \~english Padding Y
IMV_EPixelType ePixelFormat; ///< [IN] \~chinese 像素格式 \~english Pixel format
unsigned int nReserved[5]; ///< \~chinese 预留 \~english Reserved
}IMV_RecordFrameInfoParam;
/// \~chinese
/// \brief 图像翻转结构体
/// \~english
/// \brief Flip image structure
typedef struct _IMV_FlipImageParam
{
unsigned int nWidth; ///< [IN] \~chinese 图像宽 \~english Width
unsigned int nHeight; ///< [IN] \~chinese 图像高 \~english Height
IMV_EPixelType ePixelFormat; ///< [IN] \~chinese 像素格式 \~english Pixel format
IMV_EFlipType eFlipType; ///< [IN] \~chinese 翻转类型 \~english Flip type
unsigned char* pSrcData; ///< [IN] \~chinese 输入图像数据 \~english Input image data
unsigned int nSrcDataLen; ///< [IN] \~chinese 输入图像长度 \~english Input image length
unsigned char* pDstBuf; ///< [OUT] \~chinese 输出数据缓存(调用者分配缓存) \~english Output data buffer(allocated cache by the caller)
unsigned int nDstBufSize; ///< [IN] \~chinese 提供的输出缓冲区大小 \~english Provided output buffer size
unsigned int nDstDataLen; ///< [OUT] \~chinese 输出数据长度 \~english Output data length
unsigned int nReserved[8]; ///< \~chinese 预留 \~english Reserved
}IMV_FlipImageParam;
/// \~chinese
/// \brief 图像旋转结构体
/// \~english
/// \brief Rotate image structure
typedef struct _IMV_RotateImageParam
{
unsigned int nWidth; ///< [IN][OUT] \~chinese 图像宽 \~english Width
unsigned int nHeight; ///< [IN][OUT] \~chinese 图像高 \~english Height
IMV_EPixelType ePixelFormat; ///< [IN] \~chinese 像素格式 \~english Pixel format
IMV_ERotationAngle eRotationAngle; ///< [IN] \~chinese 旋转角度 \~english Rotation angle
unsigned char* pSrcData; ///< [IN] \~chinese 输入图像数据 \~english Input image data
unsigned int nSrcDataLen; ///< [IN] \~chinese 输入图像长度 \~english Input image length
unsigned char* pDstBuf; ///< [OUT] \~chinese 输出数据缓存(调用者分配缓存) \~english Output data buffer(allocated cache by the caller)
unsigned int nDstBufSize; ///< [IN] \~chinese 提供的输出缓冲区大小 \~english Provided output buffer size
unsigned int nDstDataLen; ///< [OUT] \~chinese 输出数据长度 \~english Output data length
unsigned int nReserved[8]; ///< \~chinese 预留 \~english Reserved
}IMV_RotateImageParam;
/// \~chinese
/// \brief 枚举:图像保存格式
/// \~english
/// \brief Enumeration:image save format
typedef enum _IMV_ESaveFileType
{
typeSaveBmp = 0, ///< \~chinese BMP图像格式 \~english BMP Image Type
typeSaveJpeg = 1, ///< \~chinese JPEG图像格式 \~english Jpeg Image Type
typeSavePng = 2, ///< \~chinese PNG图像格式 \~english Png Image Type
typeSaveTiff = 3, ///< \~chinese TIFF图像格式 \~english TIFF Image Type
typeSaveUndefined = 255, ///< \~chinese 未定义的图像格式 \~english Undefined Image Type
}IMV_ESaveFileType;
/// \~chinese
/// \brief 保存图像结构体
/// \~english
/// \brief Save image structure
typedef struct _IMV_SaveImageToFileParam
{
unsigned int nWidth; ///< [IN] \~chinese 图像宽 \~english Width
unsigned int nHeight; ///< [IN] \~chinese 图像高 \~english Height
IMV_EPixelType ePixelFormat; ///< [IN] \~chinese 输入数据的像素格式 \~english Pixel format
unsigned char* pSrcData; ///< [IN] \~chinese 输入图像数据 \~english Input image data
unsigned int nSrcDataLen; ///< [IN] \~chinese 输入数据大小 \~english Input image length
IMV_ESaveFileType eImageType; ///< [IN] \~chinese 输入保存图片格式 \~english Input image save format
char* pImagePath; ///< [IN] \~chinese 输入文件路径 \~english Input image save path
unsigned int nQuality; ///< [IN] \~chinese JPG编码质量(50-99]PNG编码质量[0-9] \~english Encoding quality
IMV_EBayerDemosaic eBayerDemosaic; ///< [IN] \~chinese 转换Bayer格式算法 \~english Alorithm used for Bayer demosaic
unsigned int nReserved[8]; ///< \~chinese 预留 \~english Reserved
}IMV_SaveImageToFileParam;
/// \~chinese
/// \brief 设备连接状态事件回调函数声明
/// \param pParamUpdateArg [in] 回调时主动推送的设备连接状态事件信息
/// \param pUser [in] 用户自定义数据
/// \~english
/// \brief Call back function declaration of device connection status event
/// \param pStreamArg [in] The device connection status event which will be active pushed out during the callback
/// \param pUser [in] User defined data
typedef void(*IMV_ConnectCallBack)(const IMV_SConnectArg* pConnectArg, void* pUser);
/// \~chinese
/// \brief 参数更新事件回调函数声明
/// \param pParamUpdateArg [in] 回调时主动推送的参数更新事件信息
/// \param pUser [in] 用户自定义数据
/// \~english
/// \brief Call back function declaration of parameter update event
/// \param pStreamArg [in] The parameter update event which will be active pushed out during the callback
/// \param pUser [in] User defined data
typedef void(*IMV_ParamUpdateCallBack)(const IMV_SParamUpdateArg* pParamUpdateArg, void* pUser);
/// \~chinese
/// \brief 流事件回调函数声明
/// \param pStreamArg [in] 回调时主动推送的流事件信息
/// \param pUser [in] 用户自定义数据
/// \~english
/// \brief Call back function declaration of stream event
/// \param pStreamArg [in] The stream event which will be active pushed out during the callback
/// \param pUser [in] User defined data
typedef void(*IMV_StreamCallBack)(const IMV_SStreamArg* pStreamArg, void* pUser);
/// \~chinese
/// \brief 消息通道事件回调函数声明Gige专用
/// \param pMsgChannelArg [in] 回调时主动推送的消息通道事件信息
/// \param pUser [in] 用户自定义数据
/// \~english
/// \brief Call back function declaration of message channel event(Gige Only)
/// \param pMsgChannelArg [in] The message channel event which will be active pushed out during the callback
/// \param pUser [in] User defined data
typedef void(*IMV_MsgChannelCallBack)(const IMV_SMsgChannelArg* pMsgChannelArg, void* pUser);
/// \~chinese
/// \brief 消息通道事件回调函数声明(通用)
/// \param pMsgChannelArg [in] 回调时主动推送的消息通道事件信息
/// \param pUser [in] 用户自定义数据
/// \~english
/// \brief Call back function declaration of message channel event(Common)
/// \param pMsgChannelArg [in] The message channel event which will be active pushed out during the callback
/// \param pUser [in] User defined data
typedef void(*IMV_MsgChannelCallBackEx)(const IMV_SMsgEventArg* pMsgChannelArg, void* pUser);
/// \~chinese
/// \brief 帧数据信息回调函数声明
/// \param pFrame [in] 回调时主动推送的帧信息
/// \param pUser [in] 用户自定义数据
/// \~english
/// \brief Call back function declaration of frame data information
/// \param pFrame [in] The frame information which will be active pushed out during the callback
/// \param pUser [in] User defined data
typedef void(*IMV_FrameCallBack)(IMV_Frame* pFrame, void* pUser);
#endif // __IMV_DEFINES_H__

View File

@ -0,0 +1,856 @@
#ifndef __IMV_FG_API_H__
#define __IMV_FG_API_H__
#include "IMVFGDefines.h"
/// \~chinese
/// \brief 动态库导入导出定义
/// \~english
/// \brief Dynamic library import and export definition
#if (defined (_WIN32) || defined(WIN64))
#ifdef SUPPORT_CAPTURE_BOARD
#define IMV_FG_API _declspec(dllexport)
#else
#define IMV_FG_API _declspec(dllimport)
#endif
#define IMV_FG_CALL __stdcall
#else
#define IMV_FG_API
#define IMV_FG_CALL
#endif
#ifdef __cplusplus
extern "C" {
#endif
/// \~chinese
/// \brief 获取版本信息
/// \return 成功时返回版本信息失败时返回NULL
/// \~english
/// \brief get version information
/// \return Success, return version info. Failure, return NULL
IMV_FG_API const char* IMV_FG_CALL IMV_FG_GetVersion(void);
/// \~chinese
/// \brief 枚举采集卡设备
/// \param nInterfaceType [IN] 枚举设备接口类型
/// \param pInterfaceList [OUT] 采集卡设备列表
/// \return 成功返回IMV_FG_OK错误返回错误码
/// /// \~english
/// \brief Enumerate capture card devices
/// \param nInterfaceType [IN] interface Type
/// \param pInterfaceList [OUT] capture card Info List
/// \return Success, return version info. Failure, return NULL
IMV_FG_API int IMV_FG_CALL IMV_FG_EnumInterface(IN unsigned int nInterfaceType, OUT IMV_FG_INTERFACE_INFO_LIST* pInterfaceList);
/// \~chinese
/// \brief 打开采集卡设备
/// \param nIndex [IN] 采集卡序号
/// \param hIFDev [OUT] 采集卡设备句柄
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \~english
/// \brief Open IMV_FGDevice
/// \param nIndex [IN] capture card device Index
/// \param hIFDev [OUT] capture card device handle
/// \return Success, return IMV_FG_OK. Failure, return error code
IMV_FG_API int IMV_FG_CALL IMV_FG_OpenInterface(IN unsigned int nIndex, OUT IMV_FG_IF_HANDLE* hIFDev);
/// \~chinese
/// \brief 打开采集卡设备
/// \param mode [IN] 创建句柄模式
/// \param pIdentifier [IN] 打开采集卡设备标识
/// \param hIFDev [OUT] 采集卡设备句柄
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \~english
/// \brief Open camera device
/// \param mode [IN] create handle mode
/// \param pIdentifier [IN] open card device identifier
/// \param hDev [OUT] card device handle
/// \return Success, return IMV_FG_OK. Failure, return error code
IMV_FG_API int IMV_FG_CALL IMV_FG_OpenInterfaceEx(IN IMV_FG_ECreateHandleMode mode, IN void* pIdentifier, OUT IMV_FG_IF_HANDLE* hIFDev);
/// \~chinese
/// \brief 判断采集卡设备是否已打开
/// \param hIFDev [IN] 采集卡设备句柄
/// \return 打开状态返回true关闭状态或者掉线状态返回false
/// \~english
/// \brief Check capture card is opened or not
/// \param hIFDev [IN] capture card device handle
/// \return Opened, return true. Closed or Offline, return false
IMV_FG_API bool IMV_FG_CALL IMV_FG_IsOpenInterface(IN IMV_FG_IF_HANDLE hIFDev);
/// \~chinese
/// \brief 关闭采集卡设备
/// \param hIFDev [IN] 采集卡设备句柄
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \~english
/// \brief Close Device
/// \param hIFDev [IN] capture card device handle
/// \return Success, return IMV_FG_OK. Failure, return error code
IMV_FG_API int IMV_FG_CALL IMV_FG_CloseInterface(IN IMV_FG_IF_HANDLE hIFDev);
/// \~chinese
/// \brief 枚举相机设备
/// \param nInterfaceType [IN] 枚举设备接口类型
/// \param pDeviceList [OUT] 相机列表
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \~english
/// \brief Enumerate camera devices
/// \param nInterfaceType [IN] interface Type
/// \param pDeviceList [OUT] Camera Info List
/// \return Success, return IMV_FG_OK. Failure, return error code
IMV_FG_API int IMV_FG_CALL IMV_FG_EnumDevices(IN unsigned int nInterfaceType, OUT IMV_FG_DEVICE_INFO_LIST* pDeviceList);
/// \~chinese
/// \brief 打开相机设备
/// \param mode [IN] 创建句柄模式
/// \param pIdentifier [IN] 打开相机标识
/// \param hDev [OUT] 相机句柄
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \~english
/// \brief Open camera device
/// \param mode [IN] create handle mode
/// \param pIdentifier [IN] open identifier
/// \param hDev [OUT] camera device handle
/// \return Success, return IMV_FG_OK. Failure, return error code
IMV_FG_API int IMV_FG_CALL IMV_FG_OpenDevice(IN IMV_FG_ECreateHandleMode mode, IN void* pIdentifier, OUT IMV_FG_DEV_HANDLE* hDev);
/// \~chinese
/// \brief 打开相机设备支持相机属性自动同步到采集卡功能如宽tap像素格式
/// \param mode [IN] 创建句柄模式
/// \param pIdentifier [IN] 打开相机标识
/// \param hDev [OUT] 相机句柄
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \~english
/// \brief Open camera deviceSupport automatic synchronization of camera feature to acquisition card function. eg:width, height, tap, pixelForamt
/// \param mode [IN] create handle mode
/// \param pIdentifier [IN] open identifier
/// \param hDev [OUT] camera device handle
/// \return Success, return IMV_FG_OK. Failure, return error code
IMV_FG_API int IMV_FG_CALL IMV_FG_OpenDeviceEx(IN IMV_FG_ECreateHandleMode mode, IN void* pIdentifier, OUT IMV_FG_DEV_HANDLE* hDev);
/// \~chinese
/// \brief 判断相机设备是否已打开
/// \param hDev [IN] 相机设备句柄
/// \return 打开状态返回true关闭状态或者掉线状态返回false
/// \~english
/// \brief Check camera device is opened or not
/// \param hDev [IN] camera device handle
/// \return Opened, return true. Closed or Offline, return false
IMV_FG_API bool IMV_FG_CALL IMV_FG_IsDeviceOpen(IN IMV_FG_DEV_HANDLE hDev);
/// \~chinese
/// \brief 关闭相机设备
/// \param hDev [IN] 相机设备句柄
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \~english
/// \brief Close camera device
/// \param hDev [IN] camera device handle
/// \return Success, return IMV_FG_OK. Failure, return error code
IMV_FG_API int IMV_FG_CALL IMV_FG_CloseDevice(IN IMV_FG_DEV_HANDLE hDev);
/// \~chinese
/// \brief 设置帧数据缓存个数(不能小于2)
/// \param hIFDev [IN] 采集卡设备句柄
/// \param nSize [IN] 缓存数量
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \remarks
/// 不能在拉流过程中设置
/// \~english
/// \brief Set frame buffer count(Cannot be less than 2)
/// \param hIFDev [IN] capture card device handle
/// \param nSize [IN] The buffer count
/// \return Success, return IMV_FG_OK. Failure, return error code
/// \remarks
/// It can not be set during frame grabbing
IMV_FG_API int IMV_FG_CALL IMV_FG_SetBufferCount(IN IMV_FG_IF_HANDLE hIFDev, IN unsigned int nSize);
/// \~chinese
/// \brief 开始取流
/// \param hIFDev [IN] 采集卡设备句柄
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \~english
/// \brief Start grabbing
/// \param hIFDev [IN] capture card device handle
/// \return Success, return IMV_FG_OK. Failure, return error code
IMV_FG_API int IMV_FG_CALL IMV_FG_StartGrabbing(IN IMV_FG_IF_HANDLE hIFDev);
/// \~chinese
/// \brief 开始取流(CL专用)
/// \param hIFDev [IN] 采集卡设备句柄
/// \param maxImagesGrabbed [IN] 允许最多的取帧数达到指定取帧数后停止取流如果为0表示忽略此参数连续取流(IMV_FG_StartGrabbing默认0)
/// \param strategy [IN] 取流策略,(IMV_FG_StartGrabbing默认使用grabStrartegySequential策略取流)
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \~english
/// \brief Start grabbing(CL Only)
/// \param hIFDev [IN] capture card device handle
/// \param maxImagesGrabbed [IN] Maximum images allowed to grab, once it reaches the limit then stop grabbing;
/// If it is 0, then ignore this parameter and start grabbing continuously(default 0 in IMV_FG_StartGrabbing)
/// \param strategy [IN] Image grabbing strategy; (Default grabStrartegySequential in IMV_FG_StartGrabbing)
/// \return Success, return IMV_FG_OK. Failure, return error code
IMV_FG_API int IMV_FG_CALL IMV_FG_StartGrabbingEx(IN IMV_FG_IF_HANDLE hIFDev, IN uint64_t maxImagesGrabbed, IN IMV_FG_EGrabStrategy strategy);
/// \~chinese
/// \brief 判断设备是否正在取流
/// \param hIFDev [IN] 采集卡设备句柄
/// \return 正在取流返回true不在取流返回false
/// \~english
/// \brief Check whether device is grabbing or not
/// \param hIFDev [IN] capture card device handle
/// \return Grabbing, return true. Not grabbing, return false
IMV_FG_API bool IMV_FG_CALL IMV_FG_IsGrabbing(IN IMV_FG_IF_HANDLE hIFDev);
/// \~chinese
/// \brief 停止取流
/// \param hIFDev [IN] 采集卡设备句柄
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \~english
/// \brief Stop grabbing
/// \param hIFDev [IN] capture card device handle
/// \return Success, return IMV_FG_OK. Failure, return error code
IMV_FG_API int IMV_FG_CALL IMV_FG_StopGrabbing(IN IMV_FG_IF_HANDLE hIFDev);
/// \~chinese
/// \brief 注册帧数据回调函数(异步获取帧数据机制)
/// \param hIFDev [IN] 采集卡设备句柄
/// \param proc [IN] 帧数据信息回调函数,建议不要在该函数中处理耗时的操作,否则会阻塞后续帧数据的实时性
/// \param pUser [IN] 用户自定义数据, 可设为NULL
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \remarks
/// 该异步获取帧数据机制和同步获取帧数据机制(IMV_FG_GetFrame)互斥,对于同一设备,系统中两者只能选其一\n
/// 只支持一个回调函数, 且设备关闭后,注册会失效,打开设备后需重新注册
/// \~english
/// \brief Register frame data callback function( asynchronous getting frame data mechanism);
/// \param hIFDev [IN] capture card device handle or camera device handle
/// \param proc [IN] Frame data information callback function; It is advised to not put time-cosuming operation in this function,
/// otherwise it will block follow-up data frames and affect real time performance
/// \param pUser [IN] User defined dataIt can be set to NULL
/// \return Success, return IMV_FG_OK. Failure, return error code
/// \remarks
/// This asynchronous getting frame data mechanism and synchronous getting frame data mechanism(IMV_FG_GetFrame) are mutually exclusive,\n
/// only one method can be choosed between these two in system for the same device.\n
/// Only one call back function is supported.\n
/// Registration becomes invalid after the device is closed, , and need to re-register after the device is opened
IMV_FG_API int IMV_FG_CALL IMV_FG_AttachGrabbing(IN IMV_FG_IF_HANDLE hIFDev, IN IMV_FG_FrameCallBack proc, IN void* pUser);
/// \~chinese
/// \brief 获取一帧图像(同步获取帧数据机制)
/// \param hIFDev [IN] 采集卡设备句柄
/// \param pFrame [OUT] 帧数据信息
/// \param timeoutMS [IN] 获取一帧图像的超时时间,INFINITE时表示无限等待,直到收到一帧数据或者停止取流。单位是毫秒
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \remarks
/// 该接口不支持多线程调用。\n
/// 该同步获取帧机制和异步获取帧机制(IMV_FG_AttachGrabbing)互斥,对于同一设备,系统中两者只能选其一。\n
/// 使用内部缓存获取图像需要IMV_FG_ReleaseFrame进行释放图像缓存。
/// \~english
/// \brief Get a frame image(synchronous getting frame data mechanism)
/// \param hIFDev [IN] capture card device handle
/// \param pFrame [OUT] Frame data information
/// \param timeoutMS [IN] The time out of getting one image, INFINITE means infinite wait until the one frame data is returned or stop grabbing.unit is MS
/// \return Success, return IMV_FG_OK. Failure, return error code
/// \remarks
/// This interface does not support multi-threading.\n
/// This synchronous getting frame data mechanism and asynchronous getting frame data mechanism(IMV_FG_AttachGrabbing) are mutually exclusive,\n
/// only one method can be chose between these two in system for the same device.\n
/// Use internal cache to get image, need to release image buffer by IMV_FG_ReleaseFrame
IMV_FG_API int IMV_FG_CALL IMV_FG_GetFrame(IN IMV_FG_IF_HANDLE hIFDev, OUT IMV_FG_Frame* pFrame, IN unsigned int timeoutMS);
/// \~chinese
/// \brief 释放图像缓存
/// \param hIFDev [IN] 采集卡设备句柄
/// \param pFrame [IN] 帧数据信息
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \~english
/// \brief Free image buffer
/// \param hIFDev [IN] capture card device handle
/// \param pFrame [IN] Frame image data information
/// \return Success, return IMV_FG_OK. Failure, return error code
IMV_FG_API int IMV_FG_CALL IMV_FG_ReleaseFrame(IN IMV_FG_IF_HANDLE hIFDev, IN IMV_FG_Frame* pFrame);
/// \~chinese
/// \brief 帧数据深拷贝克隆
/// \param hIFDev [IN] 采集卡设备句柄
/// \param pFrame [IN] 克隆源帧数据信息
/// \param pCloneFrame [OUT] 新的帧数据信息
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \remarks
/// 使用IMV_FG_ReleaseFrame进行释放图像缓存。
/// \~english
/// \brief Frame data deep clone
/// \param hIFDev [IN] capture card device handle
/// \param pFrame [IN] Frame data information of clone source
/// \param pCloneFrame [OUT] New frame data information
/// \return Success, return IMV_FG_OK. Failure, return error code
/// \remarks
/// Use IMV_FG_ReleaseFrame to free image buffer
IMV_FG_API int IMV_FG_CALL IMV_FG_CloneFrame(IN IMV_FG_IF_HANDLE hIFDev, IN IMV_FG_Frame* pFrame, OUT IMV_FG_Frame* pCloneFrame);
/// \~chinese
/// \brief 获取流统计信息(IMV_StartGrabbing / IMV_StartGrabbing执行后调用)
/// \param hIFDev [IN] 采集卡设备句柄
/// \param pStreamStatsInfo [OUT] 流统计信息数据
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \~english
/// \brief Get stream statistics infomation(Used after excuting IMV_StartGrabbing / IMV_StartGrabbing)
/// \param hIFDev [IN] capture card device handle
/// \param pStreamStatsInfo [OUT] Stream statistics infomation
/// \return Success, return IMV_FG_OK. Failure, return error code
IMV_FG_API int IMV_FG_CALL IMV_FG_GetStatisticsInfo(IN IMV_FG_IF_HANDLE hIFDev, OUT IMV_FG_StreamStatisticsInfo* pStreamStatsInfo);
/// \~chinese
/// \brief 重置流统计信息(IMV_StartGrabbing / IMV_StartGrabbing执行后调用)
/// \param hIFDev [IN] 采集卡设备句柄
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \~english
/// \brief Reset stream statistics infomation(Used after excuting IMV_StartGrabbing / IMV_StartGrabbing)
/// \param hIFDev [IN] capture card device handle
/// \return Success, return IMV_FG_OK. Failure, return error code
IMV_FG_API int IMV_FG_CALL IMV_FG_ResetStatisticsInfo(IN IMV_FG_IF_HANDLE hIFDev);
/// \~chinese
/// \brief 下载设备描述XML文件并保存到指定路径D:\\xml.zip(CXP采集卡当前只支持下载相机配置)
/// \param handle [IN] 采集卡或相机设备句柄
/// \param pFullFileName [IN] 文件要保存的路径
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \~english
/// \brief Download device description XML file, and save the files to specified path. e.g. D:\\xml.zip(cxp capture card only support download the configuration of the camera device)
/// \param handle [IN] capture card device handle or camera device handle
/// \param pFullFileName [IN] The full paths where the downloaded XMl files would be saved to
/// \return Success, return IMV_FG_OK. Failure, return error code
IMV_FG_API int IMV_FG_CALL IMV_FG_DownLoadGenICamXML(IN HANDLE handle, IN const char* pFullFileName);
/// \~chinese
/// \brief 保存设备配置到指定的位置。同名文件已存在时,覆盖。(CXP采集卡当前只支持保存相机配置)
/// \param handle [IN] 采集卡或相机设备句柄
/// \param pFullFileName [IN] 导出的设备配置文件全名(含路径)D:\\config.xml 或 D:\\config.mvcfg
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \~english
/// \brief Save the configuration of the device. Overwrite the file if exists.(cxp capture card only support save the configuration of the camera device)
/// \param handle [IN] capture card device handle or camera device handle
/// \param pFullFileName [IN] The full path name of the property file(xml). e.g. D:\\config.xml or D:\\config.mvcfg
/// \return Success, return IMV_FG_OK. Failure, return error code
IMV_FG_API int IMV_FG_CALL IMV_FG_SaveDeviceCfg(IN HANDLE handle, IN const char* pFullFileName);
/// \~chinese
/// \brief 从文件加载设备xml配置(CXP采集卡当前只支持加载相机配置)
/// \param handle [IN] 采集卡或相机设备句柄
/// \param pFullFileName [IN] 设备配置(xml)文件全名(含路径)D:\\config.xml 或 D:\\config.mvcfg
/// \param pErrorList [OUT] 加载失败的属性名列表。存放加载失败的属性上限为IMV_MAX_ERROR_LIST_NUM。
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \~english
/// \brief load the configuration of the device(cxp capture card only support load the configuration of the camera device)
/// \param handle [IN] capture card device handle or camera device handle
/// \param pFullFileName [IN] The full path name of the property file(xml). e.g. D:\\config.xml or D:\\config.mvcfg
/// \param pErrorList [OUT] The list of load failed properties. The failed to load properties list up to IMV_MAX_ERROR_LIST_NUM.
/// \return Success, return IMV_FG_OK. Failure, return error code
IMV_FG_API int IMV_FG_CALL IMV_FG_LoadDeviceCfg(IN HANDLE handle, IN const char* pFullFileName, OUT IMV_FG_ErrorList* pErrorList);
/// \~chinese
/// \brief 判断属性是否可用
/// \param handle [IN] 采集卡或相机设备句柄
/// \param pFeatureName [IN] 属性名
/// \return 可用返回true不可用返回false
/// \~english
/// \brief Check the property is available or not
/// \param handle [IN] capture card device handle or camera device handle
/// \param pFeatureName [IN] Feature name
/// \return Available, return true. Not available, return false
IMV_FG_API bool IMV_FG_CALL IMV_FG_FeatureIsAvailable(IN HANDLE handle, IN const char* pFeatureName);
/// \~chinese
/// \brief 判断属性是否可读
/// \param handle [IN] 采集卡或相机设备句柄
/// \param pFeatureName [IN] 属性名
/// \return 可读返回true不可读返回false
/// \~english
/// \brief Check the property is readable or not
/// \param handle [IN] capture card device handle or camera device handle
/// \param pFeatureName [IN] Feature name
/// \return Readable, return true. Not readable, return false
IMV_FG_API bool IMV_FG_CALL IMV_FG_FeatureIsReadable(IN HANDLE handle, IN const char* pFeatureName);
/// \~chinese
/// \brief 判断属性是否可写
/// \param handle [IN] 采集卡或相机设备句柄
/// \param pFeatureName [IN] 属性名
/// \return 可写返回true不可写返回false
/// \~english
/// \brief Check the property is writeable or not
/// \param handle [IN] capture card device handle or camera device handle
/// \param pFeatureName [IN] Feature name
/// \return Writeable, return true. Not writeable, return false
IMV_FG_API bool IMV_FG_CALL IMV_FG_FeatureIsWriteable(IN HANDLE handle, IN const char* pFeatureName);
/// \~chinese
/// \brief 判断属性是否可流
/// \param handle [IN] 采集卡或相机设备句柄
/// \param pFeatureName [IN] 属性名
/// \return 可流返回true不可流返回false
/// \~english
/// \brief Check the property is streamable or not
/// \param handle [IN] capture card device handle or camera device handle
/// \param pFeatureName [IN] Feature name
/// \return Streamable, return true. Not streamable, return false
IMV_FG_API bool IMV_FG_CALL IMV_FG_FeatureIsStreamable(IN HANDLE handle, IN const char* pFeatureName);
/// \~chinese
/// \brief 判断属性是否有效
/// \param handle [IN] 采集卡或相机设备句柄
/// \param pFeatureName [IN] 属性名
/// \return 有效返回true无效返回false
/// \~english
/// \brief Check the property is valid or not
/// \param handle [IN] capture card device handle or camera device handle
/// \param pFeatureName [IN] Feature name
/// \return Valid, return true. Invalid, return false
IMV_FG_API bool IMV_FG_CALL IMV_FG_FeatureIsValid(IN HANDLE handle, IN const char* pFeatureName);
/// \~chinese
/// \brief 获取属性类型
/// \param handle [IN] 采集卡或相机设备句柄
/// \param pFeatureName [IN] 属性名
/// \param pPropertyType [OUT] 属性类型
/// \return 获取成功返回true获取失败返回false
/// \~english
/// \brief get property type
/// \param handle [IN] capture card device handle or camera device handle
/// \param pFeatureName [IN] Feature name
/// \return get success, return true. get failed, return false
IMV_FG_API bool IMV_FG_CALL IMV_FG_GetFeatureType(IN HANDLE handle, IN const char* pFeatureName, OUT IMV_FG_EFeatureType* pPropertyType);
/// \~chinese
/// \brief 获取整型属性值
/// \param handle [IN] 采集卡或相机设备句柄
/// \param pFeatureName [IN] 属性名
/// \param pIntValue [OUT] 整型属性值
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \~english
/// \brief Get integer property value
/// \param handle [IN] capture card device handle or camera device handle
/// \param pFeatureName [IN] Feature name
/// \param pIntValue [OUT] Integer property value
/// \return Success, return IMV_FG_OK. Failure, return error code
IMV_FG_API int IMV_FG_CALL IMV_FG_GetIntFeatureValue(IN HANDLE handle, IN const char* pFeatureName, OUT int64_t* pIntValue);
/// \~chinese
/// \brief 获取整型属性可设的最小值
/// \param handle [IN] 采集卡或相机设备句柄
/// \param pFeatureName [IN] 属性名
/// \param pIntValue [OUT] 整型属性可设的最小值
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \~english
/// \brief Get the integer property settable minimum value
/// \param handle [IN] capture card device handle or camera device handle
/// \param pFeatureName [IN] Feature name
/// \param pIntValue [OUT] Integer property settable minimum value
/// \return Success, return IMV_FG_OK. Failure, return error code
IMV_FG_API int IMV_FG_CALL IMV_FG_GetIntFeatureMin(IN HANDLE handle, IN const char* pFeatureName, OUT int64_t* pIntValue);
/// \~chinese
/// \brief 获取整型属性可设的最大值
/// \param handle [IN] 采集卡或相机设备句柄
/// \param pFeatureName [IN] 属性名
/// \param pIntValue [OUT] 整型属性可设的最大值
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \~english
/// \brief Get the integer property settable maximum value
/// \param handle [IN] capture card device handle or camera device handle
/// \param pFeatureName [IN] Feature name
/// \param pIntValue [OUT] Integer property settable maximum value
/// \return Success, return IMV_FG_OK. Failure, return error code
IMV_FG_API int IMV_FG_CALL IMV_FG_GetIntFeatureMax(IN HANDLE handle, IN const char* pFeatureName, OUT int64_t* pIntValue);
/// \~chinese
/// \brief 获取整型属性步长
/// \param handle [IN] 采集卡或相机设备句柄
/// \param pFeatureName [IN] 属性名
/// \param pIntValue [OUT] 整型属性步长
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \~english
/// \brief Get integer property increment
/// \param handle [IN] capture card device handle or camera device handle
/// \param pFeatureName [IN] Feature name
/// \param pIntValue [OUT] Integer property increment
/// \return Success, return IMV_FG_OK. Failure, return error code
IMV_FG_API int IMV_FG_CALL IMV_FG_GetIntFeatureInc(IN HANDLE handle, IN const char* pFeatureName, OUT int64_t* pIntValue);
/// \~chinese
/// \brief 设置整型属性值如用OpenEx打开相机配置相机宽高时会自动同步到采集卡
/// \param handle [IN] 采集卡或相机设备句柄
/// \param pFeatureName [IN] 属性名
/// \param intValue [IN] 待设置的整型属性值
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \~english
/// \brief Set integer property valueIf using OpenEx to open the camera, configure the width and height of the camera to automatically synchronize to the acquisition card
/// \param handle [IN] capture card device handle or camera device handle
/// \param pFeatureName [IN] Feature name
/// \param intValue [IN] Integer property value to be set
/// \return Success, return IMV_FG_OK. Failure, return error code
IMV_FG_API int IMV_FG_CALL IMV_FG_SetIntFeatureValue(IN HANDLE handle, IN const char* pFeatureName, IN int64_t intValue);
/// \~chinese
/// \brief 获取浮点属性值
/// \param handle [IN] 采集卡或相机设备句柄
/// \param pFeatureName [IN] 属性名
/// \param pDoubleValue [OUT] 浮点属性值
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \~english
/// \brief Get double property value
/// \param handle [IN] capture card device handle or camera device handle
/// \param pFeatureName [IN] Feature name
/// \param pDoubleValue [OUT] Double property value
/// \return Success, return IMV_FG_OK. Failure, return error code
IMV_FG_API int IMV_FG_CALL IMV_FG_GetDoubleFeatureValue(IN HANDLE handle, IN const char* pFeatureName, OUT double* pDoubleValue);
/// \~chinese
/// \brief 获取浮点属性可设的最小值
/// \param handle [IN] 采集卡或相机设备句柄
/// \param pFeatureName [IN] 属性名
/// \param pDoubleValue [OUT] 浮点属性可设的最小值
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \~english
/// \brief Get the double property settable minimum value
/// \param handle [IN] capture card device handle or camera device handle
/// \param pFeatureName [IN] Feature name
/// \param pDoubleValue [OUT] Double property settable minimum value
/// \return Success, return IMV_FG_OK. Failure, return error code
IMV_FG_API int IMV_FG_CALL IMV_FG_GetDoubleFeatureMin(IN HANDLE handle, IN const char* pFeatureName, OUT double* pDoubleValue);
/// \~chinese
/// \brief 获取浮点属性可设的最大值
/// \param handle [IN] 采集卡或相机设备句柄
/// \param pFeatureName [IN] 属性名
/// \param pDoubleValue [OUT] 浮点属性可设的最大值
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \~english
/// \brief Get the double property settable maximum value
/// \param handle [IN] capture card device handle or camera device handle
/// \param pFeatureName [IN] Feature name
/// \param pDoubleValue [OUT] Double property settable maximum value
/// \return Success, return IMV_FG_OK. Failure, return error code
IMV_FG_API int IMV_FG_CALL IMV_FG_GetDoubleFeatureMax(IN HANDLE handle, IN const char* pFeatureName, OUT double* pDoubleValue);
/// \~chinese
/// \brief 设置浮点属性值
/// \param handle [IN] 采集卡或相机设备句柄
/// \param pFeatureName [IN] 属性名
/// \param doubleValue [IN] 待设置的浮点属性值
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \~english
/// \brief Set double property value
/// \param handle [IN] capture card device handle or camera device handle
/// \param pFeatureName [IN] Feature name
/// \param doubleValue [IN] Double property value to be set
/// \return Success, return IMV_FG_OK. Failure, return error code
IMV_FG_API int IMV_FG_CALL IMV_FG_SetDoubleFeatureValue(IN HANDLE handle, IN const char* pFeatureName, IN double doubleValue);
/// \~chinese
/// \brief 获取布尔属性值
/// \param handle [IN] 采集卡或相机设备句柄
/// \param pFeatureName [IN] 属性名
/// \param pBoolValue [OUT] 布尔属性值
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \~english
/// \brief Get boolean property value
/// \param handle [IN] capture card device handle or camera device handle
/// \param pFeatureName [IN] Feature name
/// \param pBoolValue [OUT] Boolean property value
/// \return Success, return IMV_FG_OK. Failure, return error code
IMV_FG_API int IMV_FG_CALL IMV_FG_GetBoolFeatureValue(IN HANDLE handle, IN const char* pFeatureName, OUT bool* pBoolValue);
/// \~chinese
/// \brief 设置布尔属性值
/// \param handle [IN] 采集卡或相机设备句柄
/// \param pFeatureName [IN] 属性名
/// \param boolValue [IN] 待设置的布尔属性值
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \~english
/// \brief Set boolean property value
/// \param handle [IN] capture card device handle or camera device handle
/// \param pFeatureName [IN] Feature name
/// \param boolValue [IN] Boolean property value to be set
/// \return Success, return IMV_FG_OK. Failure, return error code
IMV_FG_API int IMV_FG_CALL IMV_FG_SetBoolFeatureValue(IN HANDLE handle, IN const char* pFeatureName, IN bool boolValue);
/// \~chinese
/// \brief 获取枚举属性值
/// \param handle [IN] 采集卡或相机设备句柄
/// \param pFeatureName [IN] 属性名
/// \param pEnumValue [OUT] 枚举属性值
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \~english
/// \brief Get enumeration property value
/// \param handle [IN] capture card device handle or camera device handle
/// \param pFeatureName [IN] Feature name
/// \param pEnumValue [OUT] Enumeration property value
/// \return Success, return IMV_FG_OK. Failure, return error code
IMV_FG_API int IMV_FG_CALL IMV_FG_GetEnumFeatureValue(IN HANDLE handle, IN const char* pFeatureName, OUT uint64_t* pEnumValue);
/// \~chinese
/// \brief 设置枚举属性值
/// \param handle [IN] 采集卡或相机设备句柄
/// \param pFeatureName [IN] 属性名
/// \param enumValue [IN] 待设置的枚举属性值
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \~english
/// \brief Set enumeration property value
/// \param handle [IN] capture card device handle or camera device handle
/// \param pFeatureName [IN] Feature name
/// \param enumValue [IN] Enumeration property value to be set
/// \return Success, return IMV_FG_OK. Failure, return error code
IMV_FG_API int IMV_FG_CALL IMV_FG_SetEnumFeatureValue(IN HANDLE handle, IN const char* pFeatureName, IN uint64_t enumValue);
/// \~chinese
/// \brief 获取枚举属性symbol值
/// \param handle [IN] 采集卡或相机设备句柄
/// \param pFeatureName [IN] 属性名
/// \param pEnumSymbol [OUT] 枚举属性symbol值
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \~english
/// \brief Get enumeration property symbol value
/// \param handle [IN] capture card device handle or camera device handle
/// \param pFeatureName [IN] Feature name
/// \param pEnumSymbol [OUT] Enumeration property symbol value
/// \return Success, return IMV_FG_OK. Failure, return error code
IMV_FG_API int IMV_FG_CALL IMV_FG_GetEnumFeatureSymbol(IN HANDLE handle, IN const char* pFeatureName, OUT IMV_FG_String* pEnumSymbol);
/// \~chinese
/// \brief 设置枚举属性symbol值如用OpenEx打开相机配置相机像素格式Tap时会自动同步到采集卡
/// \param handle [IN] 采集卡或相机设备句柄
/// \param pFeatureName [IN] 属性名
/// \param pEnumSymbol [IN] 待设置的枚举属性symbol值
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \~english
/// \brief Set enumeration property symbol valueIf using OpenEx to open the camera, configure the pixelFormat and tap of the camera to automatically synchronize to the acquisition card
/// \param handle [IN] capture card device handle or camera device handle
/// \param pFeatureName [IN] Feature name
/// \param pEnumSymbol [IN] Enumeration property symbol value to be set
/// \return Success, return IMV_FG_OK. Failure, return error code
IMV_FG_API int IMV_FG_CALL IMV_FG_SetEnumFeatureSymbol(IN HANDLE handle, IN const char* pFeatureName, IN const char* pEnumSymbol);
/// \~chinese
/// \brief 获取枚举属性的可设枚举值的个数
/// \param handle [IN] 采集卡或相机设备句柄
/// \param pFeatureName [IN] 属性名
/// \param pEntryNum [OUT] 枚举属性的可设枚举值的个数
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \~english
/// \brief Get the number of enumeration property settable enumeration
/// \param handle [IN] capture card device handle or camera device handle
/// \param pFeatureName [IN] Feature name
/// \param pEntryNum [OUT] The number of enumeration property settable enumeration value
/// \return Success, return IMV_FG_OK. Failure, return error code
IMV_FG_API int IMV_FG_CALL IMV_FG_GetEnumFeatureEntryNum(IN HANDLE handle, IN const char* pFeatureName, OUT unsigned int* pEntryNum);
/// \~chinese
/// \brief 获取枚举属性的可设枚举值列表
/// \param handle [IN] 采集卡或相机设备句柄
/// \param pFeatureName [IN] 属性名
/// \param pEnumEntryList [OUT] 枚举属性的可设枚举值列表
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \~english
/// \brief Get settable enumeration value list of enumeration property
/// \param handle [IN] capture card device handle or camera device handle
/// \param pFeatureName [IN] Feature name
/// \param pEnumEntryList [OUT] Settable enumeration value list of enumeration property
/// \return Success, return IMV_FG_OK. Failure, return error code
IMV_FG_API int IMV_FG_CALL IMV_FG_GetEnumFeatureEntrys(IN HANDLE handle, IN const char* pFeatureName, IN_OUT IMV_FG_EnumEntryList* pEnumEntryList);
/// \~chinese
/// \brief 获取字符串属性值
/// \param handle [IN] 采集卡或相机设备句柄
/// \param pFeatureName [IN] 属性名
/// \param pStringValue [OUT] 字符串属性值
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \~english
/// \brief Get string property value
/// \param handle [IN] capture card device handle or camera device handle
/// \param pFeatureName [IN] Feature name
/// \param pStringValue [OUT] String property value
/// \return Success, return IMV_FG_OK. Failure, return error code
IMV_FG_API int IMV_FG_CALL IMV_FG_GetStringFeatureValue(IN HANDLE handle, IN const char* pFeatureName, OUT IMV_FG_String* pStringValue);
/// \~chinese
/// \brief 设置字符串属性值
/// \param handle [IN] 采集卡或相机设备句柄
/// \param pFeatureName [IN] 属性名
/// \param pStringValue [IN] 待设置的字符串属性值
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \~english
/// \brief Set string property value
/// \param handle [IN] capture card device handle or camera device handle
/// \param pFeatureName [IN] Feature name
/// \param pStringValue [IN] String property value to be set
/// \return Success, return IMV_FG_OK. Failure, return error code
IMV_FG_API int IMV_FG_CALL IMV_FG_SetStringFeatureValue(IN HANDLE handle, IN const char* pFeatureName, IN const char* pStringValue);
/// \~chinese
/// \brief 执行命令属性
/// \param handle [IN] 采集卡或相机设备句柄
/// \param pFeatureName [IN] 属性名
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \~english
/// \brief Execute command property
/// \param handle [IN] capture card device handle or camera device handle
/// \param pFeatureName [IN] Feature name
/// \return Success, return IMV_FG_OK. Failure, return error code
IMV_FG_API int IMV_FG_CALL IMV_FG_ExecuteCommandFeature(IN HANDLE handle, IN const char* pFeatureName);
/// \~chinese
/// \brief 像素格式转换
/// \param hIFDev [IN] 采集卡设备句柄
/// \param pstPixelConvertParam [IN][OUT] 像素格式转换参数结构体
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \remarks
/// 只支持转化成目标像素格式gvspPixelRGB8 / gvspPixelBGR8 / gvspPixelMono8 / gvspPixelBGRA8\n
/// 通过该接口将原始图像数据转换成用户所需的像素格式并存放在调用者指定内存中。\n
/// 像素格式为YUV411Packed的时图像宽须能被4整除\n
/// 像素格式为YUV422Packed的时图像宽须能被2整除\n
/// 像素格式为YUYVPacked的时图像宽须能被2整除\n
/// 转换后的图像:数据存储是从最上面第一行开始的,这个是相机数据的默认存储方向
/// \~english
/// \brief Pixel format conversion
/// \param hIFDev [IN] capture card device handle
/// \param pstPixelConvertParam [IN][OUT] Convert Pixel Type parameter structure
/// \return Success, return IMV_FG_OK. Failure, return error code
/// \remarks
/// Only support converting to destination pixel format of gvspPixelRGB8 / gvspPixelBGR8 / gvspPixelMono8 / gvspPixelBGRA8\n
/// This API is used to transform the collected original data to pixel format and save to specified memory by caller.\n
/// pixelFormat:YUV411Packed, the image width is divisible by 4\n
/// pixelFormat : YUV422Packed, the image width is divisible by 2\n
/// pixelFormat : YUYVPackedthe image width is divisible by 2\n
/// converted imageThe first row of the image is located at the start of the image buffer.This is the default for image taken by a camera.
IMV_FG_API int IMV_FG_CALL IMV_FG_PixelConvert(IN IMV_FG_IF_HANDLE hIFDev, IN_OUT IMV_FG_PixelConvertParam* pstPixelConvertParam);
/// \~chinese
/// \brief 打开录像
/// \param hIFDev [IN] 采集卡设备句柄
/// \param pstRecordParam [IN] 录像参数结构体
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \~english
/// \brief Open record
/// \param hIFDev [IN] capture card device handle
/// \param pstRecordParam [IN] Record param structure
/// \return Success, return IMV_FG_OK. Failure, return error code
IMV_FG_API int IMV_FG_CALL IMV_FG_OpenRecord(IN IMV_FG_IF_HANDLE hIFDev, IN IMV_FG_RecordParam *pstRecordParam);
/// \~chinese
/// \brief 录制一帧图像
/// \param hIFDev [IN] 采集卡设备句柄
/// \param pstRecordFrameInfoParam [IN] 录像用帧信息结构体
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \~english
/// \brief Record one frame
/// \param hIFDev [IN] capture card device handle
/// \param pstRecordFrameInfoParam [IN] Frame information for recording structure
/// \return Success, return IMV_FG_OK. Failure, return error code
IMV_FG_API int IMV_FG_CALL IMV_FG_InputOneFrame(IN IMV_FG_IF_HANDLE hIFDev, IN IMV_FG_RecordFrameInfoParam *pstRecordFrameInfoParam);
/// \~chinese
/// \brief 关闭录像
/// \param hIFDev [IN] 采集卡设备句柄
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \~english
/// \brief Close record
/// \param hIFDev [IN] capture card device handle
/// \return Success, return IMV_FG_OK. Failure, return error code
IMV_FG_API int IMV_FG_CALL IMV_FG_CloseRecord(IN IMV_FG_IF_HANDLE hIFDev);
/// \~chinese
/// \brief 图像翻转
/// \param hIFDev [IN] 采集卡设备句柄
/// \param pstFlipImageParam [IN][OUT] 图像翻转参数结构体
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \remarks
/// 只支持像素格式gvspPixelRGB8 / gvspPixelBGR8 / gvspPixelMono8的图像的垂直和水平翻转。\n
/// 通过该接口将原始图像数据翻转后并存放在调用者指定内存中。
/// \~english
/// \brief Flip image
/// \param hIFDev [IN] capture card device handle
/// \param pstFlipImageParam [IN][OUT] Flip image parameter structure
/// \return Success, return IMV_FG_OK. Failure, return error code
/// \remarks
/// Only support vertical and horizontal flip of image data with gvspPixelRGB8 / gvspPixelBGR8 / gvspPixelMono8 pixel format.\n
/// This API is used to flip original data and save to specified memory by caller.
IMV_FG_API int IMV_FG_CALL IMV_FG_FlipImage(IN IMV_FG_IF_HANDLE hIFDev, IN_OUT IMV_FG_FlipImageParam* pstFlipImageParam);
/// \~chinese
/// \brief 图像顺时针旋转
/// \param hIFDev [IN] 采集卡设备句柄
/// \param pstRotateImageParam [IN][OUT] 图像旋转参数结构体
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \remarks
/// 只支持gvspPixelRGB8 / gvspPixelBGR8 / gvspPixelMono8格式数据的90/180/270度顺时针旋转。\n
/// 通过该接口将原始图像数据旋转后并存放在调用者指定内存中。
/// \~english
/// \brief Rotate image clockwise
/// \param hIFDev [IN] capture card device handle
/// \param pstRotateImageParam [IN][OUT] Rotate image parameter structure
/// \return Success, return IMV_FG_OK. Failure, return error code
/// \remarks
/// Only support 90/180/270 clockwise rotation of data in the gvspPixelRGB8 / gvspPixelBGR8 / gvspPixelMono8 format.\n
/// This API is used to rotation original data and save to specified memory by caller.
IMV_FG_API int IMV_FG_CALL IMV_FG_RotateImage(IN IMV_FG_IF_HANDLE hIFDev, IN_OUT IMV_FG_RotateImageParam* pstRotateImageParam);
/// \~chinese
/// \brief 设备连接状态事件回调注册(CL专用)
/// \param hDev [IN] 相机设备句柄
/// \param proc [IN] 设备连接状态事件回调函数
/// \param pUser [IN] 用户自定义数据, 可设为NULL
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \remarks
/// 只支持一个回调函数,且设备关闭后,注册会失效,打开设备后需重新注册
/// \~english
/// \brief Register call back function of device connection status event.(CL Only)
/// \param hDev [IN] camera device handle
/// \param proc [IN] Call back function of device connection status event
/// \param pUser [IN] User defined dataIt can be set to NULL
/// \return Success, return IMV_FG_OK. Failure, return error code
/// \remarks
/// Only one call back function is supported.\n
/// Registration becomes invalid after the device is closed, , and need to re-register after the device is opened
IMV_FG_API int IMV_FG_CALL IMV_FG_SubscribeConnectArg(IN IMV_FG_DEV_HANDLE hDev, IN IMV_FG_ConnectCallBack proc, IN void* pUser);
/// \~chinese
/// \brief 消息通道事件回调注册
/// \param handle [IN] 设备句柄
/// \param proc [IN] 消息通道事件回调注册函数(需要及时处理回调函数中的数据,否则数据会失效)
/// \param pUser [IN] 用户自定义数据, 可设为NULL
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \remarks
/// 只支持一个回调函数,且设备关闭后,注册会失效,打开设备后需重新注册
/// \~english
/// \brief Register call back function of message channel event.(Device universal interface. For the same device, the system can only choose between the two)
/// \param handle [IN] Device handle
/// \param proc [IN] Call back function of message channel event(The data in the callback function needs to be processed in a timely manner, otherwise the data will become invalid)
/// \param pUser [IN] User defined dataIt can be set to NULL
/// \return Success, return IMV_FG_OK. Failure, return error code
/// \remarks
/// Only one call back function is supported.\n
/// Registration becomes invalid after the device is closed, , and need to re-register after the device is opened
IMV_FG_API int IMV_FG_CALL IMV_FG_SubscribeMsgChannelArg(IN IMV_FG_IF_HANDLE hIFDev, IN IMV_FG_MsgChannelCallBack proc, IN void* pUser);
/// \~chinese
/// \brief 保存图像到文件
/// \param hIFDev [IN] 采集卡设备句柄
/// \param pstSaveFileParam [IN] 保存图片到文件参数结构体
/// \return 成功返回IMV_FG_OK错误返回错误码
/// \remarks
/// 该接口支持保存BMP/JPEG/PNG/TIFF
/// JPEG格式最大支持宽高为65500
/// \~english
/// \brief Save the image to file.
/// \param hIFDev [IN] capture card device handle
/// \param pstSaveFileParam [IN] Save the image file parameter structure
/// \return Success, return IMV_FG_OK. Failure, return error code
/// \remarks
/// This API support save BMP/JPEG/PNG/TIFF.
/// JPEG format supports a maximum width and height of 65500
IMV_FG_API int IMV_FG_CALL IMV_FG_SaveImageToFile(IN IMV_FG_IF_HANDLE hIFDev, IN IMV_FG_SaveImageToFileParam* pstSaveFileParam);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,763 @@
#ifndef __IMV_FG_DEFINES_H__
#define __IMV_FG_DEFINES_H__
#ifdef WIN32
typedef __int64 int64_t;
typedef unsigned int uint32_t;
typedef unsigned __int64 uint64_t;
#else
#include <stdint.h>
#endif
#include <string>
#ifndef IN
#define IN ///< \~chinese 输入型参数 \~english Input param
#endif
#ifndef OUT
#define OUT ///< \~chinese 输出型参数 \~english Output param
#endif
#ifndef IN_OUT
#define IN_OUT ///< \~chinese 输入/输出型参数 \~english Input/Output param
#endif
#ifndef __cplusplus
typedef char bool;
#define true 1
#define false 0
#endif
/// \~chinese
/// \brief 字符串信息
/// \~english
/// \brief String information
typedef struct _IMV_FG_String
{
char str[256]; ///< \~chinese 字符串.长度不超过256 \~english Strings and the maximum length of strings is 255.
}IMV_FG_String;
/// \~chinese
/// \brief 错误码
/// \~english
/// \brief Error code
#define IMV_FG_OK 0 ///< \~chinese 成功,无错误 \~english Successed, no error
#define IMV_FG_ERROR -101 ///< \~chinese 通用的错误 \~english Generic error
#define IMV_FG_INVALID_HANDLE -102 ///< \~chinese 错误或无效的句柄 \~english Error or invalid handle
#define IMV_FG_INVALID_PARAM -103 ///< \~chinese 错误的参数 \~english Incorrect parameter
#define IMV_FG_INVALID_FRAME_HANDLE -104 ///< \~chinese 错误或无效的帧句柄 \~english Error or invalid frame handle
#define IMV_FG_INVALID_FRAME -105 ///< \~chinese 无效的帧 \~english Invalid frame
#define IMV_FG_INVALID_RESOURCE -106 ///< \~chinese 相机/事件/流等资源无效 \~english Device/Event/Stream and so on resource invalid
#define IMV_FG_INVALID_IP -107 ///< \~chinese 设备与主机的IP网段不匹配 \~english Device's and PC's subnet is mismatch
#define IMV_FG_NO_MEMORY -108 ///< \~chinese 内存不足 \~english Malloc memery failed
#define IMV_FG_INSUFFICIENT_MEMORY -109 ///< \~chinese 传入的内存空间不足 \~english Insufficient memory
#define IMV_FG_ERROR_PROPERTY_TYPE -110 ///< \~chinese 属性类型错误 \~english Property type error
#define IMV_FG_INVALID_ACCESS -111 ///< \~chinese 属性不可访问、或不能读/写、或读/写失败 \~english Property not accessible, or not be read/written, or read/written failed
#define IMV_FG_INVALID_RANGE -112 ///< \~chinese 属性值超出范围、或者不是步长整数倍 \~english The property's value is out of range, or is not integer multiple of the step
#define IMV_FG_NOT_SUPPORT -113 ///< \~chinese 设备不支持的功能 \~english Device not supported function
#define IMV_FG_NO_DATA -114 ///< \~chinese 无数据 \~english No data
#define IMV_FG_PARAM_OVERFLOW -115 ///< \~chinese 参数值越界 \~english Param value overflow
#define IMV_FG_NOT_AVAILABLE -116 ///< \~chinese 连接不可达 \~english Connect not available
#define IMV_FG_NOT_GRABBING -117 ///< \~chinese 相机已停止取图 \~english The camera already stop grabbing
#define IMV_FG_NOT_CONNECTED_CARD -118 ///< \~chinese 未连接采集卡 \~english Not connect capture card
#define IMV_FG_TIMEOUT -119 ///< \~chinese 超时 \~english Timeout
#define IMV_FG_IS_CONNECTED -120 ///< \~chinese 设备已连接 \~english Device is connected
#define IMV_FG_IS_GRABBING -121 ///< \~chinese 设备正在取图 \~english The device is grabbing
#define IMV_FG_INVOCATION_ERROR -122 ///< \~chinese 调用时序错误 \~english The timing of the call is incorrect
#define IMV_FG_SYSTEM_ERROR -123 ///< \~chinese 系统接口返回错误 \~english The operating system returns an error
#define IMV_FG_OPENFILE_ERROR -124 ///< \~chinese 打开文件出现错误 \~english Open file error
#define IMV_FG_MAX_STRING_LENTH 256 ///< \~chinese 字符串最大长度 \~english The maximum length of string
#define IMV_FG_MAX_ERROR_LIST_NUM 128 ///< \~chinese 失败属性列表最大长度 \~english The maximum size of failed properties list
typedef void* IMV_FG_IF_HANDLE; ///< \~chinese 采集卡设备句柄 \~english Interface handle
typedef void* IMV_FG_DEV_HANDLE; ///< \~chinese 相机设备句柄 \~english Device handle
typedef void* HANDLE; ///< \~chinese 设备句柄(采集卡设备句柄或者相机设备句柄) \~english Device handle or Interface handle
typedef void* IMV_FG_FRAME_HANDLE; ///< \~chinese 帧句柄 \~english frame handle
/// \~chinese
///枚举:属性类型
/// \~english
///Enumeration: property type
typedef enum _IMV_FG_EFeatureType
{
IMV_FG_FEATURE_INT = 0x10000000, ///< \~chinese 整型数 \~english Integer
IMV_FG_FEATURE_FLOAT = 0x20000000, ///< \~chinese 浮点数 \~english Float
IMV_FG_FEATURE_ENUM = 0x30000000, ///< \~chinese 枚举 \~english Enumeration
IMV_FG_FEATURE_BOOL = 0x40000000, ///< \~chinese 布尔 \~english Bool
IMV_FG_FEATURE_STRING = 0x50000000, ///< \~chinese 字符串 \~english String
IMV_FG_FEATURE_COMMAND = 0x60000000, ///< \~chinese 命令 \~english Command
IMV_FG_FEATURE_GROUP = 0x70000000, ///< \~chinese 分组节点 \~english Group Node
IMV_FG_FEATURE_REG = 0x80000000, ///< \~chinese 寄存器节点 \~english Register Node
IMV_FG_FEATURE_UNDEFINED = 0x90000000 ///< \~chinese 未定义 \~english Undefined
}IMV_FG_EFeatureType;
/// \~chinese
///枚举:接口类型
/// \~english
///Enumeration: interface type
typedef enum _IMV_FG_EInterfaceType
{
typeGigEInterface = 0x00000001, ///< \~chinese 网口采集卡 \~english Gev interface type
typeU3vInterface = 0x00000002, ///< \~chinese Usb采集 \~english CXP interface type
typeCLInterface = 0x00000004, ///< \~chinese CameraLink采集卡 \~english CAMERALINK interface type
typeCXPInterface = 0x00000008, ///< \~chinese CXP采集卡 \~english CXP interface type
typeUndefinedInterface = 0xFFFFFFFF ///< \~chinese 无效接口类型 \~english Invalid interface type
}IMV_FG_EInterfaceType;
//采集卡模式
/// \~chinese
///信息:采集卡模式
/// \~english
///Information: Capture Card Mode
enum EInterfaceMode
{
FULL_MODE = 0, ///< \~chinese 单Full模式 \~english full
DUAL_BASE_MODE = 1, ///< \~chinese 双Base同时支持2个相机 \~english Dual base
DUAL_FULL_MODE = 2, ///< \~chinese 双Full同时支持2个相机 \~english Dual full
QUAD_BASE_MODE = 3, ///< \~chinese 4Base同时支持4个相机 \~english Quad full
TYPE_UNDEFINED = 255 ///< \~chinese 未知类型
};
// CL采集卡信息
/// \~chinese
///信息CameraLink采集卡信息
/// \~english
///Information: CameraLink Interface Information
typedef struct _IMV_CL_INTERFACE_INFO
{
EInterfaceMode nInterfaceMode; ///< \~chinese 采集卡模式 \~english Interface mode
unsigned int nPCIEInfo; ///< \~chinese 采集卡的PCIE插槽信息 \~english PCIE Info
unsigned int nReserved[64]; ///< \~chinese 预留 \~english Reserved field
}IMV_CL_INTERFACE_INFO;
// CXP采集卡信息
/// \~chinese
///信息CXP采集卡信息
/// \~english
///Information: CXP Interface Information
typedef struct _IMV_CXP_INTERFACE_INFO
{
EInterfaceMode nInterfaceMode; ///< \~chinese 采集卡模式 \~english Interface mode
unsigned int nPortInfo; ///< \~chinese 采集卡的Port信息 \~english Port Info
unsigned int nReserved[64]; ///< \~chinese 预留 \~english Reserved field
}IMV_CXP_INTERFACE_INFO;
typedef struct _IMV_FG_INTERFACE_INFO
{
IMV_FG_EInterfaceType nInterfaceType; ///< \~chinese 采集卡类型 \~english Interface type
unsigned int nInterfaceReserved[8]; ///< \~chinese 保留字段 \~english Reserved field
char interfaceKey[IMV_FG_MAX_STRING_LENTH]; ///< \~chinese 厂商:序列号:端口 \~english Interface key
char interfaceName[IMV_FG_MAX_STRING_LENTH]; ///< \~chinese 用户自定义名 \~english UserDefinedName
char serialNumber[IMV_FG_MAX_STRING_LENTH]; ///< \~chinese 设备序列号 \~english Interface SerialNumber
char vendorName[IMV_FG_MAX_STRING_LENTH]; ///< \~chinese 厂商 \~english Interface Vendor
char modelName[IMV_FG_MAX_STRING_LENTH]; ///< \~chinese 设备型号 \~english Interface model
char manufactureInfo[IMV_FG_MAX_STRING_LENTH]; ///< \~chinese 设备制造信息 \~english Interface ManufactureInfo
char deviceVersion[IMV_FG_MAX_STRING_LENTH]; ///< \~chinese 设备版本 \~english Interface Version
char interfaceReserved[5][IMV_FG_MAX_STRING_LENTH]; ///< \~chinese 保留 \~english Reserved field
union
{
IMV_CL_INTERFACE_INFO CLInterfaceInfo; ///< \~chinese CameraLink采集卡信息 \~english CameraLink Capture Card info
IMV_CXP_INTERFACE_INFO CxpInterfaceInfo; ///< \~chinese CameraLink采集卡信息 \~english CameraLink Capture Card info
unsigned int nReserved[128]; ///< \~chinese 限定长度 \~english limit length
}InterfaceInfo;
}IMV_FG_INTERFACE_INFO;
typedef struct _IMV_FG_INTERFACE_INFO_LIST
{
unsigned int nInterfaceNum; //数量
IMV_FG_INTERFACE_INFO* pInterfaceInfoList;
}IMV_FG_INTERFACE_INFO_LIST;
/// \~chinese
///枚举:创建句柄方式
/// \~english
///Enumeration: Create handle mode
typedef enum _IMV_FG_ECreateHandleMode
{
IMV_FG_MODE_BY_INDEX = 0, ///< \~chinese 通过已枚举设备的索引(从0开始比如 0, 1, 2...) \~english By index of enumerated devices (Start from 0, such as 0, 1, 2...)
IMV_FG_MODE_BY_CAMERAKEY, ///< \~chinese 通过设备键"厂商:序列号"(CL专用) \~english By device's key "vendor:serial number"(CL Only)
IMV_FG_MODE_BY_DEVICE_USERID, ///< \~chinese 通过设备自定义名(CL专用) \~english By device userID(CL Only)
IMV_FG_MODE_BY_IPADDRESS, ///< \~chinese 通过设备IP地址(仅适合GigE相机) \~english By device IP address.(GigE Camera only)
}IMV_FG_ECreateHandleMode;
/// \~chinese
///枚举:设备类型
/// \~english
///Enumeration: device type
typedef enum _IMV_FG_EDeviceType
{
IMV_FG_TYPE_GIGE_DEVICE = 0, ///< \~chinese GIGE相机 \~english GigE Vision Device
IMV_FG_TYPE_U3V_DEVICE = 1, ///< \~chinese USB3.0相机 \~english USB3.0 Vision Device
IMV_FG_TYPE_CL_DEVICE = 2, ///< \~chinese CAMERALINK相机 \~english Cameralink Device
IMV_FG_TYPE_CXP_DEVICE = 3, ///< \~chinese PCIe相机 \~english PCIe Device
IMV_FG_TYPE_UNDEFINED_DEVICE = 255 ///< \~chinese 未知类型 \~english Undefined Device
}IMV_FG_EDeviceType;
typedef struct _IMV_FG_DEVICE_INFO
{
IMV_FG_EDeviceType nDeviceType; ///< \~chinese 设备类型 \~english Device Type
unsigned int nReserved[8]; ///< \~chinese 保留字段 \~english Reserved field
char cameraKey[IMV_FG_MAX_STRING_LENTH]; ///< \~chinese CaptureCard_厂商:序列号 \~english Device key
char cameraName[IMV_FG_MAX_STRING_LENTH]; ///< \~chinese 用户自定义名 \~english UserDefinedName
char serialNumber[IMV_FG_MAX_STRING_LENTH]; ///< \~chinese 设备序列号 \~english Device SerialNumber
char vendorName[IMV_FG_MAX_STRING_LENTH]; ///< \~chinese 厂商 \~english Device Vendor
char modelName[IMV_FG_MAX_STRING_LENTH]; ///< \~chinese 设备型号 \~english Device model
char manufactureInfo[IMV_FG_MAX_STRING_LENTH]; ///< \~chinese 设备制造信息 \~english Device ManufactureInfo
char deviceVersion[IMV_FG_MAX_STRING_LENTH]; ///< \~chinese 设备版本 \~english Device Version
char cameraReserved[5][IMV_FG_MAX_STRING_LENTH]; ///< \~chinese 保留 \~english Reserved field
IMV_FG_INTERFACE_INFO FGInterfaceInfo; ///< \~chinese 采集卡信息 \~english Capture Card info
}IMV_FG_DEVICE_INFO;
typedef struct _IMV_FG_DEVICE_INFO_LIST
{
unsigned int nDevNum; ///< \~chinese 设备数量 \~english Device Num
IMV_FG_DEVICE_INFO* pDeviceInfoList; ///< \~chinese 设备信息 \~english Device Info
}IMV_FG_DEVICE_INFO_LIST;
#define IMV_FG_PIX_MONO 0x01000000
#define IMV_FG_PIX_RGB 0x02000000
#define IMV_FG_PIX_COLOR 0x02000000
#define IMV_FG_PIX_CUSTOM 0x80000000
#define IMV_FG_PIX_COLOR_MASK 0xFF000000
// Indicate effective number of bits occupied by the pixel (including padding).
// This can be used to compute amount of memory required to store an image.
#define IMV_FG_PIX_OCCUPY1BIT 0x00010000
#define IMV_FG_PIX_OCCUPY2BIT 0x00020000
#define IMV_FG_PIX_OCCUPY4BIT 0x00040000
#define IMV_FG_PIX_OCCUPY8BIT 0x00080000
#define IMV_FG_PIX_OCCUPY12BIT 0x000C0000
#define IMV_FG_PIX_OCCUPY16BIT 0x00100000
#define IMV_FG_PIX_OCCUPY24BIT 0x00180000
#define IMV_FG_PIX_OCCUPY32BIT 0x00200000
#define IMV_FG_PIX_OCCUPY36BIT 0x00240000
#define IMV_FG_PIX_OCCUPY48BIT 0x00300000
/// \~chinese
/// \brief 枚举属性的枚举值信息
/// \~english
/// \brief Enumeration property 's enumeration value information
typedef struct _IMV_FG_EnumEntryInfo
{
uint64_t value; ///< \~chinese 枚举值 \~english Enumeration value
char name[IMV_FG_MAX_STRING_LENTH]; ///< \~chinese symbol名 \~english Symbol name
}IMV_FG_EnumEntryInfo;
/// \~chinese
/// \brief 枚举属性的可设枚举值列表信息
/// \~english
/// \brief Enumeration property 's settable enumeration value list information
typedef struct _IMV_FG_EnumEntryList
{
unsigned int nEnumEntryBufferSize; ///< \~chinese 存放枚举值内存大小 \~english The size of saving enumeration value
IMV_FG_EnumEntryInfo* pEnumEntryInfo; ///< \~chinese 存放可设枚举值列表(调用者分配缓存) \~english Save the list of settable enumeration value(allocated cache by the caller)
}IMV_FG_EnumEntryList;
/// \~chinese
///枚举:图像格式
/// \~english
/// Enumeration:image format
typedef enum _IMV_FG_EPixelType
{
// Undefined pixel type
IMV_FG_PIXEL_TYPE_Undefined = -1,
// Mono Format
IMV_FG_PIXEL_TYPE_Mono1p = (IMV_FG_PIX_MONO | IMV_FG_PIX_OCCUPY1BIT | 0x0037),
IMV_FG_PIXEL_TYPE_Mono2p = (IMV_FG_PIX_MONO | IMV_FG_PIX_OCCUPY2BIT | 0x0038),
IMV_FG_PIXEL_TYPE_Mono4p = (IMV_FG_PIX_MONO | IMV_FG_PIX_OCCUPY4BIT | 0x0039),
IMV_FG_PIXEL_TYPE_Mono8 = (IMV_FG_PIX_MONO | IMV_FG_PIX_OCCUPY8BIT | 0x0001),
IMV_FG_PIXEL_TYPE_Mono8S = (IMV_FG_PIX_MONO | IMV_FG_PIX_OCCUPY8BIT | 0x0002),
IMV_FG_PIXEL_TYPE_Mono10 = (IMV_FG_PIX_MONO | IMV_FG_PIX_OCCUPY16BIT | 0x0003),
IMV_FG_PIXEL_TYPE_Mono10Packed = (IMV_FG_PIX_MONO | IMV_FG_PIX_OCCUPY12BIT | 0x0004),
IMV_FG_PIXEL_TYPE_Mono12 = (IMV_FG_PIX_MONO | IMV_FG_PIX_OCCUPY16BIT | 0x0005),
IMV_FG_PIXEL_TYPE_Mono12Packed = (IMV_FG_PIX_MONO | IMV_FG_PIX_OCCUPY12BIT | 0x0006),
IMV_FG_PIXEL_TYPE_Mono14 = (IMV_FG_PIX_MONO | IMV_FG_PIX_OCCUPY16BIT | 0x0025),
IMV_FG_PIXEL_TYPE_Mono16 = (IMV_FG_PIX_MONO | IMV_FG_PIX_OCCUPY16BIT | 0x0007),
// Bayer Format
IMV_FG_PIXEL_TYPE_BayGR8 = (IMV_FG_PIX_MONO | IMV_FG_PIX_OCCUPY8BIT | 0x0008),
IMV_FG_PIXEL_TYPE_BayRG8 = (IMV_FG_PIX_MONO | IMV_FG_PIX_OCCUPY8BIT | 0x0009),
IMV_FG_PIXEL_TYPE_BayGB8 = (IMV_FG_PIX_MONO | IMV_FG_PIX_OCCUPY8BIT | 0x000A),
IMV_FG_PIXEL_TYPE_BayBG8 = (IMV_FG_PIX_MONO | IMV_FG_PIX_OCCUPY8BIT | 0x000B),
IMV_FG_PIXEL_TYPE_BayGR10 = (IMV_FG_PIX_MONO | IMV_FG_PIX_OCCUPY16BIT | 0x000C),
IMV_FG_PIXEL_TYPE_BayRG10 = (IMV_FG_PIX_MONO | IMV_FG_PIX_OCCUPY16BIT | 0x000D),
IMV_FG_PIXEL_TYPE_BayGB10 = (IMV_FG_PIX_MONO | IMV_FG_PIX_OCCUPY16BIT | 0x000E),
IMV_FG_PIXEL_TYPE_BayBG10 = (IMV_FG_PIX_MONO | IMV_FG_PIX_OCCUPY16BIT | 0x000F),
IMV_FG_PIXEL_TYPE_BayGR12 = (IMV_FG_PIX_MONO | IMV_FG_PIX_OCCUPY16BIT | 0x0010),
IMV_FG_PIXEL_TYPE_BayRG12 = (IMV_FG_PIX_MONO | IMV_FG_PIX_OCCUPY16BIT | 0x0011),
IMV_FG_PIXEL_TYPE_BayGB12 = (IMV_FG_PIX_MONO | IMV_FG_PIX_OCCUPY16BIT | 0x0012),
IMV_FG_PIXEL_TYPE_BayBG12 = (IMV_FG_PIX_MONO | IMV_FG_PIX_OCCUPY16BIT | 0x0013),
IMV_FG_PIXEL_TYPE_BayGR10Packed = (IMV_FG_PIX_MONO | IMV_FG_PIX_OCCUPY12BIT | 0x0026),
IMV_FG_PIXEL_TYPE_BayRG10Packed = (IMV_FG_PIX_MONO | IMV_FG_PIX_OCCUPY12BIT | 0x0027),
IMV_FG_PIXEL_TYPE_BayGB10Packed = (IMV_FG_PIX_MONO | IMV_FG_PIX_OCCUPY12BIT | 0x0028),
IMV_FG_PIXEL_TYPE_BayBG10Packed = (IMV_FG_PIX_MONO | IMV_FG_PIX_OCCUPY12BIT | 0x0029),
IMV_FG_PIXEL_TYPE_BayGR12Packed = (IMV_FG_PIX_MONO | IMV_FG_PIX_OCCUPY12BIT | 0x002A),
IMV_FG_PIXEL_TYPE_BayRG12Packed = (IMV_FG_PIX_MONO | IMV_FG_PIX_OCCUPY12BIT | 0x002B),
IMV_FG_PIXEL_TYPE_BayGB12Packed = (IMV_FG_PIX_MONO | IMV_FG_PIX_OCCUPY12BIT | 0x002C),
IMV_FG_PIXEL_TYPE_BayBG12Packed = (IMV_FG_PIX_MONO | IMV_FG_PIX_OCCUPY12BIT | 0x002D),
IMV_FG_PIXEL_TYPE_BayGR16 = (IMV_FG_PIX_MONO | IMV_FG_PIX_OCCUPY16BIT | 0x002E),
IMV_FG_PIXEL_TYPE_BayRG16 = (IMV_FG_PIX_MONO | IMV_FG_PIX_OCCUPY16BIT | 0x002F),
IMV_FG_PIXEL_TYPE_BayGB16 = (IMV_FG_PIX_MONO | IMV_FG_PIX_OCCUPY16BIT | 0x0030),
IMV_FG_PIXEL_TYPE_BayBG16 = (IMV_FG_PIX_MONO | IMV_FG_PIX_OCCUPY16BIT | 0x0031),
// RGB Format
IMV_FG_PIXEL_TYPE_RGB8 = (IMV_FG_PIX_COLOR | IMV_FG_PIX_OCCUPY24BIT | 0x0014),
IMV_FG_PIXEL_TYPE_BGR8 = (IMV_FG_PIX_COLOR | IMV_FG_PIX_OCCUPY24BIT | 0x0015),
IMV_FG_PIXEL_TYPE_RGBA8 = (IMV_FG_PIX_COLOR | IMV_FG_PIX_OCCUPY32BIT | 0x0016),
IMV_FG_PIXEL_TYPE_BGRA8 = (IMV_FG_PIX_COLOR | IMV_FG_PIX_OCCUPY32BIT | 0x0017),
IMV_FG_PIXEL_TYPE_RGB10 = (IMV_FG_PIX_COLOR | IMV_FG_PIX_OCCUPY48BIT | 0x0018),
IMV_FG_PIXEL_TYPE_BGR10 = (IMV_FG_PIX_COLOR | IMV_FG_PIX_OCCUPY48BIT | 0x0019),
IMV_FG_PIXEL_TYPE_RGB12 = (IMV_FG_PIX_COLOR | IMV_FG_PIX_OCCUPY48BIT | 0x001A),
IMV_FG_PIXEL_TYPE_BGR12 = (IMV_FG_PIX_COLOR | IMV_FG_PIX_OCCUPY48BIT | 0x001B),
IMV_FG_PIXEL_TYPE_RGB16 = (IMV_FG_PIX_COLOR | IMV_FG_PIX_OCCUPY48BIT | 0x0033),
IMV_FG_PIXEL_TYPE_RGB10V1Packed = (IMV_FG_PIX_COLOR | IMV_FG_PIX_OCCUPY32BIT | 0x001C),
IMV_FG_PIXEL_TYPE_RGB10P32 = (IMV_FG_PIX_COLOR | IMV_FG_PIX_OCCUPY32BIT | 0x001D),
IMV_FG_PIXEL_TYPE_RGB12V1Packed = (IMV_FG_PIX_COLOR | IMV_FG_PIX_OCCUPY36BIT | 0X0034),
IMV_FG_PIXEL_TYPE_RGB565P = (IMV_FG_PIX_COLOR | IMV_FG_PIX_OCCUPY16BIT | 0x0035),
IMV_FG_PIXEL_TYPE_BGR565P = (IMV_FG_PIX_COLOR | IMV_FG_PIX_OCCUPY16BIT | 0X0036),
// YVR Format
IMV_FG_PIXEL_TYPE_YUV411_8_UYYVYY = (IMV_FG_PIX_COLOR | IMV_FG_PIX_OCCUPY12BIT | 0x001E),
IMV_FG_PIXEL_TYPE_YUV422_8_UYVY = (IMV_FG_PIX_COLOR | IMV_FG_PIX_OCCUPY16BIT | 0x001F),
IMV_FG_PIXEL_TYPE_YUV422_8 = (IMV_FG_PIX_COLOR | IMV_FG_PIX_OCCUPY16BIT | 0x0032),
IMV_FG_PIXEL_TYPE_YUV8_UYV = (IMV_FG_PIX_COLOR | IMV_FG_PIX_OCCUPY24BIT | 0x0020),
IMV_FG_PIXEL_TYPE_YCbCr8CbYCr = (IMV_FG_PIX_COLOR | IMV_FG_PIX_OCCUPY24BIT | 0x003A),
IMV_FG_PIXEL_TYPE_YCbCr422_8 = (IMV_FG_PIX_COLOR | IMV_FG_PIX_OCCUPY16BIT | 0x003B),
IMV_FG_PIXEL_TYPE_YCbCr422_8_CbYCrY = (IMV_FG_PIX_COLOR | IMV_FG_PIX_OCCUPY16BIT | 0x0043),
IMV_FG_PIXEL_TYPE_YCbCr411_8_CbYYCrYY = (IMV_FG_PIX_COLOR | IMV_FG_PIX_OCCUPY12BIT | 0x003C),
IMV_FG_PIXEL_TYPE_YCbCr601_8_CbYCr = (IMV_FG_PIX_COLOR | IMV_FG_PIX_OCCUPY24BIT | 0x003D),
IMV_FG_PIXEL_TYPE_YCbCr601_422_8 = (IMV_FG_PIX_COLOR | IMV_FG_PIX_OCCUPY16BIT | 0x003E),
IMV_FG_PIXEL_TYPE_YCbCr601_422_8_CbYCrY = (IMV_FG_PIX_COLOR | IMV_FG_PIX_OCCUPY16BIT | 0x0044),
IMV_FG_PIXEL_TYPE_YCbCr601_411_8_CbYYCrYY = (IMV_FG_PIX_COLOR | IMV_FG_PIX_OCCUPY12BIT | 0x003F),
IMV_FG_PIXEL_TYPE_YCbCr709_8_CbYCr = (IMV_FG_PIX_COLOR | IMV_FG_PIX_OCCUPY24BIT | 0x0040),
IMV_FG_PIXEL_TYPE_YCbCr709_422_8 = (IMV_FG_PIX_COLOR | IMV_FG_PIX_OCCUPY16BIT | 0x0041),
IMV_FG_PIXEL_TYPE_YCbCr709_422_8_CbYCrY = (IMV_FG_PIX_COLOR | IMV_FG_PIX_OCCUPY16BIT | 0x0045),
IMV_FG_PIXEL_TYPE_YCbCr709_411_8_CbYYCrYY = (IMV_FG_PIX_COLOR | IMV_FG_PIX_OCCUPY12BIT | 0x0042),
// RGB Planar
IMV_FG_PIXEL_TYPE_RGB8Planar = (IMV_FG_PIX_COLOR | IMV_FG_PIX_OCCUPY24BIT | 0x0021),
IMV_FG_PIXEL_TYPE_RGB10Planar = (IMV_FG_PIX_COLOR | IMV_FG_PIX_OCCUPY48BIT | 0x0022),
IMV_FG_PIXEL_TYPE_RGB12Planar = (IMV_FG_PIX_COLOR | IMV_FG_PIX_OCCUPY48BIT | 0x0023),
IMV_FG_PIXEL_TYPE_RGB16Planar = (IMV_FG_PIX_COLOR | IMV_FG_PIX_OCCUPY48BIT | 0x0024),
// BayerRG10p和BayerRG12p格式针对特定项目临时添加,请不要使用
// BayerRG10p and BayerRG12p, currently used for specific project, please do not use them
IMV_FG_PIXEL_TYPE_BayRG10p = 0x010A0058,
IMV_FG_PIXEL_TYPE_BayRG12p = 0x010c0059,
// mono1c格式自定义格式
// mono1c, customized image format, used for binary output
IMV_FG_PIXEL_TYPE_Mono1c = 0x012000FF,
// mono1e格式自定义格式用来显示连通域
// mono1e, customized image format, used for displaying connected domain
IMV_FG_PIXEL_TYPE_Mono1e = 0x01080FFF
}IMV_FG_EPixelType;
/// \~chinese
/// \brief 帧图像信息
/// \~english
/// \brief The frame image information
typedef struct _IMV_FG_FrameInfo_
{
uint64_t blockId; ///< \~chinese 帧Id(仅对GigE/Usb/PCIe相机有效) \~english The block ID(GigE/Usb/PCIe Device only)
unsigned int status; ///< \~chinese 数据帧状态(0是正常状态) \~english The status of frame(0 is normal status)
unsigned int width; ///< \~chinese 图像宽度 \~english The width of image
unsigned int height; ///< \~chinese 图像高度 \~english The height of image
unsigned int size; ///< \~chinese 图像大小 \~english The size of image
IMV_FG_EPixelType pixelFormat; ///< \~chinese 图像像素格式 \~english The pixel format of image
uint64_t timeStamp; ///< \~chinese 图像时间戳(仅对GigE/Usb/PCIe相机有效) \~english The timestamp of image(GigE/Usb/PCIe Device only)
unsigned int chunkCount; ///< \~chinese 帧数据中包含的Chunk个数(仅对GigE/Usb相机有效) \~english The number of chunk in frame data(GigE/Usb Device Only)
unsigned int paddingX; ///< \~chinese 图像paddingX(仅对GigE/Usb/PCIe相机有效) \~english The paddingX of image(GigE/Usb/PCIe Device only)
unsigned int paddingY; ///< \~chinese 图像paddingY(仅对GigE/Usb/PCIe相机有效) \~english The paddingY of image(GigE/Usb/PCIe Device only)
unsigned int recvFrameTime; ///< \~chinese 图像在网络传输所用的时间(单位:微秒,非GigE相机该值为0) \~english The time taken for the image to be transmitted over the network(unit:us, The value is 0 for non-GigE camera)
unsigned int nReserved[19]; ///< \~chinese 预留字段 \~english Reserved field
}IMV_FG_FrameInfo;
/// \~chinese
/// \brief 加载失败的属性信息
/// \~english
/// \brief Load failed properties information
typedef struct _IMV_FG_ErrorList
{
unsigned int nParamCnt; ///< \~chinese 加载失败的属性个数 \~english The count of load failed properties
IMV_FG_String paramNameList[IMV_FG_MAX_ERROR_LIST_NUM]; ///< \~chinese 加载失败的属性集合上限128 \~english Array of load failed properties, up to 128
}IMV_FG_ErrorList;
/// \~chinese
/// \brief 设置层级CXP采集卡属性分为多层每次配置属性时需配置该属性的层级(CXP专用)
/// \~english
/// \brief CXP captrue card featrue are divided into multiple levels. Each time you configure the featrue, you need to configure the level of the featrue
typedef enum _IMV_FG_EFeatureLevel
{
fg_interface_Level, ///< \~chinese 采集卡接口层 \~english Capture Card interface Level
fg_device_Level, ///< \~chinese 采集卡设备层 \~english Capture Card device Level
camera_Level ///< \~chinese 远程设备层(相机) \~english The camera Level
}IMV_FG_EFeatureLevel;
/// \~chinese
/// \brief Chunk数据信息
/// \~english
/// \brief Chunk data information
typedef struct _IMV_FG_ChunkDataInfo
{
unsigned int chunkID; ///< \~chinese ChunkID \~english ChunkID
unsigned int nParamCnt; ///< \~chinese 属性名个数 \~english The number of paramNames
IMV_FG_String* pParamNameList; ///< \~chinese Chunk数据对应的属性名集合(SDK内部缓存)\~english ParamNames Corresponding property name of chunk data(cached within the SDK)
}IMV_FG_ChunkDataInfo;
/// \~chinese
/// \brief 帧图像数据信息
/// \~english
/// \brief Frame image data information
typedef struct _IMV_FG_Frame_
{
IMV_FG_FRAME_HANDLE frameHandle; ///< \~chinese 帧图像句柄(SDK内部帧管理用) \~english Frame image handle(used for managing frame within the SDK)
unsigned char* pData; ///< \~chinese 帧图像数据的内存首地址 \~english The starting address of memory of image data
IMV_FG_FrameInfo frameInfo; ///< \~chinese 帧信息 \~english Frame information
unsigned int nReserved[10]; ///< \~chinese 预留字段 \~english Reserved field
}IMV_FG_Frame;
/// \~chinese
///枚举:抓图策略
/// \~english
///Enumeration: grab strartegy
typedef enum _IMV_FG_EGrabStrategy
{
IMV_FG_GRAB_STRARTEGY_SEQUENTIAL = 0, ///< \~chinese 按到达顺序处理图片 \~english The images are processed in the order of their arrival
IMV_FG_GRAB_STRARTEGY_LATEST_IMAGE = 1, ///< \~chinese 获取最新的图片 \~english Get latest image
IMV_FG_GRAB_STRARTEGY_UPCOMING_IMAGE = 2, ///< \~chinese 等待获取下一张图片(只针对GigE相机) \~english Waiting for next image(GigE only)
IMV_FG_GRAB_STRARTEGY_UNDEFINED ///< \~chinese 未定义 \~english Undefined
}IMV_FG_EGrabStrategy;
/// \~chinese
/// \brief PCIE设备统计流信息
/// \~english
/// \brief PCIE device stream statistics information
typedef struct _IMV_FG_CLStreamStatsInfo
{
unsigned int imageError; ///< \~chinese 图像错误的帧数 \~english Number of images error frames
unsigned int lostPacketBlock; ///< \~chinese 丢包的帧数 \~english Number of frames lost
unsigned int nReserved0[10]; ///< \~chinese 预留 \~english Reserved field
unsigned int imageReceived; ///< \~chinese 正常获取的帧数 \~english Number of frames acquired
double fps; ///< \~chinese 帧率 \~english Frame rate
double bandwidth; ///< \~chinese 带宽(Mbps) \~english Bandwidth(Mbps)
unsigned int nReserved[8]; ///< \~chinese 预留 \~english Reserved field
}IMV_FG_CLStreamStatsInfo;
/// \~chinese
/// \brief U3V设备统计流信息
/// \~english
/// \brief U3V device stream statistics information
typedef struct _IMV_FG_U3VStreamStatsInfo
{
unsigned int imageError; ///< \~chinese 图像错误的帧数 \~english Number of images error frames
unsigned int lostPacketBlock; ///< \~chinese 丢包的帧数 \~english Number of frames lost
unsigned int nReserved0[10]; ///< \~chinese 预留 \~english Reserved field
unsigned int imageReceived; ///< \~chinese 正常获取的帧数 \~english Number of images error frames
double fps; ///< \~chinese 帧率 \~english Frame rate
double bandwidth; ///< \~chinese 带宽(Mbps) \~english Bandwidth(Mbps)
unsigned int nReserved[8]; ///< \~chinese 预留 \~english Reserved field
}IMV_FG_U3VStreamStatsInfo;
/// \~chinese
/// \brief Gige设备统计流信息
/// \~english
/// \brief Gige device stream statistics information
typedef struct _IMV_FG_GigEStreamStatsInfo
{
unsigned int nReserved0[10]; ///< \~chinese 预留 \~english Reserved field
unsigned int imageError; ///< \~chinese 图像错误的帧数 \~english Number of image error frames
unsigned int lostPacketBlock; ///< \~chinese 丢包的帧数 \~english Number of frames lost
unsigned int nReserved1[4]; ///< \~chinese 预留 \~english Reserved field
unsigned int nReserved2[5]; ///< \~chinese 预留 \~english Reserved field
unsigned int imageReceived; ///< \~chinese 正常获取的帧数 \~english Number of frames acquired
double fps; ///< \~chinese 帧率 \~english Frame rate
double bandwidth; ///< \~chinese 带宽(Mbps) \~english Bandwidth(Mbps)
unsigned int nReserved[4]; ///< \~chinese 预留 \~english Reserved field
}IMV_FG_GigEStreamStatsInfo;
/// \~chinese
/// \brief 统计流信息
/// \~english
/// \brief Stream statistics information
typedef struct _IMV_FG_StreamStatisticsInfo
{
IMV_FG_EDeviceType nDeviceType; ///< \~chinese 设备类型 \~english Device type
union
{
IMV_FG_CLStreamStatsInfo clStatisticsInfo; ///< \~chinese CL设备统计信息 \~english CameraLink device statistics information
IMV_FG_U3VStreamStatsInfo u3vStatisticsInfo; ///< \~chinese U3V设备统计信息 \~english U3V device statistics information
IMV_FG_GigEStreamStatsInfo gigeStatisticsInfo; ///< \~chinese Gige设备统计信息 \~english GIGE device statistics information
};
}IMV_FG_StreamStatisticsInfo;
/// \~chinese
///枚举图像转换Bayer格式所用的算法
/// \~english
/// Enumeration:alorithm used for Bayer demosaic
typedef enum _IMV_FG_EBayerDemosaic
{
IMV_FG_DEMOSAIC_NEAREST_NEIGHBOR, ///< \~chinese 最近邻 \~english Nearest neighbor
IMV_FG_DEMOSAIC_BILINEAR, ///< \~chinese 双线性 \~english Bilinear
IMV_FG_DEMOSAIC_EDGE_SENSING, ///< \~chinese 边缘检测 \~english Edge sensing
IMV_FG_DEMOSAIC_NOT_SUPPORT = 255, ///< \~chinese 不支持 \~english Not support
}IMV_FG_EBayerDemosaic;
/// \~chinese
///枚举:视频格式
/// \~english
/// Enumeration:Video format
typedef enum _IMV_FG_EVideoType
{
IMV_FG_TYPE_VIDEO_FORMAT_AVI = 0, ///< \~chinese AVI格式 \~english AVI format
IMV_FG_TYPE_VIDEO_FORMAT_NOT_SUPPORT = 255 ///< \~chinese 不支持 \~english Not support
}IMV_FG_EVideoType;
/// \~chinese
///枚举:图像翻转类型
/// \~english
/// Enumeration:Image flip type
typedef enum _IMV_FG_EFlipType
{
IMV_FG_TYPE_FLIP_VERTICAL, ///< \~chinese 垂直(Y轴)翻转 \~english Vertical(Y-axis) flip
IMV_FG_TYPE_FLIP_HORIZONTAL ///< \~chinese 水平(X轴)翻转 \~english Horizontal(X-axis) flip
}IMV_FG_EFlipType;
/// \~chinese
///枚举:顺时针旋转角度
/// \~english
/// Enumeration:Rotation angle clockwise
typedef enum _IMV_FG_ERotationAngle
{
IMV_FG_ROTATION_ANGLE90, ///< \~chinese 顺时针旋转90度 \~english Rotate 90 degree clockwise
IMV_FG_ROTATION_ANGLE180, ///< \~chinese 顺时针旋转180度 \~english Rotate 180 degree clockwise
IMV_FG_ROTATION_ANGLE270, ///< \~chinese 顺时针旋转270度 \~english Rotate 270 degree clockwise
}IMV_FG_ERotationAngle;
/// \~chinese
/// \brief 像素转换结构体
/// \~english
/// \brief Pixel convert structure
typedef struct _IMV_FG_PixelConvertParam
{
unsigned int nWidth; ///< [IN] \~chinese 图像宽 \~english Width
unsigned int nHeight; ///< [IN] \~chinese 图像高 \~english Height
IMV_FG_EPixelType ePixelFormat; ///< [IN] \~chinese 像素格式 \~english Pixel format
unsigned char* pSrcData; ///< [IN] \~chinese 输入图像数据 \~english Input image data
unsigned int nSrcDataLen; ///< [IN] \~chinese 输入图像长度 \~english Input image length
unsigned int nPaddingX; ///< [IN] \~chinese 图像宽填充 \~english Padding X
unsigned int nPaddingY; ///< [IN] \~chinese 图像高填充 \~english Padding Y
IMV_FG_EBayerDemosaic eBayerDemosaic; ///< [IN] \~chinese 转换Bayer格式算法 \~english Alorithm used for Bayer demosaic
IMV_FG_EPixelType eDstPixelFormat; ///< [IN] \~chinese 目标像素格式 \~english Destination pixel format
unsigned char* pDstBuf; ///< [OUT] \~chinese 输出数据缓存(调用者分配缓存) \~english Output data buffer(allocated cache by the caller)
unsigned int nDstBufSize; ///< [IN] \~chinese 提供的输出缓冲区大小 \~english Provided output buffer size
unsigned int nDstDataLen; ///< [OUT] \~chinese 输出数据长度 \~english Output data length
unsigned int nReserved[8]; ///< \~chinese 预留 \~english Reserved field
}IMV_FG_PixelConvertParam;
/// \~chinese
/// \brief 录像结构体
/// \~english
/// \brief Record structure
typedef struct _IMV_FG_RecordParam
{
unsigned int nWidth; ///< [IN] \~chinese 图像宽 \~english Width
unsigned int nHeight; ///< [IN] \~chinese 图像高 \~english Height
float fFameRate; ///< [IN] \~chinese 帧率(大于0) \~english Frame rate(greater than 0)
unsigned int nQuality; ///< [IN] \~chinese 视频质量(1-100) \~english Video quality(1-100)
IMV_FG_EVideoType recordFormat; ///< [IN] \~chinese 视频格式 \~english Video format
const char* pRecordFilePath; ///< [IN] \~chinese 保存视频路径 \~english Save video path
unsigned int nReserved[5]; ///< \~chinese 预留 \~english Reserved field
}IMV_FG_RecordParam;
/// \~chinese
/// \brief 录像用帧信息结构体
/// \~english
/// \brief Frame information for recording structure
typedef struct _IMV_FG_RecordFrameInfoParam
{
unsigned char* pData; ///< [IN] \~chinese 图像数据 \~english Image data
unsigned int nDataLen; ///< [IN] \~chinese 图像数据长度 \~english Image data length
unsigned int nPaddingX; ///< [IN] \~chinese 图像宽填充 \~english Padding X
unsigned int nPaddingY; ///< [IN] \~chinese 图像高填充 \~english Padding Y
IMV_FG_EPixelType ePixelFormat; ///< [IN] \~chinese 像素格式 \~english Pixel format
unsigned int nReserved[5]; ///< \~chinese 预留 \~english Reserved field
}IMV_FG_RecordFrameInfoParam;
/// \~chinese
/// \brief 图像翻转结构体
/// \~english
/// \brief Flip image structure
typedef struct _IMV_FG_FlipImageParam
{
unsigned int nWidth; ///< [IN] \~chinese 图像宽 \~english Width
unsigned int nHeight; ///< [IN] \~chinese 图像高 \~english Height
IMV_FG_EPixelType ePixelFormat; ///< [IN] \~chinese 像素格式 \~english Pixel format
IMV_FG_EFlipType eFlipType; ///< [IN] \~chinese 翻转类型 \~english Flip type
unsigned char* pSrcData; ///< [IN] \~chinese 输入图像数据 \~english Input image data
unsigned int nSrcDataLen; ///< [IN] \~chinese 输入图像长度 \~english Input image length
unsigned char* pDstBuf; ///< [OUT] \~chinese 输出数据缓存(调用者分配缓存) \~english Output data buffer(allocated cache by the caller)
unsigned int nDstBufSize; ///< [IN] \~chinese 提供的输出缓冲区大小 \~english Provided output buffer size
unsigned int nDstDataLen; ///< [OUT] \~chinese 输出数据长度 \~english Output data length
unsigned int nReserved[8]; ///< \~chinese 预留 \~english Reserved field
}IMV_FG_FlipImageParam;
/// \~chinese
/// \brief 图像旋转结构体
/// \~english
/// \brief Rotate image structure
typedef struct _IMV_FG_RotateImageParam
{
unsigned int nWidth; ///< [IN][OUT] \~chinese 图像宽 \~english Width
unsigned int nHeight; ///< [IN][OUT] \~chinese 图像高 \~english Height
IMV_FG_EPixelType ePixelFormat; ///< [IN] \~chinese 像素格式 \~english Pixel format
IMV_FG_ERotationAngle eRotationAngle; ///< [IN] \~chinese 旋转角度 \~english Rotation angle
unsigned char* pSrcData; ///< [IN] \~chinese 输入图像数据 \~english Input image data
unsigned int nSrcDataLen; ///< [IN] \~chinese 输入图像长度 \~english Input image length
unsigned char* pDstBuf; ///< [OUT] \~chinese 输出数据缓存(调用者分配缓存) \~english Output data buffer(allocated cache by the caller)
unsigned int nDstBufSize; ///< [IN] \~chinese 提供的输出缓冲区大小 \~english Provided output buffer size
unsigned int nDstDataLen; ///< [OUT] \~chinese 输出数据长度 \~english Output data length
unsigned int nReserved[8]; ///< \~chinese 预留 \~english Reserved field
}IMV_FG_RotateImageParam;
/// \~chinese
/// \brief 枚举:图像保存格式
/// \~english
/// \brief Enumeration:image save format
typedef enum _IMV_FG_ESaveFileType
{
IMV_FG_TYPE_SAVE_BMP = 0, ///< \~chinese BMP图像格式 \~english BMP Image Type
IMV_FG_TYPE_SAVE_JPEG = 1, ///< \~chinese JPEG图像格式 \~english Jpeg Image Type
IMV_FG_TYPE_SAVE_PNG = 2, ///< \~chinese PNG图像格式 \~english Png Image Type
IMV_FG_TYPE_SAVE_TIFF = 3, ///< \~chinese TIFF图像格式 \~english TIFF Image Type
IMV_FG_TYPE_UNDEFINED = 255, ///< \~chinese 未定义的图像格式 \~english Undefined Image Type
}IMV_FG_ESaveFileType;
/// \~chinese
/// \brief 保存图像结构体
/// \~english
/// \brief Save image structure
typedef struct _IMV_FG_SaveImageToFileParam
{
unsigned int nWidth; ///< [IN] \~chinese 图像宽 \~english Width
unsigned int nHeight; ///< [IN] \~chinese 图像高 \~english Height
IMV_FG_EPixelType ePixelFormat; ///< [IN] \~chinese 输入数据的像素格式 \~english Pixel format
unsigned char* pSrcData; ///< [IN] \~chinese 输入图像数据 \~english Input image data
unsigned int nSrcDataLen; ///< [IN] \~chinese 输入数据大小 \~english Input image length
IMV_FG_ESaveFileType eImageType; ///< [IN] \~chinese 输入保存图片格式 \~english Input image save format
char* pImagePath; ///< [IN] \~chinese 输入文件路径 \~english Input image save path
unsigned int nQuality; ///< [IN] \~chinese JPG编码质量(50-99]PNG编码质量[0-9] \~english Encoding quality
IMV_FG_EBayerDemosaic eBayerDemosaic; ///< [IN] \~chinese 转换Bayer格式算法 \~english Alorithm used for Bayer demosaic
unsigned int nReserved[8]; ///< \~chinese 预留 \~english Reserved
}IMV_FG_SaveImageToFileParam;
/// \~chinese
///枚举:事件类型
/// \~english
/// Enumeration:event type
typedef enum _IMV_FG_EVType
{
IMV_FG_OFFLINE, ///< \~chinese 设备离线通知 \~english device offline notification
IMV_FG_ONLINE ///< \~chinese 设备在线通知 \~english device online notification
}IMV_FG_EVType;
/// \~chinese
/// \brief 连接事件信息
/// \~english
/// \brief connection event information
typedef struct _IMV_FG_SConnectArg
{
IMV_FG_EVType event; ///< \~chinese 事件类型 \~english event type
unsigned int nReserve[10]; ///< \~chinese 预留字段 \~english Reserved field
}IMV_FG_SConnectArg;
/// \~chinese
/// 消息通道事件ID列表
/// \~english
/// message channel event id list
#define IMV_FG_MSG_EVENT_ID_EXPOSURE_END 0x9001
#define IMV_FG_MSG_EVENT_ID_FRAME_TRIGGER 0x9002
#define IMV_FG_MSG_EVENT_ID_FRAME_START 0x9003
#define IMV_FG_MSG_EVENT_ID_ACQ_START 0x9004
#define IMV_FG_MSG_EVENT_ID_ACQ_TRIGGER 0x9005
#define IMV_FG_MSG_EVENT_ID_DATA_READ_OUT 0x9006
#define IMV_FG_MSG_EVENT_ID_FRAME_END 0x9007
#define IMV_FG_MSG_EVENT_ID_FRAMEACTIVE_START 0x9008
#define IMV_FG_MSG_EVENT_ID_FRAMEACTIVE_END 0x9009
#define IMV_FG_MSG_EVENT_ID_FIRST_LINE 0x900A
#define IMV_FG_MSG_EVENT_ID_LAST_LINE 0x900B
/// \~chinese
/// \brief 消息通道事件信息
/// \~english
/// \brief Message channel event information(Common to equipment)
typedef struct _IMV_FG_SMsgEventArg
{
unsigned short eventId; ///< \~chinese 事件Id \~english Event id
unsigned short channelId; ///< \~chinese 消息通道号 \~english Channel id
uint64_t blockId; ///< \~chinese 流数据BlockID \~english Block ID of stream data
uint64_t timeStamp; ///< \~chinese 时间戳 \~english Event timestamp
void* pEventData; ///< \~chinese 事件数据,内部缓存,需要及时进行数据处理 \~english Event data, internal buffer, need to be processed in time
unsigned int nEventDataSize; ///< \~chinese 事件数据长度 \~english Event data size
unsigned int reserve[8]; ///< \~chinese 预留字段 \~english Reserved field
}IMV_FG_SMsgEventArg;
/// \~chinese
/// \brief 设备连接状态事件回调函数声明
/// \param pParamUpdateArg [in] 回调时主动推送的设备连接状态事件信息
/// \param pUser [in] 用户自定义数据
/// \~english
/// \brief Call back function declaration of device connection status event
/// \param pStreamArg [in] The device connection status event which will be active pushed out during the callback
/// \param pUser [in] User defined data
typedef void(*IMV_FG_ConnectCallBack)(const IMV_FG_SConnectArg* pConnectArg, void* pUser);
/// \~chinese
/// \brief 帧数据信息回调函数声明
/// \param pFrame [in] 回调时主动推送的帧信息
/// \param pUser [in] 用户自定义数据
/// \~english
/// \brief Call back function declaration of frame data information
/// \param pFrame [in] The frame information which will be active pushed out during the callback
/// \param pUser [in] User defined data
typedef void(*IMV_FG_FrameCallBack)(IMV_FG_Frame* pFrame, void* pUser);
/// \~chinese
/// \brief 消息通道事件回调函数声明(设备通用)
/// \param pMsgChannelArg [in] 回调时主动推送的消息通道事件信息
/// \param pUser [in] 用户自定义数据
/// \~english
/// \brief Call back function declaration of message channel event(Common to equipment)
/// \param pMsgChannelArg [in] The message channel event which will be active pushed out during the callback
/// \param pUser [in] User defined data
typedef void(*IMV_FG_MsgChannelCallBack)(const IMV_FG_SMsgEventArg* pMsgChannelArg, void* pUser);
#endif

82
addshu.cpp Normal file
View File

@ -0,0 +1,82 @@
#include "addshu.h"
#include "ui_addshu.h"
QString id3;
addshu::addshu(QWidget *parent) :
QWidget(parent),
ui(new Ui::addshu)
{
ui->setupUi(this);
setWindowTitle("æ°å¢žè<EFBFBD>Œå±ž");
this->setFixedSize(423,244);
ui->widget->setFixedHeight(55);
ui->lineEdit->setFixedSize(301,32);
ui->lineEdit_2->setFixedSize(301,32);
ui->pushButton->setFixedSize(76,37);
ui->pushButton_2->setFixedSize(76,37);
this->setWindowFlags(Qt::FramelessWindowHint); // éš<C3A9>è—<C3A8>标题æ ?
this->setFixedSize(437,244);
this->setWindowFlags(Qt::FramelessWindowHint);//È¥³ý´°¿Ú±ß¿ò
setAttribute(Qt::WA_TranslucentBackground);
}
addshu::~addshu()
{
delete ui;
}
void addshu::on_pushButton_clicked()
{
if(!ui->lineEdit->text().isEmpty()&&!ui->lineEdit_2->text().isEmpty()){QString sql=QString("INSERT INTO junshu (id,name,time,ren) VALUES ('%1','%2','%3','%4')")
.arg(ui->lineEdit->text()).arg(ui->lineEdit_2->text()).arg(gettime()).arg(id3);
qDebug()<<sql;
QSqlQuery query;
if(query.exec(sql))
{
qDebug()<<"æ<EFBFBD>å…¥æˆ<EFBFBD>功";
}
}
else{
}
emit xinzeng();
this->close();
}
QString addshu::getname()
{
QString sql=QString("select usersname from users where id='%1'").arg(id3);
qDebug()<<sql;
QSqlQuery query;
if(query.exec(sql))
{
if(query.first()){
QString str1=query.value(0).toString();
qDebug()<<str1;
return str1;
}
}
else
{
qDebug()<<"没查到å<EFBFBD><EFBFBD>å­?";
}
}
QString addshu::gettime()
{
QDateTime dateTime= QDateTime::currentDateTime();//获å<C2B7>系统当å‰<C3A5>的时é—?
QString str = dateTime .toString("yyyy-MM-dd hh:mm:ss");//æ ¼å¼<C3A5>åŒæ—¶é—?
return str;
}
void addshu::on_pushButton_2_clicked()
{
this->close();
emit xinzeng();
}

38
addshu.h Normal file
View File

@ -0,0 +1,38 @@
#ifndef ADDSHU_H
#define ADDSHU_H
#include <QWidget>
#include <QSqlDatabase>
#include <QtSql/QSql>
#include <QtSql/QSqlDatabase>
#include <QtSql/QSqlQueryModel>
#include <QtSql/QSqlError>
#include <QSqlQuery>
#include<QDebug>
#include<QDateTime>
namespace Ui {
class addshu;
}
class addshu : public QWidget
{
Q_OBJECT
public:
explicit addshu(QWidget *parent = nullptr);
~addshu();
private slots:
void on_pushButton_clicked();
void on_pushButton_2_clicked();
private:
Ui::addshu *ui;
QString getname();
QString gettime();
signals:
void xinzeng();
};
#endif // ADDSHU_H

366
addshu.ui Normal file
View File

@ -0,0 +1,366 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>addshu</class>
<widget class="QWidget" name="addshu">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>609</width>
<height>394</height>
</rect>
</property>
<property name="windowTitle">
<string>新增菌属</string>
</property>
<property name="styleSheet">
<string notr="true">border-top-left-radius: 12px;
border-top-right-radius: 12px;</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QFrame" name="frame">
<property name="styleSheet">
<string notr="true"> border-radius: 12px;
background-color: rgb(255, 255, 255);</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="1" column="3">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="2" colspan="2">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="styleSheet">
<string notr="true">font:12pt;</string>
</property>
<property name="text">
<string>项目名称:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="styleSheet">
<string notr="true">font:12pt;</string>
</property>
<property name="text">
<string>菌属名称:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEdit">
<property name="styleSheet">
<string notr="true"> border: 1px solid rgb(175, 175, 175) ; /* 设置1px宽的灰色实线边框 */
border-radius: 2px; /* 边框圆角半径为4像素实现倒角效果 */
padding: 2px 4px; /* 可选设置内部文字的内边距这里示例上下2像素左右4像素 */</string>
</property>
<property name="text">
<string>真菌药敏试剂盒</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEdit_2">
<property name="styleSheet">
<string notr="true">QLineEdit {
border: 1px solid rgb(175, 175, 175) ; /* 设置1px宽的灰色实线边框 */
border-radius: 2px; /* 边框圆角半径为4像素实现倒角效果 */
padding: 2px 4px; /* 可选设置内部文字的内边距这里示例上下2像素左右4像素 */
}</string>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="2" column="4">
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>174</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="1">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="0" colspan="5">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="styleSheet">
<string notr="true">QPushButton {
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1,
stop:0 rgba(0, 255, 255, 255) ,
stop:1 rgba(0, 144, 209, 255)
);
color: rgb(255, 255, 255);
border-radius: 4px;
font: bold 10pt ;
}
</string>
</property>
<property name="text">
<string>确定</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton_2">
<property name="styleSheet">
<string notr="true">background-color: rgb(255, 255, 255);
border: 1px solid rgb(175, 175, 175) ;
border-radius: 4px;</string>
</property>
<property name="text">
<string>取消</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="0" column="0" colspan="6">
<widget class="QWidget" name="widget" native="true">
<property name="styleSheet">
<string notr="true">QWidget{
border-top-left-radius: 12px;
border-top-right-radius: 12px;
color: rgb(0, 0, 0);
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1,
stop:0 rgba(0, 255, 255, 255) ,
stop:1 rgba(0, 144, 209, 255)
);
border-bottom-left-radius: 0px;
border-top-left-radius: 12px;
border-top-right-radius: 12px;
border-bottom-right-radius: 0px;
}
QLabel{
background: transparent;
}
QPushButton{
background: transparent;
}</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="styleSheet">
<string notr="true">font: bold 20px;
color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>新增菌属</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>pushButton_2</sender>
<signal>clicked()</signal>
<receiver>addshu</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>406</x>
<y>294</y>
</hint>
<hint type="destinationlabel">
<x>304</x>
<y>196</y>
</hint>
</hints>
</connection>
</connections>
</ui>

77
addusers.cpp Normal file
View File

@ -0,0 +1,77 @@
#include "addusers.h"
#include "ui_addusers.h"
#include<QDateTime>
#include<QMessageBox>
#include<QGraphicsDropShadowEffect>
addusers::addusers(QWidget *parent) :
QWidget(parent),
ui(new Ui::addusers)
{
ui->setupUi(this);
ui->lineEdit_3->setFixedSize(301,32);
ui->lineEdit_2->setFixedSize(301,32);
ui->pushButton->setFixedSize(76,37);
ui->pushButton_2->setFixedSize(76,37);
ui->comboBox_2->setFixedSize(301,32);
this->setWindowFlags(Qt::FramelessWindowHint); // 闅愯棌鏍囬鏍?
this->setFixedSize(437,292);
ui->widget->setFixedHeight(55);
QGraphicsDropShadowEffect *shadow2 = new QGraphicsDropShadowEffect(this);
//设置阴影距离
shadow2->setOffset(0, 0);
//设置阴影颜色
shadow2->setColor(QColor(214, 214, 214));
//设置阴影圆角
shadow2->setBlurRadius(30);
//给嵌套QWidget设置阴影
ui->frame->setGraphicsEffect(shadow2);
this->setWindowFlags(Qt::FramelessWindowHint);//去除窗口边框
setAttribute(Qt::WA_TranslucentBackground);
}
addusers::~addusers()
{
delete ui;
}
void addusers::on_pushButton_clicked()
{
QDateTime dateTime= QDateTime::currentDateTime();//鑾峰彇绯荤粺褰撳墠鐨勬椂闂?
QString str = dateTime .toString("yyyy-MM-dd hh:mm:ss");//鏍煎紡鍖栨椂闂?
if(!ui->lineEdit_2->text().isEmpty()&&!ui->lineEdit_3->text().isEmpty()){
QString sql=QString("INSERT INTO users (time,id,password,juese) VALUES ('%1','%2','%3','%4')")
.arg(str).arg(ui->lineEdit_2->text()).arg(ui->lineEdit_3->text()).arg(ui->comboBox_2->currentText());
qDebug()<<sql;
QSqlQuery query;
if(query.exec(sql))
{
qDebug()<<"鎻掑叆鎴愬姛";
ui->lineEdit_2->clear();
ui->lineEdit_3->clear();
}
else{
QMessageBox::warning(nullptr, "新增人员", "添加失败");
}
}
else{
QMessageBox::warning(nullptr, "新增人员", "用户名或秘密不能为空");
}
emit xinzeng();
this->close();
}
void addusers::on_pushButton_2_clicked()
{
emit xinzeng();
this->close();
}

33
addusers.h Normal file
View File

@ -0,0 +1,33 @@
#ifndef ADDUSERS_H
#define ADDUSERS_H
#include <QWidget>
#include <QSqlDatabase>
#include <QtSql/QSql>
#include <QtSql/QSqlDatabase>
#include <QtSql/QSqlQueryModel>
#include <QtSql/QSqlError>
#include <QSqlQuery>
#include<QDebug>
namespace Ui {
class addusers;
}
class addusers : public QWidget
{
Q_OBJECT
public:
explicit addusers(QWidget *parent = nullptr);
~addusers();
private:
Ui::addusers *ui;
signals:
void xinzeng();
private slots:
void on_pushButton_clicked();
void on_pushButton_2_clicked();
};
#endif // ADDUSERS_H

410
addusers.ui Normal file
View File

@ -0,0 +1,410 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>addusers</class>
<widget class="QWidget" name="addusers">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>822</width>
<height>538</height>
</rect>
</property>
<property name="windowTitle">
<string>新增人员</string>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QWidget" name="widget" native="true">
<property name="styleSheet">
<string notr="true">QWidget{
border-top-left-radius: 12px;
border-top-right-radius: 12px;
color: rgb(0, 0, 0);
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1,
stop:0 rgba(0, 255, 255, 255) ,
stop:1 rgba(0, 144, 209, 255)
);
border-bottom-left-radius: 0px;
border-top-left-radius: 12px;
border-top-right-radius: 12px;
border-bottom-right-radius: 0px;
}
QLabel{
background: transparent;
}
QPushButton{
background: transparent;
}</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="styleSheet">
<string notr="true">font: bold 20px;
color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>新增人员</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QFrame" name="frame">
<property name="styleSheet">
<string notr="true">background-color: rgb(249, 249, 249);
border-top-left-radius: 0px;
border-top-right-radius: 0px;
border-bottom-left-radius: 12px;
border-bottom-right-radius: 12px;</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>266</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="3">
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>266</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="styleSheet">
<string notr="true">QPushButton {
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1,
stop:0 rgba(0, 255, 255, 255) ,
stop:1 rgba(0, 144, 209, 255)
);
color: rgb(255, 255, 255);
border-radius: 4px;
font: bold 10pt ;
}
</string>
</property>
<property name="text">
<string>保存</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton_2">
<property name="styleSheet">
<string notr="true">
border:1px solid rgb(214, 214, 214);
border-radius: 4px;</string>
</property>
<property name="text">
<string>取消</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="1">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1" colspan="2">
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="1">
<widget class="QLabel" name="label">
<property name="styleSheet">
<string notr="true">color: rgb(147, 147, 147);</string>
</property>
<property name="text">
<string>提示:用户名设置不能含中文,长度不能低于2位</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="lineEdit_3">
<property name="styleSheet">
<string notr="true">QLineEdit {
border: 1px solid rgb(175, 175, 175) ; /* 设置1px宽的灰色实线边框 */
border-radius: 2px; /* 边框圆角半径为4像素实现倒角效果 */
padding: 2px 4px; /* 可选设置内部文字的内边距这里示例上下2像素左右4像素 */
}</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_5">
<property name="styleSheet">
<string notr="true">font:12pt;</string>
</property>
<property name="text">
<string>角色:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="1">
<spacer name="verticalSpacer_7">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEdit_2">
<property name="styleSheet">
<string notr="true">QLineEdit {
border: 1px solid rgb(175, 175, 175) ; /* 设置1px宽的灰色实线边框 */
border-radius: 2px; /* 边框圆角半径为4像素实现倒角效果 */
padding: 2px 4px; /* 可选设置内部文字的内边距这里示例上下2像素左右4像素 */
}</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="styleSheet">
<string notr="true">font:12pt;</string>
</property>
<property name="text">
<string>用户名:</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QComboBox" name="comboBox_2">
<property name="styleSheet">
<string notr="true">
border: 1px solid rgb(175, 175, 175) ; /* 设置1px宽的灰色实线边框 */
border-radius: 2px; /* 边框圆角半径为4像素实现倒角效果 */
padding: 2px 4px; /* 可选设置内部文字的内边距这里示例上下2像素左右4像素 */
</string>
</property>
<item>
<property name="text">
<string>实验员</string>
</property>
</item>
<item>
<property name="text">
<string>管理员</string>
</property>
</item>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_3">
<property name="styleSheet">
<string notr="true">font:12pt;</string>
</property>
<property name="text">
<string>密码:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="1">
<widget class="QLabel" name="label_6">
<property name="styleSheet">
<string notr="true">color: rgb(147, 147, 147);</string>
</property>
<property name="text">
<string>提示密码设置需大于8位字符</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

132
addyaomin.cpp Normal file
View File

@ -0,0 +1,132 @@
#include "addyaomin.h"
#include "ui_addyaomin.h"
#include<QFileDialog>
QString id5;
addyaomin::addyaomin(QWidget *parent) :
QWidget(parent),
ui(new Ui::addyaomin)
{
ui->setupUi(this);
setWindowTitle("新增药敏板");
ui->widget->setFixedHeight(55);
ui->lineEdit->setFixedSize(301,32);
ui->lineEdit_2->setFixedSize(301,32);
ui->lineEdit_8->setFixedSize(301,32);
ui->pushButton->setFixedSize(76,37);
ui->pushButton_2->setFixedSize(76,37);
this->setWindowFlags(Qt::FramelessWindowHint); // 隐藏标题栏
this->setFixedSize(500,447);
ui->label_8->setFixedSize(173,130);
ui->label_8->setScaledContents(true);
this->setWindowFlags(Qt::FramelessWindowHint);//去除窗口边框
setAttribute(Qt::WA_TranslucentBackground);
}
addyaomin::~addyaomin()
{
delete ui;
}
void addyaomin::on_pushButton_clicked()
{
QSqlQuery query;
query.prepare("INSERT INTO yaominban (id, name, time, ren, peijian,tu) "
"VALUES (:id, :name, :time, :ren, :peijian, :tu)");
query.bindValue(":id", ui->lineEdit->text());
query.bindValue(":name", ui->lineEdit_2->text());
query.bindValue(":time", gettime());
query.bindValue(":ren", id5);
query.bindValue(":peijian", ui->lineEdit_8->text());
query.bindValue(":tu", data);
if(query.exec())
{
qDebug()<<"插入成功";
ui->lineEdit->clear();
ui->lineEdit_2->clear();
ui->lineEdit_8->clear();
ui->label_8->clear();
}
else{
qDebug() << "SQL error:" << query.lastError().text();}
emit xinzeng();
this->close();
}
QString addyaomin::getname()
{
QString sql=QString("select usersname from users where id='%1'").arg(id5);
qDebug()<<sql;
QSqlQuery query;
if(query.exec(sql))
{
if(query.first()){
QString str1=query.value(0).toString();
qDebug()<<str1;
return str1;
}
}
else
{
qDebug()<<"没查到名字";
}
}
QString addyaomin::gettime()
{
QDateTime dateTime= QDateTime::currentDateTime();//获取系统当前的时间
QString str = dateTime .toString("yyyy-MM-dd hh:mm:ss");//格式化时间
return str;
}
//导入配方文件
void addyaomin::on_pushButton_3_clicked()
{
QString filePath = QFileDialog::getOpenFileName(this, "导入配方文件");
qDebug()<<filePath;
ui->lineEdit_8->setText(filePath);
}
//导入配方图片
void addyaomin::on_pushButton_4_clicked()
{
ui->label->setGeometry(10, 10, 400, 300); // 设置位置和大小
ui->label->setAlignment(Qt::AlignCenter); // 设置对齐方式
QString aFile=QFileDialog::getOpenFileName(this,"选择图片文件");
qDebug()<<aFile;
QFile* file=new QFile(aFile); //fileName为二进制数据文件名
file->open(QIODevice::ReadOnly);
data = file->readAll();
// 加载图片
QPixmap pixmap(aFile); // 如果图片在资源文件中
if (!pixmap.isNull()) {
ui->label_8->setPixmap(pixmap.scaled(ui->label->size(), Qt::KeepAspectRatio));
} else {
ui->label_8->setText("Failed to load image");
}
}
void addyaomin::on_pushButton_5_clicked()
{
this->close();
emit xinzeng();
}
void addyaomin::on_pushButton_2_clicked()
{
this->close();
emit xinzeng();
}

44
addyaomin.h Normal file
View File

@ -0,0 +1,44 @@
#ifndef ADDYAOMIN_H
#define ADDYAOMIN_H
#include <QWidget>
#include <QSqlDatabase>
#include <QtSql/QSql>
#include <QtSql/QSqlDatabase>
#include <QtSql/QSqlQueryModel>
#include <QtSql/QSqlError>
#include <QSqlQuery>
#include<QDebug>
#include<QDateTime>
namespace Ui {
class addyaomin;
}
class addyaomin : public QWidget
{
Q_OBJECT
public:
explicit addyaomin(QWidget *parent = nullptr);
~addyaomin();
private slots:
void on_pushButton_clicked();
void on_pushButton_3_clicked();
void on_pushButton_4_clicked();
void on_pushButton_5_clicked();
void on_pushButton_2_clicked();
private:
Ui::addyaomin *ui;
QString getname();
QString gettime();
QByteArray data;
signals:
void xinzeng();
};
#endif // ADDYAOMIN_H

455
addyaomin.ui Normal file
View File

@ -0,0 +1,455 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>addyaomin</class>
<widget class="QWidget" name="addyaomin">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>503</width>
<height>517</height>
</rect>
</property>
<property name="windowTitle">
<string>新增药敏板</string>
</property>
<property name="styleSheet">
<string notr="true">border-top-left-radius: 12px;
border-top-right-radius: 12px;</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QFrame" name="frame">
<property name="styleSheet">
<string notr="true"> border-radius: 12px;
background-color: rgb(255, 255, 255);</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="1" column="1">
<spacer name="verticalSpacer_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="1">
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1">
<layout class="QGridLayout" name="gridLayout">
<item row="4" column="0">
<widget class="QPushButton" name="pushButton_3">
<property name="styleSheet">
<string notr="true">border-bottom:1px solid rgb(0, 170, 255);
border:transparent;
border-left:transparent;
border-right:transparent;
color: rgb(0, 170, 255);
background-color: transparent;
font: 10pt ;
padding-bottom: 5px ;
padding-right: 18px ; </string>
</property>
<property name="text">
<string>点击上传配方文件</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QLabel" name="label_8">
<property name="styleSheet">
<string notr="true">
border: 1px solid rgb(175, 175, 175) ; /* 设置1px宽的灰色实线边框 */
border-radius: 2px; /* 边框圆角半径为4像素实现倒角效果 */
padding: 2px 4px; /* 可选设置内部文字的内边距这里示例上下2像素左右4像素 */</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEdit_2">
<property name="styleSheet">
<string notr="true">
border: 1px solid rgb(175, 175, 175) ; /* 设置1px宽的灰色实线边框 */
border-radius: 2px; /* 边框圆角半径为4像素实现倒角效果 */
padding: 2px 4px; /* 可选设置内部文字的内边距这里示例上下2像素左右4像素 */</string>
</property>
<property name="text">
<string>真菌药敏试剂盒</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QPushButton" name="pushButton_4">
<property name="styleSheet">
<string notr="true">border-bottom:1px solid rgb(0, 170, 255);
border:transparent;
border-left:transparent;
border-right:transparent;
color: rgb(0, 170, 255);
background-color: transparent;
font: 10pt ;
padding-bottom: 5px ;
padding-right: 18px ; </string>
</property>
<property name="text">
<string>点击上传配方图片</string>
</property>
</widget>
</item>
<item row="3" column="1">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>15</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="1">
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>15</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="styleSheet">
<string notr="true">font:10pt;</string>
</property>
<property name="text">
<string> 项目名称:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label">
<property name="styleSheet">
<string notr="true">font:10pt;</string>
</property>
<property name="text">
<string> 项目编号:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>15</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEdit">
<property name="styleSheet">
<string notr="true">
border: 1px solid rgb(175, 175, 175) ; /* 设置1px宽的灰色实线边框 */
border-radius: 2px; /* 边框圆角半径为4像素实现倒角效果 */
padding: 2px 4px; /* 可选设置内部文字的内边距这里示例上下2像素左右4像素 */</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="lineEdit_8">
<property name="styleSheet">
<string notr="true">
border: 1px solid rgb(175, 175, 175) ; /* 设置1px宽的灰色实线边框 */
border-radius: 2px; /* 边框圆角半径为4像素实现倒角效果 */
padding: 2px 4px; /* 可选设置内部文字的内边距这里示例上下2像素左右4像素 */</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0" colspan="3">
<widget class="QWidget" name="widget" native="true">
<property name="styleSheet">
<string notr="true">QWidget{
border-top-left-radius: 12px;
border-top-right-radius: 12px;
color: rgb(0, 0, 0);
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1,
stop:0 rgba(0, 255, 255, 255) ,
stop:1 rgba(0, 144, 209, 255)
);
border-bottom-left-radius: 0px;
border-top-left-radius: 12px;
border-top-right-radius: 12px;
border-bottom-right-radius: 0px;
}
QLabel{
background: transparent;
}
QPushButton{
background: transparent;
}</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="1">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="styleSheet">
<string notr="true">font: bold 20px;
color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>新增药敏板</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="styleSheet">
<string notr="true">QPushButton {
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1,
stop:0 rgba(0, 255, 255, 255) ,
stop:1 rgba(0, 144, 209, 255)
);
color: rgb(255, 255, 255);
border-radius: 4px;
font: bold 10pt ;
}
</string>
</property>
<property name="text">
<string>确定</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton_2">
<property name="styleSheet">
<string notr="true">background-color: rgb(255, 255, 255);
border: 1px solid rgb(175, 175, 175) ;
border-radius: 4px;</string>
</property>
<property name="text">
<string>取消</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="2" column="2">
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>134</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

102
addzhong.cpp Normal file
View File

@ -0,0 +1,102 @@
#include "addzhong.h"
#include "ui_addzhong.h"
//QString id4;
addzhong::addzhong(QWidget *parent) :
QWidget(parent),
ui(new Ui::addzhong)
{
ui->setupUi(this);
setWindowTitle("新增菌种");
getshui();
ui->widget->setFixedHeight(55);
ui->lineEdit->setFixedSize(200,30);
ui->lineEdit_2->setFixedSize(200,30);
ui->pushButton->setFixedSize(76,37);
ui->pushButton_2->setFixedSize(76,37);
ui->comboBox->setFixedSize(200,30);
this->setWindowFlags(Qt::FramelessWindowHint); // 隐藏标题栏
this->setFixedSize(437,292);
this->setWindowFlags(Qt::FramelessWindowHint);//去除窗口边框
setAttribute(Qt::WA_TranslucentBackground);
}
addzhong::~addzhong()
{
delete ui;
}
void addzhong::getshui()
{
ui->comboBox->clear();
QString queryString = QString("SELECT name FROM junshu");
QSqlQuery mquery;
if (!mquery.exec(queryString)) {
}
while (mquery.next()) {
QVariant value = mquery.value(0); // 假设要获取的列是查询结果的第一列
ui->comboBox->addItem(value.toString());
}
}
void addzhong::on_pushButton_clicked()
{
QString sql=QString("INSERT INTO junzhong (id,name,time,ren,shuname) VALUES ('%1','%2','%3','%4','%5')")
.arg(ui->lineEdit->text()).arg(ui->lineEdit_2->text()).arg(gettime()).arg("1").arg(ui->comboBox->currentText());
qDebug()<<sql;
QSqlQuery query;
if(query.exec(sql))
{
qDebug()<<"插入成功";
ui->lineEdit_2->clear();
}
emit xinzeng();
this->close();
}
QString addzhong::getname()
{
// QString sql=QString("select usersname from users where id='%1'").arg(id4);
// qDebug()<<sql;
// QSqlQuery query;
// if(query.exec(sql))
// {
// if(query.first()){
// QString str1=query.value(0).toString();
// qDebug()<<str1;
// return str1;
// }
// }
// else
// {
// qDebug()<<"没查到名字";
// }
}
QString addzhong::gettime()
{
QDateTime dateTime= QDateTime::currentDateTime();//获取系统当前的时间
QString str = dateTime .toString("yyyy-MM-dd hh:mm:ss");//格式化时间
return str;
}
void addzhong::on_pushButton_3_clicked()
{
this->close();
}
void addzhong::on_pushButton_2_clicked()
{
emit xinzeng();
this->close();
}

40
addzhong.h Normal file
View File

@ -0,0 +1,40 @@
#ifndef ADDZHONG_H
#define ADDZHONG_H
#include <QWidget>
#include <QSqlDatabase>
#include <QtSql/QSql>
#include <QtSql/QSqlDatabase>
#include <QtSql/QSqlQueryModel>
#include <QtSql/QSqlError>
#include <QSqlQuery>
#include<QDebug>
#include<QDateTime>
namespace Ui {
class addzhong;
}
class addzhong : public QWidget
{
Q_OBJECT
public:
explicit addzhong(QWidget *parent = nullptr);
~addzhong();
void getshui();
private slots:
void on_pushButton_clicked();
void on_pushButton_3_clicked();
void on_pushButton_2_clicked();
private:
Ui::addzhong *ui;
QString getname();
QString gettime();
signals:
void xinzeng();
};
#endif // ADDZHONG_H

381
addzhong.ui Normal file
View File

@ -0,0 +1,381 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>addzhong</class>
<widget class="QWidget" name="addzhong">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>386</width>
<height>349</height>
</rect>
</property>
<property name="windowTitle">
<string>新增菌种</string>
</property>
<property name="styleSheet">
<string notr="true">QWidget{
border:transparent;
border-radius: 4px;
background-color: rgb(247, 247, 247)
}
QPushButton{
}
QLabel{
border:transparent;
}</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QFrame" name="frame">
<property name="styleSheet">
<string notr="true">border-radius: 12px;
border:transparent;
background-color: rgb(255, 255, 255);</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="1" column="1">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>81</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="7" column="1">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>81</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="styleSheet">
<string notr="true">QPushButton {
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1,
stop:0 rgba(0, 255, 255, 255) ,
stop:1 rgba(0, 144, 209, 255)
);
color: rgb(255, 255, 255);
border-radius: 4px;
font: bold 10pt ;
}
</string>
</property>
<property name="text">
<string>确定</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton_2">
<property name="styleSheet">
<string notr="true">background-color: rgb(255, 255, 255);
border: 1px solid rgb(175, 175, 175) ;
border-radius: 4px;</string>
</property>
<property name="text">
<string>取消</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="2" column="1" rowspan="2">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="styleSheet">
<string notr="true">font:12pt;</string>
</property>
<property name="text">
<string>项目名称:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEdit">
<property name="styleSheet">
<string notr="true">
border: 1px solid rgb(175, 175, 175) ; /* 设置1px宽的灰色实线边框 */
border-radius: 2px; /* 边框圆角半径为4像素实现倒角效果 */
padding: 2px 4px; /* 可选设置内部文字的内边距这里示例上下2像素左右4像素 */</string>
</property>
<property name="text">
<string>真菌药敏试剂盒</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="styleSheet">
<string notr="true">font:12pt;</string>
</property>
<property name="text">
<string>菌属名称:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBox">
<property name="styleSheet">
<string notr="true">/*QCombobox主体*/
QComboBox{
border: 1px solid rgb(175, 175, 175) ;
border-radius: 2px;
}
/*QCombobox右侧按钮*/
QComboBox::drop-down {
subcontrol-origin: padding;
subcontrol-position: top right;/*放于右方顶部*/
width: 30px;/*设置按钮范围宽度*/
/*border-radius: 15px;
border-left-width: 1px;
border-left-color: darkgray;
border-left-style: solid;*/
border-top-right-radius: 1px;/*设置边框圆角*/
border-bottom-right-radius: 1px;
/*padding-right: 50px;*/
}
/*QCombobox右侧按钮的箭头图标*/
QComboBox::down-arrow {
border-image: url(:/icon/arrow-down-s-line.png);
width: 20px;/*设置该图标的宽高*/
height: 20px;
}/</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="styleSheet">
<string notr="true">font:12pt;</string>
</property>
<property name="text">
<string>菌种名称:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEdit_2">
<property name="styleSheet">
<string notr="true">
border: 1px solid rgb(175, 175, 175) ; /* 设置1px宽的灰色实线边框 */
border-radius: 2px; /* 边框圆角半径为4像素实现倒角效果 */
padding: 2px 4px; /* 可选设置内部文字的内边距这里示例上下2像素左右4像素 */</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" colspan="3">
<widget class="QWidget" name="widget" native="true">
<property name="styleSheet">
<string notr="true">QWidget{
border-top-left-radius: 12px;
border-top-right-radius: 12px;
color: rgb(0, 0, 0);
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1,
stop:0 rgba(0, 255, 255, 255) ,
stop:1 rgba(0, 144, 209, 255)
);
border-bottom-left-radius: 0px;
border-top-left-radius: 12px;
border-top-right-radius: 12px;
border-bottom-right-radius: 0px;
}
QLabel{
background: transparent;
}
QPushButton{
background: transparent;
}</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="styleSheet">
<string notr="true">font: bold 20px;
color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>新增菌种</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

914
bachistoricalrecords.cpp Normal file
View File

@ -0,0 +1,914 @@
#include "bachistoricalrecords.h"
#include "ui_bachistoricalrecords.h"
#include <QFileDialog>
#include<QStandardItemModel>
#include<QMessageBox>
#include <QApplication>
#include <QWidget>
#include <QPainter>
#include <QImage>
#include <QFile>
#include <QTextDocument>
#include <QAxObject>
#include <QAxWidget>
#include<QGraphicsDropShadowEffect>
#include<QPrinter>
bachistoricalrecords::bachistoricalrecords(QWidget *parent) :
QWidget(parent),
ui(new Ui::bachistoricalrecords),
currentPage(1),
recordsPerPage(18),
totalPages(0),
currentModel(nullptr) // 初始化 currentModel
{
ui->setupUi(this);
this->setWindowFlags(Qt::FramelessWindowHint); // 隐藏标题栏
ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
ui->tableView->setSelectionBehavior(QAbstractItemView::SelectItems);
ui->tableView->setSelectionMode(QAbstractItemView::SingleSelection);
ui->tableView->setAlternatingRowColors(true);
model = new CheckBoxTableModel2(this);
model->setTable("xijun");// 打开数据库中名为“xijun”的表
model->select();
ui->tableView->setModel(model);
theSelection = new QItemSelectionModel(model);// 关联选择模型
connect(theSelection, SIGNAL(currentChanged(QModelIndex, QModelIndex)),
this, SLOT(on_currentChanged(QModelIndex, QModelIndex)));
ui->tableView->setSelectionModel(theSelection); // 设置选择模型
// 设置第一列的复选框初始状态
for (int i = 0; i < model->rowCount(); ++i) {
QModelIndex index = model->index(i, 0);
model->setData(index, Qt::Unchecked, Qt::CheckStateRole);
}
// 连接信号槽,当复选框状态改变时选中整行
connect(model, &CheckBoxTableModel2::dataChanged, this, &bachistoricalrecords::onDataChanged);
// 启用整行选择模式,允许多行选中
ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
ui->tableView->setSelectionMode(QAbstractItemView::MultiSelection);
// 连接点击信号
connect(ui->tableView, &QTableView::clicked, this, &bachistoricalrecords::onTableViewClicked);
// 设置自定义表头
header = new CheckBoxHeader2(Qt::Horizontal, ui->tableView);
ui->tableView->setHorizontalHeader(header);
connect(header, &CheckBoxHeader2::checkStateChanged, this, &bachistoricalrecords::onHeaderCheckStateChanged);
shuaxin();
// 创建界面组件与数据模型的字段之间的数据映射
dataMapper = new QDataWidgetMapper();
dataMapper->setModel(model);// 设置数据模型
dataMapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit);
m_maxtu = new maxtu;
connect(this, SIGNAL(yuan(QPixmap)), m_maxtu, SLOT(getyuan2(QPixmap)));
// connect(this, SIGNAL(lujing(QString)), m_maxtu, SLOT(getlujing2(QString)));
connect(this, SIGNAL(lujing(QString,QString)), m_maxtu, SLOT(getlujing2(QString,QString)));
ui->pushButton->setFixedSize(76, 37);
ui->pushButton_2->setFixedSize(76, 37);
ui->pushButton_4->setFixedSize(76, 37);
ui->frame->setFixedSize(170, 37);
ui->frame_2->setFixedSize(170, 37);
ui->tableView->setItemDelegateForColumn(2, &delegate);
ui->tableView->setItemDelegateForColumn(3, &delegate);
QTimer *timer;
timer = new QTimer(this);
connect(timer, &QTimer::timeout, this, [=]() {
QDateTime dateTime = QDateTime::currentDateTime();// 获取系统当前的时间
QString str = dateTime.toString("yyyy-MM-dd hh:mm:ss");// 格式化时间
// ui->label_5->setText(str);
});
timer->start(1000);
ui->tableView->setShowGrid(false);
ui->tableView->verticalHeader()->setVisible(false);
this->setWindowFlags(Qt::FramelessWindowHint); // 隐藏标题栏
delegate2 = new ButtonDelegate4;
ui->tableView->setItemDelegateForColumn(6, delegate2);
connect(delegate2, &ButtonDelegate4::deleteButtonClicked, this, &bachistoricalrecords::shanchu);
ui->tableView->setShowGrid(false);
ui->tableView->setFixedSize(1730, 760);
ui->tableView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
connect(ui->tableView, &QTableView::clicked, this, &bachistoricalrecords::onCellClicked);
m_date = new date;
connect(m_date, SIGNAL(kaishi(QString)), this, SLOT(getkaishi(QString)));
m_datee = new datee;
connect(m_datee, SIGNAL(kaishi(QString)), this, SLOT(getkaishii(QString)));
QGraphicsDropShadowEffect *shadow = new QGraphicsDropShadowEffect(this);
// 设置阴影距离
shadow->setOffset(0, 0);
// 设置阴影颜色
shadow->setColor(QColor(214, 214, 214));
// 设置阴影圆角
shadow->setBlurRadius(30);
// 给嵌套QWidget设置阴影
ui->frame_3->setFixedSize(1755, 907);
ui->frame_3->setGraphicsEffect(shadow);
CenteredItemDelegate2* delegate = new CenteredItemDelegate2();
ui->tableView->setItemDelegate(delegate);
for (int i = 1; i <= 7; ++i) {
ui->tableView->setColumnWidth(i, 275);
}
ui->tableView->setColumnWidth(0, 80);
ui->tableView->horizontalHeader()->setFixedHeight(40);
connect(m_maxtu, &maxtu::guanmeng, this, [=]() { mask_window.close(); });
ui->lineEdit_2->setFixedSize(56, 32);
QWidget *buttonContainer = new QWidget(this);
buttonLayout = new QHBoxLayout(buttonContainer);
ui->scrollArea->setWidget(buttonContainer);
ui->scrollArea->setWidgetResizable(true);
buttonGroup = new QButtonGroup(this);
totalPages = (model->rowCount() + recordsPerPage - 1) / recordsPerPage;
updateButtons();
ui->scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
ui->lineEdit_2->setFixedSize(56, 32);
getname();
ui->tableView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
ui->tableView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
}
bachistoricalrecords::~bachistoricalrecords()
{
delete ui;
}
void bachistoricalrecords::onDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
{
if (topLeft.column() == 0) {
bool checked = model->data(topLeft, Qt::CheckStateRole).toBool();
if (checked) {
// 选中整行
ui->tableView->selectRow(topLeft.row());
} else {
// 取消当前行的选中状态
QItemSelectionModel *selectionModel = ui->tableView->selectionModel();
selectionModel->select(topLeft, QItemSelectionModel::Deselect | QItemSelectionModel::Rows);
}
}
}
void bachistoricalrecords::onTableViewClicked(const QModelIndex &index)
{
// 如果点击的是第一列,直接返回
if (index.column() == 0) {
return;
}
// 获取复选框索引
QModelIndex checkBoxIndex = model->index(index.row(), 0);
// 切换复选框状态
bool isChecked = model->data(checkBoxIndex, Qt::CheckStateRole).toBool();
model->setData(checkBoxIndex, !isChecked ? Qt::Checked : Qt::Unchecked, Qt::CheckStateRole);
// 确保整行选择状态与复选框状态一致
if (!isChecked) {
ui->tableView->selectRow(index.row());
} else {
ui->tableView->selectionModel()->select(index, QItemSelectionModel::Deselect | QItemSelectionModel::Rows);
}
}
void bachistoricalrecords::onHeaderCheckStateChanged(Qt::CheckState state)
{
model->setAllCheckState(state);
if (state == Qt::Checked) {
for (int i = 0; i < model->rowCount(); ++i) {
ui->tableView->selectRow(i);
ui->tableView->selectAll();
}
} else {
ui->tableView->clearSelection();
}
}
void bachistoricalrecords::getname()
{/*
QString queryString2 = QString("SELECT id FROM users");
QSqlQuery mquery2;
if (!mquery2.exec(queryString2)) {
}
while (mquery2.next()) {
QVariant value = mquery2.value(0);
ui->comboBox->addItem(value.toString());
}*/
}
void bachistoricalrecords::getshuaxin()
{
qDebug()<<"刷新了";
QTimer::singleShot(100,this,[=](){shuaxin();});
}
void bachistoricalrecords::shanchu(const QModelIndex& index)
{
qDebug() << "删除按钮被点击,行: " << index.row() << " 列: " << index.column();
int result = QMessageBox::information(NULL, "提示", "确定要删除本行内容吗", QMessageBox::Ok | QMessageBox::Cancel);
if (result == QMessageBox::Ok) {
if (model->removeRow(index.row())) {
if (model->submitAll()) {
shuaxin(); // 重置视图,强制刷新界面显示
} else {
}
} else {
}
}
}
//刷新字段
void bachistoricalrecords::shuaxin()
{
// ui->lineEdit_3->setText("2025-01-01");
// // ...
// // 获取当前日期
// QDate currentDate = QDate::currentDate();
// // 日期加一天
// QDate nextDay = currentDate.addDays(1);
// // 将加一天后的日期以 "yyyy-MM-dd" 格式转为字符串并设置到 lineEdit_4 中
// ui->lineEdit_4->setText(nextDay.toString("yyyy-MM-dd"));
// QSqlQuery query;
// QString str=QString("SELECT * FROM xijun WHERE time BETWEEN '%1' AND '%2' ")
// .arg(ui->lineEdit_3->text())
// .arg(ui->lineEdit_4->text());
// qDebug() <<str;
// query.prepare(str);
// if (query.exec()) { // 确保查询执行成功
// // model = new QSqlQueryModel; // 更新 model
// model->setQuery(query); // 先设置查询,这样模型就会包含查询结果
model->setTable("xijun");
ui->tableView->setModel(model);
model->select();
ui->tableView->show();
model->setHeaderData(0, Qt::Horizontal, "序号");
model->setHeaderData(1, Qt::Horizontal, "用户");
model->setHeaderData(2, Qt::Horizontal, "原始照片");
model->setHeaderData(3, Qt::Horizontal, "结果照片");
model->setHeaderData(4, Qt::Horizontal, "计数");
model->setHeaderData(5, Qt::Horizontal, "时间");
model->setHeaderData(6, Qt::Horizontal, "操作");
qDebug() << "Model row count: " << model->rowCount();
totalPages = (model->rowCount() + recordsPerPage - 1) / recordsPerPage;
QString s = "" + QString::number(totalPages) + "";
ui->label_7->setText(s);
for (int i=0;i<=model->rowCount() ;i++ ) {
ui->tableView->setRowHeight(i,40);
}
for (int i=1;i<=7 ;i++ ) {
ui->tableView->setColumnWidth(i,275);
}
ui->tableView->setColumnWidth(0,80);
// } else {
// qDebug() << "Query failed:" << query.lastError().text();
// }
}
//pdf导出
void bachistoricalrecords::on_pushButton_2_clicked()
{
// QAbstractItemModel *model = ui->tableView->model();
// if (!model) {
// qDebug() << "No model set on the table view.";
// return;
// }
// // 获取选中的行
// QItemSelectionModel *selectionModel = ui->tableView->selectionModel();
// QModelIndexList selectedRows = selectionModel->selectedRows();
// if (selectedRows.isEmpty()) {
// qDebug() << "No rows selected.";
// return;
// }
// QString filePath = QFileDialog::getSaveFileName(this, "Export to CSV", "", "CSV Files (*.csv)");
// qDebug() << filePath;
// if (filePath.isEmpty()) {
// return;
// }
// QFile file(filePath);
// if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
// qDebug() << "Could not open file for writing:" << file.errorString();
// return;
// }
// QTextStream out(&file);
// // 写入表头可选跳过第七列索引为6
// int columnCount = model->columnCount();
// for (int col = 0; col < columnCount; ++col) {
// if (col == 6) {
// continue;
// }
// out << model->headerData(col, Qt::Horizontal, Qt::DisplayRole).toString();
// if (col < columnCount - 1 && col != 6) {
// out << ",";
// }
// }
// out << "\n";
// // 写入选中行的数据跳过第七列索引为6
// for (const QModelIndex &index : selectedRows) {
// int row = index.row();
// for (int col = 0; col < columnCount; ++col) {
// if (col == 6) {
// continue;
// }
// QVariant data = model->data(model->index(row, col), Qt::DisplayRole);
// out << data.toString().replace(",", ";");
// if (col < columnCount - 1 && col != 6) {
// out << ",";
// }
// }
// out << "\n";
// }
// file.close();
// qDebug() << "Selected data exported to CSV successfully.";
// 获取选中的行
QItemSelectionModel *selectionModel = ui->tableView->selectionModel();
QModelIndexList selectedRows = selectionModel->selectedRows();
if (selectedRows.isEmpty()) {
qDebug() << "没有选中任何行";
QMessageBox::warning(this, "导出失败", "未选中任何行。");
return;
}
// 弹出文件保存对话框获取用户选择的PDF文件路径
QString filePath = QFileDialog::getSaveFileName(this, "保存PDF文件", "", "PDF文件 (*.pdf)");
if (filePath.isEmpty()) {
qDebug() << "用户取消保存";
return;
}
// 创建QPrinter对象设置输出格式为PDF
QPrinter printer(QPrinter::HighResolution);
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setOutputFileName(filePath);
// 创建QPainter对象用于绘制PDF内容
QPainter painter;
if (!painter.begin(&printer)) {
qDebug() << "无法创建PDF文件";
return;
}
// 列宽设置
const int columnWidths[] = {300, 450, 2800, 2800, 400, 1500}; // 一到七列宽度
int columnSpacing = 100; // 列间距
int x = 400; // 起始横坐标
int y = 400; // 起始纵坐标
int lineHeight = 150; // 文字行高
int rowHeight = 2800; // 修改行高度为3000
int rowSpacing = 300; // 行间距300
int currentPage = 1;
int totalPages = (selectedRows.size() + 3) / 4; // 一页存放四条数据,重新计算总页数
// 绘制表头
QStringList headers = {"序号", "用户", "原始照片", "结果照片", "计数", "时间"};
for (int col = 0; col < headers.size(); ++col) {
painter.drawText(x, y, columnWidths[col], lineHeight, Qt::AlignCenter, headers[col]);
x += columnWidths[col] + columnSpacing;
}
y += 500; // 表头高度
x = 400;
// 遍历选中的行,分页绘制
for (int rowIndex = 0; rowIndex < selectedRows.size(); ++rowIndex) {
const QModelIndex &index = selectedRows[rowIndex];
QStringList rowData;
for (int col = 0; col < model->columnCount(); ++col) {
QModelIndex cellIndex = model->index(index.row(), col);
rowData << model->data(cellIndex).toString();
}
// 绘制行数据
x = 400;
for (int col = 0; col < rowData.size(); ++col) {
if (col == 2 || col == 3) { // 图片列
QString imagePath = rowData[col];
QPixmap pixmap(imagePath);
if (!pixmap.isNull()) {
pixmap = pixmap.scaled(columnWidths[col], columnWidths[col],
Qt::KeepAspectRatio, Qt::SmoothTransformation);
painter.drawPixmap(x, y - lineHeight, pixmap);
}
} else {
painter.drawText(x, y, columnWidths[col], lineHeight,
Qt::AlignCenter, rowData[col]);
}
x += columnWidths[col] + columnSpacing;
}
y += rowHeight + rowSpacing; // 加上行间距
x = 400;
// 分页处理
if ((rowIndex + 1) % 4 == 0 || rowIndex == selectedRows.size() - 1) {
// 绘制页码
QString pageText = QString("第 %1 页 共 %2 页").arg(currentPage).arg(totalPages);
painter.drawText(4300, y + 100, pageText);
if (rowIndex != selectedRows.size() - 1) {
printer.newPage();
y = 400;
currentPage++;
// 重新绘制表头
x = 400;
for (int col = 0; col < headers.size(); ++col) {
painter.drawText(x, y, columnWidths[col], lineHeight,
Qt::AlignCenter, headers[col]);
x += columnWidths[col] + columnSpacing;
}
y += 500;
x = 400;
}
}
}
painter.end();
qDebug() << "PDF文件已保存到: " << filePath;
QMessageBox::information(this, "导出","导出成功");
}
void bachistoricalrecords::onCellClicked(const QModelIndex &index) {
if (!model) {
qDebug() << "Model is null!";
return;
}
// 检查是否点击了第三行(索引为 2或第四行索引为 3
if (index.column() == 2 || index.column() == 3) {
int curRecNo = index.row();
QSqlRecord curRec = model->record(curRecNo);
qDebug() << "Record values:";
for (int i = 0; i < curRec.count(); ++i) {
qDebug() << curRec.fieldName(i) << ": " << curRec.value(i).toString();
}
// 获取 "yuanshi" 和 "jieguo" 字段的值
QString yuanshi = curRec.value("yuanshi").toString();
QString jieguo = curRec.value("jieguo").toString();
qDebug() << "yuanshi:" << yuanshi;
qDebug() << "jieguo:" << jieguo;
// 发送信号 lujing传递 yuanshi 和 jieguo 的值
emit lujing(yuanshi, jieguo);
mask_window.setWindowOpacity(0.2);
mask_window.setStyleSheet("background-color: black;");
mask_window.setGeometry(0, 0, 1920, 1080);
mask_window.setWindowFlags(Qt::FramelessWindowHint);
mask_window.show();
m_maxtu->setWindowModality(Qt::ApplicationModal);
m_maxtu->show();
}
}
// void bachistoricalrecords::onCellClicked(const QModelIndex &index) {
// if (!model) {
// qDebug() << "Model is null!";
// return;
// }
// if (index.column() == 2 || index.column() == 3) {
// int curRecNo = index.row();
// QSqlRecord curRec = model->record(curRecNo);
// qDebug() << "Record values:";
// for (int i = 0; i < curRec.count(); ++i) {
// qDebug() << curRec.fieldName(i) << ": " << curRec.value(i).toString();
// }
// QString fieldName = (index.column() == 2) ? "yuanshi" : "jieguo";
// QString lu = curRec.value(fieldName).toString();
// qDebug() << "lu:" << lu;
// emit lujing(lu);
// mask_window.setWindowOpacity(0.2);
// mask_window.setStyleSheet("background-color: black;");
// mask_window.setGeometry(0, 0, 1920, 1080);
// mask_window.setWindowFlags(Qt::FramelessWindowHint);
// mask_window.show();
// m_maxtu->setWindowModality(Qt::ApplicationModal);
// m_maxtu->show();
// }
// }
// void bachistoricalrecords::onCellClicked(const QModelIndex &index) {
// if (!model) {
// qDebug() << "Model is null!";
// return;
// }
// // 检查是否点击了第三行或第四行
// if (index.row() == 2 || index.row() == 3) {
// int curRecNo = index.row();
// QSqlRecord curRec = model->record(curRecNo);
// qDebug() << "Record values:";
// for (int i = 0; i < curRec.count(); ++i) {
// qDebug() << curRec.fieldName(i) << ": " << curRec.value(i).toString();
// }
// // 获取 "yuanshi" 和 "jieguo" 字段的值
// QString yuanshiValue = curRec.value("yuanshi").toString();
// QString jieguoValue = curRec.value("jieguo").toString();
// qDebug() << "yuanshi:" << yuanshiValue;
// qDebug() << "jieguo:" << jieguoValue;
// // 发送信号 lujing 和 lujing2
// emit lujing(yuanshiValue);
// emit lujing2(jieguoValue);
// mask_window.setWindowOpacity(0.2);
// mask_window.setStyleSheet("background-color: black;");
// mask_window.setGeometry(0, 0, 1920, 1080);
// mask_window.setWindowFlags(Qt::FramelessWindowHint);
// mask_window.show();
// m_maxtu->setWindowModality(Qt::ApplicationModal);
// m_maxtu->show();
// }
// }
void bachistoricalrecords::on_pushButton_6_clicked()
{
emit fanhui();
}
void bachistoricalrecords::on_toolButton_clicked()
{
int result = QMessageBox::information(NULL, "提示", "确定要退出运行吗", QMessageBox::Ok| QMessageBox::Cancel);
if (result == QMessageBox::Ok) {
emit guan();
emit tuichu2();
QTimer::singleShot(500,this,[=](){qApp->quit();
}) ;
}
}
void bachistoricalrecords::handleErrorAndRelease(QAxObject *workbook, QAxObject *workbooks, QAxWidget *excel) {
qDebug() << "操作出现错误,释放相关资源";
if (workbook) {
workbook->dynamicCall("Close()");
}
delete workbooks;
delete excel;
}
void bachistoricalrecords::on_pushButton_3_clicked()
{
m_date->move(200,170);
m_date->exec();
}
void bachistoricalrecords::on_pushButton_5_clicked()
{
m_datee->move(350,170);
m_datee->exec();
}
void bachistoricalrecords::getkaishi(QString str)
{
ui->lineEdit_3->setText(str);
}
void bachistoricalrecords::getkaishii(QString str)
{
ui->lineEdit_4->setText(str);
}
void bachistoricalrecords::onPageButtonClicked(int id) {
currentPage = id;
qDebug()<<id;
updatePage();
updateButtons();
}
void bachistoricalrecords::on_pushButton_10_clicked()
{
if (currentPage > 1) {
currentPage--;
updatePage();
updateButtons();
} else {
qDebug() << "已经是第一页,无法继续上一页操作";
}
}
void bachistoricalrecords::on_pushButton_9_clicked()
{
if (currentPage < totalPages) {
currentPage++;
updatePage();
updateButtons();
} else {
qDebug() << "已经是最后一页,无法继续下一页操作";
}
}
//跳转
void bachistoricalrecords::on_pushButton_11_clicked()
{
bool ok;
int page = ui->lineEdit_2->text().toInt(&ok);
if (ok) {
// 页码从 1 开始,所以减 1 转换为从 0 开始的索引
int targetPage = page ;
if (targetPage >= 0 && targetPage <= totalPages) {
currentPage = targetPage;
updatePage();
updateButtons();
} else {
qDebug() << "输入的页码超出范围,请输入 1 到 " << totalPages << " 之间的页码";
}
} else {
qDebug() << "输入的页码不合法,请输入一个有效的数字";
}
}
//重置
void bachistoricalrecords::on_pushButton_4_clicked()
{
shuaxin();
updatePage();
updateButtons();
}
//查询
void bachistoricalrecords::on_pushButton_clicked()
{
QSqlQuery query;
QString str=QString("SELECT * FROM xijun WHERE time BETWEEN '%1' AND '%2' ")
.arg(ui->lineEdit_3->text())
.arg(ui->lineEdit_4->text());
qDebug() <<str;
query.prepare(str);
if (query.exec()) { // 确保查询执行成功
model->setQuery(query); // 先设置查询,这样模型就会包含查询结果
ui->tableView->setModel(model);
ui->tableView->show();
model->setHeaderData(0, Qt::Horizontal, "序号");
model->setHeaderData(1, Qt::Horizontal, "用户");
model->setHeaderData(2, Qt::Horizontal, "原始照片");
model->setHeaderData(3, Qt::Horizontal, "结果照片");
model->setHeaderData(4, Qt::Horizontal, "计数");
model->setHeaderData(5, Qt::Horizontal, "时间");
model->setHeaderData(6, Qt::Horizontal, "操作");
totalPages = (model->rowCount() + recordsPerPage - 1) / recordsPerPage;
QString s = "" + QString::number(totalPages) + "";
ui->label_7->setText(s);
for (int i = 0; i <= model->rowCount(); i++) {
ui->tableView->setRowHeight(i, 40);
}
updateButtons();
qDebug() << "Model row count: " << model->rowCount();
for (int i=0;i<=model->rowCount() ;i++ ) {
ui->tableView->setRowHeight(i,40);
}
for (int i=0;i<=7 ;i++ ) {
ui->tableView->setColumnWidth(i,275);
}
ui->tableView->setColumnWidth(0,80);
} else {
qDebug() << "Query failed:" << query.lastError().text();
}
}
// void bachistoricalrecords::updateButtons()
// {
// QLayoutItem *item;
// while ((item = buttonLayout->takeAt(0)) != nullptr) {
// delete item->widget();
// delete item;
// }
// int startPage = std::max(1, currentPage - 4); // 计算起始页
// int endPage = std::min(totalPages, startPage + 9); // 计算结束页
// // 确保当前页在第五个位置
// if (endPage - startPage < 9 && currentPage - 4 > 0) {
// startPage = std::max(1, currentPage - (9 - (endPage - startPage)));
// endPage = std::min(totalPages, startPage + 9);
// }
// for (int i = startPage; i <= endPage; i++) {
// QPushButton *button = new QPushButton(QString::number(i), this);
// buttonLayout->addWidget(button);
// buttonGroup->addButton(button, i);
// // 设置当前页按钮样式
// if (i == currentPage) {
// button->setStyleSheet("QPushButton {color:rgb(0, 170, 255); }");
// } else {
// button->setStyleSheet("");
// }
// // 连接按钮点击信号到槽函数
// connect(button, &QPushButton::clicked, this, [=]() {
// currentPage = i;
// updatePage();
// updateButtons(); // 更新按钮样式
// });
// }
// for (int i = 0; i <= model->rowCount(); ++i) {
// ui->tableView->setRowHeight(i, 40);
// }
// for (int i = 0; i <= 7; ++i) {
// ui->tableView->setColumnWidth(i, 275);
// }
// ui->tableView->setColumnWidth(0, 80);
// }
// void bachistoricalrecords::updateButtons()
// {
// QLayoutItem *item;
// while ((item = buttonLayout->takeAt(0)) != nullptr) {
// delete item->widget();
// delete item;
// }
// int startPage = std::max(1, currentPage - 4); // 计算起始页
// int endPage = std::min(totalPages, startPage + 9); // 计算结束页
// // 确保当前页在第五个位置
// if (endPage - startPage < 9 && currentPage - 4 > 0) {
// startPage = std::max(1, currentPage - (9 - (endPage - startPage)));
// endPage = std::min(totalPages, startPage + 9);
// }
// int buttonCount = 0; // 用于记录按钮个数
// for (int i = startPage; i <= endPage; i++) {
// QPushButton *button = new QPushButton(QString::number(i), this);
// buttonLayout->addWidget(button);
// buttonGroup->addButton(button, i);
// // 设置当前页按钮样式
// if (i == currentPage) {
// button->setStyleSheet("QPushButton {color:rgb(0, 170, 255); }");
// } else {
// button->setStyleSheet("");
// }
// // 连接按钮点击信号到槽函数
// connect(button, &QPushButton::clicked, this, [=]() {
// currentPage = i;
// updatePage();
// updateButtons(); // 更新按钮样式
// });
// buttonCount++;
// }
// // 根据按钮个数设置 scrollArea 的宽度
// if (buttonCount == 1) {
// ui->scrollArea->setFixedWidth(30);
// } else if (buttonCount == 2) {
// ui->scrollArea->setFixedWidth(60);
// }
// for (int i = 0; i <= model->rowCount(); ++i) {
// ui->tableView->setRowHeight(i, 40);
// }
// for (int i = 0; i <= 7; ++i) {
// ui->tableView->setColumnWidth(i, 275);
// }
// ui->tableView->setColumnWidth(0, 80);
// }
void bachistoricalrecords::updateButtons()
{
QLayoutItem *item;
while ((item = buttonLayout->takeAt(0)) != nullptr) {
delete item->widget();
delete item;
}
int startPage = std::max(1, currentPage - 4); // 计算起始页
int endPage = std::min(totalPages, startPage + 9); // 计算结束页
// 确保当前页在第五个位置
if (endPage - startPage < 9 && currentPage - 4 > 0) {
startPage = std::max(1, currentPage - (9 - (endPage - startPage)));
endPage = std::min(totalPages, startPage + 9);
}
int buttonCount = 0; // 用于记录按钮个数
for (int i = startPage; i <= endPage; i++) {
QPushButton *button = new QPushButton(QString::number(i), this);
buttonLayout->addWidget(button);
buttonGroup->addButton(button, i);
// 设置当前页按钮样式
if (i == currentPage) {
button->setStyleSheet("QPushButton {color:rgb(0, 170, 255); }");
} else {
button->setStyleSheet("");
}
// 连接按钮点击信号到槽函数
connect(button, &QPushButton::clicked, this, [=]() {
currentPage = i;
updatePage();
updateButtons(); // 更新按钮样式
});
buttonCount++;
}
// 根据按钮个数设置 scrollArea 的宽度
if (buttonCount >= 1 && buttonCount <= 10) {
ui->scrollArea->setFixedWidth(buttonCount * 40);
}
for (int i = 0; i <= model->rowCount(); ++i) {
ui->tableView->setRowHeight(i, 40);
}
for (int i = 0; i <= 7; ++i) {
ui->tableView->setColumnWidth(i, 275);
}
ui->tableView->setColumnWidth(0, 80);
}
void bachistoricalrecords::updatePage()
{
if (model) {
int startIndex = (currentPage - 1) * recordsPerPage;
int endIndex = std::min(startIndex + recordsPerPage, model->rowCount());
for (int i = 0; i < model->rowCount(); ++i) {
ui->tableView->setRowHidden(i, i < startIndex || i >= endIndex);
}
for (int i = 0; i <= model->rowCount(); ++i) {
ui->tableView->setRowHeight(i, 40);
}
for (int i = 0; i <= 7; ++i) {
ui->tableView->setColumnWidth(i, 275);
}
ui->tableView->setColumnWidth(0, 80);
}
}

341
bachistoricalrecords.h Normal file
View File

@ -0,0 +1,341 @@
#ifndef BACHISTORICALRECORDS_H
#define BACHISTORICALRECORDS_H
#include <QApplication>
#include <QWidget>
#include <QtSql>
#include <QDataWidgetMapper>
#include <QSqlTableModel>
#include <QTableView>
#include <QStyledItemDelegate>
#include "maxtu.h"
#include <QStyledItemDelegate>
#include <QPainter>
#include <QStyleOptionButton>
#include <QApplication>
#include<QMouseEvent>
#include <QApplication>
#include <QWidget>
#include <QPainter>
#include <QImage>
#include <QFile>
#include <QTextDocument>
#include <QAxObject>
#include <QAxWidget>
#include <date.h>
#include<datee.h>
#include<QHBoxLayout>
#include<QScrollArea>
#include<QButtonGroup>
#include <QCheckBox>
#include <QHeaderView>
#include<QMouseEvent>
#include<QPainter>
class CheckBoxTableModel2 : public QSqlTableModel
{
Q_OBJECT
public:
CheckBoxTableModel2(QObject *parent = nullptr, QSqlDatabase db = QSqlDatabase())
: QSqlTableModel(parent, db) {}
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override
{
if (index.column() == 0 && role == Qt::CheckStateRole) {
// 返回复选框的状态
return m_checkStates.value(index.row(), Qt::Unchecked);
}
return QSqlTableModel::data(index, role);
}
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override
{
if (index.column() == 0 && role == Qt::CheckStateRole) {
// 设置复选框的状态
m_checkStates[index.row()] = value.toBool() ? Qt::Checked : Qt::Unchecked;
emit dataChanged(index, index, {role});
return true;
}
return QSqlTableModel::setData(index, value, role);
}
Qt::ItemFlags flags(const QModelIndex &index) const override
{
if (index.column() == 0) {
// 使第一列可选中
return QSqlTableModel::flags(index) | Qt::ItemIsUserCheckable;
}
return QSqlTableModel::flags(index);
}
void setAllCheckState(Qt::CheckState state)
{
for (int i = 0; i < rowCount(); ++i) {
QModelIndex index = this->index(i, 0);
setData(index, state, Qt::CheckStateRole);
}
}
private:
QHash<int, Qt::CheckState> m_checkStates; // 存储复选框的状态
};
class CheckBoxHeader2 : public QHeaderView
{
Q_OBJECT
public:
CheckBoxHeader2(Qt::Orientation orientation, QWidget *parent = nullptr)
: QHeaderView(orientation, parent), m_checkState(Qt::Unchecked) {}
protected:
void paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const override
{
painter->save();
QHeaderView::paintSection(painter, rect, logicalIndex);
painter->restore();
if (logicalIndex == 0) {
QStyleOptionButton option;
option.initFrom(this);
option.rect = QRect(rect.left() + 3, rect.top() + 13, 16, 16);
option.state = QStyle::State_Enabled | QStyle::State_Active;
if (m_checkState == Qt::Checked) {
option.state |= QStyle::State_On;
} else if (m_checkState == Qt::Unchecked) {
option.state |= QStyle::State_Off;
} else {
option.state |= QStyle::State_NoChange;
}
style()->drawPrimitive(QStyle::PE_IndicatorCheckBox, &option, painter, this);
}
}
void mousePressEvent(QMouseEvent *event) override
{
int logicalIndex = logicalIndexAt(event->pos());
if (logicalIndex == 0) {
if (m_checkState == Qt::Checked) {
m_checkState = Qt::Unchecked;
} else {
m_checkState = Qt::Checked;
}
updateSection(0);
emit checkStateChanged(m_checkState);
}
QHeaderView::mousePressEvent(event);
}
signals:
void checkStateChanged(Qt::CheckState state);
private:
Qt::CheckState m_checkState;
};
class CenteredItemDelegate2 : public QStyledItemDelegate {
public:
QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const override {
QWidget* editor = QStyledItemDelegate::createEditor(parent, option, index);
if (editor) {
editor->setStyleSheet("text-align: center;");
}
return editor;
}
void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override {
QStyleOptionViewItem opt = option;
opt.displayAlignment = Qt::AlignHCenter | Qt::AlignVCenter;
QStyledItemDelegate::paint(painter, opt, index);
}
};
class ButtonDelegate4 : public QStyledItemDelegate
{
Q_OBJECT
signals:
void editButtonClicked(const QModelIndex& index) const;
void deleteButtonClicked(const QModelIndex& index) const;
public:
using QStyledItemDelegate::QStyledItemDelegate;
// 创建编辑器这里我们不需要编辑器返回nullptr
QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const override
{
return nullptr;
}
// 重绘函数用于绘制按<E588B6><E68C89>?
void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override
{
if (index.column() == 6)
{
// 绘制删除按钮
QStyleOptionButton deleteButtonOption;
// deleteButtonOption.rect = option.rect;
deleteButtonOption.rect = option.rect;
deleteButtonOption.text = "删除";
deleteButtonOption.state = QStyle::State_Enabled;
deleteButtonOption.features |= QStyleOptionButton::Flat; // 设置为扁平样式,去除边框
QFontMetrics metrics(painter->font());
// 创建一个调色板对象
QPalette buttonPalette = QApplication::style()->standardPalette();
// 设置文本颜色为红色
buttonPalette.setColor(QPalette::ButtonText, Qt::red);
// 将调色板应用到按钮样式选项中
deleteButtonOption.palette = buttonPalette;
QApplication::style()->drawControl(QStyle::CE_PushButton, &deleteButtonOption, painter);
}
else
{
QStyledItemDelegate::paint(painter, option, index);
}
}
// 处理鼠标事件判断按钮点<E992AE><E782B9>?
bool editorEvent(QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index)
{
if (index.column() == 6 && event->type() == QEvent::MouseButtonPress)
{
QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
QRect cellRect = option.rect; // 使用更表意清晰的变量名表示单元格矩形区域
if (cellRect.contains(mouseEvent->pos()))
{
emit deleteButtonClicked(index);
return true;
}
}
return QStyledItemDelegate::editorEvent(event, model, option, index);
}
};
class ClickToViewDelegate : public QStyledItemDelegate
{
public:
using QStyledItemDelegate::QStyledItemDelegate;
QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const override
{
// 不允许编辑返回nullptr
return nullptr;
}
void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override
{
if (index.column() == 2 || index.column() == 3) // 第三列列索引从0开始计<E5A78B><E8AEA1>?
{
QString text = "点击查看";
QStyleOptionButton buttonOption;
buttonOption.rect = option.rect;
buttonOption.text = text;
buttonOption.state = QStyle::State_Enabled;
buttonOption.features |= QStyleOptionButton::Flat; // 璁剧疆涓烘墎骞虫牱寮忥紝鍘婚櫎杈规
QFontMetrics metrics(painter->font());
// 创建一个调色板对象
QPalette buttonPalette2 = QApplication::style()->standardPalette();
buttonPalette2.setColor(QPalette::ButtonText, QColor(0, 170, 255));
// 将调色板应用到按钮样式选项中
buttonOption.palette = buttonPalette2;
QApplication::style()->drawControl(QStyle::CE_PushButton, &buttonOption, painter);
}
else
{
QStyledItemDelegate::paint(painter, option, index);
}
}
};
namespace Ui {
class bachistoricalrecords;
}
class bachistoricalrecords : public QWidget
{
Q_OBJECT
public:
explicit bachistoricalrecords(QWidget *parent = nullptr);
~bachistoricalrecords();
void getname();
public slots:
void getshuaxin();
private slots:
void onCellClicked(const QModelIndex &index);
void on_pushButton_clicked();
void on_pushButton_2_clicked();
void on_pushButton_4_clicked();
void on_pushButton_6_clicked();
void shanchu(const QModelIndex& index);
void on_toolButton_clicked();
void on_pushButton_3_clicked();
void on_pushButton_5_clicked();
void getkaishi(QString str);
void getkaishii(QString str);
void onPageButtonClicked(int id);
void on_pushButton_10_clicked();
void on_pushButton_9_clicked();
void on_pushButton_11_clicked();
void onTableViewClicked(const QModelIndex &index);
void onDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
void onHeaderCheckStateChanged(Qt::CheckState state);
private:
CheckBoxHeader2 *header;
CheckBoxTableModel2* model;
QSqlQueryModel *currentModel; // 新增成员变量
void updateButtons();
int currentPage=0;
int totalPages;
int recordsPerPage=18;
void updatePage();
QButtonGroup *buttonGroup;
QHBoxLayout *buttonLayout;
QWidget mask_window;
void handleErrorAndRelease(QAxObject *workbook, QAxObject *workbooks, QAxWidget *excel);
Ui::bachistoricalrecords *ui;
QSqlQuery query;
void shuaxin();
QItemSelectionModel *theSelection; //选择模型
QDataWidgetMapper *dataMapper; //数据映射
maxtu *m_maxtu;
ClickToViewDelegate delegate;
ButtonDelegate4* delegate2;
date *m_date;
datee *m_datee;
signals:
void yuan(QPixmap p);
void jie(QPixmap p);
void fanhui();
void lujing(QString str1,QString str2);
void guan();
void tuichu2();//历史记录的退出
};
#endif // BACHISTORICALRECORDS_H

578
bachistoricalrecords.ui Normal file
View File

@ -0,0 +1,578 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>bachistoricalrecords</class>
<widget class="QWidget" name="bachistoricalrecords">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>3774</width>
<height>588</height>
</rect>
</property>
<property name="windowTitle">
<string>菌落计数历史记录</string>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(255, 255, 255);
font:14px;
color: rgb(81, 89, 108);</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QFrame" name="frame_3">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>15</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="horizontalSpacing">
<number>0</number>
</property>
<property name="verticalSpacing">
<number>6</number>
</property>
<item row="3" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>15</number>
</property>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>37</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>共10页</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_10">
<property name="styleSheet">
<string notr="true">border: transparent;</string>
</property>
<property name="text">
<string>上一页</string>
</property>
</widget>
</item>
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="styleSheet">
<string notr="true">border: transparent;
</string>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_3">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>858</width>
<height>256</height>
</rect>
</property>
</widget>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_9">
<property name="styleSheet">
<string notr="true">border: transparent;</string>
</property>
<property name="text">
<string>下一页</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_11">
<property name="styleSheet">
<string notr="true">border: transparent;</string>
</property>
<property name="text">
<string>跳转至</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_2">
<property name="styleSheet">
<string notr="true">border:1px solid rgb(227, 227, 227);
border-radius: 4px; </string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_9">
<property name="text">
<string>页</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QWidget" name="widget_3" native="true">
<layout class="QGridLayout" name="gridLayout_3">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="1" column="0">
<widget class="QTableView" name="tableView">
<property name="styleSheet">
<string notr="true">QTableView{ border: transparent;}
QTableView::item{ border: none;
text-align:center; /* 设置文本水平居中 */
}
QTableView::item:alternate{ background-color: rgba(229, 247, 255, 1); }
QTableView::item:selected {
background-color: rgb(196, 228, 255);
color: rgb(255, 255, 255);
}
QHeaderView::section:horizontal:frist {
padding:3px;
margin:0px;
color:#FFFFFF;
font: bold 11pt &quot;微软雅黑&quot;;
background: rgb(77,199,255);
border-top-left-radius:12px;
border-top-right-radius:0px;
border-bottom-left-radius:0px;
border-bottom-right-radius:0px;
}
QHeaderView::section:horizontal:middle {
padding:3px;
margin:0px;
color:#FFFFFF;
font: bold 11pt &quot;微软雅黑&quot;;
background: rgb(77,199,255);
border-radius:0px;
}
QHeaderView::section:horizontal:last {
padding:3px;
margin:0px;
color:#FFFFFF;
font: bold 11pt &quot;微软雅黑&quot;;
background: rgb(77,199,255);
border-top-left-radius:0px;
border-top-right-radius:15px;
border-bottom-left-radius:0px;
border-bottom-right-radius:0px;
}</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>15</number>
</property>
<property name="rightMargin">
<number>15</number>
</property>
<item>
<widget class="QLabel" name="label_2">
<property name="styleSheet">
<string notr="true">font:12pt</string>
</property>
<property name="text">
<string>日期:</string>
</property>
</widget>
</item>
<item>
<widget class="QFrame" name="frame">
<property name="styleSheet">
<string notr="true">background-color: rgb(255, 255, 255);
border: 1px solid rgba(74, 94, 226,0.7);
border-radius: 2px;
border: 1px solid gray; /* 设置1px宽的灰色实线边框 */
border-radius: 4px; /* 边框圆角半径为4像素实现倒角效果 */
padding: 2px 4px; /*</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLineEdit" name="lineEdit_3">
<property name="styleSheet">
<string notr="true"> border: 1px solid rgba(74, 94, 226,0.7);
border: transparent;
border-radius: 1px;
background-color: rgb(255, 255, 255);
color: rgb(0, 0, 0);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_3">
<property name="styleSheet">
<string notr="true">border: transparent;</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="img.qrc">
<normaloff>:/new/icon/date.png</normaloff>:/new/icon/date.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_11">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>5</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_8">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="img.qrc">:/new/icon/-.png</pixmap>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_12">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>5</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QFrame" name="frame_2">
<property name="styleSheet">
<string notr="true">background-color: rgb(255, 255, 255);
border: 1px solid rgba(74, 94, 226,0.7);
border-radius: 2px;
border: 1px solid gray; /* 设置1px宽的灰色实线边框 */
border-radius: 4px; /* 边框圆角半径为4像素实现倒角效果 */
padding: 2px 4px; /*</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLineEdit" name="lineEdit_4">
<property name="styleSheet">
<string notr="true"> border: 1px solid rgba(74, 94, 226,0.7);
border: transparent;
border-radius: 1px;
background-color: rgb(255, 255, 255);
color: rgb(0, 0, 0);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_5">
<property name="styleSheet">
<string notr="true">border: transparent;</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="img.qrc">
<normaloff>:/new/icon/date.png</normaloff>:/new/icon/date.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="styleSheet">
<string notr="true">QPushButton {
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1,
stop:0 rgba(0, 255, 255, 255) ,
stop:1 rgba(0, 144, 209, 255)
);
color: rgb(255, 255, 255);
border-radius: 4px;
font: bold 10pt ;
}
</string>
</property>
<property name="text">
<string>查询</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_18">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton_4">
<property name="styleSheet">
<string notr="true">border-radius: 4px;
background-color: rgb(255, 255, 255);
border: 1px solid gray;</string>
</property>
<property name="text">
<string>重置</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit"/>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_5"/>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton_2">
<property name="styleSheet">
<string notr="true">border-radius: 4px;
background-color: rgb(255, 255, 255);
border: 1px solid gray;</string>
</property>
<property name="text">
<string>导出</string>
</property>
<property name="icon">
<iconset resource="img.qrc">
<normaloff>:/new/icon/Frame (2).png</normaloff>:/new/icon/Frame (2).png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="img.qrc"/>
</resources>
<connections/>
</ui>

2146
bacteria.cpp Normal file

File diff suppressed because it is too large Load Diff

200
bacteria.h Normal file
View File

@ -0,0 +1,200 @@
#ifndef BACTERIA_H
#define BACTERIA_H
#include <QWidget>
#include <QMainWindow>
#include <QCamera> //管理摄像头的大类
//#include <QCameraInfo> //管理摄像头设别表
// #include <QCameraViewfinder> //管理摄像头显示区域
// #include <QCameraImageCapture> //管理图片
// #include<IMVDefines.h>
// #include<IMVApi.h>
#include "IMVDefines.h"
#include "IMVApi.h"
#include<QMediaDevices>
#include<QMediaCaptureSession>
#include <QMediaRecorder>
#include <QImageCapture>
#include <QVideoWidget>
#include <QVideoSink>
#include <QtSql>
#include <QDataWidgetMapper>
#include <QSqlTableModel>
#include <QTableView>
#include "bachistoricalrecords.h"
#include "cammer.h"
#include <QSerialPort>
#include <QSerialPortInfo>
#include<QTimer>
#include <QMouseEvent>
#include <QPainter>
#include<QLabel>
#include<QListWidgetItem>
#include<QTableWidgetItem>
#include<QMessageBox>
#include "zidingyi.h"
#include "msgbox.h"
extern int count;
namespace Ui {
class bacteria;
}
class bacteria : public QWidget
{
Q_OBJECT
public:
explicit bacteria(QWidget *parent = nullptr);
~bacteria();
HANDLE hthread;
bool issave=false;
void savezhao();
bool jixu=true;//用于取消时不再进行之后操作
public slots:
void getxinhao(QString p);
private slots:
void showtu();
void on_tableWidget_3_itemClicked(QTableWidgetItem *item);
void on_pushButton_clicked();
void on_pushButton_3_clicked();
void on_pushButton_4_clicked();
void on_pushButton_2_clicked();
void on_pushButton_5_clicked();
// void on_pushButton_6_clicked();
// void on_pushButton_7_clicked();
void getguan();
void getkai();
// void on_checkBox_clicked();
// void on_checkBox_2_clicked();
void on_horizontalSlider_valueChanged(int value);
void on_horizontalSlider_2_valueChanged(int value);
void on_horizontalSlider_5_valueChanged(int value);
void on_horizontalSlider_6_valueChanged(int value);
void on_horizontalSlider_7_valueChanged(int value);
void getming(QString s);
void on_pushButton_6_clicked();
void on_pushButton_7_clicked();
void on_pushButton_8_clicked();
void on_pushButton_9_clicked();
void on_pushButton_10_clicked();
void on_pushButton_11_clicked();
void on_pushButton_12_clicked();
void on_pushButton_13_clicked();
void on_pushButton_14_clicked();
private:
QString getProcessName(DWORD pid);
QList<DWORD> getProcessIdsByName(const QString& processName);
bool terminateProcess(pid_t pid) ;
// 停止标志位
bool stopFlag = false;
bool stopbreak = false;
void usepython();
void usepython_slow(QString yuan,QString jie);
void usepython_quick(QString yuan,QString jie);
QFuture<void> f;
zidingyi *m_zidingyi;
msgBox *m_msgBox;
int row=0;
QTimer *timer;
Ui::bacteria *ui;
IMV_HANDLE handle;
void drawOnLabelPixmap(QLabel* label, QPoint adjustedPos);
void drawOnLabelPixmap2(QLabel* label, QPoint adjustedPos);
QString getname();
QString gettime();
QCamera *Camera; //使用这个类,实例化出来,用指针接收
// QList<QCameraInfo> Infolist; //用于保存可用摄像头
// QCameraViewfinder *Viewfinder;
// QCameraImageCapture *ImageCapture;
QList<QCameraDevice> list_cameras;
QScopedPointer<QCamera> my_camera;
QScopedPointer<QMediaRecorder> my_mediaRecorder;
QMediaCaptureSession my_captureSession;
QImageCapture *imageCapture;
bool camera_state;
bachistoricalrecords *m_bachistoricalrecords;
QVideoWidget *w;
QTimer m_staticTimer;
cammer m_cammer;
QSerialPort SerialPort;
QList<QPoint> leftClickPoints;
QList<QPoint> rightClickPoints;
int x;
int y;
int gouxuan;
int a=0;
int radius=5 ;
void baocun();
bool eventFilterEnabled=true;
QString pix;//读取的照片路径
bool jishu;//确定是否要将本地照片进行计数
protected:
void mousePressEvent(QMouseEvent *event) override;
void wheelEvent(QWheelEvent *event) override ;
bool eventFilter(QObject *obj, QEvent *event){
if (!eventFilterEnabled) {
return QObject::eventFilter(obj, event);
}
// 只处理鼠标按下事件
if (event->type() == QEvent::MouseButtonPress) {
QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
// 只允许处理左键点击
if (mouseEvent->button() == Qt::LeftButton||
mouseEvent->button() == Qt::RightButton) {
qDebug() << "点击事件被拦截";
return true; // 拦截非左键点击事件
} else {
qDebug() << "非点击事件正常";
return QObject::eventFilter(obj, event);
}
}
// 继续处理其他类型的事件
return QObject::eventFilter(obj, event);
}
signals:
void shuaxin();
void tuichu();
void show();
};
#endif // BACTERIA_H

931
bacteria.ui Normal file
View File

@ -0,0 +1,931 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>bacteria</class>
<widget class="QWidget" name="bacteria">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1920</width>
<height>703</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<property name="styleSheet">
<string notr="true">QSlider#horizontalSlider::groove:horizontal {
border: none;
height: 6px;
border-radius: 3px;
background: lightgray;
}
QSlider#horizontalSlider::handle:horizontal {
border: none;
margin: -5px 0px; /* 上下边距和左右边距*/
width: 16px;
height: 16px;
border-radius: 8px;
background: rgb(35, 215, 255);
}
/*划过部分*/
QSlider#horizontalSlider::sub-page:horizontal {
background: rgb(0, 170, 255);
height: 4px;
border-radius: 1px;
}
/*未划过部分*/
QSlider#horizontalSlider::add-page:horizontal {
background: rgb(255, 255, 255);
height: 4px;
border-radius: 3px;
}</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="1" column="0">
<layout class="QGridLayout" name="gridLayout_5">
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="2">
<widget class="QFrame" name="frame_2">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="spacing">
<number>0</number>
</property>
<item row="1" column="0">
<widget class="QTableWidget" name="tableWidget_3">
<property name="styleSheet">
<string notr="true"> border: none;</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="pushButton_7">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="img.qrc">
<normaloff>:/new/icon/shang.png</normaloff>:/new/icon/shang.png</iconset>
</property>
<property name="iconSize">
<size>
<width>60</width>
<height>16</height>
</size>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="pushButton_8">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="img.qrc">
<normaloff>:/new/icon/xia.png</normaloff>:/new/icon/xia.png</iconset>
</property>
<property name="iconSize">
<size>
<width>60</width>
<height>16</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="0">
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QFrame" name="frame_3">
<property name="styleSheet">
<string notr="true">background-color: rgb(0, 0, 0);</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="cammer" name="widget_3" native="true">
<property name="styleSheet">
<string notr="true"> margin-left: 0px;</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_4">
<property name="styleSheet">
<string notr="true">background-color: rgb(0, 0, 0);</string>
</property>
<property name="text">
<string>111</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="styleSheet">
<string notr="true">background-color: rgb(0, 0, 0);</string>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>350</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="styleSheet">
<string notr="true">QPushButton {
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1,
stop:0 rgba(0, 255, 255, 255) ,
stop:1 rgba(0, 144, 209, 255)
);
color: rgb(255, 255, 255);
border-radius: 4px;
font: bold 10pt ;
}
</string>
</property>
<property name="text">
<string>拍照</string>
</property>
<property name="icon">
<iconset resource="img.qrc">
<normaloff>:/new/icon/Vector (3).png</normaloff>:/new/icon/Vector (3).png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_4">
<property name="styleSheet">
<string notr="true">QPushButton {
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1,
stop:0 rgba(0, 255, 255, 255) ,
stop:1 rgba(0, 144, 209, 255)
);
color: rgb(255, 255, 255);
border-radius: 4px;
}
</string>
</property>
<property name="text">
<string>重新拍照</string>
</property>
<property name="icon">
<iconset resource="img.qrc">
<normaloff>:/new/icon/Vector (3).png</normaloff>:/new/icon/Vector (3).png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_12">
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>720</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label">
<property name="styleSheet">
<string notr="true">font:10pt;</string>
</property>
<property name="text">
<string>计数结果:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="styleSheet">
<string notr="true">font:12pt;</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_11">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>30</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton_3">
<property name="styleSheet">
<string notr="true">QPushButton {
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1,
stop:0 rgba(0, 255, 255, 255) ,
stop:1 rgba(0, 144, 209, 255)
);
color: rgb(255, 255, 255);
border-radius: 4px;
}
</string>
</property>
<property name="text">
<string>计数</string>
</property>
<property name="icon">
<iconset resource="img.qrc">
<normaloff>:/new/icon/Frame (3).png</normaloff>:/new/icon/Frame (3).png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_6">
<property name="styleSheet">
<string notr="true">QPushButton {
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1,
stop:0 rgba(0, 255, 255, 255) ,
stop:1 rgba(0, 144, 209, 255)
);
color: rgb(255, 255, 255);
border-radius: 4px;
font: bold 10pt ;
}
</string>
</property>
<property name="text">
<string>读取文件</string>
</property>
<property name="icon">
<iconset resource="img.qrc">
<normaloff>:/new/icon/Frame (3).png</normaloff>:/new/icon/Frame (3).png</iconset>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>280</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QWidget" name="widget_2" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_7">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="pushButton_2">
<property name="styleSheet">
<string notr="true">QPushButton {
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1,
stop:0 rgba(0, 255, 255, 255) ,
stop:1 rgba(0, 144, 209, 255)
);
color: rgb(255, 255, 255);
border-radius: 4px;
font: bold 10pt ;
}
</string>
</property>
<property name="text">
<string>连接相机</string>
</property>
<property name="icon">
<iconset resource="img.qrc">
<normaloff>:/new/icon/Vector (2).png</normaloff>:/new/icon/Vector (2).png</iconset>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton_13">
<property name="styleSheet">
<string notr="true">QPushButton {
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1,
stop:0 rgba(0, 255, 255, 255) ,
stop:1 rgba(0, 144, 209, 255)
);
color: rgb(255, 255, 255);
border-radius: 4px;
font: bold 10pt ;
}
</string>
</property>
<property name="text">
<string>审查模式</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_14">
<property name="styleSheet">
<string notr="true">QPushButton {
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1,
stop:0 rgba(0, 255, 255, 255) ,
stop:1 rgba(0, 144, 209, 255)
);
color: rgb(255, 255, 255);
border-radius: 4px;
font: bold 10pt ;
}
</string>
</property>
<property name="text">
<string>保存</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>0</number>
</property>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton_9">
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_10">
<property name="text">
<string>dayin</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_11">
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>上光源</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="horizontalSlider">
<property name="styleSheet">
<string notr="true">QSlider::groove:horizontal {
border: none;
height: 6px;
border-radius: 3px;
background: lightgray;
}
QSlider::handle:horizontal {
border: none;
margin: -5px 0px; /* 上下边距和左右边距*/
width: 16px;
height: 16px;
border-radius: 8px;
image: url(:/new/icon/yuan.png);
}
/*划过部分*/
QSlider::sub-page:horizontal {
background-color: rgb(0, 170, 255);
height: 4px;
border-radius:3px;
}
/*未划过部分*/
QSlider::add-page:horizontal {
background: rgb(208, 208, 208);
height: 4px;
border-radius: 3px;
}</string>
</property>
<property name="maximum">
<number>255</number>
</property>
<property name="value">
<number>76</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::NoTicks</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_8">
<property name="text">
<string>下光源</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="horizontalSlider_2">
<property name="styleSheet">
<string notr="true">QSlider::groove:horizontal {
border: none;
height: 6px;
border-radius: 3px;
background: lightgray;
}
QSlider::handle:horizontal {
border: none;
margin: -5px 0px; /* 上下边距和左右边距*/
width: 16px;
height: 16px;
border-radius: 8px;
image: url(:/new/icon/yuan.png);
}
/*划过部分*/
QSlider::sub-page:horizontal {
background-color: rgb(0, 170, 255);
height: 4px;
border-radius:3px;
}
/*未划过部分*/
QSlider::add-page:horizontal {
background: rgb(208, 208, 208);
height: 4px;
border-radius: 3px;
}</string>
</property>
<property name="maximum">
<number>255</number>
</property>
<property name="value">
<number>0</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_9">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_11">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_18">
<property name="text">
<string>检测半径</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="horizontalSlider_7">
<property name="styleSheet">
<string notr="true">QSlider::groove:horizontal {
border: none;
height: 6px;
border-radius: 3px;
background: lightgray;
}
QSlider::handle:horizontal {
border: none;
margin: -5px 0px; /* 上下边距和左右边距*/
width: 16px;
height: 16px;
border-radius: 8px;
image: url(:/new/icon/yuan.png);
}
/*划过部分*/
QSlider::sub-page:horizontal {
background-color: rgb(0, 170, 255);
height: 4px;
border-radius:3px;
}
/*未划过部分*/
QSlider::add-page:horizontal {
background: rgb(208, 208, 208);
height: 4px;
border-radius: 3px;
}</string>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>92</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_19">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<property name="spacing">
<number>10</number>
</property>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_14">
<property name="text">
<string>阈值下限</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="horizontalSlider_5">
<property name="styleSheet">
<string notr="true">QSlider::groove:horizontal {
border: none;
height: 6px;
border-radius: 3px;
background: lightgray;
}
QSlider::handle:horizontal {
border: none;
margin: -5px 0px; /* 上下边距和左右边距*/
width: 16px;
height: 16px;
border-radius: 8px;
image: url(:/new/icon/yuan.png);
}
/*划过部分*/
QSlider::sub-page:horizontal {
background-color: rgb(0, 170, 255);
height: 4px;
border-radius:3px;
}
/*未划过部分*/
QSlider::add-page:horizontal {
background: rgb(208, 208, 208);
height: 4px;
border-radius: 3px;
}</string>
</property>
<property name="singleStep">
<number>1</number>
</property>
<property name="value">
<number>43</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::NoTicks</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_15">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<property name="spacing">
<number>10</number>
</property>
<item>
<widget class="QLabel" name="label_16">
<property name="text">
<string>阈值上限</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="horizontalSlider_6">
<property name="styleSheet">
<string notr="true">QSlider::groove:horizontal {
border: none;
height: 6px;
border-radius: 3px;
background: lightgray;
}
QSlider::handle:horizontal {
border: none;
margin: -5px 0px; /* 上下边距和左右边距*/
width: 16px;
height: 16px;
border-radius: 8px;
image: url(:/new/icon/yuan.png);
}
/*划过部分*/
QSlider::sub-page:horizontal {
background-color: rgb(0, 170, 255);
height: 4px;
border-radius:3px;
}
/*未划过部分*/
QSlider::add-page:horizontal {
background: rgb(208, 208, 208);
height: 4px;
border-radius: 3px;
}</string>
</property>
<property name="value">
<number>99</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_17">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="pushButton_5">
<property name="styleSheet">
<string notr="true"> border: 1px solid rgb(175, 175, 175) ; </string>
</property>
<property name="text">
<string>历史记录</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>cammer</class>
<extends>QWidget</extends>
<header location="global">cammer.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="img.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -0,0 +1,21 @@
QMAKE_CXX.QT_COMPILER_STDCXX = 201703L
QMAKE_CXX.QMAKE_GCC_MAJOR_VERSION = 11
QMAKE_CXX.QMAKE_GCC_MINOR_VERSION = 2
QMAKE_CXX.QMAKE_GCC_PATCH_VERSION = 0
QMAKE_CXX.COMPILER_MACROS = \
QT_COMPILER_STDCXX \
QMAKE_GCC_MAJOR_VERSION \
QMAKE_GCC_MINOR_VERSION \
QMAKE_GCC_PATCH_VERSION
QMAKE_CXX.INCDIRS = \
C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++ \
C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/x86_64-w64-mingw32 \
C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/backward \
C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include \
C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include-fixed \
C:/Qt/Tools/mingw1120_64/x86_64-w64-mingw32/include
QMAKE_CXX.LIBDIRS = \
C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0 \
C:/Qt/Tools/mingw1120_64/lib/gcc \
C:/Qt/Tools/mingw1120_64/x86_64-w64-mingw32/lib \
C:/Qt/Tools/mingw1120_64/lib

Some files were not shown because too many files have changed in this diff Show More