linux 下qt调用大恒图像水星相机

1. 开发环境

系统 :ubuntu 19.04

开发工具 : Qt Creator4.3.1

语言 : linux C

2. 程序功能

金星相机的显示,

金星相机的存图

金星相机曝光

触发模式

像素格式

触发源等的设

3.

//MainWindos


#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    m_pobjAcqThread(NULL),
    m_hDevice(NULL),
    m_pobjShowImgTimer(NULL),
    m_bAcquisitionStart(false)
{    
    ui->setupUi(this);
    m_pobjShowImgTimer = new QTimer(this);
    connect(m_pobjShowImgTimer, SIGNAL(timeout()), this, SLOT(slotShowImage()));

//    // Connect image save signal and slot non-blocking
//    connect(this, SIGNAL(SigSaveImage()), this, SLOT(slotSaveImageFile()), Qt::QueuedConnection);

    // Release GxiApi libary
    GX_STATUS emStatus = GX_STATUS_SUCCESS;
    emStatus = GXInitLib();
    if (emStatus != GX_STATUS_SUCCESS)
    {
        ShowErrorString(emStatus);
    }
    UpdateUI();
}

MainWindow::~MainWindow()
{

    if (m_bAcquisitionStart)
    {
        m_pobjAcqThread->m_bAcquisitionThreadFlag = false;
        m_pobjAcqThread->quit();
        m_pobjAcqThread->wait();
    }

    // Release GxiApi libary
    GX_STATUS emStatus = GX_STATUS_SUCCESS;
    emStatus = GXCloseLib();
    if (emStatus != GX_STATUS_SUCCESS)
    {
        ShowErrorString(emStatus);
    }
    delete ui;
}

void MainWindow::ClearUI()
{

    // Clear Items in ComboBox
    ui->PixelFormat->clear();
    ui->TriggerMode->clear();
    ui->TriggerSource->clear();

    // Clear show image label
    ui->ImageLabel->clear();

    return;
}

//----------------------------------------------------------------------------------
void MainWindow::UpdateUI()
{
    ui->UpdateDeviceList->setEnabled(!m_bOpen);
    ui->DeviceList->setEnabled(!m_bOpen);
    ui->OpenDevice->setEnabled(ui->DeviceList->count() > 0 && !m_bOpen);
    ui->CloseDevice->setEnabled(m_bOpen);
    ui->Capture_Control->setEnabled(m_bOpen);

    ui->StartAcquisition->setEnabled(!m_bAcquisitionStart);
    ui->StopAcquisition->setEnabled(m_bAcquisitionStart);

    ui->PixelFormat->setEnabled(!m_bAcquisitionStart);

}

