主頁 >  其他 > 專案實戰:Qt+Arm+Fpga醫療腎鏡(又名內窺鏡)(實時影像、凍結、拍照、白平衡、九宮格、錄像、背光調整、硬體光源調整、光源手動自動調整、物理按鍵)

專案實戰:Qt+Arm+Fpga醫療腎鏡(又名內窺鏡)(實時影像、凍結、拍照、白平衡、九宮格、錄像、背光調整、硬體光源調整、光源手動自動調整、物理按鍵)

2020-12-19 11:00:43 其他

若該文為原創文章,轉載請注明原文出處
本文章博客地址:https://blog.csdn.net/qq21497936/article/details/111241205
長期持續帶來更多專案與技術分享,咨詢請加QQ:21497936、微信:yangsir198808
紅胖子(紅模仿)的博文大全:開發技術集合(包含Qt實用技術、樹莓派、三維、OpenCV、OpenGL、ffmpeg、OSG、單片機、軟硬結合等等)持續更新中…(點擊傳送門)

開發專欄:專案實戰


需求

??1. 螢屏解析度1920 x 1080;
??2. 白平衡、凍結、自動背光、自動光源等功能;’
??2. 拍照功能,可設定拍照路徑(U盤,SD卡,內置存盤);
??3. 錄像功能,可設定錄像路徑(U盤,SD卡,內置存盤);
??4. 亮度調整,攝像頭光源亮度調整;
??5. 物理按鍵,包括拍照、錄像、上下左右、選單、默認亮度、選擇等等;
??6. 定制開機界面;
??7. 照片、視頻九宮格瀏覽控制元件;
??8. 照片瀏覽器;
??9. 視頻播放器;
??10. 可查看照片、視頻同時支持按鍵對照片和視頻的操作;
??11. 對存盤控制元件的資源瀏覽器控制元件’,并可對其復制、粘貼、洗掉等操作;
??12. 設定時間日期,仿蘋果滑動效果;
??13. 其他各種定制控制元件;

注意

??受限于成本(方案整體成本,較同行業較低),不斷壓縮的成本,導致該產品的出現關鍵難點,其在于fpga上的仿arm跑linux的芯片性能等同于2011年的arm水平,經過fpga+arm+qt三方的代碼優化和記憶體優化,’


Demo

??在這里插入圖片描述
??在這里插入圖片描述
??在這里插入圖片描述
??在這里插入圖片描述
??在這里插入圖片描述
??在這里插入圖片描述
軟體界面

??在這里插入圖片描述
??在這里插入圖片描述
??在這里插入圖片描述
??在這里插入圖片描述
??在這里插入圖片描述


關鍵代碼

EndoscopeWidget.h

#ifndef ENDOSCOPEWIDGET_H
#define ENDOSCOPEWIDGET_H

#include <QWidget>
#include <QButtonGroup>
#include <QThread>
#include <QLabel>

#ifdef LINUX
#include "X264Manager.h"
extern "C" {
    #include "fpga_comm_app.h"
    #include "common.h"
}

#endif

#ifndef LINUX

#define LOCAL_DIR       ("local")
#define USB1_DIR        ("usb1")        // usb
#define USB2_DIR        ("usb2")        // usb默認路徑
#endif

#define PICTURE_DIR     ("Picture")
#define VIDEO_DIR       ("Video")

#define DEBUG_X264_SRC   (1)    // 1 - 模擬資料源測驗x264, 0 - 使用fpga資料源操作x264庫
#define DEBUG_SAVE_PATH  (1)    // 1 - 存盤到應用目錄下(arm、pc均可用), 0 - 存盤到U盤(必須在arm上)

#define MKDIR_USE_SHELL  (1)    // 1 - 使用mkdir創建目錄, 0 - 使用qt自帶的創建目錄(建議使用1)

#define SKIP_FRAMES      (0)    // 1 - 是跳幀編碼, 0 - 不跳幀
#define SKIP_NUM         (0)    // 跳幀時有用,當前幀數 % SKIP_NUM== 0時跳幀

#define X264_USE_THREAD  (0)    // 1 - x264編碼使用另外的執行緒(需要拷貝快取), 0 - 主執行緒直接呼叫

#define CFG_FILE         ("cfg") // 組態檔

namespace Ui {
class EndoscopeWidget;
}

