文章目录
- 一、相机操作相关示例
- 1.摄像头操作内容使用示例
- 2.摄像头信息展示使用示例
- 3.摄像头设置切换、预览操作示例
- 二、相机使用个人操作理解
- 1.相机类支持信息获取
- 2.相机类曝光、焦点、图像处理控制信息获取
- 3.快速启动相机设置(各个设备处于理想状态)
- 三、相机Demo源码
- mainwindow.h
- mainwindow.cpp
- mainwindow.ui
- 四、总结
一、相机操作相关示例
1.摄像头操作内容使用示例
下图演示流程如下
- 演示未打开摄像头时的拍摄提示
- 选择摄像头并打开
- 选择保存路径并查看保存路径(保证拍摄前无图)
- 点击拍摄并查看保存的图片
2.摄像头信息展示使用示例
下图演示了通过相机对象相关函数获取的相关信息展示
3.摄像头设置切换、预览操作示例
下图演示流程如下
- 预览当前照片(查看新拍摄前的照片)
- 切换相机设置信息(从设置5切换到设置0)
- 点击就拍摄当前照片(包含Qt 5.9的图像)
- 点击预览包含Qt 5.9的图像
二、相机使用个人操作理解
1.相机类支持信息获取
没错,相机对象启动后是可以查看相机的支持信息,相机可查看的支持信息包括支持的锁类型、支持的帧率范围、支持的像素格式、支持的分辨率已经支持的设置列表。
**注:**下方可传入一个取景器设置的函数将只匹配传入设置的已有配置,然后返回对应支持的配置列表;若传入设置为空则返回所有支持列表;使用相机前推荐先查看相机支持信息再继续使用。
/*** @brief supportedLocks 返回相机支持的锁类型* @return 支持的锁类型*/QCamera::LockTypes supportedLocks() const;/*** @brief supportedViewfinderFrameRateRanges 返回相机支持的帧率范围列表* @param settings 要匹配的取景器设置* @return 可适配的帧率范围列表*/QList<QCamera::FrameRateRange> supportedViewfinderFrameRateRanges(const QCameraViewfinderSettings &settings = QCameraViewfinderSettings()) const;/*** @brief supportedViewfinderPixelFormats 返回相机支持的像素格式列表* @param settings 要匹配的取景器设置* @return 可适配的像素格式列表*/QList<QVideoFrame::PixelFormat> supportedViewfinderPixelFormats(const QCameraViewfinderSettings &settings = QCameraViewfinderSettings()) const;/*** @brief supportedViewfinderResolutions 返回相机支持的分辨率列表* @param settings 要匹配的取景器设置* @return 可适配的分辨率列表*/QList<QSize> supportedViewfinderResolutions(const QCameraViewfinderSettings &settings = QCameraViewfinderSettings()) const;/*** @brief supportedViewfinderSettings 返回相机支持的取景器设置列表* @param settings 要匹配的取景器设置* @return 可适配的取景器设置列表*/QList<QCameraViewfinderSettings> supportedViewfinderSettings(const QCameraViewfinderSettings &settings = QCameraViewfinderSettings()) const;
2.相机类曝光、焦点、图像处理控制信息获取
相机可通过一下函数获取相机对于的控制对象,但是获取的控制对象是const修饰符修饰的对象,所以获取的控制对象只能查看不能修改。
/*** @brief exposure 返回相机的曝光控制对象* @return 曝光对象控制对象*/QCameraExposure *exposure() const;/*** @brief focus 返回相机的焦点控制对象* @return 焦点控制对象*/QCameraFocus *focus() const;/*** @brief imageProcessing 返回相机图像处理控制对象* @return 图像处理控制对象*/QCameraImageProcessing *imageProcessing() const;
3.快速启动相机设置(各个设备处于理想状态)
下方代码为快速获取相机信息并启动相机的代码逻辑。
// 创建相机显示控件QWidget *wgt = new QWidget;// 添加布局器wgt->setLayout(new QHBoxLayout);// 创建相机对象,并通过相机信息函数获取最后一个相机QCamera *camera = new QCamera(QCameraInfo::availableCameras().last());// 创建相机取景器对象QCameraViewfinder *viewFinder = new QCameraViewfinder(wgt);// 设置相机取景器到相机中camera->setViewfinder(viewFinder);// 将取景器添加到布局器中wgt->layout()->addWidget(viewFinder);// 显示控件wgt->show();// 启动相机camera->start();
三、相机Demo源码
mainwindow.h
#ifndef MAINWINDOW_H
#define MAINWINDOW_H#include <QMainWindow>
#include <QCameraViewfinder>
#include <QCameraInfo>QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACEclass QCamera;
class MainWindow : public QMainWindow
{Q_OBJECT
public:MainWindow(QWidget *parent = nullptr);~MainWindow();/*** @brief initUi 初始化UI界面信息*/void initUi();/*** @brief initCamera 初始化相机信息*/void initCamera();/*** @brief updateCameraSupportInfo 更新相机支持信息*/void updateCameraSupportInfo();/*** @brief updateCameraSupportSettingsInfo 更新相机支持的设置信息*/void updateCameraSupportSettingsInfo();/*** @brief updateCameraSupportSettingsInfoBySetting 基于传入相机取景器设置对象的更新相机支持的设置信息* @param setting 传入相机取景器设置对象*/void updateCameraSupportSettingsInfoBySetting(const QCameraViewfinderSettings &setting);private slots:/*** @brief on_btnOpenCloseCamera_clicked 打开/关闭摄像头*/void on_btnOpenCamera_clicked();/*** @brief on_btnCaptureImg_clicked 拍照槽函数*/void on_btnCaptureImg_clicked();/*** @brief on_btnBaseInfo_clicked 展示基础信息*/void on_btnBaseInfo_clicked();/*** @brief on_btnExposureInfo_clicked 展示曝光信息*/void on_btnExposureInfo_clicked();/*** @brief on_btnCameraFocusInfo_clicked 展示相机焦点信息*/void on_btnCameraFocusInfo_clicked();/*** @brief on_btnImageProcessingInfo_clicked*/void on_btnImageProcessingInfo_clicked();/*** @brief on_btnUseCurrentSettings_clicked 使用当前设置信息*/void on_btnUseCurrentSettings_clicked();/*** @brief on_comboBoxSettings_currentIndexChanged 设置信息下拉框项更新槽函数* @param index 更新索引位置*/void on_comboBoxSettings_currentIndexChanged(int index);/*** @brief on_btnSelSavePath_clicked 选择图片保存路径*/void on_btnSelSavePath_clicked();/*** @brief on_btnPreviewImg_clicked 图片预览按钮* @param checked 按钮选中状态,预览状态*/void on_btnPreviewImg_clicked(bool checked);private:Ui::MainWindow *ui;QCamera *m_camera = Q_NULLPTR; // 相机对象QCameraViewfinder m_cameraViewfinder; // 相机取景器对象QHash<QString, QCameraInfo> m_hashCameraInfos; // 相机信息容器
};
#endif // MAINWINDOW_H
mainwindow.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"#include <QCamera>
#include <QCameraInfo>
#include <QMessageBox>
#include <QDateTime>
#include <QFileDialog>
#include <QTimer>#include <QCameraFocus>
#include <QCameraExposure>
#include <QCameraImageCapture>
#include <QCameraImageProcessing>MainWindow::MainWindow(QWidget *parent): QMainWindow(parent), ui(new Ui::MainWindow), m_camera(new QCamera(this))
{ui->setupUi(this);// 初始化ui界面initUi();// 初始化相机信息initCamera();
}MainWindow::~MainWindow()
{delete ui;
}void MainWindow::initUi()
{// 默认显示预览窗口ui->stackedWidget->setCurrentIndex(1);// 添加相机取景器到布局器中ui->layoutCamera->addWidget(&m_cameraViewfinder);// 添加提示信息ui->btnBaseInfo->setToolTip(u8"相机对象可直接获取的信息");ui->btnExposureInfo->setToolTip(u8"相机曝光信息:使用相机对象通过exposure函数获取QCameraExposure对象中拿到的信息");ui->btnCameraFocusInfo->setToolTip(u8"相机聚焦信息:使用相机对象通过focus函数获取QCameraFocus对象中拿到的信息");ui->btnImageProcessingInfo->setToolTip(u8"相机图片处理信息:使用相机对象通过imageProcessing函数获取QCameraImageProcessing对象中拿到的信息");
}void MainWindow::initCamera()
{// 清空相机信息容器m_hashCameraInfos.clear();// 获取可用的相机信息容器const QList<QCameraInfo> &cameras = QCameraInfo::availableCameras();// 遍历可用相机信息容器,将相机信息存储并添加在相机信息下拉框中foreach (const QCameraInfo &cameraInfo, cameras) {m_hashCameraInfos[cameraInfo.description()] = cameraInfo;ui->comboBoxCameraInfo->addItem(cameraInfo.description());}// 未检测到相机的提示if(0 == ui->comboBoxCameraInfo->count()) {QMessageBox::information(this, u8"提示", u8"未检索到摄像头!");}
}void MainWindow::updateCameraSupportInfo()
{// 支持信息容器清空ui->textBrowserSupportInfo->clear();// 摄像头未启动提示if(QCamera::ActiveState != m_camera->state()) {QMessageBox::information(this, u8"提示", u8"摄像头未启动,无法获取支持信息");return;}//! 添加相机基础信息// 支持的锁定信息QString locksStr = u8"锁类型:";locksStr += QString("%1 ").arg(m_camera->supportedLocks());ui->textBrowserSupportInfo->append(locksStr);// 支持的帧率范围QString frameRateRangesStr = u8"帧率范围:";foreach(auto rangeInfo, m_camera->supportedViewfinderFrameRateRanges()) {frameRateRangesStr += QString("(%1, %2) ").arg(rangeInfo.minimumFrameRate).arg(rangeInfo.maximumFrameRate);}ui->textBrowserSupportInfo->append(frameRateRangesStr);// 支持的像素格式QString pixelFormatsStr = u8"像素格式:";foreach(auto pixelFormatInfo, m_camera->supportedViewfinderPixelFormats()) {pixelFormatsStr += QString("%1 ").arg(pixelFormatInfo);}ui->textBrowserSupportInfo->append(pixelFormatsStr);// 支持的分辨率QString resolutionsStr = u8"分辨率:";foreach(auto resolutionInfo, m_camera->supportedViewfinderResolutions()) {resolutionsStr += QString("(%1, %2) ").arg(resolutionInfo.width()).arg(resolutionInfo.height());}ui->textBrowserSupportInfo->append(resolutionsStr);
}void MainWindow::updateCameraSupportSettingsInfo()
{// 设置列表下拉框清空ui->comboBoxSettings->clear();if(QCamera::ActiveState != m_camera->state()) {QMessageBox::information(this, u8"提示", u8"摄像头支持的设置列表获取失败");return;}// 获取当前设置信息QCameraViewfinderSettings setting = m_camera->viewfinderSettings();// 更新当前设置信息容器updateCameraSupportSettingsInfoBySetting(setting);// 遍历支持的设置容器,并在设置细腻些下拉框中添加索引for(int idx = 0; idx < m_camera->supportedViewfinderSettings().size(); ++idx) {ui->comboBoxSettings->addItem(u8"设置" + QString::number(idx));}// 将设置下拉框设置为默认设置信息对于的选项ui->comboBoxSettings->setCurrentIndex(m_camera->supportedViewfinderSettings().indexOf(setting));
}void MainWindow::updateCameraSupportSettingsInfoBySetting(const QCameraViewfinderSettings &setting)
{// 设置信息显示清空ui->textBrowserSettingInfo->clear();// 分别添加分辨率、像素光谱比、帧率、像素格式数据QString resolutionStr = QString(u8"分辨率:%1, %2 ").arg(setting.resolution().width()).arg(setting.resolution().height());QString pixelAspectRatioStr = QString(u8"像素光谱比:%1, %2 ").arg(setting.pixelAspectRatio().width()).arg(setting.pixelAspectRatio().height());QString frameRateStr = QString(u8"帧率:(%1, %2) ").arg(setting.maximumFrameRate()).arg(setting.minimumFrameRate());QString pixelFormatStr = QString(u8"像素格式:%1 ").arg(setting.pixelFormat());// 信息追加显示ui->textBrowserSettingInfo->append(resolutionStr);ui->textBrowserSettingInfo->append(pixelAspectRatioStr);ui->textBrowserSettingInfo->append(frameRateStr);ui->textBrowserSettingInfo->append(pixelFormatStr);}void MainWindow::on_btnOpenCamera_clicked()
{// 当打开新相机时,释放原有相机对象,再重新创建if(Q_NULLPTR != m_camera) {delete m_camera;m_camera = new QCamera(m_hashCameraInfos[ui->comboBoxCameraInfo->currentText()], this);m_camera->setViewfinder(&m_cameraViewfinder);// 将栈窗口设置为相机窗口ui->stackedWidget->setCurrentIndex(0);}// 判断摄像头是否链接成功if(QCamera::NoError != m_camera->error()) {QMessageBox::warning(this, u8"警告", m_camera->errorString());}else {// 外部接入的摄像头输出“failed to find the video proc amp”m_camera->start();if(QCamera::ActiveState == m_camera->state()) {updateCameraSupportInfo();updateCameraSupportSettingsInfo();}}
}void MainWindow::on_btnCaptureImg_clicked()
{// 判断摄像头状态if(QCamera::ActiveState != m_camera->state()) {QMessageBox::information(this, u8"提示", u8"摄像头未启动");return;}else if(!QDir().exists(ui->lineEditSavePath->text())) { // 当前设置路径不存在则提示返回QMessageBox::information(this, u8"提示", u8"指定保存路径无效");return;}// 创建相机图像捕捉对象并传入当前摄像头对象QCameraImageCapture imageCapture(m_camera);// 判断错误信息if(QCameraImageCapture::NoError != imageCapture.error()) {QMessageBox::warning(this, u8"警告", u8"出错了:" + imageCapture.errorString());return;}// 锁定相机配置:锁定所有支持的相机设置m_camera->searchAndLock();// 通过选择的路径和当前时间,拼接出图片保存文件路径及文件名QString imgFileName = ui->lineEditSavePath->text() + QDateTime::currentDateTime().toString("/yyyyMMdd-hhmmss(z)");// 图像截取if( -1 == imageCapture.capture(imgFileName)) {QMessageBox::information(this, u8"提示", u8"图片捕获失败 " + m_camera->errorString());}else {// 将保存的图片添加到右下角的图片标签中QTimer::singleShot(200, this, [this, imgFileName](){// 设置图片保持比例及无锯齿效果ui->labelImg->setPixmap(QPixmap(imgFileName).scaled(ui->labelImg->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation));// 更新缩略图的路径ui->labelImg->setWhatsThis(imgFileName);});}// 解锁所有请求的摄像头锁m_camera->unlock();
}void MainWindow::on_btnBaseInfo_clicked()
{if(QCamera::ActiveState != m_camera->state()) {QMessageBox::information(this, u8"提示", u8"摄像头未启动,无法获取基础信息");return;}// 信息容器QStringList infoStrList;// 相机基础信息依次添加infoStrList.append(u8"错误码:" + QString::number(m_camera->error()));infoStrList.append(QString(u8"错误描述:\"%1\"").arg(m_camera->errorString()));infoStrList.append(u8"锁定状态:" + QString::number(m_camera->lockStatus()));infoStrList.append(u8"当前状态1:" + QString::number(m_camera->state()));infoStrList.append(u8"当前状态2:" + QString::number(m_camera->status()));// 展示相机基础信息QMessageBox msg(u8"提示", infoStrList.join("\n"), QMessageBox::NoIcon, QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton);msg.exec();
}void MainWindow::on_btnExposureInfo_clicked()
{if(QCamera::ActiveState != m_camera->state()) {QMessageBox::information(this, u8"提示", u8"摄像头未启动,无法获取曝光信息");return;}// 信息容器QStringList infoStrList;// 获取相机曝光对象QCameraExposure *exposure = m_camera->exposure();// 曝光信息依次添加infoStrList.append(u8"光圈:" + QString::number(exposure->aperture()));infoStrList.append(u8"曝光补偿:" + QString::number(exposure->exposureCompensation()));infoStrList.append(u8"等灵敏度:" + QString::number(exposure->isoSensitivity()));infoStrList.append(u8"快门速度:" + QString::number(exposure->shutterSpeed()));infoStrList.append(u8"点测量点:" + QString::number(exposure->spotMeteringPoint().x())+ "," + QString::number(exposure->spotMeteringPoint().y()));// 展示曝光信息QMessageBox msg(u8"提示", infoStrList.join("\n"), QMessageBox::NoIcon, QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton);msg.exec();
}void MainWindow::on_btnCameraFocusInfo_clicked()
{if(QCamera::ActiveState != m_camera->state()) {QMessageBox::information(this, u8"提示", u8"摄像头未启动,无法获取聚焦信息");return;}// 信息容器QStringList infoStrList;// 获取相机聚焦对象QCameraFocus *focus = m_camera->focus();// 聚焦信息依次添加infoStrList.append(u8"自定义焦点:" + QString::number(focus->customFocusPoint().x())+ "," + QString::number(focus->customFocusPoint().y()));infoStrList.append(u8"数码变焦:" + QString::number(focus->digitalZoom()));infoStrList.append(u8"最大数码变焦:" + QString::number(focus->maximumDigitalZoom()));infoStrList.append(u8"光学变焦:" + QString::number(focus->opticalZoom()));infoStrList.append(u8"最大光学变焦:" + QString::number(focus->maximumOpticalZoom()));// 展示聚焦信息QMessageBox msg(u8"提示", infoStrList.join("\n"), QMessageBox::NoIcon, QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton);msg.exec();
}void MainWindow::on_btnImageProcessingInfo_clicked()
{if(QCamera::ActiveState != m_camera->state()) {QMessageBox::information(this, u8"提示", u8"摄像头未启动,无法获取图片处理信息");return;}// 信息容器QStringList infoStrList;// 获取相机图片处理对象QCameraImageProcessing *focus = m_camera->imageProcessing();// 图片处理信息依次添加infoStrList.append(u8"亮度:" + QString::number(focus->brightness()));infoStrList.append(u8"对比度:" + QString::number(focus->contrast()));infoStrList.append(u8"降噪级别:" + QString::number(focus->denoisingLevel()));infoStrList.append(u8"手动白平衡:" + QString::number(focus->manualWhiteBalance()));infoStrList.append(u8"饱和度:" + QString::number(focus->saturation()));infoStrList.append(u8"锐化级别:" + QString::number(focus->sharpeningLevel()));// 展示图片处理信息QMessageBox msg(u8"提示", infoStrList.join("\n"), QMessageBox::NoIcon, QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton);msg.exec();
}void MainWindow::on_btnUseCurrentSettings_clicked()
{if(QCamera::ActiveState != m_camera->state()) {QMessageBox::information(this, u8"提示", u8"摄像头未启动,无法更新设置");}else if(m_camera->viewfinderSettings()!= m_camera->supportedViewfinderSettings().at(ui->comboBoxSettings->currentIndex())) { // 判断当前取景器设置和将要设置的取景器设置不一致则进入// 根据当前取景器设置下拉框索引位置获取设置m_camera->setViewfinderSettings(m_camera->supportedViewfinderSettings().at(ui->comboBoxSettings->currentIndex()));}
}void MainWindow::on_comboBoxSettings_currentIndexChanged(int index)
{if(-1 != index) {// 根据设置信息下拉框切换后的索引位置获取对应的设置并更新相机设置信息updateCameraSupportSettingsInfoBySetting(m_camera->supportedViewfinderSettings().at(index));}
}void MainWindow::on_btnSelSavePath_clicked()
{// 获取保存目录QString savePath = QFileDialog::getExistingDirectory();// 保存路径不为空则进入设置if(!savePath.isEmpty()) {ui->lineEditSavePath->setText(savePath);}
}void MainWindow::on_btnPreviewImg_clicked(bool checked)
{// 更新按钮文本if(!checked) {ui->btnPreviewImg->setText(u8"预览");// 切换到相机窗口ui->stackedWidget->setCurrentIndex(0);}else if(checked && !ui->labelImg->whatsThis().isEmpty()) { // 判断是否存在可预览图像// 将图像显示到预览标签中并设置图片保持比例及无锯齿效果ui->labelImgPreview->setPixmap(QPixmap(ui->labelImg->whatsThis()).scaled(ui->labelImgPreview->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation));ui->btnPreviewImg->setText(u8"返回");// 切换到预览窗口ui->stackedWidget->setCurrentIndex(1);}else {ui->btnPreviewImg->setChecked(!checked);QMessageBox::information(this, u8"提示", u8"暂无可预览图片");}
}
mainwindow.ui
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"><class>MainWindow</class><widget class="QMainWindow" name="MainWindow"><property name="geometry"><rect><x>0</x><y>0</y><width>1117</width><height>857</height></rect></property><property name="windowTitle"><string>MainWindow</string></property><widget class="QWidget" name="centralwidget"><layout class="QGridLayout" name="gridLayout_2" rowstretch="1,0,1,1,1" columnstretch="1,0"><item row="0" column="0" rowspan="5"><widget class="QWidget" name="widgetCamera" native="true"><property name="styleSheet"><string notr="true">border:2px solid rgb(112, 112, 112);</string></property><layout class="QVBoxLayout" name="layoutStacked"><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="QStackedWidget" name="stackedWidget"><widget class="QWidget" name="page"><layout class="QVBoxLayout" name="layoutCamera"/></widget><widget class="QWidget" name="page_2"><layout class="QHBoxLayout" name="horizontalLayout_2"><item><widget class="QLabel" name="labelImgPreview"><property name="sizePolicy"><sizepolicy hsizetype="Expanding" vsizetype="Expanding"><horstretch>0</horstretch><verstretch>0</verstretch></sizepolicy></property><property name="styleSheet"><string notr="true">border:none;</string></property><property name="text"><string/></property><property name="alignment"><set>Qt::AlignCenter</set></property></widget></item></layout></widget></widget></item></layout></widget></item><item row="0" column="1"><widget class="QGroupBox" name="groupBox_2"><property name="title"><string>摄像头操作</string></property><layout class="QVBoxLayout" name="verticalLayout"><item><widget class="QComboBox" name="comboBoxCameraInfo"/></item><item><widget class="QPushButton" name="btnOpenCamera"><property name="text"><string>打开摄像头</string></property></widget></item><item><layout class="QHBoxLayout" name="horizontalLayout"><item><widget class="QLineEdit" name="lineEditSavePath"><property name="placeholderText"><string>请选择保存路径</string></property></widget></item><item><widget class="QPushButton" name="btnSelSavePath"><property name="text"><string>选择路径</string></property></widget></item></layout></item><item><widget class="QPushButton" name="btnCaptureImg"><property name="text"><string>拍摄</string></property></widget></item></layout></widget></item><item row="1" column="1"><widget class="QGroupBox" name="groupBox"><property name="title"><string>信息展示</string></property><layout class="QGridLayout" name="gridLayout"><item row="0" column="0"><widget class="QPushButton" name="btnBaseInfo"><property name="text"><string>基础信息</string></property></widget></item><item row="0" column="1"><widget class="QPushButton" name="btnExposureInfo"><property name="text"><string>曝光信息</string></property></widget></item><item row="1" column="0"><widget class="QPushButton" name="btnCameraFocusInfo"><property name="text"><string>相机聚焦信息</string></property></widget></item><item row="1" column="1"><widget class="QPushButton" name="btnImageProcessingInfo"><property name="text"><string>图像处理信息</string></property></widget></item></layout></widget></item><item row="2" column="1"><widget class="QGroupBox" name="groupBox_3"><property name="title"><string>相机支持信息</string></property><layout class="QGridLayout" name="gridLayout_3"><item row="0" column="0"><widget class="QTextBrowser" name="textBrowserSupportInfo"/></item></layout></widget></item><item row="4" column="1"><widget class="QGroupBox" name="groupBox_4"><property name="title"><string>图片预览</string></property><layout class="QGridLayout" name="gridLayout_5"><item row="1" column="0"><widget class="QPushButton" name="btnPreviewImg"><property name="text"><string>预览</string></property><property name="checkable"><bool>true</bool></property></widget></item><item row="0" column="0"><widget class="QLabel" name="labelImg"><property name="sizePolicy"><sizepolicy hsizetype="Expanding" vsizetype="Expanding"><horstretch>0</horstretch><verstretch>0</verstretch></sizepolicy></property><property name="text"><string/></property><property name="alignment"><set>Qt::AlignCenter</set></property></widget></item></layout></widget></item><item row="3" column="1"><widget class="QGroupBox" name="groupBox_5"><property name="title"><string>相机支持的取景器设置列表</string></property><layout class="QGridLayout" name="gridLayout_6"><item row="1" column="0"><widget class="QTextBrowser" name="textBrowserSettingInfo"/></item><item row="0" column="0"><widget class="QComboBox" name="comboBoxSettings"/></item><item row="2" column="0"><widget class="QPushButton" name="btnUseCurrentSettings"><property name="text"><string>使用设置</string></property></widget></item></layout></widget></item></layout></widget><widget class="QMenuBar" name="menubar"><property name="geometry"><rect><x>0</x><y>0</y><width>1117</width><height>26</height></rect></property></widget><widget class="QStatusBar" name="statusbar"/></widget><resources/><connections/>
</ui>
四、总结
- 需要修改相机参数,使用相机前请参考相机支持函数信息。
- 相机提供的几个控制对象获取函数都是只能查看不能修改。
- 同时,相机对象发出的信号信息也值得关注。
友情提示——哪里看不懂可私哦,让我们一起互相进步吧
(创作不易,请留下一个免费的赞叭 谢谢 ^o^/)
注:文章为作者编程过程中所遇到的问题和总结,内容仅供参考,若有错误欢迎指出。
注:如有侵权,请联系作者删除