//----------------------------------------------------------------------------------
/**
/Show images acquired and processed(slot)
\param[in]
\param[out]
\return void
*/
//----------------------------------------------------------------------------------
void MainWindow::slotShowImage()
{
    // If acquisition did not started
    if (!m_bAcquisitionStart)
    {
        return;
    }

    // Get Image from image show queue, if image show queue is empty, return directly
    QImage* qobjImgShow = m_pobjAcqThread->PopFrontFromShowImageDeque();
    if(qobjImgShow == NULL)
    {
        return;
    }

    if (m_bSaveImage)
    {

        QString pictrureName="../img/1.jpg";
        qobjImgShow->save(pictrureName, "JPG", 100);
    }

    // Display the image
    QImage objImgScaled = qobjImgShow->scaled(ui->ImageLabel->width(), ui->ImageLabel->height(),
                                              Qt::IgnoreAspectRatio, Qt::FastTransformation);
    ui->ImageLabel->setPixmap(QPixmap::fromImage(objImgScaled));

    // Display is finished, push back image buffer to buffer queue
    m_pobjAcqThread->PushBackToEmptyBufferDeque(qobjImgShow);

    // Calculate image showing frame rate
    m_ui32ShowCount++;

    // m_objFps.IncreaseFrameNum();

    return;
}
//----------------------------------------------------------------------------------
/**
\brief  Enumerate Devcie List, Get baseinfo of these devices
\param[in]
\param[out]
\return
*/
//----------------------------------------------------------------------------------
void MainWindow::UpdateDeviceList()
{

    // Release GxiApi libary
    GX_STATUS emStatus = GX_STATUS_SUCCESS;

    // If base info exist, delete it firstly
    //RELEASE_ALLOC_ARR(m_pstBaseInfo);

    // Enumerate Devcie List
    emStatus = GXUpdateDeviceList(&m_ui32DeviceNum, ENUMRATE_TIME_OUT);
    GX_VERIFY(emStatus);
    // If avalible devices enumerated, get base info of enumerate devices
    if(m_ui32DeviceNum > 0)
    {
        // Alloc resourses for device baseinfo
        try
        {

            m_pstBaseInfo = new GX_DEVICE_BASE_INFO[m_ui32DeviceNum];

        }
        catch (std::bad_alloc &e)
        {
            QMessageBox::about(NULL, "Allocate memory error", "Cannot allocate memory, please exit this app!");
            // RELEASE_ALLOC_MEM(m_pstBaseInfo);
            return;
        }

        // Set size of function "GXGetAllDeviceBaseInfo"
        size_t nSize = m_ui32DeviceNum * sizeof(GX_DEVICE_BASE_INFO);

        // Get all device baseinfo
        emStatus = GXGetAllDeviceBaseInfo(m_pstBaseInfo, &nSize);
        if (emStatus != GX_STATUS_SUCCESS)
        {
            RELEASE_ALLOC_ARR(m_pstBaseInfo);
            ShowErrorString(emStatus);

            // Reset device number
            m_ui32DeviceNum = 0;

            return;
        }
    }

    return;
}
//----------------------------------------------------------------------------------
/**
\Open Device
\param[in]
\param[out]
\return void
*/
//----------------------------------------------------------------------------------
void MainWindow::OpenDevice()
{
    GX_STATUS emStatus = GX_STATUS_SUCCESS;

    emStatus = GXOpenDeviceByIndex(ui->DeviceList->currentIndex() + 1, &m_hDevice);
    GX_VERIFY(emStatus);

    // isOpen flag set true
    m_bOpen = true;

    return;
}

//----------------------------------------------------------------------------------
/**
\Setup acquisition thread
\param[in]
\param[out]
\return void
*/
//----------------------------------------------------------------------------------
void MainWindow::SetUpAcquisitionThread()
{

    // if Acquisition thread is on Stop acquisition thread
    if (m_pobjAcqThread != NULL)
    {

        m_pobjAcqThread->m_bAcquisitionThreadFlag = false;

        m_pobjAcqThread->quit();

        m_pobjAcqThread->wait();
        // Release acquisition thread object
        RELEASE_ALLOC_MEM(m_pobjAcqThread);
    }

    // Instantiation acquisition thread
    try
    {
        m_pobjAcqThread = new CAcquisitionThread;
    }
    catch (std::bad_alloc &e)
    {
        QMessageBox::about(NULL, "Allocate memory error", "Cannot allocate memory, please exit this app!");
        RELEASE_ALLOC_MEM(m_pobjAcqThread);
        return;
    }

//    // Connect error signal and error handler
//    connect(m_pobjAcqThread, SIGNAL(SigAcquisitionError(QString)), this,
//            SLOT(slotAcquisitionErrorHandler(QString)), Qt::QueuedConnection);

//    connect(m_pobjAcqThread, SIGNAL(SigImageProcError(VxInt32)), this,
//            SLOT(slotImageProcErrorHandler(VxInt32)), Qt::QueuedConnection);

    return;
}
//----------------------------------------------------------------------------------
/**
\Check if MultiROI is opened(This sample does not support MultiROI)
\param[in]
\param[out]
\return bool        true       MultiROI is on or not implemented
                    false      MultiROI is off
*/
//----------------------------------------------------------------------------------
bool MainWindow::CheckMultiROIOn()
{
    GX_STATUS emStatus = GX_STATUS_SUCCESS;

    int64_t emRegionSendMode = GX_REGION_SEND_SINGLE_ROI_MODE;
    bool bRegionMode = false;
    emStatus = GXIsImplemented(m_hDevice, GX_ENUM_REGION_SEND_MODE, &bRegionMode);
    if (emStatus != GX_STATUS_SUCCESS)
    {
        ShowErrorString(emStatus);
    }

    if (bRegionMode)
    {
        emStatus = GXGetEnum(m_hDevice, GX_ENUM_REGION_SEND_MODE, &emRegionSendMode);
        if (emStatus != GX_STATUS_SUCCESS)
        {
            ShowErrorString(emStatus);
        }
    }

    if (emRegionSendMode == GX_REGION_SEND_MULTI_ROI_MODE)
    {
        QMessageBox::about(this, "MultiROI not supported", "This sample does not support MultiROI!\n"
                                                           "please change region mode!");
        return true;
    }
    return false;
}