class EndoscopeWidget : public QWidget
{
    Q_OBJECT
public:
    enum LANGUAGE_TYPE {        // 語言型別
        LANGUAGE_TYPE_CHINESE_SIMPLE = 0x00,
        LANGUAGE_TYPE_ENGLISH,
        LANGUAGE_TYPE_CHINESE_TRADITION
    };
    enum SAVE_LOCATION {        // 存盤位置
        SAVE_LOCATION_LOCAL = 0x00,
        SAVE_LOCATION_USB1,
        SAVE_LOCATION_USB2
    };
    enum FUNCTION_TYPE {        // 功能型別
        FUNCTION_TYPE_NO_USE = 0x00,
        FUNCTION_TYPE_PHTOTO,
        FUNCTION_TYPE_RECORD,
        FUNCTION_TYPE_FREEZE,
        FUNCTION_TYPE_WHITE_BALANCE_CORRECT
    };

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

signals:
    void signal_recvYuv(QByteArray byteArray);

protected:
    void addFont();                                             // 添加字體
    void loadCfg();                                             // 加載組態檔
    void saveCfg();                                             // 存盤組態檔
    void updateDate();                                          // 更新日期
    void updateLocateState();                                   // 更新本地local位置使能
    void mkdir(QString currentDir);                             // 切換存盤的時候需要創建檔案夾

protected:
    void paintEvent(QPaintEvent *event);
    void resizeEvent(QResizeEvent *event);

protected slots:
    void slot_labelInfoTimeOut();

protected slots:
    void slot_backgroundLightBrightnessValueChanged(int value);
    void slot_lightSourceBrightnessValueChanged(int value);

protected slots:
    void slot_dateChanged();                                    // 日期改變更新
    void slot_languageButtonClicked(QAbstractButton *pBtn);     // 語言按鈕(中文簡體、English、中文繁體)
    void slot_locateLocationClicked(QAbstractButton *pBtn);     // 存盤位置(本機、USB1,USB2)
    void slot_key1ButtonClicked(QAbstractButton *pBtn);         // 按鍵一功能(不用、拍照、錄像、凍結、白平衡校正)
    void slot_key2ButtonClicked(QAbstractButton *pBtn);         // 按鍵二功能(不用、拍照、錄像、凍結、白平衡校正)
    void slot_doubleClickedVideoFile(QString filePath);         // 雙擊選中視頻檔案

private slots:                                                  // 左側選單
    void on_pushButton_photograph_clicked();                    // 拍照
    void on_pushButton_record_clicked(bool checked);            // 錄像
    void on_pushButton_freezeScreen_clicked(bool checked);      // 凍結
    void on_pushButton_whiteBalanceCorrect_clicked();           // 白平衡校正
    void on_pushButton_defaultLight_clicked();                  // 默認亮度
    void on_pushButton_photoSee_clicked();                      // 圖片查看

private slots:                                                  // 右側選單
    void on_pushButton_lightSourceSet_clicked();                // 光源亮度設定
    void on_pushButton_dateSet_clicked();                       // 時間日期設定
    void on_pushButton_languageSet_clicked();                   // 語言設定
    void on_pushButton_key1Set_clicked();                       // 按鍵一設定
    void on_pushButton_key2Set_clicked();                       // 按鍵二設定
    void on_pushButton_backgroundLightSet_clicked();            // 背光亮度設定
    void on_pushButton_photoVideoSet_clicked();                 // 照片/錄像檔案設定
    void on_pushButton_set_clicked(bool checked);               // 設定回傳

private slots:                                                  // 檔案操作:左側操作圖片選單
    void on_pushButton_delete_clicked();                        // 檔案操作:洗掉
    void on_pushButton_selectAll_clicked();                     // 檔案操作:選擇所有
    void on_pushButton_copy_clicked();                          // 檔案操作:復制
    void on_pushButton_paste_clicked();                         // 檔案操作:粘貼
    void on_pushButton_back_clicked();                          // 檔案操作:回傳

private slots:
    void on_pushButton_startPlay_clicked();                     // 播放器:播放
    void on_pushButton_pause_clicked();                         // 播放器:暫停
    void on_pushButton_resume_clicked();                        // 播放器:恢復
    void on_pushButton_stop_clicked();                          // 播放器:停止
    void on_pushButton_playerBack_clicked();                    // 播放器:回傳


private:
    Ui::EndoscopeWidget *ui;

    QList<QString> _listCopyFile;                               // 復制的檔案串列
    QButtonGroup _buttonGroupLanguage;                          // 語言選擇
    QButtonGroup _buttonGroupKey1Function;                      // 按鍵1功能
    QButtonGroup _buttonGroupKey2Function;                      // 按鍵2功能
    QButtonGroup _buttonLocation;                               // 存盤位置

    QString _filePath;                                          // 播放地址

    bool _isLoopSaveImageIndex;
    int _imageIndex;                                            // 當天拍照的序號(從0開始)

    bool _isLoopSaveVideoIndex;
    int _videoIndex;                                            // 當天錄像的序號(從0開始)

    QString _cfgFile;                                           // 組態檔

    LANGUAGE_TYPE _language;                                    // 當前語言
    SAVE_LOCATION _saveLocation;                                // 當前存盤位置
    FUNCTION_TYPE _key1Function;                                // 按鍵1功能
    FUNCTION_TYPE _key2Function;                                // 按鍵2功能
    int _backgroundLightBrightness;                             // 背光亮度
    int _lightSourceBrightness;                                 // 光源亮度

    QString _storeDir;
    QString _photoDir;                                          // 輔助變數:當前拍照檔案夾
    QString _videoDir;                                          // 輔助變數:當前視頻檔案夾
    QString _fileName;                                          // 輔助變數:存盤檔案名稱

#ifdef LINUX
    static QThread *_pX264ManagerThread;                        // x264視頻編碼執行緒
    static X264Manager *_pX264Manager;                          // x264管理類
    static int _index;
private:
    QTimer *_pTimer;
protected slots:
    void slot_timeOut();
public:
    static bool _recording;
    static int fpga_com_read_record_data_handler_t(char *buffer, int length);
#endif

    QTimer *_pTimerInfo;                                        // 計時器用于顯示
    QLabel *_pLabelRecIcon;                                     // 圖示
    QLabel *_pLabelRecord;                                      // 圖示
    QLabel *_pLabelInfo;                                        // 提示Label

};

#endif // ENDOSCOPEWIDGET_H

EndoscopeWidget.cpp

#include "EndoscopeWidget.h"
#include "ui_EndoscopeWidget.h"

#include <QStyleOption>
#include <QPaintEvent>
#include <QPainter>
#include <QDebug>
#include <QDate>
#include <QFontDatabase>
#include <QButtonGroup>
#include <QProcess>
#include <QMessageBox>
#include "DateTime2Widget.h"

//#include "JpegManager.h"

#ifdef LINUX
QThread *EndoscopeWidget::_pX264ManagerThread = 0;
X264Manager *EndoscopeWidget::_pX264Manager = 0;
bool EndoscopeWidget::_recording = false;
int EndoscopeWidget::_index = 0;
#endif

