项目实战:Qt+Arm+Fpga医疗肾镜(又名内窥镜)(实时影像、冻结、拍照、白平衡、九宫格、录像、背光调整、硬件光源调整、光源手动自动调整、物理按键)
若该文为原创文章,转载请注明原文出处
本文章博客地址: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
项目实战:Qt+Arm+Fpga医疗肾镜(又名内窥镜)(实时影像、冻结、拍照、白平衡、九宫格、录像、背光调整、硬件光源调整、光源手动自动调整、物理按键)的更多相关文章
- 案例分享:Qt+Arm基于RV1126平台的内窥镜软硬整套解决方案(实时影像、冻结、拍照、录像、背光调整、硬件光源调整,其他产品也可使用该平台,如视频监控,物联网产品等等)
自研产品系列方案 1. 基于瑞芯微的 RV1126 芯片平台: 2. 外接 USB 摄像头(OV9734. OV6946.OV2740 等 UVC 模块)作为图像输入源: 3. 可通过 LED ...
- Visual Studio 2015开发Qt项目实战经验分享(附项目示例源码)
Visual Studio 2015开发Qt项目实战经验分享(附项目示例源码) 转 https://blog.csdn.net/lhl1124281072/article/details/800 ...
- 【大话QT之十六】使用ctkPluginFramework插件系统构建项目实战
"使用ctkPluginFramework插件系统构建项目实战",这篇文章是写博客以来最纠结的一篇文章. 倒不是由于技术都多么困难,而是想去描写叙述一个项目架构採用ctkPlugi ...
- 项目实战:Qt手机模拟器拉伸旋转框架
若该文为原创文章,未经允许不得转载原博主博客地址:https://blog.csdn.net/qq21497936原博主博客导航:https://blog.csdn.net/qq21497936/ar ...
- 项目实战:Qt+Ffmpeg+OpenCV相机程序(打开摄像头、支持多种摄像头、分辨率调整、翻转、旋转、亮度调整、拍照、录像、回放图片、回放录像)
若该文为原创文章,未经允许不得转载原博主博客地址:https://blog.csdn.net/qq21497936原博主博客导航:https://blog.csdn.net/qq21497936/ar ...
- QT5 QSS QML界面美化视频课程系列 QT原理 项目实战 C++1X STL
QT5 QSS QML界面美化视频课程系列 QT原理 项目实战 C++1X STL 课程1 C语言程序设计高级实用速成课程 基础+进阶+自学 课程2 C语言程序设计Windows GDI图形绘 ...
- 第二百五十二节,Bootstrap项目实战-首页
Bootstrap项目实战-首页 html <!DOCTYPE html> <html lang="zh-cn"> <head> <met ...
- Net core项目实战篇01---EFCore CodeFirs For Mysql 数据库初始化
从今天开始我们用Net Core进行项目实战,采用微服务构架,因此你会看到我各模块开始都是用的web api.项目中的代码直接可以复制.费话不多说,现在就来跟我一起开始吧! 1.打开VS2017—&g ...
- Asp.Net Core 项目实战之权限管理系统(4) 依赖注入、仓储、服务的多项目分层实现
0 Asp.Net Core 项目实战之权限管理系统(0) 无中生有 1 Asp.Net Core 项目实战之权限管理系统(1) 使用AdminLTE搭建前端 2 Asp.Net Core 项目实战之 ...
- 给缺少Python项目实战经验的人
我们在学习过程中最容易犯的一个错误就是:看的多动手的少,特别是对于一些项目的开发学习就更少了! 没有一个完整的项目开发过程,是不会对整个开发流程以及理论知识有牢固的认知的,对于怎样将所学的理论知识应用 ...
随机推荐
- lldb3.9.0 安装攻略
Study From https://github.com/dotnet/diagnostics/blob/master/documentation/lldb/centos7/build-instal ...
- charles如何抓取https请求
我们都知道charles下载安装后只能抓取http请求,要想抓取https请求需要下载安装证书 下面介绍pc端和移动端的配置方法 一.pc端(win) 1.打开charles,点击help>SS ...
- 如何给所有的 await async 函数添加try/catch?
如何给所有的 await async 函数添加try/catch?做全局捕获异常. 面试官:如何给所有的 await async 函数添加try/catch?做全局捕获异常. 我们可以使用 windo ...
- 吾爱破解 2023 春节解题领红包之 Web 题解
(图作者 | 吾爱破解@Ps出来的小赵) 吾爱破解每年都有个解题领红包活动,今年也不例外,需要我们使出看家逆向本领来分析内容获得口令红包,根据难度等级不同会获得不同数量的吾爱币,活动持续到元宵节结束. ...
- Gorm 数据库表迁移与表模型定义
目录 一.Docker快速创建MySQL实例 1.1 创建 1.3 创建数据库 二.AutoMigrate介绍与使用 2.1 AutoMigrate介绍 2.2 AutoMigrate 基本使用 三. ...
- chrome谷歌浏览器多开(独立环境 独立cookie)
复制下面代码(路径) "C:\Program Files\Google\Chrome\Application\chrome.exe" --user-data-dir="D ...
- 提高Unity编译dll的速度
前言 我们有一个Unity纯C#开发的mmo项目(使用ILRuntime热更,开发阶段跑纯C#),在开发到后期之后,每次修改C#代码编译时间在25秒左右,这部分的等待时间是很长的, 我在想有没有办法可 ...
- 金融领域:产业链知识图谱包括上市公司、行业和产品共3类实体,构建并形成了一个节点10w+,关系边16w的十万级别产业链图谱
金融领域:产业链知识图谱包括上市公司.行业和产品共3类实体,构建并形成了一个节点10w+,关系边16w的十万级别产业链图谱 包括上市公司所属行业关系.行业上级关系.产品上游原材料关系.产品下游产品关系 ...
- 【二】分布式训练---参数服务器训练(飞桨paddle1.8)
1.参数服务器训练简介 参数服务器训练是分布式训练领域普遍采用的编程架构,主要解决以下两类问题: 模型参数过大:单机内存空间不足,需要采用分布式存储. 训练数据过多:单机训练太慢,需要加大训练节点,来 ...
- 【CSDN浏览器插件测评超详细版】——万能便捷的C功能,直接爱不释手,强烈推荐!更多功能等你探索
我的界面预览: 1.下载安装 下载链接:https://plugin.csdn.net/?utm_source=chajian-contest-1210#/chrome-index-help 说明:若 ...