//----------------------------------------------------------------------------------
/**
\ Enable all UI Groups except Camera select group
\param[in]
\param[out]
\return  void
*/
//----------------------------------------------------------------------------------
void MainWindow::EnableUI()
{
    ui->Capture_Control->setEnabled(true);
}

//----------------------------------------------------------------------------------
/**
\ Disable all UI Groups except Camera select group
\param[in]
\param[out]
\return  void
*/
//----------------------------------------------------------------------------------
void MainWindow::DisableUI()
{
    ui->Capture_Control->setEnabled(false);
}
//----------------------------------------------------------------------------------
/**
\Set device acquisition buffer number.
\param[in]
\param[out]
\return bool    true : Setting success
\               false: Setting fail
*/
//----------------------------------------------------------------------------------
bool MainWindow::SetAcquisitionBufferNum()
{
    GX_STATUS emStatus = GX_STATUS_SUCCESS;
    uint64_t ui64BufferNum = 0;
    int64_t i64PayloadSize = 0;

    // Get device current payload size
    emStatus = GXGetInt(m_hDevice, GX_INT_PAYLOAD_SIZE, &i64PayloadSize);
    if (emStatus != GX_STATUS_SUCCESS)
    {
        ShowErrorString(emStatus);
        return false;
    }

    // Set buffer quantity of acquisition queue
    if (i64PayloadSize == 0)
    {
        QMessageBox::about(this, "Set Buffer Number", "Set acquisiton buffer number failed : Payload size is 0 !");
        return false;
    }

    // Calculate a reasonable number of Buffers for different payload size
    // Small ROI and high frame rate will requires more acquisition Buffer
    const size_t MAX_MEMORY_SIZE = 8 * 1024 * 1024; // The maximum number of memory bytes available for allocating frame Buffer
    const size_t MIN_BUFFER_NUM  = 5;               // Minimum frame Buffer number
    const size_t MAX_BUFFER_NUM  = 450;             // Maximum frame Buffer number
    ui64BufferNum = MAX_MEMORY_SIZE / i64PayloadSize;
    ui64BufferNum = (ui64BufferNum <= MIN_BUFFER_NUM) ? MIN_BUFFER_NUM : ui64BufferNum;
    ui64BufferNum = (ui64BufferNum >= MAX_BUFFER_NUM) ? MAX_BUFFER_NUM : ui64BufferNum;

    emStatus = GXSetAcqusitionBufferNumber(m_hDevice, ui64BufferNum);
    if (emStatus != GX_STATUS_SUCCESS)
    {
        ShowErrorString(emStatus);
        return false;
    }

    // Transfer buffer number to acquisition thread class for using GXDQAllBufs
    m_pobjAcqThread->m_ui64AcquisitionBufferNum = ui64BufferNum;

    return true;
}
//----------------------------------------------------------------------------------
/**
\Device start acquisition and start acquisition thread
\param[in]
\param[out]
\return void
*/
//----------------------------------------------------------------------------------
void MainWindow::StartAcquisition()
{
    GX_STATUS emStatus = GX_STATUS_SUCCESS;

    emStatus = GXStreamOn(m_hDevice);
    GX_VERIFY(emStatus);

    // Set acquisition thread run flag
    m_pobjAcqThread->m_bAcquisitionThreadFlag = true;

    // Acquisition thread start
    m_pobjAcqThread->start();

    // isStart flag set true
    m_bAcquisitionStart = true;

    return;
}
//----------------------------------------------------------------------------------
/**
\Device stop acquisition and stop acquisition thread
\param[in]
\param[out]
\return void
*/
//----------------------------------------------------------------------------------
void MainWindow::StopAcquisition()
{
    GX_STATUS emStatus = GX_STATUS_SUCCESS;

    m_pobjAcqThread->m_bAcquisitionThreadFlag = false;
    m_pobjAcqThread->quit();
    m_pobjAcqThread->wait();

    // Turn off stream
    emStatus = GXStreamOff(m_hDevice);
    GX_VERIFY(emStatus);

    // isStart flag set false
    m_bAcquisitionStart = false;

    return;
}
//----------------------------------------------------------------------------------
/**
\Close Device
\param[in]
\param[out]
\return void
*/
//----------------------------------------------------------------------------------
void MainWindow::CloseDevice()
{
    GX_STATUS emStatus = GX_STATUS_SUCCESS;

    // Stop Timer
    m_pobjShowImgTimer->stop();
    // m_pobjShowFrameRateTimer->stop();

    // Stop acquisition thread before close device if acquisition did not stoped
    if (m_bAcquisitionStart)
    {
        m_pobjAcqThread->m_bAcquisitionThreadFlag = false;
        m_pobjAcqThread->quit();
        m_pobjAcqThread->wait();

        // isStart flag reset
        m_bAcquisitionStart = false;
    }

    // Release acquisition thread object
    RELEASE_ALLOC_MEM(m_pobjAcqThread);

    //Close Device
    emStatus = GXCloseDevice(m_hDevice);
    GX_VERIFY(emStatus);

    // isOpen flag reset
    m_bOpen = false;

    // release device handle
    m_hDevice = NULL;

    // Update Mainwindow
    UpdateUI();

    return;
}
//----------------------------------------------------------------------------------
/**
\Refresh Main window when execute usersetload
\param[in]
\param[out]
\return  void
*/
//----------------------------------------------------------------------------------
void MainWindow::slotRefreshMainWindow()
{
    // Clear Items in ComboBox
    ui->PixelFormat->clear();
    ui->TriggerMode->clear();
    ui->TriggerSource->clear();

    this->GetDeviceInitParam();

    return;
}
//----------------------------------------------------------------------------------
/**
\defult show lineEdit settings
\param[in]
\param[out]
\return void
*/
//----------------------------------------------------------------------------------
void MainWindow::setLineEditSettings()
{
    GX_STATUS emStatus = GX_STATUS_SUCCESS;

    double dValue = 0;
    emStatus = GXGetFloat(m_hDevice, GX_FLOAT_EXPOSURE_TIME, &dValue);

    ui->lineEdit->setText(QString::number(dValue));


    emStatus = GXGetFloat(m_hDevice, GX_FLOAT_GAIN, &dValue);
    ui->lineEdit_2->setText(QString::number(dValue));

    int64_t nValue = 0;
    emStatus = GXGetInt(m_hDevice, GX_INT_CENTER_WIDTH, &nValue);
     ui->lineEdit_3->setText(QString::number(nValue));
    emStatus = GXGetInt(m_hDevice, GX_INT_CENTER_HEIGHT, &nValue);
    ui->lineEdit_4->setText(QString::number(nValue));
}