EndoscopeWidget::EndoscopeWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::EndoscopeWidget),
    _imageIndex(1),
    _isLoopSaveImageIndex(false),
    _videoIndex(1),
    _cfgFile(CFG_FILE),                     // 組態檔
    _language(LANGUAGE_TYPE_CHINESE_SIMPLE),// 默認語言(未加載組態檔之前)
    _saveLocation(SAVE_LOCATION_LOCAL),     // 默認存盤在本地(未加載組態檔之前)
    _key1Function(FUNCTION_TYPE_NO_USE),    // 默認按鍵1無功能(未加載組態檔之前)
    _key2Function(FUNCTION_TYPE_NO_USE),    // 默認按鍵2無功能(未加載組態檔之前)
    _backgroundLightBrightness(3),
    _lightSourceBrightness(9),
    _pLabelRecIcon(0),
    _pLabelRecord(0),
    _pLabelInfo(0),
    _pTimerInfo(0),
#ifdef LINUX
    _pTimer(0),
#endif
    _isLoopSaveVideoIndex(false)
{
    ui->setupUi(this);

    // 加載組態檔
    loadCfg();

    // 加入自帶的字體 “Roboto-Condensed”
    addFont();

    // rec圖示和提示資訊
    {
        _pLabelRecIcon = new QLabel(this);
        _pLabelRecIcon->setStyleSheet("border-image: url(:/images/recIcon.png);");
        _pLabelRecIcon->show();
        _pLabelRecord = new QLabel(this);
        _pLabelRecord->setStyleSheet("border-image: url(:/images/rec.png);");
        _pLabelRecord->show();
        _pLabelInfo = new QLabel(this);
        _pLabelInfo->setStyleSheet("font: 14px \"思源黑體\"; color: rgb(210,210,210);");
        _pLabelInfo->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
        _pLabelInfo->hide();
        _pTimerInfo = new QTimer();
        _pTimerInfo->setInterval(1500);
        connect(_pTimerInfo, SIGNAL(timeout()), this, SLOT(slot_labelInfoTimeOut()));
    }

    // 初始化影像控制元件的默認存盤地址(無需加載)
    {
//        ui->widget_camera->setPhotoDir(QString("%1/%2").arg(LOCAL_DIR).arg(PICTURE_DIR));
//        ui->widget_camera->setRecordDir(QString("%1/%2").arg(LOCAL_DIR).arg(VIDEO_DIR));
    }

    // 初始化按鈕(拍照、錄像、觸屏凍結、白平衡校正、默認亮度、照片查看)
    {
        // 初始化按鈕的圖示區域
        int iconWidth = 60;
        int iconHeight = 60;
        int iconCenterX = 46;
        int iconCenterY = 63;
        QRect iconRect(iconCenterX - iconWidth / 2, iconCenterY - iconHeight / 2, iconWidth, iconHeight);
        // 初始化按鈕的文字區域
        int textWidht = 236;
        int textheight = 60;
        int textCenterX = 168;
        int textCenterY = 63;
        QRect textRect(textCenterX - textWidht / 2, textCenterY - textheight / 2, textWidht, textheight);
        // 初始化按鈕的字體
        QFont font = QFont();
        font.setFamily("思源黑體 CN Normal");
        font.setPixelSize(36);
        // 拍照
        ui->pushButton_photograph->setIconPixmap(QPixmap(":/images/photograph.png"));
        ui->pushButton_photograph->setIconPixmapPressed(QPixmap(":/images/photograph_pressed.png"));
        ui->pushButton_photograph->setIconPixmapDisable(QPixmap(":/images/photograph_disabled.png"));
        ui->pushButton_photograph->setIconPixmapRect(iconRect);
        ui->pushButton_photograph->setText(tr("拍照"));
        ui->pushButton_photograph->setTextRect(textRect);
        ui->pushButton_photograph->setFont(font);
        // 錄像
        ui->pushButton_record->setIconPixmap(QPixmap(":/images/record.png"));
        ui->pushButton_record->setIconPixmapPressed(QPixmap(":/images/record_pressed.png"));
        ui->pushButton_record->setIconPixmapDisable(QPixmap(":/images/record_disabled.png"));
        ui->pushButton_record->setIconPixmapRect(iconRect);
        ui->pushButton_record->setText(tr("錄像"));
        ui->pushButton_record->setTextRect(textRect);
        ui->pushButton_record->setFont(font);
        // 觸屏凍結
        ui->pushButton_freezeScreen->setIconPixmap(QPixmap(":/images/freezeScreen.png"));
        ui->pushButton_freezeScreen->setIconPixmapPressed(QPixmap(":/images/freezeScreen_pressed.png"));
        ui->pushButton_freezeScreen->setIconPixmapDisable(QPixmap(":/images/freezeScreen_disabled.png"));
        ui->pushButton_freezeScreen->setIconPixmapRect(iconRect);
        ui->pushButton_freezeScreen->setText(tr("觸屏凍結"));
        ui->pushButton_freezeScreen->setTextRect(textRect);
        ui->pushButton_freezeScreen->setFont(font);
        // 白平衡校正
        ui->pushButton_whiteBalanceCorrect->setIconPixmap(QPixmap(":/images/whiteBalanceCorrect.png"));
        ui->pushButton_whiteBalanceCorrect->setIconPixmapPressed(QPixmap(":/images/whiteBalanceCorrect_pressed.png"));
        ui->pushButton_whiteBalanceCorrect->setIconPixmapDisable(QPixmap(":/images/whiteBalanceCorrect_disabled.png"));
        ui->pushButton_whiteBalanceCorrect->setIconPixmapRect(iconRect);
        ui->pushButton_whiteBalanceCorrect->setText(tr("白平衡校正"));
        ui->pushButton_whiteBalanceCorrect->setTextRect(textRect);
        ui->pushButton_whiteBalanceCorrect->setFont(font);
        // 默認亮度
        ui->pushButton_defaultLight->setIconPixmap(QPixmap(":/images/defaultLight.png"));
        ui->pushButton_defaultLight->setIconPixmapPressed(QPixmap(":/images/defaultLight_pressed.png"));
        ui->pushButton_defaultLight->setIconPixmapDisable(QPixmap(":/images/defaultLight_disabled.png"));
        ui->pushButton_defaultLight->setIconPixmapRect(iconRect);
        ui->pushButton_defaultLight->setText(tr("默認亮度"));
        ui->pushButton_defaultLight->setTextRect(textRect);
        ui->pushButton_defaultLight->setFont(font);
        // 照片查看
        ui->pushButton_photoSee->setIconPixmap(QPixmap(":/images/photoSee.png"));
        ui->pushButton_photoSee->setIconPixmapPressed(QPixmap(":/images/photoSee_pressed.png"));
        ui->pushButton_photoSee->setIconPixmapDisable(QPixmap(":/images/photoSee_disabled.png"));
        ui->pushButton_photoSee->setIconPixmapRect(iconRect);
        ui->pushButton_photoSee->setText(tr("照片查看"));
        ui->pushButton_photoSee->setTextRect(textRect);
        ui->pushButton_photoSee->setFont(font);
    }

    // 初始化按鈕(洗掉、復制、粘貼、選擇、回傳)
    {
        int iconWidth2 = 40;
        int iconHeight2 = 40;
        int iconCenterX2 = 80;
        int iconCenterY2 = 63;
        QRect iconRect2(iconCenterX2 - iconWidth2 / 2, iconCenterY2 - iconHeight2 / 2, iconWidth2, iconHeight2);
        // 初始化按鈕的文字區域
        int textWidht = 236;
        int textheight = 60;
        int textCenterX = 170;
        int textCenterY = 63;
        QRect textRect(textCenterX - textWidht / 2, textCenterY - textheight / 2, textWidht, textheight);
        // 初始化按鈕的字體
        QFont font = QFont();
        font.setFamily("思源黑體 CN Normal");
        font.setPixelSize(32);
        // 洗掉
        ui->pushButton_delete->setIconPixmap(QPixmap(":/images/delete.png"));
        ui->pushButton_delete->setIconPixmapPressed(QPixmap(":/images/delete_pressed.png"));
        ui->pushButton_delete->setIconPixmapDisable(QPixmap(":/images/delete_disabled.png"));
        ui->pushButton_delete->setIconPixmapRect(iconRect2);
        ui->pushButton_delete->setText(tr("刪 除"));
        ui->pushButton_delete->setTextRect(textRect);
        ui->pushButton_delete->setFont(font);
        // 全選
        ui->pushButton_selectAll->setIconPixmap(QPixmap(":/images/selectAll.png"));
        ui->pushButton_selectAll->setIconPixmapPressed(QPixmap(":/images/selectAll_pressed.png"));
        ui->pushButton_selectAll->setIconPixmapDisable(QPixmap(":/images/selectAll_disabled.png"));
        ui->pushButton_selectAll->setIconPixmapRect(iconRect2);
        ui->pushButton_selectAll->setText(tr("全 選"));
        ui->pushButton_selectAll->setTextRect(textRect);
        ui->pushButton_selectAll->setFont(font);
        // 復制
        ui->pushButton_copy->setIconPixmap(QPixmap(":/images/copy.png"));
        ui->pushButton_copy->setIconPixmapPressed(QPixmap(":/images/copy_pressed.png"));
        ui->pushButton_copy->setIconPixmapDisable(QPixmap(":/images/copy_disabled.png"));
        ui->pushButton_copy->setIconPixmapRect(iconRect2);
        ui->pushButton_copy->setText(tr("復 制"));
        ui->pushButton_copy->setTextRect(textRect);
        ui->pushButton_copy->setFont(font);
        // 粘貼
        ui->pushButton_paste->setIconPixmap(QPixmap(":/images/paste.png"));
        ui->pushButton_paste->setIconPixmapPressed(QPixmap(":/images/paste_pressed.png"));
        ui->pushButton_paste->setIconPixmapDisable(QPixmap(":/images/paste_disabled.png"));
        ui->pushButton_paste->setIconPixmapRect(iconRect2);
        ui->pushButton_paste->setText(tr("粘 貼"));
        ui->pushButton_paste->setTextRect(textRect);
        ui->pushButton_paste->setFont(font);
        // 回傳
        ui->pushButton_back->setIconPixmap(QPixmap(":/images/back.png"));
        ui->pushButton_back->setIconPixmapPressed(QPixmap(":/images/back_pressed.png"));
        ui->pushButton_back->setIconPixmapDisable(QPixmap(":/images/delete_disabled.png"));
        ui->pushButton_back->setIconPixmapRect(iconRect2);
        ui->pushButton_back->setText(tr("返 回"));
        ui->pushButton_back->setTextRect(textRect);
        ui->pushButton_back->setFont(font);
    }

    // 初始化按鈕(播放、暫停、恢復、停止、回傳)
    {
        // 初始化按鈕的文字區域
        int textWidht = 236;
        int textheight = 60;
        int textCenterX = 170;
        int textCenterY = 63;
        QRect textRect(textCenterX - textWidht / 2, textCenterY - textheight / 2, textWidht, textheight);
        // 初始化按鈕的字體
        QFont font = QFont();
        font.setFamily("思源黑體 CN Normal");
        font.setPixelSize(32);
        // 播放
        ui->pushButton_startPlay->setText(tr("播 放"));
        ui->pushButton_startPlay->setTextRect(textRect);
        ui->pushButton_startPlay->setFont(font);
        // 暫停
        ui->pushButton_pause->setText(tr("暫 停"));
        ui->pushButton_pause->setTextRect(textRect);
        ui->pushButton_pause->setFont(font);
        // 恢復
        ui->pushButton_resume->setText(tr("恢 復"));
        ui->pushButton_resume->setTextRect(textRect);
        ui->pushButton_resume->setFont(font);
        // 停止
        ui->pushButton_stop->setText(tr("停 止"));
        ui->pushButton_stop->setTextRect(textRect);
        ui->pushButton_stop->setFont(font);
        // 回傳
        ui->pushButton_playerBack->setText(tr("返 回"));
        ui->pushButton_playerBack->setTextRect(textRect);
        ui->pushButton_playerBack->setFont(font);
    }

    // 初始化按鈕(設定)
    {
        int iconWidth2 = 34;
        int iconHeight2 = 34;
        int iconCenterX2 = 256;
        int iconCenterY2 = 46;
        QRect iconRect2(iconCenterX2 - iconWidth2 / 2, iconCenterY2 - iconHeight2 / 2, iconWidth2, iconHeight2);
        // 初始化按鈕的文字區域
        QRect textRect = ui->pushButton_set->rect();
        // 初始化按鈕的字體
        QFont font = QFont();
        font.setFamily("思源黑體 CN Normal");
        font.setPixelSize(36);
        ui->pushButton_set->setIconPixmap(QPixmap(":/images/back.png"));
        ui->pushButton_set->setIconPixmapPressed(QPixmap(":/images/back_pressed.png"));
        ui->pushButton_set->setIconPixmapDisable(QPixmap(":/images/back_pressed.png"));
        ui->pushButton_set->setIconPixmapRect(iconRect2);
        ui->pushButton_set->setText(tr("設定選項"));
        ui->pushButton_set->setTextRect(textRect);
        ui->pushButton_set->setFont(font);
    }
    // 初始化各區域顯示界面
    {
        ui->stackedWidget_leftKeys->setCurrentIndex(0);
        ui->stackedWidget_center->setCurrentIndex(0);
        ui->stackedWidget_rightKeys->setCurrentIndex(0);
    }

    // 用于模擬,打開usb攝像頭
    {
        ui->widget_camera->open(0);
    }

    // 背景亮度改為4級(0,1,2,3)(默認為9級,0~8)
    {
        QFont font = ui->widget_backgroundLightSlider->getFont();
        font.setFamily("思源黑體 CN Normal");
        font.setPixelSize(32);
        ui->widget_backgroundLightSlider->setAddPixmap(QPixmap(":/images/add.png"));
        ui->widget_backgroundLightSlider->setAddPixmapPressed(QPixmap(":/images/add_pressed.png"));
        ui->widget_backgroundLightSlider->setDecPixmap(QPixmap(":/images/dec.png"));
        ui->widget_backgroundLightSlider->setDecPixmapPressed(QPixmap(":/images/dec_pressed.png"));
        ui->widget_backgroundLightSlider->setFont(font);
        ui->widget_backgroundLightSlider->setMinValue(0);
        ui->widget_backgroundLightSlider->setMaxValue(3);
        ui->widget_backgroundLightSlider->setValue(_backgroundLightBrightness);
        ui->widget_backgroundLightSlider->setBackgroundPixmap(QPixmap(":/sliderWidget/images/background.png"));
        connect(ui->widget_backgroundLightSlider, SIGNAL(signal_valueChanged(int)),
                this, SLOT(slot_backgroundLightBrightnessValueChanged(int)));
    }

    // 光源亮度9級別(0,1,2,3,4,5,6,7,8,9)
    {
        QFont font = ui->widget_backgroundLightSlider->getFont();
        font.setFamily("思源黑體 CN Normal");
        font.setPixelSize(32);
        ui->widget_lightSourceSlider->setAddPixmap(QPixmap(":/images/add.png"));
        ui->widget_lightSourceSlider->setAddPixmapPressed(QPixmap(":/images/add_pressed.png"));
        ui->widget_lightSourceSlider->setDecPixmap(QPixmap(":/images/dec.png"));
        ui->widget_lightSourceSlider->setDecPixmapPressed(QPixmap(":/images/dec_pressed.png"));
        ui->widget_lightSourceSlider->setFont(font);
        ui->widget_lightSourceSlider->setMinValue(0);
        ui->widget_lightSourceSlider->setMaxValue(9);
        ui->widget_lightSourceSlider->setValue(_lightSourceBrightness);
        ui->widget_lightSourceSlider->setBackgroundPixmap(QPixmap(":/sliderWidget/images/ligthSourceBackground.png"));
        connect(ui->widget_lightSourceSlider, SIGNAL(signal_valueChanged(int)),
                this, SLOT(slot_lightSourceBrightnessValueChanged(int)));
    }

    // 語言選擇
    {
        _buttonGroupLanguage.addButton(ui->pushButton_chineseSimple);
        _buttonGroupLanguage.addButton(ui->pushButton_english);
        _buttonGroupLanguage.addButton(ui->pushButton_chineseTradition);
        connect(&_buttonGroupLanguage, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(slot_languageButtonClicked(QAbstractButton*)));
        switch (_language)
        {
        case LANGUAGE_TYPE_CHINESE_SIMPLE:
            ui->pushButton_chineseSimple->setChecked(true);
            break;
        case LANGUAGE_TYPE_ENGLISH:
            ui->pushButton_english->setChecked(true);
            break;
        case LANGUAGE_TYPE_CHINESE_TRADITION:
            ui->pushButton_chineseTradition->setChecked(true);
            break;
        default:
            break;
        }
    }

    // 按鍵1和2的功能
    {
        // 按鍵1的功能按鈕
        {
            ui->pushButton_key1NoUse->setText(tr("不使用"));
            ui->pushButton_key1Photo->setText(tr("拍照"));
            ui->pushButton_key1Record->setText(tr("錄像"));
            ui->pushButton_key1Freeze->setText(tr("凍結"));
            ui->pushButton_key1WhiteBalanceCorrect->setText(tr("白平衡校準"));

            _buttonGroupKey1Function.addButton(ui->pushButton_key1NoUse);
            _buttonGroupKey1Function.addButton(ui->pushButton_key1Photo);
            _buttonGroupKey1Function.addButton(ui->pushButton_key1Record);
            _buttonGroupKey1Function.addButton(ui->pushButton_key1Freeze);
            _buttonGroupKey1Function.addButton(ui->pushButton_key1WhiteBalanceCorrect);

            connect(&_buttonGroupKey1Function, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(slot_key1ButtonClicked(QAbstractButton*)));

            switch (_key1Function)
            {
            case FUNCTION_TYPE_NO_USE:
                ui->pushButton_key1NoUse->setChecked(true);
                break;
            case FUNCTION_TYPE_PHTOTO:
                ui->pushButton_key1Photo->setChecked(true);
                break;
            case FUNCTION_TYPE_RECORD:
                ui->pushButton_key1Record->setChecked(true);
                break;
            case FUNCTION_TYPE_FREEZE:
                ui->pushButton_key1Freeze->setChecked(true);
                break;
            case FUNCTION_TYPE_WHITE_BALANCE_CORRECT:
                ui->pushButton_key1WhiteBalanceCorrect->setChecked(true);
                break;
            default:
                break;
            }
        }
        // 按鍵2的功能按鈕
        {
            ui->pushButton_key2NoUse->setText(tr("不使用"));
            ui->pushButton_key2Photo->setText(tr("拍照"));
            ui->pushButton_key2Record->setText(tr("錄像"));
            ui->pushButton_key2Freeze->setText(tr("凍結"));
            ui->pushButton_key2WhiteBalanceCorrect->setText(tr("白平衡校準"));

            _buttonGroupKey2Function.addButton(ui->pushButton_key2NoUse);
            _buttonGroupKey2Function.addButton(ui->pushButton_key2Photo);
            _buttonGroupKey2Function.addButton(ui->pushButton_key2Record);
            _buttonGroupKey2Function.addButton(ui->pushButton_key2Freeze);
            _buttonGroupKey2Function.addButton(ui->pushButton_key2WhiteBalanceCorrect);

            connect(&_buttonGroupKey2Function, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(slot_key2ButtonClicked(QAbstractButton*)));

            switch (_key1Function)
            {
            case FUNCTION_TYPE_NO_USE:
                ui->pushButton_key2NoUse->setChecked(true);
                break;
            case FUNCTION_TYPE_PHTOTO:
                ui->pushButton_key2Photo->setChecked(true);
                break;
            case FUNCTION_TYPE_RECORD:
                ui->pushButton_key2Record->setChecked(true);
                break;
            case FUNCTION_TYPE_FREEZE:
                ui->pushButton_key2Freeze->setChecked(true);
                break;
            case FUNCTION_TYPE_WHITE_BALANCE_CORRECT:
                ui->pushButton_key2WhiteBalanceCorrect->setChecked(true);
                break;
            default:
                break;
            }
        }
    }

    // 存盤位置選擇
    {
        // 存盤位置選擇
        {
            ui->label_locateLocal->setText(tr("本機"));
            ui->label_locateUsb1->setText(tr("USB1"));
            ui->label_locateUsb2->setText(tr("USB2"));

            ui->label_locateLocal->setParent(ui->pushButton_locateLocal);
            ui->label_locateUsb1->setParent(ui->pushButton_locateUsb1);
            ui->label_locateUsb2->setParent(ui->pushButton_locateUsb2);

            ui->label_locateLocal->move(0, 0);
            ui->label_locateUsb1->move(0, 0);
            ui->label_locateUsb2->move(0, 0);

            ui->label_locateLocalStore->setText(QString("%1MB%2").arg(320).arg(tr("剩余")));
            ui->label_locateUsb1Store->setText(QString("%1MB%2").arg(320).arg(tr("剩余")));
            ui->label_locateUsb2Store->setText(QString("%1MB%2").arg(0).arg(tr("剩余")));

            ui->label_locateLocalStore->setParent(ui->pushButton_locateLocal);
            ui->label_locateUsb1Store->setParent(ui->pushButton_locateUsb1);
            ui->label_locateUsb2Store->setParent(ui->pushButton_locateUsb2);

            ui->label_locateLocalStore->move(ui->pushButton_locateLocal->width() / 2, 0);
            ui->label_locateUsb1Store->move(ui->pushButton_locateUsb1->width() / 2, 0);
            ui->label_locateUsb2Store->move(ui->pushButton_locateUsb2->width() / 2, 0);

            _buttonLocation.addButton(ui->pushButton_locateLocal);
            _buttonLocation.addButton(ui->pushButton_locateUsb1);
            _buttonLocation.addButton(ui->pushButton_locateUsb2);

            connect(&_buttonLocation, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(slot_locateLocationClicked(QAbstractButton*)));

            switch (_saveLocation)
            {
            case SAVE_LOCATION_LOCAL:
                ui->pushButton_locateLocal->setChecked(true);
                break;
            case SAVE_LOCATION_USB1:
                ui->pushButton_locateUsb1->setChecked(true);
                break;
            case SAVE_LOCATION_USB2:
                ui->pushButton_locateUsb2->setChecked(true);
                break;
            default:
                break;
            }
        }
        // 更新一下路徑
        updateLocateState();
    }


    // 檔案瀏覽器信號
    {
        ui->widget_resourceBrowser->setCols(4);
        ui->widget_resourceBrowser->setRows(4);
        connect(ui->widget_resourceBrowser, SIGNAL(signal_doubleClickedVideoFile(QString)), this, SLOT(slot_doubleClickedVideoFile(QString)));
    }


    // 時間控制元件關聯日期控制元件
    {
        ui->widget_time->setBackgroundPixmap(QPixmap(":/images/timeBackground.png"));
        connect(ui->widget_time, SIGNAL(signal_dateChanged()), this, SLOT(slot_dateChanged()));
    }

    // 日期控制元件初始化
    {
        QFont font = ui->widget_dateSet->getFont();
        font.setPixelSize(44);
        ui->widget_dateSet->setFont(font);
        ui->widget_dateSet->setBackgroundPixmap(QPixmap(":/images/setTimeBackground.png"));
    }

    // 時間控制元件初始化
    {
        QFont font = ui->widget_timeSet->getFont();
        font.setPixelSize(32);
        ui->widget_timeSet->setFont(font);
        ui->widget_timeSet->setBackgroundPixmap(QPixmap(":/images/setTimeBackground.png"));
    }

    // 重繪日期
    updateDate();

#ifdef LINUX
    // 注冊錄像回呼函式
//    fpga_comm_init(&fpga_com_read_record_data_handler_t);
    fpga_comm_init(0);
    // 初始化編碼行程
    {
//        _pX264ManagerThread = new QThread();
        _pX264Manager = new X264Manager();
        connect(this, SIGNAL(signal_recvYuv(QByteArray)), _pX264Manager, SLOT(slot_recvYuv(QByteArray)), Qt::QueuedConnection);
//        _pX264Manager->moveToThread(_pX264ManagerThread);
//        _pX264ManagerThread->start();
    }
#endif

}

EndoscopeWidget::~EndoscopeWidget()
{
    delete ui;
}
...
#endif

若該文為原創文章,轉載請注明原文出處
本文章博客地址:https://blog.csdn.net/qq21497936/article/details/111241205

轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/237154.html

標籤:其他

上一篇:鄰接矩陣:BFS實作拓撲排序(實作輸入兩種格式的圖的輸入函式)(為什么總是出現RE)(一道題試怎么讓一個程式員枯萎的,又是怎么起死回生的)

下一篇:DDR3 MIG測驗記錄

標籤雲
其他(157675) Python(38076) JavaScript(25376) Java(17977) C(15215) 區塊鏈(8255) C#(7972) AI(7469) 爪哇(7425) MySQL(7132) html(6777) 基礎類(6313) sql(6102) 熊猫(6058) PHP(5869) 数组(5741) R(5409) Linux(5327) 反应(5209) 腳本語言(PerlPython)(5129) 非技術區(4971) Android(4554) 数据框(4311) css(4259) 节点.js(4032) C語言(3288) json(3245) 列表(3129) 扑(3119) C++語言(3117) 安卓(2998) 打字稿(2995) VBA(2789) Java相關(2746) 疑難問題(2699) 细绳(2522) 單片機工控(2479) iOS(2429) ASP.NET(2402) MongoDB(2323) 麻木的(2285) 正则表达式(2254) 字典(2211) 循环(2198) 迅速(2185) 擅长(2169) 镖(2155) 功能(1967) .NET技术(1958) Web開發(1951) python-3.x(1918) HtmlCss(1915) 弹簧靴(1913) C++(1909) xml(1889) PostgreSQL(1872) .NETCore(1853) 谷歌表格(1846) Unity3D(1843) for循环(1842)