//----------------------------------------------------------------------------------
/**
\Get parameters from Device and set them into UI items
\param[in]
\param[out]
\return void
*/
//----------------------------------------------------------------------------------
void MainWindow::GetDeviceInitParam()
{
    GX_STATUS emStatus = GX_STATUS_SUCCESS;

    // Disable all items to avoid user input while initializing
    DisableUI();

    // Init pixel format combobox entrys
    emStatus = InitComboBox(m_hDevice, ui->PixelFormat, GX_ENUM_PIXEL_FORMAT);
    if (emStatus != GX_STATUS_SUCCESS)
    {
        CloseDevice();
        GX_VERIFY(emStatus);
    }

    // Init trigger mode combobox entrys
    emStatus = InitComboBox(m_hDevice, ui->TriggerMode, GX_ENUM_TRIGGER_MODE);
    if (emStatus != GX_STATUS_SUCCESS)
    {
        CloseDevice();
        GX_VERIFY(emStatus);
    }

    // If Trigger mode is on, set Flag to true
    if (ui->TriggerMode->itemData(ui->TriggerMode->currentIndex()).value() == GX_TRIGGER_MODE_ON)
    {
        m_bTriggerModeOn = true;
    }
    else
    {
        m_bTriggerModeOn = false;
    }

    // Init trigger source combobox entrys
    emStatus = InitComboBox(m_hDevice, ui->TriggerSource, GX_ENUM_TRIGGER_SOURCE);
    if (emStatus != GX_STATUS_SUCCESS)
    {
        CloseDevice();
        GX_VERIFY(emStatus);
    }

    // If Trigger software is on, set Flag to true
    if (ui->TriggerSource->itemData(ui->TriggerSource->currentIndex()).value() == GX_TRIGGER_SOURCE_SOFTWARE)
    {
        m_bSoftTriggerOn = true;
    }
    else
    {
        m_bSoftTriggerOn = false;
    }

    // Device support frame control or not
    bool bFrameRateControl = false;
    emStatus = GXIsImplemented(m_hDevice, GX_ENUM_ACQUISITION_FRAME_RATE_MODE, &bFrameRateControl);
    if (emStatus != GX_STATUS_SUCCESS)
    {
        CloseDevice();
        GX_VERIFY(emStatus);
    }

    EnableUI();

    return;
}
void MainWindow::on_UpdateDeviceList_clicked()
{
    QString szDeviceDisplayName;

    ui->DeviceList->clear();

    // Enumerate Devices
    UpdateDeviceList();

    // If enumerate no device, return
    if (m_ui32DeviceNum == 0)
    {
        // Update Mainwindow
        UpdateUI();
        return;
    }

    // Add items and display items on ComboBox
    for (uint32_t i = 0; i < m_ui32DeviceNum; i++)
    {
        szDeviceDisplayName.sprintf("%s", m_pstBaseInfo[i].szDisplayName);
        ui->DeviceList->addItem(QString(szDeviceDisplayName));
    }

    // Focus on the first device
    ui->DeviceList->setCurrentIndex(0);

    // Update Mainwindow
    UpdateUI();
    return;
}

void MainWindow::on_OpenDevice_clicked()
{
    // Open Device
    OpenDevice();

    // Do not init device or get init params when open failed
    if (!m_bOpen)
    {
        return;
    }

    // Setup acquisition thread
    SetUpAcquisitionThread();

    //    // Setup all Dialogs
    slotRefreshMainWindow();


    //    // Transfer Device handle to acquisition thread class
    m_pobjAcqThread->GetDeviceHandle(m_hDevice);
    setLineEditSettings();
    // Update Mainwindow
    UpdateUI();

    return;
}

void MainWindow::on_StartAcquisition_clicked()
{
    bool bMultiRoiOn = false;
    // This sample does not support MultiROI, acquisition will not started when multiROI is on.

    bMultiRoiOn = CheckMultiROIOn();
    if (bMultiRoiOn)
    {
        return;
    }


    bool bSetDone = false;
    // Set acquisition buffer number
    bSetDone = SetAcquisitionBufferNum();
    if (!bSetDone)
    {
        return;
    }
    bool bPrepareDone = false;
    // Alloc resource for image acquisition
    bPrepareDone = m_pobjAcqThread->PrepareForShowImg();
    if (!bPrepareDone)
    {
        return;
    }

    // Device start acquisition and start acquisition thread
    StartAcquisition();
    // Do not start timer when acquisition start failed
    if (!m_bAcquisitionStart)
    {
        return;
    }

    // Start image showing timer(Image show frame rate = 1000/nShowTimerInterval)
    // Refresh interval 33ms
    const int nShowTimerInterval = 33;

    m_pobjShowImgTimer->start(nShowTimerInterval);

    // Update Mainwindow
    UpdateUI();

    return;
}