熱門瀏覽
  • 網閘典型架構簡述

    網閘架構一般分為兩種:三主機的三系統架構網閘和雙主機的2+1架構網閘。 三主機架構分別為內端機、外端機和仲裁機。三機無論從軟體和硬體上均各自獨立。首先從硬體上來看,三機都用各自獨立的主板、記憶體及存盤設備。從軟體上來看,三機有各自獨立的作業系統。這樣能達到完全的三機獨立。對于“2+1”系統,“2”分為 ......

    uj5u.com 2020-09-10 02:00:44 more
  • 如何從xshell上傳檔案到centos linux虛擬機里

    如何從xshell上傳檔案到centos linux虛擬機里及:虛擬機CentOs下執行 yum -y install lrzsz命令,出現錯誤:鏡像無法找到軟體包 前言 一、安裝lrzsz步驟 二、上傳檔案 三、遇到的問題及解決方案 總結 前言 提示:其實很簡單,往虛擬機上安裝一個上傳檔案的工具 ......

    uj5u.com 2020-09-10 02:00:47 more
  • 一、SQLMAP入門

    一、SQLMAP入門 1、判斷是否存在注入 sqlmap.py -u 網址/id=1 id=1不可缺少。當注入點后面的引數大于兩個時。需要加雙引號, sqlmap.py -u "網址/id=1&uid=1" 2、判斷文本中的請求是否存在注入 從文本中加載http請求,SQLMAP可以從一個文本檔案中 ......

    uj5u.com 2020-09-10 02:00:50 more
  • Metasploit 簡單使用教程

    metasploit 簡單使用教程 浩先生, 2020-08-28 16:18:25 分類專欄: kail 網路安全 linux 文章標簽: linux資訊安全 編輯 著作權 metasploit 使用教程 前言 一、Metasploit是什么? 二、準備作業 三、具體步驟 前言 Msfconsole ......

    uj5u.com 2020-09-10 02:00:53 more
  • 游戲逆向之驅動層與用戶層通訊

    驅動層代碼: #pragma once #include <ntifs.h> #define add_code CTL_CODE(FILE_DEVICE_UNKNOWN,0x800,METHOD_BUFFERED,FILE_ANY_ACCESS) /* 更多游戲逆向視頻www.yxfzedu.com ......

    uj5u.com 2020-09-10 02:00:56 more
  • 北斗電力時鐘(北斗授時服務器)讓網路資料更精準

    北斗電力時鐘(北斗授時服務器)讓網路資料更精準 北斗電力時鐘(北斗授時服務器)讓網路資料更精準 京準電子科技官微——ahjzsz 近幾年,資訊技術的得了快速發展,互聯網在逐漸普及,其在人們生活和生產中都得到了廣泛應用,并且取得了不錯的應用效果。計算機網路資訊在電力系統中的應用,一方面使電力系統的運行 ......

    uj5u.com 2020-09-10 02:01:03 more
  • 【CTF】CTFHub 技能樹 彩蛋 writeup

    ?碎碎念 CTFHub:https://www.ctfhub.com/ 筆者入門CTF時時剛開始刷的是bugku的舊平臺,后來才有了CTFHub。 感覺不論是網頁UI設計,還是題目質量,賽事跟蹤,工具軟體都做得很不錯。 而且因為獨到的金幣制度的確讓人有一種想去刷題賺金幣的感覺。 個人還是非常喜歡這個 ......

    uj5u.com 2020-09-10 02:04:05 more
  • 02windows基礎操作

    我學到了一下幾點 Windows系統目錄結構與滲透的作用 常見Windows的服務詳解 Windows埠詳解 常用的Windows注冊表詳解 hacker DOS命令詳解(net user / type /md /rd/ dir /cd /net use copy、批處理 等) 利用dos命令制作 ......

    uj5u.com 2020-09-10 02:04:18 more
  • 03.Linux基礎操作

    我學到了以下幾點 01Linux系統介紹02系統安裝,密碼啊破解03Linux常用命令04LAMP 01LINUX windows: win03 8 12 16 19 配置不繁瑣 Linux:redhat,centos(紅帽社區版),Ubuntu server,suse unix:金融機構,證券,銀 ......

    uj5u.com 2020-09-10 02:04:30 more
  • 05HTML

    01HTML介紹 02頭部標簽講解03基礎標簽講解04表單標簽講解 HTML前段語言 js1.了解代碼2.根據代碼 懂得挖掘漏洞 (POST注入/XSS漏洞上傳)3.黑帽seo 白帽seo 客戶網站被黑帽植入劫持代碼如何處理4.熟悉html表單 <html><head><title>TDK標題,描述 ......

    uj5u.com 2020-09-10 02:04:36 more