void MainWindow::on_CloseDevice_clicked()
{
    // Close Device
    CloseDevice();

    // Update Mainwindow
    UpdateUI();

    return;

}

void MainWindow::on_StopAcquisition_clicked()
{
    // Stop Acquisition
    StopAcquisition();

    // Stop timer
    m_pobjShowImgTimer->stop();

    // Update Mainwindow
    UpdateUI();
}

void MainWindow::on_PixelFormat_activated(int index)
{
    GX_STATUS emStatus = GX_STATUS_SUCCESS;
    // Set Pixel format
    emStatus = GXSetEnum(m_hDevice, GX_ENUM_PIXEL_FORMAT, ui->PixelFormat->itemData(index).value());
    GX_VERIFY(emStatus);
}



void MainWindow::on_TriggerMode_activated(int index)
{
    GX_STATUS emStatus = GX_STATUS_SUCCESS;

    // Set trigger Mode
    emStatus = GXSetEnum(m_hDevice, GX_ENUM_TRIGGER_MODE, ui->TriggerMode->itemData(index).value());
    GX_VERIFY(emStatus);

    // If Trigger mode is on, set Flag to true
    if (ui->TriggerMode->itemData(index).value() == GX_TRIGGER_MODE_ON)
    {
        m_bTriggerModeOn = true;
    }
    else
    {
        m_bTriggerModeOn = false;
    }

    // If Trigger software is on, set Flag to true
    if (ui->TriggerSource->itemData(ui->TriggerSource->currentIndex()).value() == GX_TRIGGER_SOURCE_SOFTWARE)
    {
        m_bSoftTriggerOn = true;
    }
    else
    {
        m_bSoftTriggerOn = false;
    }

    //Update Mainwindow
    UpdateUI();
}

void MainWindow::on_TriggerSource_activated(int index)
{
    GX_STATUS emStatus = GX_STATUS_SUCCESS;

    // Set trigger Source
    emStatus = GXSetEnum(m_hDevice, GX_ENUM_TRIGGER_SOURCE,  ui->TriggerSource->itemData(index).value());
    GX_VERIFY(emStatus);

    if (ui->TriggerSource->itemData(index).value() == GX_TRIGGER_SOURCE_SOFTWARE)
    {
        m_bSoftTriggerOn = true;
    }
    else
    {
        m_bSoftTriggerOn = false;
    }

    //Update Mainwindow
    UpdateUI();

    return;
}

void MainWindow::on_checkBox_clicked()
{
    if( ui->checkBox->isChecked() )
    {
        m_bSaveImage=true;
    }
    else if(ui->checkBox->isChecked() == false)
    {
        m_bSaveImage=false;

    }

}


void MainWindow::on_lineEdit_editingFinished()
{
    QString a;
    a=ui->lineEdit->text();


    GX_STATUS emStatus = GX_STATUS_SUCCESS;
    emStatus = GXSetFloat(m_hDevice, GX_FLOAT_EXPOSURE_TIME, a.toDouble());
//    if(emStatus!=GX_STATUS_SUCCESS)
//    {
//        QMessageBox::about(NULL, "Error", "曝光设置失败");
//    }
        GX_VERIFY(emStatus);

}

void MainWindow::on_lineEdit_2_editingFinished()
{

    QString a;
    a=ui->lineEdit_2->text();

    GX_STATUS emStatus = GX_STATUS_SUCCESS;

    emStatus = GXSetEnum(m_hDevice, GX_ENUM_GAIN_SELECTOR, GX_GAIN_SELECTOR_ALL);
    //VERIFY_STATUS_RET(emStatus);

    emStatus = GXSetFloat(m_hDevice, GX_FLOAT_GAIN, a.toFloat());
    //VERIFY_STATUS_RET(emStatus);
     GX_VERIFY(emStatus);
}

void MainWindow::on_lineEdit_3_editingFinished()
{

    QString a;
    a=ui->lineEdit_3->text();

    GX_STATUS emStatus = GX_STATUS_SUCCESS;

    emStatus = GXSetInt(m_hDevice,GX_INT_CENTER_HEIGHT, a.toInt());
    GX_VERIFY(emStatus);
}

void MainWindow::on_lineEdit_4_editingFinished()
{

    QString a;
    a=ui->lineEdit_4->text();


    GX_STATUS emStatus = GX_STATUS_SUCCESS;

    emStatus = GXSetInt(m_hDevice,GX_INT_CENTER_WIDTH, a.toInt());
     GX_VERIFY(emStatus);
}

//mainwindos.h
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#define ENUMRATE_TIME_OUT       200
//-----------
#include 
#include 
#include"GxIAPI.h"
#include"DxImageProc.h"
#include"AcquisitionThread.h"
#include"Common.h"
namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

private slots:
    void on_UpdateDeviceList_clicked();

    void on_OpenDevice_clicked();

    void on_StartAcquisition_clicked();

    /// Show images acquired and processed
    void slotShowImage();

    void on_CloseDevice_clicked();

    void on_StopAcquisition_clicked();

    void on_PixelFormat_activated(int index);

    void on_TriggerMode_activated(int index);

    void on_TriggerSource_activated(int index);

    /// Refresh Main window when execute usersetload
    void slotRefreshMainWindow();

    void on_checkBox_clicked();



    void on_lineEdit_editingFinished();


    void on_lineEdit_2_editingFinished();

    void on_lineEdit_3_editingFinished();

    void on_lineEdit_4_editingFinished();

private:
    Ui::MainWindow *ui;
    //----------------------
   void setLineEditSettings();

    /// Clear Mainwindow items
    void ClearUI();

    /// Enable all UI Groups
    void EnableUI();

    /// Disable all UI Groups
    void DisableUI();

    /// Update all items status on MainWindow
    void UpdateUI();

    /// Update device list
    void UpdateDeviceList();

    /// Setup acquisition thread
    void SetUpAcquisitionThread();

    /// Open device selected
    void OpenDevice();

    /// Close device opened
    void CloseDevice();

    /// Set device acquisition buffer number.
    bool SetAcquisitionBufferNum();

    /// Get parameters from opened device
    void GetDeviceInitParam();

    /// Check if MultiROI is on
    bool CheckMultiROIOn();

    /// Device start acquisition and start acquisition thread
    void StartAcquisition();

    /// Device stop acquisition and stop acquisition thread
    void StopAcquisition();

    CAcquisitionThread  *m_pobjAcqThread;           ///< Child image acquisition and process thread
    GX_DEV_HANDLE        m_hDevice;                 ///< Device Handle
    GX_DEVICE_BASE_INFO *m_pstBaseInfo;             ///< Pointer struct of Device info
    uint32_t             m_ui32DeviceNum;           ///< Device number enumerated

    bool                 m_bOpen;                   ///< Flag : camera is opened or not
    bool                 m_bAcquisitionStart;       ///< Flag : camera is acquiring or not
    bool                 m_bTriggerModeOn;          ///< Flag : Trigger mode is on or not
    bool                 m_bSoftTriggerOn;          ///< Flag : Trigger software is on or not
    bool                 m_bSaveImage;              ///< Flag : Save one image when it is true
    //int                  m_freamNumber;             ///  Fream Number;
    // QImage               m_objImageForSave;         ///< For image saving

    uint32_t             m_ui32ShowCount;           ///< Frame count of image show

    QTimer              *m_pobjShowImgTimer;        ///< Timer of Show Image

    //----------------------
};

#endif // MAINWINDOW_H

只截取了一部分重要的代码,也在学习中,欢迎大家指正

你可能感兴趣的:(C++,水星相机,linux,qt,计算机视觉)