最新发布
  • 2023年最新微信小程式抓包教程

    01 開門見山 隔一個月發一篇文章,不過分。 首先回顧一下《微信系結手機號資料庫被脫庫事件》,我也是第一時間得知了這個訊息,然后跟蹤了整件事情的經過。下面是這起事件的相關截圖以及近日流出的一萬條資料樣本: 個人認為這件事也沒什么,還不如關注一下之前45億快遞資料查詢渠道疑似在近日復活的訊息。 訊息是 ......

    uj5u.com 2023-04-20 08:48:24 more
  • web3 產品介紹:metamask 錢包 使用最多的瀏覽器插件錢包

    Metamask錢包是一種基于區塊鏈技術的數字貨幣錢包,它允許用戶在安全、便捷的環境下管理自己的加密資產。Metamask錢包是以太坊生態系統中最流行的錢包之一,它具有易于使用、安全性高和功能強大等優點。 本文將詳細介紹Metamask錢包的功能和使用方法。 一、 Metamask錢包的功能 數字資 ......

    uj5u.com 2023-04-20 08:47:46 more
  • vulnhub_Earth

    前言 靶機地址->>>vulnhub_Earth 攻擊機ip:192.168.20.121 靶機ip:192.168.20.122 參考文章 https://www.cnblogs.com/Jing-X/archive/2022/04/03/16097695.html https://www.cnb ......

    uj5u.com 2023-04-20 07:46:20 more
  • 從4k到42k,軟體測驗工程師的漲薪史,給我看哭了

    清明節一過,盲猜大家已經無心上班,在數著日子準備過五一,但一想到銀行卡里的余額……瞬間心情就不美麗了。最近,2023年高校畢業生就業調查顯示,本科畢業月平均起薪為5825元。調查一出,便有很多同學表示自己又被平均了。看著這一資料,不免讓人想到前不久中國青年報的一項調查:近六成大學生認為畢業10年內會 ......

    uj5u.com 2023-04-20 07:44:00 more
  • 最新版本 Stable Diffusion 開源 AI 繪畫工具之中文自動提詞篇

    🎈 標簽生成器 由于輸入正向提示詞 prompt 和反向提示詞 negative prompt 都是使用英文,所以對學習母語的我們非常不友好 使用網址:https://tinygeeker.github.io/p/ai-prompt-generator 這個網址是為了讓大家在使用 AI 繪畫的時候 ......

    uj5u.com 2023-04-20 07:43:36 more
  • 漫談前端自動化測驗演進之路及測驗工具分析

    隨著前端技術的不斷發展和應用程式的日益復雜,前端自動化測驗也在不斷演進。隨著 Web 應用程式變得越來越復雜,自動化測驗的需求也越來越高。如今,自動化測驗已經成為 Web 應用程式開發程序中不可或缺的一部分,它們可以幫助開發人員更快地發現和修復錯誤,提高應用程式的性能和可靠性。 ......

    uj5u.com 2023-04-20 07:43:16 more
  • CANN開發實踐:4個DVPP記憶體問題的典型案例解讀

    摘要:由于DVPP媒體資料處理功能對存放輸入、輸出資料的記憶體有更高的要求(例如,記憶體首地址128位元組對齊),因此需呼叫專用的記憶體申請介面,那么本期就分享幾個關于DVPP記憶體問題的典型案例,并給出原因分析及解決方法。 本文分享自華為云社區《FAQ_DVPP記憶體問題案例》,作者:昇騰CANN。 DVPP ......

    uj5u.com 2023-04-20 07:43:03 more
  • msf學習

    msf學習 以kali自帶的msf為例 一、msf核心模塊與功能 msf模塊都放在/usr/share/metasploit-framework/modules目錄下 1、auxiliary 輔助模塊,輔助滲透(埠掃描、登錄密碼爆破、漏洞驗證等) 2、encoders 編碼器模塊,主要包含各種編碼 ......

    uj5u.com 2023-04-20 07:42:59 more
  • Halcon軟體安裝與界面簡介

    1. 下載Halcon17版本到到本地 2. 雙擊安裝包后 3. 步驟如下 1.2 Halcon軟體安裝 界面分為四大塊 1. Halcon的五個助手 1) 影像采集助手:與相機連接,設定相機引數,采集影像 2) 標定助手:九點標定或是其它的標定,生成標定檔案及內參外參,可以將像素單位轉換為長度單位 ......

    uj5u.com 2023-04-20 07:42:17 more
  • 在MacOS下使用Unity3D開發游戲

    第一次發博客,先發一下我的游戲開發環境吧。 去年2月份買了一臺MacBookPro2021 M1pro(以下簡稱mbp),這一年來一直在用mbp開發游戲。我大致分享一下我的開發工具以及使用體驗。 1、Unity 官網鏈接: https://unity.cn/releases 我一般使用的Apple ......

    uj5u.com 2023-04-20 07:40:19 more