7 Commits

Author SHA1 Message Date
d326dabff7 add,深度相机:
1、采集惯导数据并写入文件;
2、轮播看板添加深度图像;
3、植物表型场景控制深度相机看板;

fix:
优化调焦时,图像像素的填充方式;
2026-04-14 13:14:55 +08:00
5009832b3a add
1、采集深度、彩色、rgb点云,并存储到文件;
2、界面操作逻辑控制,防止用户错误操作;
2026-04-09 16:29:12 +08:00
5350d9431a add
添加深度相机1:控制看板界面
2026-04-08 17:04:51 +08:00
87d9a7fe01 右下角控制看板:每个tab都通过QDialog进行添加 2026-04-08 11:07:25 +08:00
fa6ce1a606 fix
1、【相机----马达】双向意外断掉容错 + 提示:(1)ximea、pica l、pica nir(2)1轴/2轴马达,usb串口/wifi的马达通讯方式;
2、提示弹窗美化;
2026-04-03 19:32:51 +08:00
e3a778919a 改变文件编码:utf-8带bom 2026-04-02 10:34:57 +08:00
486a9defc1 fix:
1、配置页面3;
2、resononNirImager的bug修复;
2026-04-02 09:55:21 +08:00
110 changed files with 2811 additions and 666 deletions

View File

@ -1,6 +1,7 @@
#include "AppSettings.h"
const QString AppSettings::kDefaultDataFolder = QStringLiteral("C:\\HPPA_image");
const QString AppSettings::kDefaultFileName = QStringLiteral("test_image");
AppSettings::AppSettings()
: m_settings(QSettings::IniFormat, QSettings::UserScope,
@ -23,3 +24,12 @@ void AppSettings::setDataFolder(const QString& path)
{
m_settings.setValue("General/DataFolder", path);
}
QString AppSettings::fileName() const
{
return m_settings.value("General/FileName", kDefaultFileName).toString();
}
void AppSettings::setFileName(const QString& path)
{
m_settings.setValue("General/FileName", path);
}

View File

@ -12,6 +12,8 @@ public:
QString dataFolder() const;
void setDataFolder(const QString& path);
QString fileName() const;
void setFileName(const QString& path);
// 在此处添加更多参数的 getter/setter ...
private:
@ -23,4 +25,5 @@ private:
// 默认值
static const QString kDefaultDataFolder;
static const QString kDefaultFileName;
};

View File

@ -97,7 +97,6 @@ void TwoMotionCaptureCoordinator::stop()
std::cout << "The user manually stops the collection! " << std::endl;
savePathLinesToCsv();
emit sequenceComplete(1);
emit finishRecordLineNumSignal(m_numCurrentPathLine);
//emit stopRecordHSISignal(m_numCurrentPathLine);
if (m_cameraCtrl != nullptr)
@ -106,6 +105,8 @@ void TwoMotionCaptureCoordinator::stop()
}
move2LocBeforeStart();
emit sequenceComplete(1);
}
void TwoMotionCaptureCoordinator::getLocBeforeStart()
@ -471,7 +472,8 @@ OneMotionCaptureCoordinator::OneMotionCaptureCoordinator(
OneMotionCaptureCoordinator::~OneMotionCaptureCoordinator()
{
disconnect(m_motorCtrl, &IrisMultiMotorController::motorStopSignal,
this, &OneMotionCaptureCoordinator::handleMotorStoped);
}
void OneMotionCaptureCoordinator::startStepMotion(OneMotionCapturePathLine pathLine)
@ -585,6 +587,10 @@ void OneMotionCaptureCoordinator::handleMotorStoped(int motorID, double pos)
m_cameraCtrl->stop_record();
}
move2LocBeforeStart();
// emit sequenceComplete last: the slot connected to it may delete this object,
// so no member access is allowed after this point.
emit sequenceComplete(0);
}
void OneMotionCaptureCoordinator::handleCaptureComplete(double index)

View File

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include <QWidget>
#include <QPushButton>
@ -40,13 +40,13 @@ private:
QString m_nomalQSS;
QString m_lockedQSS;
// ״ֵ̬
// 状态值
int m_currentIndex;
bool m_isPlaying;
bool m_isLocked;
int m_lockedIndex;
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// 参数
int m_playInterval;
int m_intervalButtonSize;

View File

@ -1,8 +1,8 @@
#include "Corning410Imager.h"
#include "Corning410Imager.h"
Corning410Imager::Corning410Imager()
{
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>У<EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
//配置文件:如果没有,就创建配置文件
string CfgFile = getPathofEXE() + "\\corning410.cfg";
m_configfile.setConfigfilePath(CfgFile);
if (!m_configfile.isConfigfileExist())
@ -18,7 +18,7 @@ Corning410Imager::~Corning410Imager()
{
if (buffer != nullptr)
{
std::cout << "<EFBFBD>ͷŶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>" << std::endl;
std::cout << "释放堆上内存" << std::endl;
free(buffer);
free(dark);
free(white);
@ -70,7 +70,7 @@ void Corning410Imager::connectImager(const char* camera_sn)
{
m_imager.connect();
//<EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD><EFBFBD><EFBFBD>
//读取配置文件参数,并为相机设置参数
bool ret, ret1, ret2;
int spatialBin;
@ -82,8 +82,8 @@ void Corning410Imager::connectImager(const char* camera_sn)
bool haha = m_imager.setSpectralBin(spectralBin);
bool haha2 = m_imager.setSpatialBin(spatialBin);
std::cout << "spectralBin<EFBFBD><EFBFBD>" << spectralBin << std::endl;
std::cout << "spatialBin<EFBFBD><EFBFBD>" << spatialBin << std::endl;
std::cout << "spectralBin" << spectralBin << std::endl;
std::cout << "spatialBin" << spatialBin << std::endl;
}
float gain, offset;

View File

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include <string>
#include <opencv2/core/core.hpp>

View File

@ -1,4 +1,4 @@
#include "CustomDockWidgetBase.h"
#include "CustomDockWidgetBase.h"
CustomDockWidgetBase::CustomDockWidgetBase(QMainWindow* parent)
: QDockWidget(parent),
@ -55,7 +55,7 @@ void CustomDockWidgetBase::initialize()
border-top: 1px solid #2c586b;
border-left: 1px solid #2c586b;
border-right: 1px solid #2c586b;
border-bottom: none; /* ȡ<EFBFBD><EFBFBD><EFBFBD>ײ<EFBFBD><EFBFBD>߿<EFBFBD> */
border-bottom: none; /* 取消底部边框 */
border-top-left-radius: 5px;
border-top-right-radius: 5px;

View File

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include <QDockWidget>
#include <QToolButton>
#include <QStyle>

160
HPPA/DepthCamera.ui Normal file
View File

@ -0,0 +1,160 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DepthCameraClass</class>
<widget class="QDialog" name="DepthCameraClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>416</width>
<height>219</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>DepthCamera</string>
</property>
<property name="styleSheet">
<string notr="true">QGroupBox
{
border: 12px solid transparent;
/*border-top: 12px solid transparent;
border-right: 0px solid transparent;
border-bottom: 0px solid transparent;
border-left: 0px solid transparent;*/
color: #ACCDFF;
}
QPushButton
{
/*width: 172px;
height: 56px;*/
font: 19pt &quot;新宋体&quot;;
background-color: qlineargradient(
spread:pad,
x1:0.5, y1:0, x2:0.5, y2:1,
stop:0 #283D86,
stop:1 #0F1A40
);
color: white;
border: none;
padding: 8px 16px;
border-radius: 4px;
}
QPushButton:hover
{
background-color: qlineargradient(
spread:pad,
x1:0, y1:0, x2:1, y2:0,
stop:0 #3A4875,
stop:1 #5F6B91
);
}
/* 按下时的效果 */
QPushButton:pressed
{
background-color: qlineargradient(
spread:pad,
x1:0, y1:0, x2:1, y2:0,
stop:0 #1A254F,
stop:1 #3A466B
);
/* 可选:添加下压效果 */
padding-top: 9px;
padding-bottom: 7px;
}</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>18</width>
<height>100</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>135</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QPushButton" name="closeDepthCamera_btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>关 闭</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="openDepthCamera_btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>打 开</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>135</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>18</width>
<height>100</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>

323
HPPA/DepthCameraWindow.cpp Normal file
View File

@ -0,0 +1,323 @@
#include "DepthCameraWindow.h"
DepthCameraWindow::DepthCameraWindow(QWidget* parent)
: QDialog(parent)
{
ui.setupUi(this);
m_DepthCameraThread = new QThread();
m_DepthCameraOperation = new DepthCameraOperation();
m_DepthCameraOperation->moveToThread(m_DepthCameraThread);
m_DepthCameraThread->start();
connect(ui.openDepthCamera_btn, &QPushButton::clicked, this, &DepthCameraWindow::openDepthCamera);
connect(ui.closeDepthCamera_btn, &QPushButton::clicked, this, &DepthCameraWindow::closeDepthCamera);
connect(this, &DepthCameraWindow::openDepthCameraSignal, m_DepthCameraOperation, &DepthCameraOperation::OpenDepthCamera);
connect(m_DepthCameraOperation, &DepthCameraOperation::CamOpenedSignal, this, &DepthCameraWindow::onCamOpened);
connect(m_DepthCameraOperation, &DepthCameraOperation::CamClosedSignal, this, &DepthCameraWindow::onCamClosed);
connect(m_DepthCameraOperation, &DepthCameraOperation::PlotSignal, this, &DepthCameraWindow::PlotDepthImageSignal);
connect(m_DepthCameraOperation, &DepthCameraOperation::CamClosedSignal, this, &DepthCameraWindow::DepthCamClosedSignal);
}
DepthCameraWindow::~DepthCameraWindow()
{
m_DepthCameraThread->quit();
m_DepthCameraThread->wait();
delete m_DepthCameraOperation;
m_DepthCameraOperation = nullptr;
}
void DepthCameraWindow::openDepthCamera()
{
if (!m_DepthCameraOperation->getRecordStatus())
{
emit openDepthCameraSignal();
}
}
void DepthCameraWindow::onCamOpened()
{
ui.openDepthCamera_btn->setEnabled(false);
ui.closeDepthCamera_btn->setEnabled(true);
ui.openDepthCamera_btn->setText(QString::fromLocal8Bit("已打开"));
}
void DepthCameraWindow::closeDepthCamera()
{
m_DepthCameraOperation->CloseDepthCamera();
}
void DepthCameraWindow::onCamClosed()
{
ui.openDepthCamera_btn->setEnabled(true);
ui.closeDepthCamera_btn->setEnabled(false);
ui.openDepthCamera_btn->setText(QString::fromLocal8Bit("打 开"));
}
//-------------------------------------------------------------------------------------------------------------------------------
DepthCameraOperation::DepthCameraOperation()
{
m_pipe = nullptr;
m_func = nullptr;
record = false;
}
DepthCameraOperation::~DepthCameraOperation()
{
if (m_pipe)
{
m_pipe->stop();
delete m_pipe;
m_pipe = nullptr;
}
}
void DepthCameraOperation::OpenDepthCamera()
{
if (m_pipe)
{
return;
}
m_pipe = new ob::Pipeline();
std::shared_ptr<ob::Config> config = std::make_shared<ob::Config>();
// Get device from pipeline.
auto device = m_pipe->getDevice();
auto devInfo = device->getDeviceInfo();
auto pid = devInfo->getPid();
auto vid = devInfo->getVid();
//// Get sensorList from device.
//auto sensorList = device->getSensorList();
//for (uint32_t index = 0; index < sensorList->getCount(); index++) {
// // Query all supported infrared sensor type and enable the infrared stream.
// // For dual infrared device, enable the left and right infrared streams.
// // For single infrared device, enable the infrared stream.
// OBSensorType sensorType = sensorList->getSensorType(index);
// std::cout << "Supported Sensor type: " << sensorType << std::endl;
// // Enable the stream for the sensor type.
// config->enableStream(sensorType);
//}
config->enableVideoStream(OB_STREAM_DEPTH, 640, 480, 15, OB_FORMAT_Y16);
config->enableVideoStream(OB_STREAM_COLOR, 640, 480, 15, OB_FORMAT_YUYV);
config->enableAccelStream();
config->enableGyroStream();
config->setFrameAggregateOutputMode(OB_FRAME_AGGREGATE_OUTPUT_ALL_TYPE_FRAME_REQUIRE);
config->setAlignMode(ALIGN_D2C_HW_MODE);
m_pipe->enableFrameSync();
// Create a format converter filter.
auto formatConverter = std::make_shared<ob::FormatConvertFilter>();
m_pipe->start(config);
// Drop several frames
for (int i = 0; i < 15; ++i) {
auto lost = m_pipe->waitForFrameset(100);
}
auto pointCloud = std::make_shared<ob::PointCloudFilter>();
int frameIndex = 0;
record = true;
QString fileNamePrefix = AppSettings::instance().dataFolder() + QDir::separator() + AppSettings::instance().fileName();
QString imuFilePath = fileNamePrefix + "_IMU.txt";
std::ofstream imuFile(imuFilePath.toStdString(), std::ios::out | std::ios::trunc);
while (record)
{
if(frameIndex==0)
{
emit CamOpenedSignal();
std::cout << "Start recording..." << std::endl;
}
auto frameSet = m_pipe->waitForFrameset(100);
if (frameSet == nullptr)
{
std::cout << "No frames received in 100ms..." << std::endl;
continue;
}
std::cout << "DepthCamera frameIndex"<< frameIndex << std::endl;
// 彩色和深度图像
auto depthFrame = frameSet->getFrame(OB_FRAME_DEPTH)->as<ob::DepthFrame>();
auto colorFrame = frameSet->getFrame(OB_FRAME_COLOR)->as<ob::ColorFrame>();
// Convert the color frame to RGB format.
if (colorFrame->format() != OB_FORMAT_RGB) {
if (colorFrame->format() == OB_FORMAT_MJPG) {
formatConverter->setFormatConvertType(FORMAT_MJPG_TO_RGB);
}
else if (colorFrame->format() == OB_FORMAT_UYVY) {
formatConverter->setFormatConvertType(FORMAT_UYVY_TO_RGB);
}
else if (colorFrame->format() == OB_FORMAT_YUYV) {
formatConverter->setFormatConvertType(FORMAT_YUYV_TO_RGB);
}
else {
std::cout << "Color format is not support!" << std::endl;
continue;
}
colorFrame = formatConverter->process(colorFrame)->as<ob::ColorFrame>();
}
// Processed the color frames to BGR format, use OpenCV to save to disk.
formatConverter->setFormatConvertType(FORMAT_RGB_TO_BGR);
colorFrame = formatConverter->process(colorFrame)->as<ob::ColorFrame>();
saveDepthFrame(depthFrame, frameIndex, fileNamePrefix.toStdString());
saveColorFrame(colorFrame, frameIndex, fileNamePrefix.toStdString());
cv::Mat colorMat(colorFrame->height(), colorFrame->width(), CV_8UC3, colorFrame->data());
cv::Mat rgbMat;
cv::cvtColor(colorMat, rgbMat, cv::COLOR_BGR2RGB);
m_colorImage = QImage(rgbMat.data, rgbMat.cols, rgbMat.rows, static_cast<int>(rgbMat.step), QImage::Format_RGB888).copy();
cv::Mat depthMat(depthFrame->height(), depthFrame->width(), CV_16UC1, depthFrame->data());
cv::Mat depthMat8U;
depthMat.convertTo(depthMat8U, CV_8UC1, 255.0 / 4096.0);
cv::Mat depthColorMap;
cv::applyColorMap(depthMat8U, depthColorMap, cv::COLORMAP_JET);
cv::Mat depthRgbMat;
cv::cvtColor(depthColorMap, depthRgbMat, cv::COLOR_BGR2RGB);
m_depthImage = QImage(depthRgbMat.data, depthRgbMat.cols, depthRgbMat.rows, static_cast<int>(depthRgbMat.step), QImage::Format_RGB888).copy();
//m_depthImage = QImage(depthMat.data, depthMat.cols, depthMat.rows, static_cast<int>(depthMat.step), QImage::Format_Grayscale16).copy();
emit PlotSignal();
//点云
pointCloud->setCreatePointFormat(OB_FORMAT_RGB_POINT);
std::shared_ptr<ob::Frame> frame = pointCloud->process(frameSet);
QString plyPath = fileNamePrefix + "_"+ QString::number(frameIndex) + ".ply";
ob::PointCloudHelper::savePointcloudToPly(plyPath.toStdString().c_str(), frame, false, false, 50);
//惯导数据
auto accelFrameRaw = frameSet->getFrame(OB_FRAME_ACCEL);
auto accelFrame = accelFrameRaw->as<ob::AccelFrame>();
auto accelIndex = accelFrame->getIndex();
auto accelTimeStampUs = accelFrame->getTimeStampUs();
auto accelTemperature = accelFrame->getTemperature();
auto accelType = accelFrame->getType();
//if (frameIndex % 50 == 0)
//{ // print information every 50 frames.
// auto accelValue = accelFrame->getValue();
// printImuValue(accelValue, accelIndex, accelTimeStampUs, accelTemperature, accelType, "m/s^2");
//}
//auto accelValue = accelFrame->getValue();
//printImuValue(accelValue, accelIndex, accelTimeStampUs, accelTemperature, accelType, "m/s^2");
auto gyroFrameRaw = frameSet->getFrame(OB_FRAME_GYRO);
auto gyroFrame = gyroFrameRaw->as<ob::GyroFrame>();
auto gyroIndex = gyroFrame->getIndex();
auto gyroTimeStampUs = gyroFrame->getTimeStampUs();
auto gyroTemperature = gyroFrame->getTemperature();
auto gyroType = gyroFrame->getType();
//if (frameIndex % 50 == 0) { // print information every 50 frames.
// auto gyroValue = gyroFrame->getValue();
// printImuValue(gyroValue, gyroIndex, gyroTimeStampUs, gyroTemperature, gyroType, "rad/s");
//}
//auto gyroValue = gyroFrame->getValue();
//printImuValue(gyroValue, gyroIndex, gyroTimeStampUs, gyroTemperature, gyroType, "rad/s");
saveImuData(imuFile, accelFrame, gyroFrame);
frameIndex++;
}
imuFile.close();
m_pipe->stop();
delete m_pipe;
m_pipe = nullptr;
}
void DepthCameraOperation::saveDepthFrame(const std::shared_ptr<ob::DepthFrame> depthFrame, const uint32_t frameIndex, std::string fileNamePrefix_)
{
std::vector<int> params;
params.push_back(cv::IMWRITE_PNG_COMPRESSION);
params.push_back(0);
params.push_back(cv::IMWRITE_PNG_STRATEGY);
params.push_back(cv::IMWRITE_PNG_STRATEGY_DEFAULT);
std::string depthName = fileNamePrefix_ + "_Depth_" + std::to_string(depthFrame->width()) + "x" + std::to_string(depthFrame->height()) + "_" + std::to_string(frameIndex) + "_"
+ std::to_string(depthFrame->timeStamp()) + "ms.png";
cv::Mat depthMat(depthFrame->height(), depthFrame->width(), CV_16UC1, depthFrame->data());
cv::imwrite(depthName, depthMat, params);
//std::cout << "Depth saved:" << depthName << std::endl;
}
void DepthCameraOperation::saveColorFrame(const std::shared_ptr<ob::ColorFrame> colorFrame, const uint32_t frameIndex, std::string fileNamePrefix_)
{
std::vector<int> params;
params.push_back(cv::IMWRITE_PNG_COMPRESSION);
params.push_back(0);
params.push_back(cv::IMWRITE_PNG_STRATEGY);
params.push_back(cv::IMWRITE_PNG_STRATEGY_DEFAULT);
std::string colorName = fileNamePrefix_ + "_Color_" + std::to_string(colorFrame->width()) + "x" + std::to_string(colorFrame->height()) + "_" + std::to_string(frameIndex) + "_"
+ std::to_string(colorFrame->timeStamp()) + "ms.png";
cv::Mat depthMat(colorFrame->height(), colorFrame->width(), CV_8UC3, colorFrame->data());
cv::imwrite(colorName, depthMat, params);
//std::cout << "Color saved:" << colorName << std::endl;
}
void DepthCameraOperation::printImuValue(OBFloat3D obFloat3d, uint64_t index, uint64_t timeStampUs, float temperature, OBFrameType type, const std::string& unitStr)
{
std::cout << "frame index: " << index << std::endl;
auto typeStr = ob::TypeHelper::convertOBFrameTypeToString(type);
std::cout << typeStr << " Frame: \n\r{\n\r"
<< " tsp = " << timeStampUs << "\n\r"
<< " temperature = " << temperature << "\n\r"
<< " " << typeStr << ".x = " << obFloat3d.x << unitStr << "\n\r"
<< " " << typeStr << ".y = " << obFloat3d.y << unitStr << "\n\r"
<< " " << typeStr << ".z = " << obFloat3d.z << unitStr << "\n\r"
<< "}\n\r" << std::endl;
}
void DepthCameraOperation::saveImuData(std::ofstream& imuFile, const std::shared_ptr<ob::AccelFrame>& accelFrame, const std::shared_ptr<ob::GyroFrame>& gyroFrame)
{
if (!imuFile.is_open())
return;
auto accelValue = accelFrame->getValue();
auto gyroValue = gyroFrame->getValue();
// position (acceleration): ax, ay, az
// attitude (angular velocity): gx, gy, gz
imuFile << accelFrame->getIndex() << ","
<< accelFrame->getTimeStampUs() << ","
<< accelValue.x << "," << accelValue.y << "," << accelValue.z << ","
<< gyroFrame->getIndex() << ","
<< gyroFrame->getTimeStampUs() << ","
<< gyroValue.x << "," << gyroValue.y << "," << gyroValue.z << "\n";
}
void DepthCameraOperation::OpenDepthCamera_callback()
{
}
void DepthCameraOperation::setCallback(void(*func)())
{
m_func = func;
}
void DepthCameraOperation::CloseDepthCamera()
{
std::cout << "DepthCameraOperation::CloseDepthCamera关闭深度相机" << std::endl;
record = false;
emit CamClosedSignal();
}

84
HPPA/DepthCameraWindow.h Normal file
View File

@ -0,0 +1,84 @@
#pragma once
#include <QDialog>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QNetworkAccessManager>
#include <QImage>
#include <Qthread>
#include <QDir>
#include <iostream>
#include "ui_DepthCamera.h"
#include "AppSettings.h"
#include <fstream>
#include <opencv2/opencv.hpp>
#include <libobsensor/ObSensor.hpp>
#include "libobsensor/hpp/Utils.hpp"
typedef void(*func)();
class DepthCameraOperation :public QObject
{
Q_OBJECT
public:
DepthCameraOperation();
~DepthCameraOperation();
QImage m_colorImage;
QImage m_depthImage;
void setCallback(void(*func)());
bool getRecordStatus() const { return record; }
private:
ob::Pipeline* m_pipe;
cv::Mat frame;
func m_func;
void saveDepthFrame(const std::shared_ptr<ob::DepthFrame> depthFrame, const uint32_t frameIndex, std::string fileNamePrefix_);
void saveColorFrame(const std::shared_ptr<ob::ColorFrame> colorFrame, const uint32_t frameIndex, std::string fileNamePrefix_);
void printImuValue(OBFloat3D obFloat3d, uint64_t index, uint64_t timeStampUs, float temperature, OBFrameType type, const std::string& unitStr);
void saveImuData(std::ofstream& imuFile, const std::shared_ptr<ob::AccelFrame>& accelFrame, const std::shared_ptr<ob::GyroFrame>& gyroFrame);
bool record;
public slots:
void OpenDepthCamera();
void OpenDepthCamera_callback();//不使用信号而使用回调函数来通知界面刷新视频
void CloseDepthCamera();
signals:
void PlotSignal();
void CamOpenedSignal();
void CamClosedSignal();
};
class DepthCameraWindow : public QDialog
{
Q_OBJECT
public:
DepthCameraWindow(QWidget* parent = nullptr);
~DepthCameraWindow();
DepthCameraOperation* m_DepthCameraOperation;
public Q_SLOTS:
void openDepthCamera();
void onCamOpened();
void closeDepthCamera();
void onCamClosed();
signals:
void openDepthCameraSignal();
void PlotDepthImageSignal();
void DepthCamClosedSignal();
private:
Ui::DepthCameraClass ui;
QThread* m_DepthCameraThread;
};

46
HPPA/FileNameLineEdit.cpp Normal file
View File

@ -0,0 +1,46 @@
#include "FileNameLineEdit.h"
FileNameLineEdit::FileNameLineEdit(QWidget* parent)
: QLineEdit(parent)
{
setText(AppSettings::instance().fileName());
connect(this, &QLineEdit::textChanged, this, &FileNameLineEdit::onTextChanged);
}
void FileNameLineEdit::keyPressEvent(QKeyEvent* event)
{
if (event->key() == Qt::Key_Space)
{
event->ignore();
return;
}
QLineEdit::keyPressEvent(event);
}
void FileNameLineEdit::inputMethodEvent(QInputMethodEvent* event)
{
QString commitString = event->commitString();
if (commitString.contains(' '))
{
commitString.remove(' ');
QInputMethodEvent filtered(event->preeditString(), event->attributes());
filtered.setCommitString(commitString);
QLineEdit::inputMethodEvent(&filtered);
return;
}
QLineEdit::inputMethodEvent(event);
}
void FileNameLineEdit::onTextChanged(const QString& text)
{
QString cleaned = text;
if (cleaned.contains(' '))
{
int pos = cursorPosition();
cleaned.remove(' ');
setText(cleaned);
setCursorPosition(qMin(pos, cleaned.length()));
return;
}
AppSettings::instance().setFileName(cleaned);
}

21
HPPA/FileNameLineEdit.h Normal file
View File

@ -0,0 +1,21 @@
#pragma once
#include <QLineEdit>
#include <QKeyEvent>
#include "AppSettings.h"
class FileNameLineEdit : public QLineEdit
{
Q_OBJECT
public:
explicit FileNameLineEdit(QWidget* parent = nullptr);
protected:
void keyPressEvent(QKeyEvent* event) override;
void inputMethodEvent(QInputMethodEvent* event) override;
private slots:
void onTextChanged(const QString& text);
};

861
HPPA/HPPA - 副本 (2).ui Normal file
View File

@ -0,0 +1,861 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>HPPAClass</class>
<widget class="QMainWindow" name="HPPAClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1486</width>
<height>898</height>
</rect>
</property>
<property name="windowTitle">
<string>Spectral Insight</string>
</property>
<property name="windowIcon">
<iconset resource="HPPA.qrc">
<normaloff>:/ico/resources/icons/ico/Spectral_Insight_128.ico</normaloff>:/ico/resources/icons/ico/Spectral_Insight_128.ico</iconset>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<widget class="QWidget" name="centralWidget"/>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1486</width>
<height>30</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>-1</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QMenuBar{
background:#F0F0F0;
color:rgb(0,0,0);
font-size:14px;
padding:1px;
border:1px solid rgb(165,171,184);
}
QMenuBar::item{
background:#F0F0F0;
width:30px;
height:15px;
}
QMenuBar::item:selected{
background:rgb(185,196,221);
}
QMenu{
background:rgb(255,255,255);
color:rgb(0,0,0);
border:1px solid rgb(165,171,184);
}
QMenu::item:selected{
background:rgb(69,123,255);
color:white;
}
</string>
</property>
<widget class="QMenu" name="file">
<property name="title">
<string>文件</string>
</property>
<addaction name="mActionOpenImg"/>
<addaction name="separator"/>
<addaction name="mSetting"/>
<addaction name="action_exit"/>
</widget>
<widget class="QMenu" name="menuspectrometer">
<property name="title">
<string>光谱仪</string>
</property>
<widget class="QMenu" name="menu">
<property name="font">
<font>
<family>宋体</family>
</font>
</property>
<property name="title">
<string>选择相机类型</string>
</property>
<addaction name="mActionPica_L"/>
<addaction name="mActionPica_NIR"/>
<addaction name="mActionPika_XC2"/>
<addaction name="separator"/>
<addaction name="mActionCorning_410"/>
</widget>
<addaction name="menu"/>
<addaction name="action_connect_imager"/>
<addaction name="separator"/>
<addaction name="action_auto_exposure"/>
<addaction name="action_focus"/>
<addaction name="action_dark"/>
<addaction name="action_reference"/>
<addaction name="separator"/>
<addaction name="action_start_recording"/>
<addaction name="separator"/>
<addaction name="actionOpenDirectory"/>
</widget>
<widget class="QMenu" name="menuhelp">
<property name="title">
<string>帮助</string>
</property>
<addaction name="action_about"/>
</widget>
<widget class="QMenu" name="mWindowsMenu">
<property name="title">
<string>窗口</string>
</property>
</widget>
<widget class="QMenu" name="menu_2">
<property name="title">
<string>扫描平台</string>
</property>
<addaction name="mAction_is_no_motor"/>
<addaction name="mAction_1AxisMotor"/>
<addaction name="mAction_2AxisMotor_new"/>
<addaction name="separator"/>
<addaction name="mAction_RobotArm"/>
</widget>
<widget class="QMenu" name="mMenuScenario">
<property name="title">
<string>应用场景</string>
</property>
<addaction name="mActionOneMotorScenario"/>
<addaction name="mActionPlantPhenotypeScenario"/>
</widget>
<widget class="QMenu" name="menu_4">
<property name="title">
<string>数据处理</string>
</property>
<addaction name="action_4"/>
<addaction name="action_5"/>
<addaction name="action_13"/>
</widget>
<addaction name="file"/>
<addaction name="menuspectrometer"/>
<addaction name="mMenuScenario"/>
<addaction name="menu_4"/>
<addaction name="menu_2"/>
<addaction name="mWindowsMenu"/>
<addaction name="menuhelp"/>
</widget>
<widget class="QToolBar" name="mainToolBar">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>宋体</family>
<pointsize>2</pointsize>
</font>
</property>
<property name="windowTitle">
<string>相机控制</string>
</property>
<property name="styleSheet">
<string notr="true">QToolBar{
background-color: #f5f5f5;
color:rgb(0,0,0);
}
QToolBar QToolButton {
background: #f5f5f5; /* 按钮背景颜色 */
font-size:15px;
border-radius: 3px; /* 按钮圆角 */
padding: 4px; /* 按钮内边距 */
}
QToolBar QToolButton:hover {
background: rgb(185,196,221); /* 按钮悬停背景颜色 */
color: white; /* 按钮悬停文字颜色 */
}
</string>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="action_connect_imager"/>
<addaction name="action_auto_exposure"/>
<addaction name="action_focus"/>
<addaction name="action_dark"/>
<addaction name="action_reference"/>
<addaction name="action_start_recording"/>
<addaction name="actionOpenDirectory"/>
<addaction name="mActionPan"/>
<addaction name="mActionSpectral"/>
</widget>
<widget class="QStatusBar" name="statusBar">
<property name="styleSheet">
<string notr="true">QStatusBar
{
background-color: #0D1233;
color: white;
}
QStatusBar::item
{
border: none;
}</string>
</property>
</widget>
<widget class="CustomDockWidgetBase" name="mDockWidgetSimulator">
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="features">
<set>QDockWidget::AllDockWidgetFeatures</set>
</property>
<property name="windowTitle">
<string>3D模型</string>
</property>
<attribute name="dockWidgetArea">
<number>1</number>
</attribute>
<widget class="QWidget" name="dockWidgetContents_2">
<layout class="QGridLayout" name="gridLayout_7">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="verticalSpacing">
<number>0</number>
</property>
</layout>
</widget>
</widget>
<widget class="CustomDockWidgetHideAbove" name="mDockWidgetSpectrometer">
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="windowTitle">
<string>控制</string>
</property>
<attribute name="dockWidgetArea">
<number>2</number>
</attribute>
<widget class="QWidget" name="controlContents">
<property name="styleSheet">
<string notr="true">QWidget #controlContents
{
background-color: #0E1C4C;
border-top: 1px solid #2c586b;
border-left: 1px solid #2c586b;
border-right: 1px solid #2c586b;
border-bottom: 1px solid #2c586b;
border-top-left-radius: 0px;
border-top-right-radius: 0px;
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
}
</string>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<property name="horizontalSpacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QTabWidget" name="controlTabWidget">
<property name="styleSheet">
<string notr="true">QTabBar::tab {
background: #0E1C4C;
color: white;
padding: 6px 12px;
border: none;
border-top: 1px solid #27376C;
height: 41;
}
QTabBar::tab:selected {
background: #0D1233;
color: white;
border: none;
}
/*QTabBar::tab:hover {
background: #141A45;
}*/
QTabWidget::pane {
border: none;
border-top: 1px solid #27376C;
background: #0D1233;
top: -1px;
}
</string>
</property>
<property name="tabPosition">
<enum>QTabWidget::South</enum>
</property>
<property name="tabShape">
<enum>QTabWidget::Rounded</enum>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<property name="elideMode">
<enum>Qt::ElideNone</enum>
</property>
<widget class="QWidget" name="rgbCameraWidget">
<property name="styleSheet">
<string notr="true">QGroupBox
{
border: 12px solid transparent;
color: #ACCDFF;
}
QPushButton
{
/*width: 172px;
height: 56px;*/
font: 19pt &quot;新宋体&quot;;
background-color: qlineargradient(
spread:pad,
x1:0.5, y1:0, x2:0.5, y2:1,
stop:0 #283D86,
stop:1 #0F1A40
);
color: white;
border: none;
padding: 8px 16px;
border-radius: 4px;
}
QPushButton:hover
{
background-color: qlineargradient(
spread:pad,
x1:0, y1:0, x2:1, y2:0,
stop:0 #3A4875,
stop:1 #5F6B91
);
}
/* 按下时的效果 */
QPushButton:pressed
{
background-color: qlineargradient(
spread:pad,
x1:0, y1:0, x2:1, y2:0,
stop:0 #1A254F,
stop:1 #3A466B
);
/* 可选:添加下压效果 */
padding-top: 9px;
padding-bottom: 7px;
}</string>
</property>
<attribute name="title">
<string>rgb相机</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4" rowstretch="2,4,2" columnstretch="1,3,1">
<item row="0" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>174</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>115</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<layout class="QGridLayout" name="gridLayout_3" columnstretch="1,1">
<property name="spacing">
<number>20</number>
</property>
<item row="1" column="0">
<widget class="QPushButton" name="take_video_btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>录制视频</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="take_photo_btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>拍照</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="close_rgb_camera_btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>关闭</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="open_rgb_camera_btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>打开</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>115</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>173</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QToolBar" name="toolBar">
<property name="minimumSize">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
<property name="windowTitle">
<string>toolBar</string>
</property>
<property name="styleSheet">
<string notr="true">QToolBar {
background: #040125;/*transparent*/
border: 1px solid #040125;
}</string>
</property>
<property name="movable">
<bool>false</bool>
</property>
<attribute name="toolBarArea">
<enum>LeftToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<widget class="QToolBar" name="toolBar_2">
<property name="minimumSize">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
<property name="windowTitle">
<string>toolBar_2</string>
</property>
<property name="styleSheet">
<string notr="true">QToolBar {
background: #040125;/*transparent*/
border: 1px solid #040125;
}</string>
</property>
<property name="movable">
<bool>false</bool>
</property>
<attribute name="toolBarArea">
<enum>RightToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<widget class="QToolBar" name="toolBar_3">
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="windowTitle">
<string>toolBar_3</string>
</property>
<property name="styleSheet">
<string notr="true">QToolBar {
background: #040125;/*transparent*/
border: 1px solid #040125;
}</string>
</property>
<property name="movable">
<bool>false</bool>
</property>
<attribute name="toolBarArea">
<enum>BottomToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<action name="action_exit">
<property name="text">
<string>退出</string>
</property>
<property name="font">
<font>
<family>Adobe Devanagari</family>
</font>
</property>
</action>
<action name="action_open">
<property name="text">
<string>open</string>
</property>
<property name="iconText">
<string>open</string>
</property>
</action>
<action name="actionpreference">
<property name="text">
<string>preference...</string>
</property>
</action>
<action name="action_start_recording">
<property name="text">
<string>采集</string>
</property>
</action>
<action name="action_focus">
<property name="text">
<string>调焦</string>
</property>
</action>
<action name="action_auto_exposure">
<property name="text">
<string>曝光</string>
</property>
</action>
<action name="action_dark">
<property name="text">
<string>暗电流</string>
</property>
</action>
<action name="action_reference">
<property name="text">
<string>白板</string>
</property>
</action>
<action name="action_connect_imager">
<property name="text">
<string>连接相机</string>
</property>
<property name="font">
<font>
<family>宋体</family>
</font>
</property>
</action>
<action name="actionOpenDirectory">
<property name="text">
<string>打开文件夹</string>
</property>
</action>
<action name="mActionPica_L">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Pika L</string>
</property>
<property name="font">
<font>
<family>宋体</family>
</font>
</property>
</action>
<action name="mActionCorning_410">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Corning 410</string>
</property>
</action>
<action name="mActionPika_XC2">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Pika XC2</string>
</property>
<property name="font">
<font>
<family>宋体</family>
</font>
</property>
</action>
<action name="action_about">
<property name="text">
<string>关于</string>
</property>
</action>
<action name="mActionPica_NIR">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Pika NIR</string>
</property>
<property name="font">
<font>
<family>宋体</family>
</font>
</property>
</action>
<action name="actionpanel">
<property name="text">
<string>面板</string>
</property>
</action>
<action name="action">
<property name="text">
<string>工具栏</string>
</property>
</action>
<action name="action_2">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>马达</string>
</property>
</action>
<action name="mAction_is_no_motor">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>无</string>
</property>
</action>
<action name="mAction_2AxisMotor">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>2 轴线性马达</string>
</property>
</action>
<action name="mAction_RobotArm">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="text">
<string>机械臂</string>
</property>
</action>
<action name="mAction_1AxisMotor">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>1 轴线性马达</string>
</property>
</action>
<action name="mActionOneMotorScenario">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>室内1轴线性平台</string>
</property>
</action>
<action name="action_4">
<property name="text">
<string>辐亮度</string>
</property>
</action>
<action name="action_5">
<property name="text">
<string>反射率</string>
</property>
</action>
<action name="action_6">
<property name="text">
<string>机械臂</string>
</property>
</action>
<action name="action_7">
<property name="text">
<string>显微镜</string>
</property>
</action>
<action name="action_8">
<property name="text">
<string>三脚架(旋转平台)</string>
</property>
</action>
<action name="mActionOpenImg">
<property name="text">
<string>打开影像</string>
</property>
</action>
<action name="action_10">
<property name="text">
<string>关闭影像</string>
</property>
</action>
<action name="mSetting">
<property name="text">
<string>设置</string>
</property>
</action>
<action name="action_13">
<property name="text">
<string>拼接</string>
</property>
</action>
<action name="mActionPlantPhenotypeScenario">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>植物表型</string>
</property>
</action>
<action name="action2">
<property name="text">
<string>2轴旋转平台</string>
</property>
</action>
<action name="mAction_2AxisMotor_new">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>2 轴线性马达</string>
</property>
</action>
<action name="mActionPan">
<property name="text">
<string>漫游</string>
</property>
</action>
<action name="mActionSpectral">
<property name="text">
<string>光谱</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>CustomDockWidgetBase</class>
<extends>QDockWidget</extends>
<header>customdockwidgetbase.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>CustomDockWidgetHideAbove</class>
<extends>QDockWidget</extends>
<header>CustomDockWidgetBase.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="HPPA.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -399,12 +399,28 @@ HPPA::HPPA(QWidget* parent)
m_carousel->addWidget(sa);
m_carousel->setContentsMargins(0, 0, 0, 0);
QWidget* tmp8 = new QWidget();
tmp8->setStyleSheet(R"(
//---------------------------------------------------------------------
QScrollArea* sa_depthCamera = new QScrollArea();
sa_depthCamera->setObjectName("sa_depthCamera");
sa_depthCamera->setStyleSheet(R"(
border: none;
background-color: #0D1233;
)");
QGridLayout* gridLayout_sa_depthCamera = new QGridLayout(sa_depthCamera);
gridLayout_sa_depthCamera->setSpacing(6);
gridLayout_sa_depthCamera->setObjectName(QString::fromUtf8("gridLayout_sa_depthCamera"));
gridLayout_sa_depthCamera->setVerticalSpacing(0);
gridLayout_sa_depthCamera->setContentsMargins(0, 0, 0, 0);
m_depthCamera_label = new QLabel();
m_depthCamera_label->setAlignment(Qt::AlignHCenter);
m_depthCamera_label->setStyleSheet(R"(
background-color: #0D1233;
)");
m_carousel->addWidget(tmp8);
//m_carousel->setContentsMargins(0, 0, 0, 0);
gridLayout_sa_depthCamera->addWidget(m_depthCamera_label);
m_carousel->addWidget(sa_depthCamera);
m_carousel->setContentsMargins(0, 0, 0, 0);
m_carousel->play();
@ -417,7 +433,7 @@ HPPA::HPPA(QWidget* parent)
//ui.mDockWidgetSpectrometer->show();
initControlTabwidget();
m_tabManager = new TabManager(ui.controlTabWidget, this);
ui.mDockWidgetSpectrometer->setWidget(tmp(ui.controlContents));
//3D模型看板
@ -506,6 +522,10 @@ HPPA::HPPA(QWidget* parent)
//光谱仪操作
m_Imager = nullptr;
m_RecordThread = nullptr;
m_CopyFileThread = nullptr;
m_FileOperation = nullptr;
m_TestImagerStausThread = nullptr;
m_RecordState = 0;
connect(this->ui.action_connect_imager, SIGNAL(triggered()), this, SLOT(onconnect()));//信号与槽连接相机相机操作相关信号与槽绑定放在函数onconnect中
@ -630,10 +650,8 @@ void HPPA::initMenubarToolbar()
QAction* action = ui.mainToolBar->insertWidget(ui.action_start_recording, frame_number);
frame_number->setEnabled(false);
m_FilenameLineEdit = new QLineEdit(ui.mainToolBar);
m_FilenameLineEdit->setStyleSheet("QLineEdit{background-color:rgb(255,255,255);}");
m_FilenameLineEdit = new FileNameLineEdit(ui.mainToolBar);
m_FilenameLineEdit->setMaximumWidth(100);
m_FilenameLineEdit->setText("tmp_image");
m_FilenameLineEdit->setStyleSheet(R"(
QLineEdit {
background-color: #142D7F;
@ -737,43 +755,43 @@ QWidget* HPPA::tmp(QWidget* a)
void HPPA::initControlTabwidget()
{
ui.controlTabWidget->removeTab(0);//首先删除默认的tab
m_hic = new HyperImagerControl();
//ui.controlTabWidget->addTab(m_hic, QString::fromLocal8Bit("光谱仪"));
ui.controlTabWidget->insertTab(0, m_hic, QString::fromLocal8Bit("光谱仪"));
m_hic->setDisabled(true);
ui.controlTabWidget->addTab(m_hic, QString::fromLocal8Bit("光谱仪"));
ui.controlTabWidget->setCurrentIndex(0);
//rgb相机
m_RgbCameraThread = new QThread();
m_RgbCamera = new RgbCameraOperation();
m_RgbCamera->moveToThread(m_RgbCameraThread);
m_RgbCameraThread->start();
connect(ui.open_rgb_camera_btn, SIGNAL(clicked()), m_RgbCamera, SLOT(OpenCamera()));//使用信号通知主线程ui线程刷新视频 → 成功,但是界面卡顿
connect(m_RgbCamera, SIGNAL(PlotSignal()), this, SLOT(onPlotRgbImage()));
//m_RgbCamera->setCallback(onPlotRgbImage);
//connect(this->ui.open_rgb_camera_btn, SIGNAL(clicked()), m_RgbCamera, SLOT(OpenCamera_callback()));//使用回调函数来刷新主线程ui线程上的视频 → 失败
connect(ui.close_rgb_camera_btn, SIGNAL(clicked()), this, SLOT(onCloseRgbCamera()));//关闭相机
connect(m_RgbCamera, SIGNAL(CamClosed()), this, SLOT(onClearLabel()));
//图像控制
m_ic = new ImageControl();
m_ic->setWindowFlags(Qt::Widget);
connect(m_ic, SIGNAL(bandSelectionChanged(double, double, double)),
this, SLOT(onBandSelectionChanged(double, double, double)));
ui.controlTabWidget->addTab(m_ic, QString::fromLocal8Bit("图像控制"));
ui.controlTabWidget->addTab(m_ic, QString::fromLocal8Bit("图像控制"));//?????????????????????????????????????????????????????????????????????????????????????????????????
//深度相机
m_depthCameraWindow = new DepthCameraWindow();
ui.controlTabWidget->addTab(m_depthCameraWindow, QString::fromLocal8Bit("深度相机"));
//rgb相机
m_rgbCameraControlWindow = new rgbCameraWindow();
connect(m_rgbCameraControlWindow, &rgbCameraWindow::PlotRgbImageSignal, this, &HPPA::onPlotRgbImage);
connect(m_rgbCameraControlWindow, &rgbCameraWindow::CamClosedSignal, this, &HPPA::onClearLabel);
connect(m_depthCameraWindow, &DepthCameraWindow::PlotDepthImageSignal, this, &HPPA::onPlotDepthImage);
connect(m_depthCameraWindow, &DepthCameraWindow::DepthCamClosedSignal, this, &HPPA::onClearDepthLabel);
ui.controlTabWidget->addTab(m_rgbCameraControlWindow, QString::fromLocal8Bit("rgb相机"));
//升降桌dock
m_adt = new adjustTable();
m_adt->setWindowFlags(Qt::Widget);
ui.controlTabWidget->addTab(m_adt, QString::fromLocal8Bit("升降桌"));
//电源控制
m_pc = new PowerControl();
m_pc->setWindowFlags(Qt::Widget);
ui.controlTabWidget->addTab(m_pc, QString::fromLocal8Bit("电源控制"));
ui.controlTabWidget->addTab(m_pc, QString::fromLocal8Bit("电源控制"));
//机械臂控制
m_rac = new RobotArmControl();
@ -793,7 +811,6 @@ void HPPA::initControlTabwidget()
m_tmc->setWindowFlags(Qt::Widget);
ui.controlTabWidget->addTab(m_tmc, QString::fromLocal8Bit("2轴控制"));
// Connect ImageControl band change to re-render (m_ic created in initControlTabwidget)
connect(m_ic, SIGNAL(bandSelectionChanged(double,double,double)),
this, SLOT(onBandSelectionChanged(double,double,double)));
@ -801,6 +818,13 @@ void HPPA::initControlTabwidget()
void HPPA::recordFromRobotArm(int fileCounter)
{
if (!testImagerVality())
{
showMessageBox(QString::fromLocal8Bit("找不到光谱仪!"));
return;
}
//qDebug() << "recordFromRobotArm" << fileCounter;
if (fileCounter == -1)
@ -959,11 +983,7 @@ HPPA::~HPPA()
file.close();
}
if (m_Imager != nullptr)
{
//m_Imager->~ResononNirImager();//释放资源
delete m_Imager;
}
disconnectImagerAndCleanup();
if (s_instance == this)
{
@ -1213,7 +1233,8 @@ void HPPA::createOneMotorScenario()
ui.mAction_1AxisMotor->setChecked(true);
//右下角控制tab
m_tabManager->hideTab(ui.rgbCameraWidget);
m_tabManager->hideTab(m_depthCameraWindow);
m_tabManager->hideTab(m_rgbCameraControlWindow);
m_tabManager->hideTab(m_adt);
m_tabManager->hideTab(m_pc);
m_tabManager->hideTab(m_rac);
@ -1238,13 +1259,14 @@ void HPPA::createPlantPhenotypeScenario()
// return;
//在菜单中选择移动平台
ui.mAction_2AxisMotor_new->setChecked(true);
ui.mAction_2AxisMotor_new->setChecked(true);
//右下角控制tab
m_tabManager->hideTab(m_rac);
m_tabManager->hideTab(m_omc);
m_tabManager->showTab(ui.rgbCameraWidget);
m_tabManager->showTab(m_depthCameraWindow);
m_tabManager->showTab(m_rgbCameraControlWindow);
m_tabManager->showTab(m_adt);
m_tabManager->showTab(m_pc);
m_tabManager->showTab(m_tmc);
@ -1255,22 +1277,161 @@ void HPPA::createPlantPhenotypeScenario()
}
bool HPPA::testImagerVality()
{
try
{
if (m_Imager == nullptr)
{
return false;
}
double framerate = m_Imager->getFramerate();
m_Imager->setFramerate(framerate);
return true;
}
catch (const std::exception& e)
{
disconnectImagerAndCleanup();
return false;
}
catch (int e)//ximea相机异常
{
disconnectImagerAndCleanup();
return false;
}
catch (...)
{
disconnectImagerAndCleanup();
return false;
}
}
void HPPA::showMessageBox(QString msg, QString title)
{
QMessageBox msgBox(this);
msgBox.setWindowTitle(title);
msgBox.setText(msg);
msgBox.setStyleSheet(R"(
QMessageBox {
background-color: #0D1233;
}
QMessageBox QLabel {
color: #ACCDFF;
font-size: 14px;
}
QPushButton {
background-color: #142D7F;
color: #e6eeff;
border: 1px solid #2f6bff;
border-radius: 6px;
padding: 6px 20px;
min-width: 60px;
font-size: 13px;
}
QPushButton:hover {
border: 1px solid #4d8dff;
background-color: red;
}
QPushButton:pressed {
background-color: #23345c;
}
)");
msgBox.exec();
}
bool HPPA::showResultMessageBox(QString title, QString msg)
{
QMessageBox msgBox(this);
msgBox.setWindowTitle(title);
msgBox.setText(msg);
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::No);
msgBox.setStyleSheet(R"(
QMessageBox {
background-color: #0D1233;
}
QMessageBox QLabel {
color: #ACCDFF;
font-size: 14px;
}
QPushButton {
background-color: #142D7F;
color: #e6eeff;
border: 1px solid #2f6bff;
border-radius: 6px;
padding: 6px 20px;
min-width: 60px;
font-size: 13px;
}
QPushButton:hover {
border: 1px solid #4d8dff;
background-color: red;
}
QPushButton:pressed {
background-color: #23345c;
}
)");
QMessageBox::StandardButton ret = static_cast<QMessageBox::StandardButton>(msgBox.exec());
if (ret == QMessageBox::Yes)
{
return true;
}
else
{
return false;
}
}
void HPPA::onStartRecordStep1()
{
//判断移动平台
QAction* checked = moveplatformActionGroup->checkedAction();
if (!checked)
{
QMessageBox msgBox;
msgBox.setText(QString::fromLocal8Bit("请选择扫描平台!"));
msgBox.exec();
showMessageBox(QString::fromLocal8Bit("请选择扫描平台!"));
return;
}
QString checkedName = checked->objectName();
if (checkedName == "mAction_is_no_motor")
{
}
else if (checkedName == "mAction_1AxisMotor")
{
if (!m_omc->getMotorsConnectionStatus())
{
showMessageBox(QString::fromLocal8Bit("找不到马达!"));
return;
}
}
else if (checkedName == "mAction_2AxisMotor_new")
{
if (!m_tmc->getMotorsConnectionStatus())
{
showMessageBox(QString::fromLocal8Bit("找不到马达!"));
return;
}
}
else if (checkedName == "mAction_RobotArm")
{
}
//判断光谱仪
if(!testImagerVality())
{
showMessageBox(QString::fromLocal8Bit("找不到光谱仪!"));
return;
}
//判断是否覆盖存在的文件
FileOperation* fileOperation = new FileOperation();
string directory = fileOperation->getDirectoryFromString();
//string imgPath = directory + "\\tmp_image";
string imgPath = directory + "\\" + m_FilenameLineEdit->text().toStdString();
string imgPath = (AppSettings::instance().dataFolder() + QDir::separator() + AppSettings::instance().fileName()).toStdString();
string x_location = removeFileExtension(imgPath) + "_x_location.pos";
m_RecordState += 1;
@ -1282,14 +1443,9 @@ void HPPA::onStartRecordStep1()
int x = _access(tmp.c_str(), 0);
if (!x)//如果文件存在就执行此if的代码
{
enum QMessageBox::StandardButton response = QMessageBox::question(this, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("文件存在!是否覆盖?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);;
if (response == QMessageBox::Yes)//
bool res = showResultMessageBox(QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("文件存在!是否覆盖?"));
if (!res)
{
//std::cout << "覆盖" << std::endl;
}
else
{
//std::cout << "不覆盖" << std::endl;
return;
}
}
@ -1299,7 +1455,7 @@ void HPPA::onStartRecordStep1()
m_RecordState -= 1;
}
QString checkedName = checked->objectName();
if (checkedName == "mAction_is_no_motor")
{
m_RecordState += 1;
@ -1309,8 +1465,7 @@ void HPPA::onStartRecordStep1()
//m_imageViewerTabWidget->clear();
removeAllLayersInRasterGroup();
m_Imager->setFileName2Save(imgPath);
m_Imager->setFrameNumber(this->frame_number->text().toInt());
emit updateRecordingFileInfoSignal(AppSettings::instance().dataFolder(), AppSettings::instance().fileName(), this->frame_number->text().toInt());
emit StartRecordSignal();//发射开始采集信号
ui.action_start_recording->setText(QString::fromLocal8Bit("停止采集"));
@ -1323,7 +1478,7 @@ void HPPA::onStartRecordStep1()
m_RecordState -= 1;
ui.action_start_recording->setText(QString::fromLocal8Bit("采集"));
ui.action_start_recording->setIcon(QIcon(":/svg/resources/icons/svg/record_done.svg"));
ui.action_start_recording->setIcon(QIcon(":/svg/resources/icons/svg/record_done.svg"));
//ui.mainToolBar->widgetForAction(ui.action_start_recording)->setStyleSheet("QWidget{background-color:rgb(0,255,0);}");
}
return;
@ -1338,12 +1493,11 @@ void HPPA::onStartRecordStep1()
removeAllLayersInRasterGroup();
ui.action_start_recording->setText(QString::fromLocal8Bit("停止采集"));
ui.action_start_recording->setIcon(QIcon(":/svg/resources/icons/svg/record_ing.svg"));
ui.action_start_recording->setIcon(QIcon(":/svg/resources/icons/svg/record_ing.svg"));
//ui.mainToolBar->widgetForAction(ui.action_start_recording)->setStyleSheet("QWidget{background-color:rgb(255,0,0);}");
//应该先控制马达运动,当马达运动后,再开始光谱仪采集(发射开始采集信号)
m_Imager->setFileName2Save(imgPath);
m_Imager->setFrameNumber(this->frame_number->text().toInt());
emit updateRecordingFileInfoSignal(AppSettings::instance().dataFolder(), AppSettings::instance().fileName(), this->frame_number->text().toInt());
m_omc->setImager(m_Imager);
m_omc->run();
}
@ -1367,15 +1521,14 @@ void HPPA::onStartRecordStep1()
//m_imageViewerTabWidget->clear();
removeAllLayersInRasterGroup();
m_Imager->setFileName2Save(imgPath);
m_Imager->setFrameNumber(this->frame_number->text().toInt());
m_tmc->setImager(m_Imager);
m_tmc->setPosFileName(QString::fromStdString(x_location));
m_tmc->run();
ui.action_start_recording->setText(QString::fromLocal8Bit("停止采集"));
ui.action_start_recording->setIcon(QIcon(":/svg/resources/icons/svg/record_ing.svg"));
//ui.mainToolBar->widgetForAction(ui.action_start_recording)->setStyleSheet("QWidget{background-color:rgb(255,0,0);}");
emit updateRecordingFileInfoSignal(AppSettings::instance().dataFolder(), AppSettings::instance().fileName(), this->frame_number->text().toInt());
m_tmc->setImager(m_Imager);
m_tmc->setPosFileName(QString::fromStdString(x_location));
m_tmc->run();
}
else
{
@ -1393,8 +1546,7 @@ void HPPA::onStartRecordStep1()
else if (checkedName == "mAction_RobotArm")
{
//先判断是否选择了任务执行函数RobotArmControl::executeTask修复界面显示bug
m_Imager->setFileName2Save(imgPath);
m_Imager->setFrameNumber(this->frame_number->text().toInt());
emit updateRecordingFileInfoSignal(AppSettings::instance().dataFolder(), AppSettings::instance().fileName(), this->frame_number->text().toInt());
m_rac->executeTaskWithHyperImager();
return;
@ -1498,18 +1650,21 @@ void HPPA::onActionOpenDirectory()
void HPPA::onFramerateChanged(double framerate)
{
if (!m_Imager) return;
m_Imager->setFramerate(framerate);
m_hic->setFrameRate(m_Imager->getFramerate());
}
void HPPA::onIntegrationTimeChanged(double integrationTime)
{
if (!m_Imager) return;
m_Imager->setIntegrationTime(integrationTime);
m_hic->setIntegrationTime(m_Imager->getIntegrationTime());
}
void HPPA::onGainChanged(double gain)
{
if (!m_Imager) return;
m_Imager->setGain(gain);
m_hic->setGain(m_Imager->getGain());
}
@ -1615,7 +1770,7 @@ void HPPA::OnSendLogToCallClass(QString str)
void HPPA::onPlotRgbImage()
{
//std::cout << "显示视频+++++++++++++++++++++++++++++++++++++++++++" << std::endl;
QPixmap pixmap = QPixmap::fromImage(m_RgbCamera->m_qImage);
QPixmap pixmap = QPixmap::fromImage(m_rgbCameraControlWindow->m_RgbCamera->m_qImage);
int width = m_cam_label->width();
int height = m_cam_label->height();
@ -1624,18 +1779,29 @@ void HPPA::onPlotRgbImage()
m_cam_label->setPixmap(fitpixmap);
}
void HPPA::onCloseRgbCamera()
{
//std::cout << "关闭视频+++++++++++++++++++++++++++++++++++++++++++" << std::endl;
m_RgbCamera->CloseCamera();
}
void HPPA::onClearLabel()
{
m_cam_label->clear();
m_cam_label->setText("closed");
}
void HPPA::onPlotDepthImage()
{
QPixmap pixmap = QPixmap::fromImage(m_depthCameraWindow->m_DepthCameraOperation->m_depthImage);
int width = m_depthCamera_label->width();
int height = m_depthCamera_label->height();
QPixmap fitpixmap = pixmap.scaled(width, height, Qt::KeepAspectRatio, Qt::SmoothTransformation);
m_depthCamera_label->setPixmap(fitpixmap);
}
void HPPA::onClearDepthLabel()
{
m_depthCamera_label->clear();
m_depthCamera_label->setText("closed");
}
void HPPA::onCopyFinished()
{
this->setEnabled(true);
@ -1679,40 +1845,8 @@ void HPPA::onExit()
void HPPA::closeEvent(QCloseEvent* event)
{
QMessageBox msgBox(this);
msgBox.setWindowTitle(QString::fromLocal8Bit("退出确认"));
msgBox.setText(QString::fromLocal8Bit("确定要退出程序吗?"));
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::No);
msgBox.setStyleSheet(R"(
QMessageBox {
background-color: #0D1233;
}
QMessageBox QLabel {
color: #ACCDFF;
font-size: 14px;
}
QPushButton {
background-color: #142D7F;
color: #e6eeff;
border: 1px solid #2f6bff;
border-radius: 6px;
padding: 6px 20px;
min-width: 60px;
font-size: 13px;
}
QPushButton:hover {
border: 1px solid #4d8dff;
background-color: red;
}
QPushButton:pressed {
background-color: #23345c;
}
)");
QMessageBox::StandardButton ret = static_cast<QMessageBox::StandardButton>(msgBox.exec());
if (ret == QMessageBox::Yes)
bool res = showResultMessageBox(QString::fromLocal8Bit("退出确认"), QString::fromLocal8Bit("确定要退出程序吗?"));
if (res)
{
event->accept(); // 允许关闭
}
@ -1742,12 +1876,104 @@ void HPPA::onOpenImg()
addLayer(baseName, uri, true);
}
void HPPA::disconnectImagerAndCleanup()
{
if (m_Imager == nullptr)
return;
// 如果正在采集,先停止
if (m_RecordState % 2 == 1)
{
m_Imager->setRecordControlState(false);
m_RecordState = 0;
}
// 断开所有与 m_Imager 相关的信号槽
disconnect(m_Imager, nullptr, this, nullptr);
disconnect(this, SIGNAL(StartFocusSignal()), m_Imager, SLOT(focus()));
disconnect(this, SIGNAL(StartRecordSignal()), m_Imager, SLOT(start_record()));
disconnect(this, &HPPA::updateRecordingFileInfoSignal, m_Imager, &ImagerOperationBase::updateRecordingFileInfo);
disconnect(this, SIGNAL(RecordWhiteSignal()), m_Imager, SLOT(record_white()));
disconnect(this, SIGNAL(RecordDarlSignal()), m_Imager, SLOT(record_dark()));
// 断开 UI 控件与本类槽的连接(它们在 onconnect 中绑定,避免重复连接)
disconnect(ui.action_auto_exposure, SIGNAL(triggered()), this, SLOT(onAutoExposure()));
disconnect(ui.action_focus, SIGNAL(triggered()), this, SLOT(onFocus1()));
disconnect(ui.action_dark, SIGNAL(triggered()), this, SLOT(onDark()));
disconnect(ui.action_reference, SIGNAL(triggered()), this, SLOT(onReference()));
disconnect(ui.action_start_recording, SIGNAL(triggered()), this, SLOT(onStartRecordStep1()));
disconnect(ui.actionOpenDirectory, SIGNAL(triggered()), this, SLOT(onActionOpenDirectory()));
disconnect(m_hic, SIGNAL(framerateChanged(double)), this, SLOT(onFramerateChanged(double)));
disconnect(m_hic, SIGNAL(integrationTimeChanged(double)), this, SLOT(onIntegrationTimeChanged(double)));
disconnect(m_hic, SIGNAL(gainChanged(double)), this, SLOT(onGainChanged(double)));
// 停止采集线程
if (m_RecordThread)
{
m_RecordThread->quit();
m_RecordThread->wait(3000);
delete m_RecordThread;
m_RecordThread = nullptr;
}
// 停止文件拷贝线程
if (m_CopyFileThread)
{
if (m_FileOperation)
{
disconnect(this, SIGNAL(CopyFileThreadSignal(QString, QString)), m_FileOperation, SLOT(copyFile(QString, QString)));
disconnect(m_FileOperation, SIGNAL(CopyFinishedSignal()), this, SLOT(onCopyFinished()));
}
m_CopyFileThread->quit();
m_CopyFileThread->wait(3000);
delete m_FileOperation;
m_FileOperation = nullptr;
delete m_CopyFileThread;
m_CopyFileThread = nullptr;
}
// 删除 imager 对象
try
{
m_Imager->disconnectImager();
}
catch (...)
{
// 断连时忽略异常
}
delete m_Imager;
m_Imager = nullptr;
// 禁用相机参数控件
frame_number->setEnabled(false);
m_hic->setDisabled(true);
// 重置图标
ui.action_connect_imager->setIcon(QIcon(":/svg/resources/icons/svg/connect_imager.svg"));
ui.action_auto_exposure->setIcon(QIcon(":/svg/resources/icons/svg/exposure.svg"));
ui.action_dark->setIcon(QIcon(":/svg/resources/icons/svg/dark.svg"));
ui.action_reference->setIcon(QIcon(":/svg/resources/icons/svg/reference.svg"));
ui.action_start_recording->setIcon(QIcon(":/svg/resources/icons/svg/record.svg"));
ui.action_start_recording->setText(QString::fromLocal8Bit("采集"));
}
void HPPA::onconnect()
{
if (m_Imager != nullptr)
if (!testImagerVality())
{
//std::cout << "相机已经连接!" << std::endl;
return;
disconnectImagerAndCleanup();
}
else
{
bool res = showResultMessageBox(QString::fromLocal8Bit("相机连接"), QString::fromLocal8Bit("确定要重连相机吗?"));
if (res)
{
disconnectImagerAndCleanup();
}
else
{
return;
}
}
try
@ -1775,11 +2001,9 @@ void HPPA::onconnect()
}
else
{
QMessageBox msgBox;
msgBox.setText(QString::fromLocal8Bit("请选择相机!"));
msgBox.exec();
showMessageBox(QString::fromLocal8Bit("请选择相机类型!"));
return;
return;
}
ui.action_connect_imager->setIcon(QIcon(":/svg/resources/icons/svg/connect_imager_ing.svg"));
@ -1791,13 +2015,12 @@ void HPPA::onconnect()
connect(m_Imager, SIGNAL(PlotSignal(int, int, QString)), this, SLOT(onPlotHyperspectralImageRgbImage(int, int, QString)));
connect(m_Imager, SIGNAL(RecordFinishedSignal_WhenFrameNumberMeet()), this, SLOT(onRecordFinishedSignal_WhenFrameNumberMeet()));
connect(m_Imager, SIGNAL(RecordFinishedSignal_WhenFrameNumberNotMeet()), this, SLOT(onRecordFinishedSignal_WhenFrameNumberNotMeet()));
connect(m_Imager, SIGNAL(SpectralSignal(int)), this, SLOT(PlotSpectral(int)));
connect(m_Imager, SIGNAL(SpectralSignal(int)), this, SLOT(focusPlotSpectralImg(int)));
connect(m_Imager, SIGNAL(testImagerStatus()), this, SLOT(testImagerStatus()));
connect(m_Imager, &ImagerOperationBase::autoExposureSignal, this, &HPPA::autoExposureFinished);
m_Imager->connect_imager(frame_number->text().toInt());
m_Imager->setFileName2Save(m_FilenameLineEdit->text().toStdString());
//文件拷贝
m_CopyFileThread = new QThread();
@ -1819,6 +2042,7 @@ void HPPA::onconnect()
connect(this->ui.action_start_recording, SIGNAL(triggered()), this, SLOT(onStartRecordStep1()));
connect(this, SIGNAL(StartRecordSignal()), m_Imager, SLOT(start_record()));
connect(this, &HPPA::updateRecordingFileInfoSignal, m_Imager, &ImagerOperationBase::updateRecordingFileInfo);
connect(this, SIGNAL(RecordWhiteSignal()), m_Imager, SLOT(record_white()));
connect(this, SIGNAL(RecordDarlSignal()), m_Imager, SLOT(record_dark()));
connect(m_Imager, SIGNAL(RecordWhiteFinishSignal()), this, SLOT(recordWhiteFinish()));
@ -1858,13 +2082,17 @@ void HPPA::onconnect()
delete m_Imager;
m_Imager = nullptr;
QMessageBox msgBox;
msgBox.setText(QString::fromLocal8Bit("请连接相机!"));
msgBox.exec();
showMessageBox(QString::fromLocal8Bit("请连接相机!"));
}
catch (int e)//ximea相机异常
{
ui.action_connect_imager->setIcon(QIcon(":/svg/resources/icons/svg/connect_imager.svg"));
delete m_Imager;
m_Imager = nullptr;
showMessageBox(QString::fromLocal8Bit("请连接相机!"));
}
}
void HPPA::testImagerStatus()
@ -1880,6 +2108,13 @@ void HPPA::autoExposureFinished()
void HPPA::onAutoExposure()
{
if (!testImagerVality())
{
showMessageBox(QString::fromLocal8Bit("找不到光谱仪!"));
return;
}
ui.action_auto_exposure->setIcon(QIcon(":/svg/resources/icons/svg/exposure_ing.svg"));
double ReturnedExposureTime = m_Imager->auto_exposure();
@ -1892,6 +2127,13 @@ void HPPA::onAutoExposure()
void HPPA::onFocus1()
{
if (!testImagerVality())
{
showMessageBox(QString::fromLocal8Bit("找不到光谱仪!"));
return;
}
focusWindow* w = new focusWindow(this, m_Imager);
connect(w, SIGNAL(StartManualFocusSignal(int)), this, SLOT(onFocus2(int)));
connect(w, SIGNAL(closeSignal()), this, SLOT(onFocusWindowClosed()));
@ -1931,14 +2173,16 @@ void HPPA::onFocus2(int command)
}
else if (command == 0)
{
m_Imager->setFocusControlState(false);
if (m_Imager)
m_Imager->setFocusControlState(false);
}
}
void HPPA::onFocusWindowClosed()
{
//关闭调焦窗口时,停止调焦功能
m_Imager->setFocusControlState(false);
if (m_Imager)
m_Imager->setFocusControlState(false);
//关闭调焦窗口tab
int index = m_imageViewerTabWidget->indexOf(m_focusTab);
if (index != -1)
@ -1964,9 +2208,14 @@ void HPPA::settingWindow()
void HPPA::onDark()
{
QMessageBox msgBox;
msgBox.setText(QString::fromLocal8Bit("采集暗电流,请确保镜头盖盖上!"));
msgBox.exec();
if (!testImagerVality())
{
showMessageBox(QString::fromLocal8Bit("找不到光谱仪!"));
return;
}
showMessageBox(QString::fromLocal8Bit("采集暗电流,请确保镜头盖盖上!"));
ui.action_dark->setIcon(QIcon(":/svg/resources/icons/svg/dark_ing.svg"));
@ -1997,9 +2246,14 @@ void HPPA::recordDarkFinish()
void HPPA::onReference()
{
QMessageBox msgBox;
msgBox.setText(QString::fromLocal8Bit("请确保白板放置正确!"));
msgBox.exec();
if (!testImagerVality())
{
showMessageBox(QString::fromLocal8Bit("找不到光谱仪!"));
return;
}
showMessageBox(QString::fromLocal8Bit("请确保白板放置正确!"));
ui.action_reference->setIcon(QIcon(":/svg/resources/icons/svg/reference_ing.svg"));
@ -2030,6 +2284,8 @@ void HPPA::recordWhiteFinish()
void HPPA::onPlotHyperspectralImageRgbImage(int fileNumber, int frameNumber, QString filePath)
{
if (!m_Imager) return;
//使用机械臂采集时,会在停止采集后的瞬间又开始采集,会导致上次采集最后发射的信号调用此槽函数报错
QAction* checked = moveplatformActionGroup->checkedAction();
QString checkedName = checked->objectName();
@ -2077,8 +2333,10 @@ void HPPA::onPlotHyperspectralImageRgbImage(int fileNumber, int frameNumber, QSt
//currentImageViewer[0]->SetImage(&QPixmap::fromImage(CuttedImage));//绘制图像
}
void HPPA::PlotSpectral(int state)
void HPPA::focusPlotSpectralImg(int state)
{
if (!m_Imager) return;
if (state == 1)
{
//显示影像

View File

@ -74,6 +74,11 @@
#include "recordFrameCounter.h"
#include "setWindow.h"
#include "AppSettings.h"
#include "FileNameLineEdit.h"
#include "rgbCameraWindow.h"
#include "DepthCameraWindow.h"
#define PI 3.1415926
@ -208,7 +213,7 @@ private:
QWidget* tmp(QWidget* a);
QLineEdit * frame_number;
QLineEdit * m_FilenameLineEdit;
FileNameLineEdit * m_FilenameLineEdit;
QLabel * xmotor_state_label1;
QLabel * ymotor_state_label1;
@ -219,7 +224,7 @@ private:
int m_RecordState;//用来控制相机采集流程取2的余数1 → 正在采集0 → 停止采集
QThread * m_RecordThread;//影像采集线程
QThread * m_RgbCameraThread;//rgb相机获取图像线程
QThread * m_CopyFileThread;//影像文件复制线程
FileOperation * m_FileOperation;
@ -241,7 +246,7 @@ private:
//
int m_TabWidgetCurrentIndex;//当手动选择TabWidget的标签时记录变化后的tab index
RgbCameraOperation *m_RgbCamera;
void getRequest(QString str);
@ -266,13 +271,16 @@ private:
MyCarousel* m_carousel;
QLabel* m_cam_label;
QLabel* m_depthCamera_label;
QPushButton* m_open_rgb_camera_btn;
QPushButton* m_close_rgb_camera_btn;
TabManager* m_tabManager;
HyperImagerControl* m_hic;
rgbCameraWindow* m_rgbCameraControlWindow;
ImageControl* m_ic;
DepthCameraWindow* m_depthCameraWindow;
adjustTable* m_adt;
PowerControl* m_pc;
RobotArmControl* m_rac;
@ -297,10 +305,15 @@ private:
QWidget* m_focusTab=nullptr;
recordFrameCounter* m_recordFrameCounter = nullptr;
bool testImagerVality();
void showMessageBox(QString msg, QString title= QString::fromLocal8Bit("提示"));
bool showResultMessageBox(QString title, QString msg);
void disconnectImagerAndCleanup();
public Q_SLOTS:
void onPlotHyperspectralImageRgbImage(int fileNumber, int frameNumber, QString filePath);
void PlotSpectral(int state);
void focusPlotSpectralImg(int state);
void onRecordFinishedSignal_WhenFrameNumberMeet();
void onRecordFinishedSignal_WhenFrameNumberNotMeet();
void onsequenceComplete();
@ -339,8 +352,10 @@ public Q_SLOTS:
void OnSendLogToCallClass(QString str);
void onPlotRgbImage();
void onCloseRgbCamera();
void onPlotDepthImage();
void onClearLabel();
void onClearDepthLabel();
void onCopyFinished();
@ -373,4 +388,6 @@ signals:
void RecordWhiteSignal();
void RecordDarlSignal();
void updateRecordingFileInfoSignal(const QString& filePath, const QString& baseName, int frameNumber);
};

View File

@ -383,119 +383,6 @@ QPushButton:pressed
<attribute name="title">
<string>rgb相机</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4" rowstretch="2,4,2" columnstretch="1,3,1">
<item row="0" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>174</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>115</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<layout class="QGridLayout" name="gridLayout_3" columnstretch="1,1">
<property name="spacing">
<number>20</number>
</property>
<item row="1" column="0">
<widget class="QPushButton" name="take_video_btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>录制视频</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="take_photo_btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>拍照</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="close_rgb_camera_btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>关闭</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="open_rgb_camera_btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>打开</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>115</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>173</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>

View File

@ -55,8 +55,8 @@
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<IncludePath>D:\cpp_library\gdal2.2.3_vs2017\include;C:\Program Files\ResononAPI\include;D:\cpp_library\opencv3.4.11\opencv\build\include;D:\cpp_library\opencv3.4.11\opencv\build\include\opencv;D:\cpp_library\opencv3.4.11\opencv\build\include\opencv2;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL\SDKs\PCOMM\Include;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL\SDKs\PortControl;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL;D:\cpp_project_vs2022\HPPA\HPPA;D:\cpp_library\libconfig-1.7.3\lib;D:\cpp_project_vs2022\HPPA\vincecontrol;D:\cpp_library\vincecontrol_vs2017;C:\XIMEA\API\xiAPI;D:\cpp_project_vs2022\HPPA\IrisMultiMotorController\IrisMultiMotorController;D:\cpp_library\eigen-3.4-rc1;$(IncludePath)</IncludePath>
<LibraryPath>D:\cpp_library\opencv3.4.11\opencv\build\x64\vc15\lib;D:\cpp_library\gdal2.2.3_vs2017\lib;C:\Program Files\ResononAPI\lib64;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\x64\Debug;D:\cpp_library\libconfig-1.7.3\build\x64;D:\cpp_project_vs2022\HPPA\x64\Debug;C:\XIMEA\API\xiAPI;D:\cpp_project_vs2022\HPPA\IrisMultiMotorController\x64\Debug;$(LibraryPath)</LibraryPath>
<IncludePath>D:\cpp_library\gdal2.2.3_vs2017\include;C:\Program Files\ResononAPI\include;D:\cpp_library\opencv3.4.11\opencv\build\include;D:\cpp_library\opencv3.4.11\opencv\build\include\opencv;D:\cpp_library\opencv3.4.11\opencv\build\include\opencv2;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL\SDKs\PCOMM\Include;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL\SDKs\PortControl;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\AutoFocus_InspireLinearMotor_DLL;D:\cpp_project_vs2022\HPPA\HPPA;D:\cpp_library\libconfig-1.7.3\lib;D:\cpp_project_vs2022\HPPA\vincecontrol;D:\cpp_library\vincecontrol_vs2017;C:\XIMEA\API\xiAPI;D:\cpp_project_vs2022\HPPA\IrisMultiMotorController\IrisMultiMotorController;D:\cpp_library\eigen-3.4-rc1;C:\Program Files\OrbbecSDK 2.7.6\include;$(IncludePath)</IncludePath>
<LibraryPath>D:\cpp_library\opencv3.4.11\opencv\build\x64\vc15\lib;D:\cpp_library\gdal2.2.3_vs2017\lib;C:\Program Files\ResononAPI\lib64;D:\cpp_project_vs2022\AutoFocus_InspireLinearMotor_DLL\x64\Debug;D:\cpp_library\libconfig-1.7.3\build\x64;D:\cpp_project_vs2022\HPPA\x64\Debug;C:\XIMEA\API\xiAPI;D:\cpp_project_vs2022\HPPA\IrisMultiMotorController\x64\Debug;C:\Program Files\OrbbecSDK 2.7.6\lib;$(LibraryPath)</LibraryPath>
<TargetName>Spectral Insight</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
@ -66,7 +66,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Link>
<AdditionalDependencies>opencv_world3411.lib;opencv_world3411d.lib;gdal_i.lib;resonon-basler.lib;AutoFocus_InspireLinearMotor_DLL.lib;libconfig++d.lib;vincecontrol.lib;resonon-allied.lib;xiapi64.lib;IrisMultiMotorController.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>opencv_world3411.lib;opencv_world3411d.lib;gdal_i.lib;resonon-basler.lib;AutoFocus_InspireLinearMotor_DLL.lib;libconfig++d.lib;vincecontrol.lib;resonon-allied.lib;xiapi64.lib;IrisMultiMotorController.lib;OrbbecSDK.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>D:\cpp_project_vs2022\HPPA\x64\Debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<ClCompile>
@ -114,6 +114,8 @@
<ClCompile Include="Carousel.cpp" />
<ClCompile Include="Corning410Imager.cpp" />
<ClCompile Include="CustomDockWidgetBase.cpp" />
<ClCompile Include="DepthCameraWindow.cpp" />
<ClCompile Include="FileNameLineEdit.cpp" />
<ClCompile Include="hppaConfigFile.cpp" />
<ClCompile Include="HyperImagerControl.cpp" />
<ClCompile Include="imageControl.cpp" />
@ -133,6 +135,7 @@
<ClCompile Include="MapToolPan.cpp" />
<ClCompile Include="MapTools.cpp" />
<ClCompile Include="MapToolSpectral.cpp" />
<ClCompile Include="MotorWindowBase.cpp" />
<ClCompile Include="OneMotorControl.cpp" />
<ClCompile Include="path_tc.cpp" />
<ClCompile Include="PowerControl.cpp" />
@ -145,6 +148,7 @@
<ClCompile Include="resononImager.cpp" />
<ClCompile Include="ResononNirImager.cpp" />
<ClCompile Include="RgbCameraOperation.cpp" />
<ClCompile Include="rgbCameraWindow.cpp" />
<ClCompile Include="RobotArmControl.cpp" />
<ClCompile Include="setWindow.cpp" />
<ClCompile Include="stdafx.cpp">
@ -159,6 +163,7 @@
<QtRcc Include="HPPA.qrc" />
<QtUic Include="about.ui" />
<QtUic Include="adjustTable.ui" />
<QtUic Include="DepthCamera.ui" />
<QtUic Include="FocusDialog.ui" />
<QtUic Include="HPPA.ui" />
<QtMoc Include="HPPA.h" />
@ -179,6 +184,7 @@
<QtUic Include="PowerControl.ui" />
<QtUic Include="RadianceConversion.ui" />
<QtUic Include="ReflectanceConversion.ui" />
<QtUic Include="rgbCamera.ui" />
<QtUic Include="RobotArmControl.ui" />
<QtUic Include="set.ui" />
<QtUic Include="twoMotorControl.ui" />
@ -206,6 +212,8 @@
<QtMoc Include="AspectRatioLabel.h" />
<QtMoc Include="HyperImagerControl.h" />
<ClInclude Include="AppSettings.h" />
<QtMoc Include="FileNameLineEdit.h" />
<QtMoc Include="DepthCameraWindow.h" />
<ClInclude Include="imager_base.h" />
<ClInclude Include="irisximeaimager.h" />
<QtMoc Include="OneMotorControl.h" />
@ -225,10 +233,12 @@
<QtMoc Include="MapToolPan.h" />
<QtMoc Include="MapToolSpectral.h" />
<QtMoc Include="MapTools.h" />
<ClInclude Include="MotorWindowBase.h" />
<ClInclude Include="RasterDataProvider.h" />
<ClInclude Include="RasterRenderer.h" />
<QtMoc Include="recordFrameCounter.h" />
<QtMoc Include="setWindow.h" />
<QtMoc Include="rgbCameraWindow.h" />
<ClInclude Include="utility_tc.h" />
<QtMoc Include="aboutWindow.h" />
<ClInclude Include="hppaConfigFile.h" />

View File

@ -205,6 +205,18 @@
<ClCompile Include="AppSettings.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="FileNameLineEdit.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="MotorWindowBase.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="rgbCameraWindow.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="DepthCameraWindow.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<QtMoc Include="fileOperation.h">
@ -333,6 +345,15 @@
<QtMoc Include="setWindow.h">
<Filter>Header Files</Filter>
</QtMoc>
<QtMoc Include="FileNameLineEdit.h">
<Filter>Header Files</Filter>
</QtMoc>
<QtMoc Include="rgbCameraWindow.h">
<Filter>Header Files</Filter>
</QtMoc>
<QtMoc Include="DepthCameraWindow.h">
<Filter>Header Files</Filter>
</QtMoc>
</ItemGroup>
<ItemGroup>
<ClInclude Include="imageProcessor.h">
@ -377,6 +398,9 @@
<ClInclude Include="AppSettings.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="MotorWindowBase.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<QtUic Include="FocusDialog.ui">
@ -418,6 +442,12 @@
<QtUic Include="set.ui">
<Filter>Form Files</Filter>
</QtUic>
<QtUic Include="rgbCamera.ui">
<Filter>Form Files</Filter>
</QtUic>
<QtUic Include="DepthCamera.ui">
<Filter>Form Files</Filter>
</QtUic>
</ItemGroup>
<ItemGroup>
<None Include="cpp.hint" />

View File

@ -1,4 +1,4 @@
#include "stdafx.h"
#include "stdafx.h"
#include <iostream>
#include "ImageReaderWriter.h"
@ -11,11 +11,11 @@ ImageReaderWriter::ImageReaderWriter(const char * fileName)
m_poDataset = (GDALDataset *)GDALOpen(fileName, GA_ReadOnly);
if (m_poDataset == NULL)
{
std::cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӱ<EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>" << std::endl;
std::cout << "打开影像失败!" << std::endl;
return;
}
//<EFBFBD><EFBFBD>ȡӰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
//获取影像信息
m_DataType = m_poDataset->GetRasterBand(1)->GetRasterDataType();
m_iBands = m_poDataset->GetRasterCount();
m_iXCount = m_poDataset->GetRasterXSize();
@ -47,11 +47,11 @@ float * ImageReaderWriter::ReadImage(int nXOff, int nYOff, int nXSize, int nYSiz
float *pDataBuffer = (float*)CPLMalloc(sizeof(float)*(1)*(1)*(m_iBands));
memset(pDataBuffer, 0, 1 * 1 * m_iBands * sizeof(float));
CPLErr status = m_poDataset->RasterIO(GF_Read, nXOff, nYOff, nXSize, nYSize, pDataBuffer, xBuff, yBuff, GDT_Float32, m_iBands, NULL, 0, 0, 0); //<EFBFBD>ȸߺ<EFBFBD><EFBFBD><EFBFBD>
CPLErr status = m_poDataset->RasterIO(GF_Read, nXOff, nYOff, nXSize, nYSize, pDataBuffer, xBuff, yBuff, GDT_Float32, m_iBands, NULL, 0, 0, 0); //先高后宽
if (status != CE_None)
{
std::cout << "<EFBFBD><EFBFBD>ȡӰ<EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>" << std::endl;
std::cout << "读取影像失败!" << std::endl;
return 0;
}

View File

@ -1,4 +1,4 @@
#ifndef IMAGE_READER_WRITER
#ifndef IMAGE_READER_WRITER
#define IMAGE_READER_WRITER
#include "stdafx.h"
#include "gdal_priv.h"

View File

@ -1,4 +1,4 @@
#include "stdafx.h"
#include "stdafx.h"
#include <iostream>
#include <cmath>
@ -20,7 +20,7 @@ Mapcavas::Mapcavas(QWidget* pParent) :QGraphicsView(pParent)
setRenderHint(QPainter::SmoothPixmapTransform);
setDragMode(QGraphicsView::ScrollHandDrag);
// ʹ<EFBFBD><EFBFBD> Qt Ĭ<EFBFBD><EFBFBD> anchor <EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// 使用 Qt 默认 anchor 行为以外的配置
setTransformationAnchor(QGraphicsView::NoAnchor);
setResizeAnchor(QGraphicsView::NoAnchor);

View File

@ -1,4 +1,4 @@
#ifndef MAPCAVAS_H
#ifndef MAPCAVAS_H
#define MAPCAVAS_H
#include "QGraphicsView"
@ -35,15 +35,15 @@ public:
void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
void scaling(qreal scaleFactor);
void zoomIn(); // <EFBFBD>Ŵ<EFBFBD>
void zoomOut(); // <EFBFBD><EFBFBD>С
void zoom(float scaleFactor); // <EFBFBD><EFBFBD><EFBFBD><EFBFBD> - scaleFactor<EFBFBD><EFBFBD><EFBFBD>ŵı<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void zoomIn(); // 放大
void zoomOut(); // 缩小
void zoom(float scaleFactor); // 缩放 - scaleFactor缩放的比例因子
// ƽ<EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>
// 平移速度
void setTranslateSpeed(qreal speed);
qreal translateSpeed() const;
// <EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// 缩放的增量
void setZoomDelta(qreal delta);
qreal zoomDelta() const;
@ -63,16 +63,16 @@ protected:
QGraphicsScene *m_qtGraphicsScene;
private:
QGraphicsPixmapItem *m_GraphicsPixmapItemHandle;
QLabel *m_framNumberLabel;//<EFBFBD><EFBFBD>ʾʵʱ<EFBFBD>ɼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD><EFBFBD>
QLabel *m_framNumberLabel;//显示实时采集到的帧数
RasterLayer* m_rasterLayer = nullptr; // associated raster layer
MapTool* m_mapTool = nullptr; // current active map tool
qreal m_translateSpeed; // ƽ<EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>
qreal m_zoomDelta; // <EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
bool m_bMouseTranslate; // ƽ<EFBFBD>Ʊ<EFBFBD>ʶ
QPoint m_lastMousePos; // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD>λ<EFBFBD><EFBFBD>
qreal m_scale; // <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
qreal m_translateSpeed; // 平移速度
qreal m_zoomDelta; // 缩放的增量
bool m_bMouseTranslate; // 平移标识
QPoint m_lastMousePos; // 鼠标最后按下的位置
qreal m_scale; // 缩放值
double m_CrosshairHalfLen = 10.0;
QGraphicsLineItem* m_hLine = nullptr; // horizontal line

View File

@ -1,4 +1,5 @@
#include "ImagerOperationBase.h"
#include <QDir>
ImagerOperationBase::ImagerOperationBase()
{
@ -250,6 +251,7 @@ void ImagerOperationBase::start_record()
string timesFile = removeFileExtension(m_FileName2Save2) + ".times";
FILE* hTimesFile = fopen(timesFile.c_str(), "w+");
imagerStartCollect();
while (m_bRecordControlState)
{
@ -257,7 +259,8 @@ void ImagerOperationBase::start_record()
getFrame(buffer);
long long timeOs = getNanosecondsSinceMidnight();
//qDebug() << "time ns-------------------: " << timeOs;
//减去暗电流应为buffer和dark都是unsigned short所以当dark>buffer时buffer-dark=65535
if (m_HasDark)
{
@ -297,7 +300,7 @@ void ImagerOperationBase::start_record()
}
x = fwrite(buffer, 2, m_FrameSize, m_fImage);
fprintf(hTimesFile, "%d\n", timeOs);
fprintf(hTimesFile, "%ll\n", timeOs);
//将rgb波段提取出来以便在界面中显示
m_RgbImage->FillRgbImage(buffer);//??????????????????????????????????????????????????????????????????????????????????????????????????????
@ -320,7 +323,7 @@ void ImagerOperationBase::start_record()
//在最后一次画图前需要进行一次拉伸
//m_RgbImage
emit PlotSignal(m_FileSavedCounter, -1, filePath);
emit PlotSignal(m_FileSavedCounter, -1, filePath);//采集完成后进行一次画图,以防采集帧数不是帧率的倍数时,画图不全
m_bRecordControlState = false;
WriteHdr();
@ -357,6 +360,14 @@ void ImagerOperationBase::setFileName2Save(string FileName)
m_FileSavedCounter = 0;
}
void ImagerOperationBase::updateRecordingFileInfo(const QString& filePath, const QString& baseName, int frameNumber)
{
m_FileName2Save = (filePath + QDir::separator() + baseName).toStdString();
m_FileSavedCounter = 0;
setFrameNumber(frameNumber);
}
void ImagerOperationBase::setFocusControlState(bool FocusControlState)
{
m_bFocusControlState = FocusControlState;

View File

@ -101,6 +101,9 @@ public slots:
virtual void record_white();
void getFocusIndexSobel();
void updateRecordingFileInfo(const QString& filePath, const QString& baseName, int frameNumber);
signals:
void PlotSignal(int, int, QString);//绘制影像信号,第一个参数:第几个影像;第二个参数:采集到的帧数,-1代表此次采集的最后一次绘制
void RecordFinishedSignal_WhenFrameNumberMeet();//采集完成信号需要采集的总帧数m_iFrameNumber采集完成

View File

@ -1,4 +1,4 @@
#include "stdafx.h"
#include "stdafx.h"
#include "ImagerPositionSimulation.h"
@ -61,7 +61,7 @@ void ImagerPositionSimulation::mouseReleaseEvent(QMouseEvent *event)
{
QPoint viewPos = event->pos();
////<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
////输出类型
//const type_info &x = typeid(imager);
//qDebug() << "---------------type_info: " << x.name() << x.raw_name() << x.hash_code();

View File

@ -1,4 +1,4 @@
#ifndef IMAGER_POSITION_SIMULATION
#ifndef IMAGER_POSITION_SIMULATION
#define IMAGER_POSITION_SIMULATION
#include <QGraphicsView>
#include <QGraphicsScene>
@ -16,7 +16,7 @@ public:
void drawX();
void setSceneRect();//<EFBFBD><EFBFBD>QGraphicsView<EFBFBD><EFBFBD>viewport<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪsceneRect
void setSceneRect();//QGraphicsViewviewport设置为sceneRect
QRectF sceneRect();

View File

@ -1,4 +1,4 @@
#include "LayerTree.h"
#include "LayerTree.h"
LayerTree::LayerTree(QObject* parent)
: LayerTreeGroup("__root__", parent)

View File

@ -1,14 +1,14 @@
#pragma once
#pragma once
#include "LayerTreeGroupNode.h"
/**
* LayerTree<EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>
* - <EFBFBD>̳<EFBFBD><EFBFBD><EFBFBD> LayerTreeGroup<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD><EFBFBD>ڵ<EFBFBD>
* - <EFBFBD><EFBFBD>ɼ<EFBFBD><EFBFBD>Լ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD>µľ<EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* LayerTree:图层树根节点
* - 继承自 LayerTreeGroup,本身就是树的根节点
* - 提供可见性级联与父节点三态更新的静态工具
*
* ע<EFBFBD>beginInsertRows/endInsertRows <EFBFBD><EFBFBD> Qt Model <EFBFBD><EFBFBD><EFBFBD><EFBFBD>֪ͨӦ<EFBFBD><EFBFBD> Model <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD>
* LayerTree ֻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ά<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݽṹ<EFBFBD><EFBFBD>ȷ<EFBFBD>ԡ<EFBFBD>
* 注意:beginInsertRows/endInsertRows Qt Model 变更通知应由 Model 驱动调用,
* LayerTree 只负责维护数据结构正确性。
*/
class LayerTree : public LayerTreeGroup
{
@ -20,7 +20,7 @@ public:
LayerTree(const LayerTree&) = delete;
LayerTree& operator=(const LayerTree&) = delete;
// <EFBFBD>ɼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>߼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Model <EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD>
// 可见性逻辑(供 Model 调用)
static void setChildrenVisible(LayerTreeNode* n, Qt::CheckState state);
static void updateParentVisibleFromChildren(LayerTreeNode* parent);
};

View File

@ -1,4 +1,4 @@
#include "LayerTreeGroupNode.h"
#include "LayerTreeGroupNode.h"
#include "LayerTreeLayerNode.h"
LayerTreeGroup::LayerTreeGroup(const QString& name, QObject* parent)

View File

@ -1,12 +1,12 @@
#pragma once
#pragma once
#include "LayerTreeNode.h"
class LayerTreeLayer;
/**
* LayerTreeGroup<EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>
* - <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ LayerTreeNode
* - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD>ڵ㣨LayerTreeLayer<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD>LayerTreeGroup<EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* LayerTreeGroup:图层组节点
* - 基类为 LayerTreeNode
* - 提供插入图层节点(LayerTreeLayer)或图层组(LayerTreeGroup)的便利方法
*/
class LayerTreeGroup : public LayerTreeNode
{
@ -17,28 +17,28 @@ public:
Type type() const override { return Type::Group; }
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// 便利方法:插入子组
LayerTreeGroup* insertGroup(int index, const QString& name);
LayerTreeGroup* addGroup(const QString& name);
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>
// 便利方法:插入图层节点
LayerTreeLayer* insertLayer(int index, LayerTreeLayer* layer);
LayerTreeLayer* addLayer(LayerTreeLayer* layer);
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>
// 插入任意节点
void insertChildNode(int index, LayerTreeNode* node);
void addChildNode(LayerTreeNode* node);
// <EFBFBD>Ƴ<EFBFBD><EFBFBD>ӽڵ㣨<EFBFBD><EFBFBD> delete<74><65><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD><D8B1>Ƴ<EFBFBD><C6B3>ڵ㣩
// 移除子节点(不 delete返回被移除节点
LayerTreeNode* removeChildNode(LayerTreeNode* node);
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// 查找
LayerTreeLayer* findLayer(const QString& name) const;
QList<LayerTreeLayer*> findLayers() const;
QList<LayerTreeGroup*> findGroups() const;
// <EFBFBD>Ժ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>չ<EFBFBD><EFBFBD>collapsed / groupOpacity <EFBFBD><EFBFBD>
// 以后可扩展:collapsed / groupOpacity
};
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// 保持向后兼容
using LayerTreeGroupNode = LayerTreeGroup;

View File

@ -1,4 +1,4 @@
#include "LayerTreeLayerNode.h"
#include "LayerTreeLayerNode.h"
LayerTreeLayer::LayerTreeLayer(MapLayer* layer, QObject* parent)
: LayerTreeNode(layer ? layer->name() : QString(), parent), m_layer(layer)
@ -10,7 +10,7 @@ LayerTreeNode::Type LayerTreeLayer::type() const
return Type::Layer;
}
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD> MapLayer ָ<EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD>У<EFBFBD>
// 持有一个 MapLayer 指针(不拥有)
void LayerTreeLayer::setMapLayer(MapLayer* layer)
{
m_layer = layer;

View File

@ -1,11 +1,11 @@
#pragma once
#pragma once
#include "LayerTreeNode.h"
#include "MapLayer.h"
/**
* LayerTreeLayer<EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>
* - <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ LayerTreeNode
* - <EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD> MapLayer ָ<EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD>У<EFBFBD>
* LayerTreeLayer:图层节点
* - 基类为 LayerTreeNode
* - 持有一个 MapLayer 指针(不拥有)
*/
class LayerTreeLayer : public LayerTreeNode
{
@ -21,8 +21,8 @@ public:
private:
MapLayer* m_layer = nullptr;
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD>չ<EFBFBD><EFBFBD>layerId / pointer / legendItems <EFBFBD><EFBFBD>
// 可扩展:layerId / pointer / legendItems
};
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// 保持向后兼容
using LayerTreeLayerNode = LayerTreeLayer;

View File

@ -1,4 +1,4 @@
#include "LayerTreeModel.h"
#include "LayerTreeModel.h"
#include "LayerTreeGroupNode.h"
#include "LayerTreeLayerNode.h"
@ -90,15 +90,15 @@ bool LayerTreeModel::setData(const QModelIndex& index, const QVariant& value, in
n->setVisible(newState);
// 1) <EFBFBD><EFBFBD> -> <EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
// 1) -> 子 级联
if (m_cascadeCheck) {
LayerTree::setChildrenVisible(n, newState);
}
// 2) <EFBFBD><EFBFBD> -> <EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> PartiallyChecked
// 2) -> 父 更新 PartiallyChecked
LayerTree::updateParentVisibleFromChildren(n->parentNode());
// <EFBFBD>򻯣<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˢ<EFBFBD>£<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>滻Ϊ<EFBFBD><EFBFBD>׼ dataChanged<EFBFBD><EFBFBD>
// 简化:整体刷新(你后续可替换为精准 dataChanged
emit layoutChanged();
return true;
}
@ -156,7 +156,7 @@ bool LayerTreeModel::cascadeCheckEnabled() const
return m_cascadeCheck;
}
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD>֣<EFBFBD><EFBFBD>Ƴ<EFBFBD><EFBFBD>ӽڵ㲢<EFBFBD><EFBFBD> model <EFBFBD>Ϸ<EFBFBD><EFBFBD><EFBFBD> begin/endRemoveRows
// 新增实现:移除子节点并在 model 上发出 begin/endRemoveRows
LayerTreeNode* LayerTreeModel::removeNode(LayerTreeNode* parent, int row)
{
if (!parent) parent = m_tree;

View File

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include <QCoreApplication>
#include <QAbstractItemModel>
#include "LayerTree.h"
@ -6,9 +6,9 @@
class LayerTreeLayer; // forward declare
/**
* LayerTreeModel<EFBFBD><EFBFBD>Qt <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* - 1 <EFBFBD>У<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD>+ checkbox
* - <EFBFBD><EFBFBD>ѡ<EFBFBD>ɼ<EFBFBD><EFBFBD>ԣ<EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD>
* LayerTreeModelQt 适配层(不再管理树)
* - 1 列:名称(带图标)+ checkbox
* - 勾选可见性(可选级联勾选)
*/
class LayerTreeModel : public QAbstractItemModel
{
@ -19,7 +19,7 @@ public:
bool cascadeCheck = true);
~LayerTreeModel() override = default;
// QAbstractItemModel <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD>
// QAbstractItemModel 必须接口
QModelIndex index(int row, int column,
const QModelIndex& parent = QModelIndex()) const override;
QModelIndex parent(const QModelIndex& child) const override;
@ -30,7 +30,7 @@ public:
bool setData(const QModelIndex& index, const QVariant& value, int role) override;
Qt::ItemFlags flags(const QModelIndex& index) const override;
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD> API<50><49><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD> begin/endInsertRows<EFBFBD><EFBFBD>
// 对外 API构建树内部会正确调用 begin/endInsertRows
LayerTreeNode* root() const;
LayerTreeNode* addGroup(LayerTreeNode* parent, const QString& name, const QIcon& icon = QIcon());
@ -39,7 +39,7 @@ public:
void setCascadeCheckEnabled(bool enabled);
bool cascadeCheckEnabled() const;
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӹ<EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD>Ƴ<EFBFBD><EFBFBD>ӽڵ㣨<EFBFBD><EFBFBD>װ LayerTree::removeNode <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> model ֪ͨ<EFBFBD><EFBFBD>
// 新增:从父节点移除子节点(包装 LayerTree::removeNode 并发出 model 通知)
LayerTreeNode* removeNode(LayerTreeNode* parent, int row);
private:

View File

@ -1,4 +1,4 @@
#include "LayerTreeNode.h"
#include "LayerTreeNode.h"
#include <QtGlobal>
@ -55,7 +55,7 @@ LayerTreeNode* LayerTreeNode::parentNode() const
void LayerTreeNode::setParentNode(LayerTreeNode* p)
{
m_parentNode = p;
// <EFBFBD><EFBFBD> QObject <EFBFBD><EFBFBD> parent Ҳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Qt <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ι<EFBFBD><CEB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD><D2B2><EFBFBD>Ӱ<EFBFBD><D3B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD> delete children<EFBFBD><EFBFBD>
// QObject parent 也跟随(便于 Qt 对象层次管理,且不会影响我们手动 delete children
if (p) this->setParent(p);
else this->setParent(nullptr);
}

View File

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include <QObject>
#include <QVector>
@ -6,14 +6,14 @@
#include <QString>
/**
* LayerTreeNode<EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><CDBC>/<2F>ɼ<EFBFBD><C9BC><EFBFBD>/<2F><><EFBFBD>ӹ<EFBFBD>ϵ
* - Group / Layer <EFBFBD>ڵ<EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD>̳<EFBFBD>ʵ<EFBFBD><EFBFBD>
* - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><C9BE><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD>ź<EFBFBD>֪ͨ
* LayerTreeNode:节点基类(抽象)
* - 仅包含通用属性:名称/图标/可见性/父子关系
* - Group / Layer 节点通过继承实现
* - 提供插入/删除节点的信号通知
*
* ˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* - <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬʱά<EFBFBD><EFBFBD>"<22><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>"<22><>m_parentNode<EFBFBD><EFBFBD><EFBFBD><EFBFBD> QObject parent<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD>
* - children <EFBFBD>ɽڵ<EFBFBD><EFBFBD>Լ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷţ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ delete children<EFBFBD><EFBFBD>
* 说明:
* - 这里同时维护"树父指针"m_parentNode)与 QObject parent(可选)
* - children 由节点自己持有并负责释放(析构时 delete children
*/
class LayerTreeNode : public QObject
{
@ -52,8 +52,8 @@ public:
void appendChild(LayerTreeNode* child);
void insertChild(int row, LayerTreeNode* child);
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD> QgsLayerTreeNode::removeChildrenPrivate <EFBFBD>Ľ<EFBFBD>
// from: <EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>, count: <EFBFBD>Ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, destroy: true <EFBFBD><EFBFBD> delete <EFBFBD><EFBFBD><EFBFBD>Ƴ<EFBFBD><EFBFBD>ڵ<EFBFBD>
// 基于 QgsLayerTreeNode::removeChildrenPrivate 改进
// from: 起始索引, count: 移除数量, destroy: true delete 被移除节点
void removeChild(int from, int count, bool destroy = true);
// ---- static type helpers ----
@ -68,11 +68,11 @@ public:
}
signals:
// <EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӽڵ<EFBFBD>֮ǰ/֮<>󷢳<EFBFBD>
// 在插入子节点之前/之后发出
void willAddChildren(LayerTreeNode* node, int indexFrom, int indexTo);
void addedChildren(LayerTreeNode* node, int indexFrom, int indexTo);
// <EFBFBD><EFBFBD><EFBFBD>Ƴ<EFBFBD><EFBFBD>ӽڵ<EFBFBD>֮ǰ/֮<>󷢳<EFBFBD>
// 在移除子节点之前/之后发出
void willRemoveChildren(LayerTreeNode* node, int indexFrom, int indexTo);
void removedChildren(LayerTreeNode* node, int indexFrom, int indexTo);

View File

@ -1,4 +1,4 @@
#include "LayerTreeView.h"
#include "LayerTreeView.h"
#include "LayerTreeViewMenuProvider.h"
#include <QContextMenuEvent>
#include <QMenu>

View File

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include <QTreeView>

View File

@ -1,4 +1,4 @@
#include "LayerTreeViewMenuProvider.h"
#include "LayerTreeViewMenuProvider.h"
#include "LayerTreeView.h"
#include "LayerTreeModel.h"
#include "LayerTreeNode.h"
@ -36,7 +36,7 @@ QMenu* LayerTreeViewMenuProvider::createContextMenu()
if (node->type() == LayerTreeNode::Type::Layer)
{
QAction* removeAction = new QAction(QStringLiteral("<EFBFBD>Ƴ<EFBFBD>ͼ<EFBFBD><EFBFBD>"), menu);
QAction* removeAction = new QAction(QStringLiteral("移除图层"), menu);
connect(removeAction, &QAction::triggered, HPPA::instance(), &HPPA::removeLayerByTreeIndex);
menu->addAction(removeAction);
}
@ -45,7 +45,7 @@ QMenu* LayerTreeViewMenuProvider::createContextMenu()
HPPA* app = HPPA::instance();
if (app && node == app->rasterGroupNode())
{
QAction* removeAllAction = new QAction(QStringLiteral("<EFBFBD>Ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD>"), menu);
QAction* removeAllAction = new QAction(QStringLiteral("移除所有图层"), menu);
connect(removeAllAction, &QAction::triggered, app, &HPPA::removeAllLayersInRasterGroup);
menu->addAction(removeAllAction);
}

View File

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include <QMenu>
#include <QObject>
@ -15,7 +15,7 @@ public:
explicit LayerTreeViewMenuProvider(LayerTreeView* view, QObject* parent = nullptr);
~LayerTreeViewMenuProvider() override = default;
// <EFBFBD><EFBFBD><EFBFBD>ݸ<EFBFBD><EFBFBD><EFBFBD> index <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߸<EFBFBD><DFB8><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD> QMenu*
// 根据给定 index 创建一个菜单,调用者负责删除返回的 QMenu*
QMenu* createContextMenu();
private:

View File

@ -1,4 +1,4 @@
#include "MapLayer.h"
#include "MapLayer.h"
MapLayer::MapLayer(const QString& name, const QString& uri)
: QObject(nullptr), m_name(name), m_uri(uri)

View File

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include <QObject>
#include <QString>

View File

@ -1,4 +1,4 @@
#include "MapLayerStore.h"
#include "MapLayerStore.h"
#include "MapLayer.h"
MapLayerStore::MapLayerStore(QObject* parent)

View File

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include <QObject>
#include <QString>

11
HPPA/MotorWindowBase.cpp Normal file
View File

@ -0,0 +1,11 @@
#include "MotorWindowBase.h"
MotorWindowBase::MotorWindowBase()
{
}
MotorWindowBase::~MotorWindowBase()
{
}

15
HPPA/MotorWindowBase.h Normal file
View File

@ -0,0 +1,15 @@
#pragma once
class MotorWindowBase
{
public:
MotorWindowBase();
~MotorWindowBase();
protected:
virtual bool getMotorsConnectionStatus()=0;
private:
};

View File

@ -1,4 +1,4 @@
#include "OneMotorControl.h"
#include "OneMotorControl.h"
OneMotorControl::OneMotorControl(QWidget* parent) : QDialog(parent)
{
@ -6,6 +6,16 @@ OneMotorControl::OneMotorControl(QWidget* parent) : QDialog(parent)
connect(this->ui.connect_btn, SIGNAL(pressed()), this, SLOT(onConnectMotor()));
connect(this->ui.right_btn, SIGNAL(pressed()), this, SLOT(onxMotorRight()));
connect(this->ui.right_btn, SIGNAL(released()), this, SLOT(onxMotorStop()));
connect(this->ui.left_btn, SIGNAL(pressed()), this, SLOT(onxMotorLeft()));
connect(this->ui.left_btn, SIGNAL(released()), this, SLOT(onxMotorStop()));
connect(this->ui.move2loc_pushButton, SIGNAL(pressed()), this, SLOT(onxMove2Loc()));
connect(this->ui.zero_start_btn, SIGNAL(released()), this, SLOT(zeroStart()));
connect(this->ui.rangeMeasurement_btn, SIGNAL(pressed()), this, SLOT(onx_rangeMeasurement()));
}
OneMotorControl::~OneMotorControl()
@ -16,6 +26,31 @@ OneMotorControl::~OneMotorControl()
void OneMotorControl::onConnectMotor()
{
if (getMotorsConnectionStatus())
{
QMessageBox msgBox;
msgBox.setText(QString::fromLocal8Bit("马达已连接!"));
msgBox.exec();
return;
}
if (m_multiAxisController != nullptr)
{
disconnect(m_multiAxisController, SIGNAL(broadcastLocationSignal(std::vector<double>)), this, SLOT(display_x_loc(std::vector<double>)));
disconnect(this, SIGNAL(moveSignal(int, bool, double, int)), m_multiAxisController, SLOT(move(int, bool, double, int)));
disconnect(this, SIGNAL(move2LocSignal(int, double, double, int)), m_multiAxisController, SLOT(moveTo(int, double, double, int)));
disconnect(this, SIGNAL(stopSignal(int)), m_multiAxisController, SLOT(stop(int)));
disconnect(this, SIGNAL(zeroStartSignal(int)), m_multiAxisController, SLOT(zeroStart(int)));
disconnect(this, SIGNAL(rangeMeasurement(int, double, int)), m_multiAxisController, SLOT(rangeMeasurement(int, double, int)));
disconnect(this, SIGNAL(testConnectivitySignal(int, int)), m_multiAxisController, SLOT(testConnectivity(int, int)));
disconnect(m_multiAxisController, SIGNAL(broadcastConnectivity(std::vector<int>)), this, SLOT(display_motors_connectivity(std::vector<int>)));
m_motorThread.quit();
m_motorThread.wait();
m_multiAxisController = nullptr;
}
try
{
FileOperation* fileOperation = new FileOperation();
@ -27,35 +62,27 @@ void OneMotorControl::onConnectMotor()
catch (std::exception const& e)
{
QMessageBox msgBox;
msgBox.setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
msgBox.setText(QString::fromLocal8Bit("请连接马达!"));
msgBox.exec();
return;
}
m_multiAxisController->moveToThread(&m_motorThread);
connect(&m_motorThread, SIGNAL(finished()), m_multiAxisController, SLOT(deleteLater()));
connect(this->ui.right_btn, SIGNAL(pressed()), this, SLOT(onxMotorRight()));
connect(this->ui.right_btn, SIGNAL(released()), this, SLOT(onxMotorStop()));
connect(this->ui.left_btn, SIGNAL(pressed()), this, SLOT(onxMotorLeft()));
connect(this->ui.left_btn, SIGNAL(released()), this, SLOT(onxMotorStop()));
connect(this->ui.move2loc_pushButton, SIGNAL(pressed()), this, SLOT(onxMove2Loc()));
connect(m_multiAxisController, SIGNAL(broadcastLocationSignal(std::vector<double>)), this, SLOT(display_x_loc(std::vector<double>)));
connect(this, SIGNAL(moveSignal(int, bool, double, int)), m_multiAxisController, SLOT(move(int, bool, double, int)));
connect(this, SIGNAL(move2LocSignal(int, double, double, int)), m_multiAxisController, SLOT(moveTo(int, double, double, int)));
connect(this, SIGNAL(stopSignal(int)), m_multiAxisController, SLOT(stop(int)));
connect(this->ui.zero_start_btn, SIGNAL(released()), this, SLOT(zeroStart()));
connect(this, SIGNAL(zeroStartSignal(int)), m_multiAxisController, SLOT(zeroStart(int)));
connect(this->ui.rangeMeasurement_btn, SIGNAL(pressed()), this, SLOT(onx_rangeMeasurement()));
connect(this, SIGNAL(rangeMeasurement(int, double, int)), m_multiAxisController, SLOT(rangeMeasurement(int, double, int)));
connect(this, SIGNAL(testConnectivitySignal(int, int)), m_multiAxisController, SLOT(testConnectivity(int, int)));
connect(m_multiAxisController, SIGNAL(broadcastConnectivity(std::vector<int>)), this, SLOT(display_motors_connectivity(std::vector<int>)));
m_motorThread.start();
emit testConnectivitySignal(0, 1000);
}
@ -73,11 +100,36 @@ void OneMotorControl::display_motors_connectivity(std::vector<int> connectivity)
//std::cout << "-----------------------------------"<<connectivity.size()<< std::endl;
if (connectivity[0])
{
this->ui.motor_state_label->setStyleSheet("QLabel{background-color:rgb(0,255,0);}");
m_xMotorConnectionStatus = true;
this->ui.motor_state_label->setStyleSheet(R"(
QLabel
{
background-color: #08FACE;
border-radius: 4px;
}
)");
}
else
{
this->ui.motor_state_label->setStyleSheet("QLabel{background-color:rgb(255,0,0);}");
m_xMotorConnectionStatus = false;
this->ui.motor_state_label->setStyleSheet(R"(
QLabel
{
background-color: red;
border-radius: 4px;
}
)");
}
if (getMotorsConnectionStatus())
{
this->ui.connect_btn->setText(QString::fromLocal8Bit("已连接"));
}
else
{
this->ui.connect_btn->setText(QString::fromLocal8Bit("重新连接"));
}
}
@ -150,15 +202,12 @@ void OneMotorControl::record_white()
void OneMotorControl::run()
{
if (m_coordinator == nullptr)
{
qRegisterMetaType<OneMotionCapturePathLine>("OneMotionCapturePathLine");
m_coordinator = new OneMotionCaptureCoordinator(m_multiAxisController, m_Imager);
connect(this, SIGNAL(start(OneMotionCapturePathLine)), m_coordinator, SLOT(startStepMotion(OneMotionCapturePathLine)));
connect(this, SIGNAL(stopStepMotionSignal()), m_coordinator, SLOT(stopStepMotion()));
qRegisterMetaType<OneMotionCapturePathLine>("OneMotionCapturePathLine");
m_coordinator = new OneMotionCaptureCoordinator(m_multiAxisController, m_Imager);
connect(this, SIGNAL(start(OneMotionCapturePathLine)), m_coordinator, SLOT(startStepMotion(OneMotionCapturePathLine)));
connect(this, SIGNAL(stopStepMotionSignal()), m_coordinator, SLOT(stopStepMotion()));
connect(m_coordinator, SIGNAL(sequenceComplete(int)), this, SLOT(onSequenceComplete()));
}
connect(m_coordinator, SIGNAL(sequenceComplete(int)), this, SLOT(onSequenceComplete(int)));
OneMotionCapturePathLine tmp;
tmp.speedRecord = ui.speed_lineEdit->text().toDouble();
@ -172,7 +221,22 @@ void OneMotorControl::stop()
emit stopStepMotionSignal();
}
void OneMotorControl::onSequenceComplete()
void OneMotorControl::onSequenceComplete(int state)
{
emit sequenceComplete();
disconnect(this, SIGNAL(start(OneMotionCapturePathLine)), m_coordinator, SLOT(startStepMotion(OneMotionCapturePathLine)));
disconnect(this, SIGNAL(stopStepMotionSignal()), m_coordinator, SLOT(stopStepMotion()));
disconnect(m_coordinator, SIGNAL(sequenceComplete(int)), this, SLOT(onSequenceComplete(int)));
// Use deleteLater() instead of delete: this slot may have been called directly
// from OneMotionCaptureCoordinator's call stack (direct connection), so deleting
// the object here would cause a crash when execution returns to the destroyed object.
m_coordinator->deleteLater();
m_coordinator = nullptr;
}
bool OneMotorControl::getMotorsConnectionStatus()
{
return m_xMotorConnectionStatus;
}

View File

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include <QThread>
#include <QMessageBox>
@ -7,8 +7,9 @@
#include "IrisMultiMotorController.h"
#include "fileOperation.h"
#include "CaptureCoordinator.h"
#include "MotorWindowBase.h"
class OneMotorControl : public QDialog
class OneMotorControl : public QDialog, public MotorWindowBase
{
Q_OBJECT
@ -24,6 +25,7 @@ public:
void record_dark();
void record_white();
bool getMotorsConnectionStatus();
public Q_SLOTS:
void onConnectMotor();
@ -38,7 +40,7 @@ public Q_SLOTS:
void onxMotorLeft();
void onxMotorStop();
void onSequenceComplete();
void onSequenceComplete(int state);
signals:
void moveSignal(int, bool, double, int);
@ -61,11 +63,13 @@ private:
Ui::OneMotorControl_UI ui;
QThread m_motorThread;
IrisMultiMotorController* m_multiAxisController;
IrisMultiMotorController* m_multiAxisController = nullptr;
OneMotionCaptureCoordinator* m_coordinator = nullptr;
ImagerOperationBase* m_Imager;
DarkAndWhiteCaptureCoordinator* m_darkCaptureCoordinator = nullptr;
DarkAndWhiteCaptureCoordinator* m_whiteCaptureCoordinator = nullptr;
bool m_xMotorConnectionStatus = false;
};

View File

@ -1,4 +1,4 @@
#include "PowerControl.h"
#include "PowerControl.h"
PowerControl::PowerControl(QWidget *parent)
: QDialog(parent)

View File

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include <QDialog>
#include <QNetworkRequest>

View File

@ -1,4 +1,4 @@
#include "stdafx.h"
#include "stdafx.h"
#include "qDoubleSlider.h"
QDoubleSlider::QDoubleSlider(QWidget* pParent /*= NULL*/) :
QSlider(pParent),
@ -13,13 +13,13 @@ m_Multiplier(100.0)
setFocusPolicy(Qt::NoFocus);
}
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//向外发射
void QDoubleSlider::notifyValueChanged(int Value)
{
emit valueChanged((double)Value / m_Multiplier);
}
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//接收外边
void QDoubleSlider::setValue(double Value, bool BlockSignals)
{
QSlider::blockSignals(BlockSignals);

View File

@ -1,4 +1,4 @@
#ifndef Q_DOUBLE_SLIDER_H
#ifndef Q_DOUBLE_SLIDER_H
#define Q_DOUBLE_SLIDER_H
#include <QtGui/QtGui>
#include <QSlider>
@ -17,14 +17,14 @@ public:
double value() const;
public slots:
void notifyValueChanged(int value);//<EFBFBD>ź<EFBFBD>valueChanged(int)<EFBFBD><EFBFBD>wrap
void setValue(double Value, bool BlockSignals = true);//QSlider::setValue<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>wrap
void notifyValueChanged(int value);//信号valueChanged(int)wrap
void setValue(double Value, bool BlockSignals = true);//QSlider::setValue函数的wrap
private slots:
signals :
void valueChanged(double Value);//QSlider<EFBFBD><EFBFBD>valueChanged<EFBFBD>źŵIJ<EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void rangeChanged(double Min, double Max);//QSlider<EFBFBD><EFBFBD>rangeChanged<EFBFBD>źŵIJ<EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void valueChanged(double Value);//QSlidervalueChanged信号的参数为整型
void rangeChanged(double Min, double Max);//QSliderrangeChanged信号的参数为整型
private:
double m_Multiplier;

View File

@ -1,4 +1,4 @@
#include "stdafx.h"
#include "stdafx.h"
#include "QMotorDoubleSlider.h"
QMotorDoubleSlider::QMotorDoubleSlider(QWidget* pParent /*= NULL*/) :QSlider(pParent)
{
@ -14,9 +14,9 @@ QMotorDoubleSlider::QMotorDoubleSlider(QWidget* pParent /*= NULL*/) :QSlider(pPa
void QMotorDoubleSlider::setMultiplier(float lead, float stepAnglemar, float scaleFactor, int subdivisionParam)
{
//<EFBFBD><EFBFBD><EFBFBD>ݹ<EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD>룺1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(m_Multiplier)=<EFBFBD><EFBFBD><EFBFBD><EFBFBD>/(360/<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><>ֱ<EFBFBD><D6B1><EFBFBD>)<29><><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7>https://wenku.baidu.com/view/4b2ea88bd0d233d4b14e69b8.html
//m_Multiplier(0.00054496986),//<EFBFBD>Ϻ<EFBFBD>ũ<EFBFBD><EFBFBD>Ժ<EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD>ǰ<EFBFBD><EFBFBD>0.00052734375/5=0.00010546875<EFBFBD><EFBFBD><EFBFBD>޸ĺ<EFBFBD>׼ȷֵΪ0.000544969862759644<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ0.00054496986/5=0.000108993972<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>и<EFBFBD><EFBFBD><EFBFBD>еװ<EFBFBD><EFBFBD>1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>5<EFBFBD><EFBFBD>
//m_Multiplier(0.00054496986)//<EFBFBD>˰<EFBFBD><EFBFBD><EFBFBD>ũ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//根据公式将脉冲换算为距离1脉冲距离(m_Multiplier)=导程/(360/步距角*细分倍数);网址:https://wenku.baidu.com/view/4b2ea88bd0d233d4b14e69b8.html
//m_Multiplier(0.00054496986),//上海农科院,修改前:0.00052734375/5=0.00010546875;修改后准确值为0.000544969862759644,近似为0.00054496986/5=0.000108993972因为有个机械装置1脉冲距离需要除以5
//m_Multiplier(0.00054496986)//兴安盟农研所
m_Multiplier = lead / (360 / stepAnglemar * getValidSubdivision(subdivisionParam)) * scaleFactor;
}
@ -38,13 +38,13 @@ int QMotorDoubleSlider::getValidSubdivision(int subdivisionParam)
return 256;
}
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//向外发射
void QMotorDoubleSlider::notifyValueChanged(int Value)
{
emit valueChanged((double)Value * m_Multiplier);//////////
}
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//接收外边
void QMotorDoubleSlider::setValue(double Value, bool BlockSignals)
{
QSlider::blockSignals(BlockSignals);

View File

@ -1,4 +1,4 @@
#ifndef Q_MOTOR_DOUBLE_SLIDER_H
#ifndef Q_MOTOR_DOUBLE_SLIDER_H
#define Q_MOTOR_DOUBLE_SLIDER_H
#include <QtGui/QtGui>
#include <QSlider>
@ -15,7 +15,7 @@ public:
void setMultiplier(float lead, float stepAnglemar, float scaleFactor, int subdivisionParam);
int getValidSubdivision(int subdivisionParam);
double m_Multiplier;//<EFBFBD><EFBFBD><EFBFBD>ݹ<EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD>룺1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(m_Multiplier)=<EFBFBD><EFBFBD><EFBFBD><EFBFBD>/(360/<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><>ֱ<EFBFBD><D6B1><EFBFBD>)<29><><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7>https://wenku.baidu.com/view/4b2ea88bd0d233d4b14e69b8.html
double m_Multiplier;//根据公式将脉冲换算为距离1脉冲距离(m_Multiplier)=导程/(360/步距角*细分倍数);网址:https://wenku.baidu.com/view/4b2ea88bd0d233d4b14e69b8.html
void setRange(double Min, double Max);
void setMinimum(double Min);
@ -23,13 +23,13 @@ public:
void setMaximum(double Max);
double maximum() const;
double value() const;
double OriginalValue() const;//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫʵ<EFBFBD>ʵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǿ<EFBFBD><EFBFBD><EFBFBD>
long getPositionPulse(double position);//<EFBFBD><EFBFBD><EFBFBD>ݴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
double OriginalValue() const;//返回脉冲值:马达需要实际的脉冲值,而不是距离
long getPositionPulse(double position);//根据传入的距离返回脉冲值
double getDistanceFromPulse(int pulse);
public slots:
void notifyValueChanged(int value);//<EFBFBD>ź<EFBFBD>valueChanged(int)<EFBFBD><EFBFBD>wrap
void setValue(double Value, bool BlockSignals = true);//QSlider::setValue<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>wrap
void notifyValueChanged(int value);//信号valueChanged(int)wrap
void setValue(double Value, bool BlockSignals = true);//QSlider::setValue函数的wrap
signals:
void valueChanged(double Value);

View File

@ -1,4 +1,4 @@
#include "RasterDataProvider.h"
#include "RasterDataProvider.h"
#include <QString>
#include <QDebug>
#include <QFile>

View File

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include <QString>
#include <vector>

View File

@ -1,4 +1,4 @@
#include "RasterLayer.h"
#include "RasterLayer.h"
#include "RasterDataProvider.h"
#include "RasterRenderer.h"
#include <algorithm>

View File

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include "MapLayer.h"
#include <memory>

View File

@ -1,4 +1,4 @@
#include "RasterRenderer.h"
#include "RasterRenderer.h"
#include "RasterDataProvider.h"
#include <QDebug>
#include <algorithm>

View File

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include <QImage>
#include <vector>

View File

@ -1,4 +1,4 @@
#include "stdafx.h"
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <iomanip>
@ -14,7 +14,7 @@ ResononNirImager::~ResononNirImager()
{
if (buffer != nullptr)
{
std::cout << "<EFBFBD>ͷŶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>" << std::endl;
std::cout << "释放堆上内存" << std::endl;
free(buffer);
free(dark);
free(white);
@ -40,12 +40,12 @@ double ResononNirImager::getIntegrationTime()
double ResononNirImager::getGain()
{
//return m_ResononNirImager.get_gain();
return 0.0;//nir<EFBFBD><EFBFBD>֧<EFBFBD><EFBFBD>gian
return 0.0;//nir不支持gian
}
void ResononNirImager::setGain(const double gain)
{
//m_ResononNirImager.set_gain(gain);//nir<EFBFBD><EFBFBD>֧<EFBFBD><EFBFBD>gian
//m_ResononNirImager.set_gain(gain);//nir不支持gian
}
void ResononNirImager::setFramerate(const double frames_per_second)
@ -103,12 +103,12 @@ void ResononNirImager::setSpectraBin(int new_spectral_bin)
double ResononNirImager::auto_exposure()
{
//<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ع<EFBFBD>ʱ<EFBFBD><EFBFBD>Ϊ<EFBFBD>ڵ<EFBFBD>ǰ֡<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
double x = 1 / getFramerate() * 1000;//<EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ع<EFBFBD>ʱ<EFBFBD><EFBFBD>
//第一步:先设置曝光时间为在当前帧率情况下最大
double x = 1 / getFramerate() * 1000;//获取最大毫秒曝光时间
reConnectImage();
setIntegrationTime(x);
//<EFBFBD>ڶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD>ѭ<EFBFBD><EFBFBD>Ѱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ع<EFBFBD>ʱ<EFBFBD><EFBFBD>
//第二步:通过循环寻找最佳曝光时间
imagerStartCollect();
while (true)
@ -117,7 +117,7 @@ double ResononNirImager::auto_exposure()
if (GetMaxValue(buffer, m_FrameSize) >= 4095)
{
setIntegrationTime(getIntegrationTime() * 0.8);
std::cout << "<EFBFBD>Զ<EFBFBD><EFBFBD>ع<EFBFBD>-----------" << std::endl;
std::cout << "自动曝光-----------" << std::endl;
}
else
{
@ -128,7 +128,7 @@ double ResononNirImager::auto_exposure()
reConnectImage();
//imagerStopCollect();
//std::cout << "<EFBFBD>Զ<EFBFBD><EFBFBD>ع⣺" << getIntegrationTime() << std::endl;
//std::cout << "自动曝光:" << getIntegrationTime() << std::endl;
return getIntegrationTime();
}
@ -151,7 +151,7 @@ int ResononNirImager::getSampleCount()
void ResononNirImager::focus()
{
m_iFocusFrameCounter = 1;
//std::cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>-----------" << std::endl;
//std::cout << "调焦-----------" << std::endl;
double tmpFrmerate = getFramerate();
double tmpIntegrationTime = getIntegrationTime();
@ -159,7 +159,7 @@ void ResononNirImager::focus()
setFramerate(5);
auto_exposure();
std::cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><EFBFBD>ع<EFBFBD>ʱ<EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>" << getIntegrationTime() << std::endl;
std::cout << "调焦获得的曝光时间为:" << getIntegrationTime() << std::endl;
reConnectImage();
imagerStartCollect();
@ -183,12 +183,12 @@ void ResononNirImager::focus()
reConnectImage();
setIntegrationTime(tmpIntegrationTime);
setFramerate(tmpFrmerate);//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
setFramerate(tmpFrmerate);//必须要放在这里,如果不放这里,这行代码就要出错。。。。。。
}
void ResononNirImager::record_dark()
{
std::cout << "<EFBFBD>ɼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" << std::endl;
std::cout << "采集暗电流!!!!!!!!!" << std::endl;
reConnectImage();
imagerStartCollect();
@ -221,7 +221,7 @@ void ResononNirImager::record_dark()
void ResononNirImager::record_white()
{
std::cout << "<EFBFBD>ɼ<EFBFBD><EFBFBD>װ壡<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" << std::endl;
std::cout << "采集白板!!!!!!!!!" << std::endl;
reConnectImage();
imagerStartCollect();
@ -247,7 +247,7 @@ void ResononNirImager::record_white()
imagerStopCollect();
//<EFBFBD>װ<EFBFBD><EFBFBD>۰<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//白板扣暗电流
if (m_HasDark)
{
for (size_t i = 0; i < m_FrameSize; i++)
@ -275,18 +275,23 @@ void ResononNirImager::start_record()
//std::cout << "------------------------------------------------------" << std::endl;
m_iFrameCounter = 0;
m_RgbImage->m_iFrameCounter = 0;//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>rgbͼ<EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD>0<EFBFBD><EFBFBD>
m_RgbImage->m_iFrameCounter = 0;//设置填充rgb图像的第0行
m_bRecordControlState = true;
//<EFBFBD>ж<EFBFBD><EFBFBD>ڴ<EFBFBD>buffer<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//判断内存buffer是否正常分配
if (buffer == 0)
{
std::cerr << "Error: memory could not be allocated for datacube";
exit(EXIT_FAILURE);
}
// 在开始采集时仅发出文件信息UI 层自行创建 MapLayer 并管理生命周期
// prepare file name that will be used for saving
m_FileName2Save2 = m_FileName2Save + "_" + std::to_string(m_FileSavedCounter) + ".bil";
QString baseName = QString::fromStdString(getFileNameFromPath(m_FileName2Save2));
QString filePath = QString::fromStdString(m_FileName2Save2);
emit LayerFileCreated(baseName, filePath, m_FileSavedCounter);
FILE* m_fImage = fopen(m_FileName2Save2.c_str(), "w+b");
size_t x;
@ -295,7 +300,7 @@ void ResononNirImager::start_record()
string timesFile = removeFileExtension(m_FileName2Save2) + ".times";
FILE* hTimesFile = fopen(timesFile.c_str(), "w+");
reConnectImage();//nir<EFBFBD>ڶ<EFBFBD><EFBFBD>βɼ<EFBFBD>ʱ<EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>imagerStartCollect()<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
reConnectImage();//nir第二次采集时需要重新连接相机,否则函数imagerStartCollect()会报错。。。。。。
imagerStartCollect();
while (m_bRecordControlState)
{
@ -305,7 +310,7 @@ void ResononNirImager::start_record()
long long timeOs = getNanosecondsSinceMidnight();
//qDebug() << "time ns-------------------: " << timeOs;
//<EFBFBD><EFBFBD>ȥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӦΪbuffer<EFBFBD><EFBFBD>dark<EFBFBD><EFBFBD><EFBFBD><EFBFBD>unsigned short<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ե<EFBFBD>dark>bufferʱ<EFBFBD><EFBFBD>buffer-dark=65535
//减去暗电流,应为bufferdark都是unsigned short,所以当dark>buffer时,buffer-dark=65535
if (m_HasDark)
{
for (size_t i = 0; i < m_FrameSize; i++)
@ -323,12 +328,12 @@ void ResononNirImager::start_record()
}
//ת<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//转反射率
if (m_HasWhite)
{
for (size_t i = 0; i < m_FrameSize; i++)
{
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ壩Ϊ0<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//处理除数白板为0的情况
if (white[i] != 0)
{
pixelValueTmp = buffer[i];
@ -344,14 +349,14 @@ void ResononNirImager::start_record()
}
x = fwrite(buffer, 2, m_FrameSize, m_fImage);
fprintf(hTimesFile, "%lld\n", timeOs);
fprintf(hTimesFile, "%ll\n", timeOs);
//<EFBFBD><EFBFBD>rgb<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD>ڽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
//rgb波段提取出来,以便在界面中显示
m_RgbImage->FillRgbImage(buffer);//??????????????????????????????????????????????????????????????????????????????????????????????????????
//std::cout << "<EFBFBD><EFBFBD>" << m_iFrameCounter << "֡д<EFBFBD><EFBFBD>" << x << "<EFBFBD><EFBFBD>unsigned short<EFBFBD><EFBFBD>" << std::endl;
//std::cout << "" << m_iFrameCounter << "帧写了" << x << "unsigned short" << std::endl;
//ÿ<EFBFBD><EFBFBD>1s<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>ν<EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD>λ<EFBFBD><EFBFBD><EFBFBD>
//每隔1s进行一次界面图形绘制
if (m_iFrameCounter % (int)getFramerate() == 0)
{
emit PlotSignal(m_FileSavedCounter, m_iFrameCounter, filePath);
@ -360,18 +365,22 @@ void ResononNirImager::start_record()
if (m_iFrameCounter >= m_iFrameNumber)
{
break;
//qDebug() << "<22><><EFBFBD><EFBFBD>ֹͣ<CDA3>ɼ<EFBFBD><C9BC><EFBFBD>֡<EFBFBD><D6A1><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>";
}
}
imagerStopCollect();
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>λ<EFBFBD>ͼǰ<EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//在最后一次画图前需要进行一次拉伸
//m_RgbImage
emit PlotSignal(m_FileSavedCounter, -1, filePath);//<EFBFBD>ɼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɺ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>λ<EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD>Է<EFBFBD><EFBFBD>ɼ<EFBFBD>֡<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD>ʵı<EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD>ȫ
emit PlotSignal(m_FileSavedCounter, -1, filePath);//采集完成后进行一次画图,以防采集帧数不是帧率的倍数时,画图不全
m_bRecordControlState = false;
WriteHdr();
// 发射 ImageFileSaved 信号,通知 UI 层把该文件加入图层管理器
// m_FileName2Save2 保存了本次写入的 .bil 文件名(例如 "tmp_image_0.bil"
emit ImageFileSaved(QString::fromStdString(m_FileName2Save2), m_FileSavedCounter);
m_FileSavedCounter++;
if (m_iFrameCounter >= m_iFrameNumber)

View File

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include <string>
#include <opencv2/core/core.hpp>

View File

@ -1,4 +1,4 @@
#include "stdafx.h"
#include "stdafx.h"
#include "RgbCameraOperation.h"
RgbCameraOperation::RgbCameraOperation()
@ -14,14 +14,14 @@ RgbCameraOperation::~RgbCameraOperation()
void RgbCameraOperation::OpenCamera()
{
std::cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ+++++++++++++++++++++++++++++++++++++++++++" << std::endl;
std::cout << "打开摄像头+++++++++++++++++++++++++++++++++++++++++++" << std::endl;
cam = new cv::VideoCapture(0);
record = true;
while (record)
{
//std::cout << "<EFBFBD>ɼ<EFBFBD>Ӱ<EFBFBD><EFBFBD>+++++++++++++++++++++++++++++++++++++++++++" << std::endl;
//std::cout << "采集影像+++++++++++++++++++++++++++++++++++++++++++" << std::endl;
cam->read(frame);
m_qImage = m_ImageProcessor->Mat2QImage(frame);
@ -30,20 +30,20 @@ void RgbCameraOperation::OpenCamera()
cam->release();
emit CamClosed();
emit CamOpenedSignal();
}
void RgbCameraOperation::OpenCamera_callback()
{
std::cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ+++++++++++++++++++++++++++++++++++++++++++" << std::endl;
std::cout << "打开摄像头+++++++++++++++++++++++++++++++++++++++++++" << std::endl;
cam = new cv::VideoCapture(0);
record = true;
while (record)
{
//std::cout << "<EFBFBD>ɼ<EFBFBD>Ӱ<EFBFBD><EFBFBD>+++++++++++++++++++++++++++++++++++++++++++" << std::endl;
//std::cout << "采集影像+++++++++++++++++++++++++++++++++++++++++++" << std::endl;
cam->read(frame);
m_qImage = m_ImageProcessor->Mat2QImage(frame);
@ -62,7 +62,9 @@ void RgbCameraOperation::setCallback(void(*func)())
void RgbCameraOperation::CloseCamera()
{
std::cout << "<EFBFBD>ر<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ+++++++++++++++++++++++++++++++++++++++++++" << std::endl;
std::cout << "关闭摄像头+++++++++++++++++++++++++++++++++++++++++++" << std::endl;
record = false;
emit CamClosedSignal();
}

View File

@ -1,4 +1,4 @@
#pragma once
#pragma once
#ifndef RGBCAMERAOPERATION_H
#define RGBCAMERAOPERATION_H
@ -36,12 +36,13 @@ private:
public slots:
void OpenCamera();
void OpenCamera_callback();//<EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD><EFBFBD>źŶ<EFBFBD>ʹ<EFBFBD>ûص<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֪ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˢ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ
void OpenCamera_callback();//不使用信号而使用回调函数来通知界面刷新视频
void CloseCamera();
signals:
void PlotSignal();
void CamClosed();
void CamOpenedSignal();
void CamClosedSignal();
};
#endif // !RGBCAMERAOPERATION_H

View File

@ -1,4 +1,4 @@
#include "RobotArmControl.h"
#include "RobotArmControl.h"
RobotArmControl::RobotArmControl(QWidget* parent): QDialog(parent)
{
@ -82,7 +82,7 @@ void RobotArmControl::getTaskList()
files.append(line.trimmed());
}
////<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>Ȼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
////先清除数据,然后添加数据
//for (size_t i = 0; i < files.length(); i++)
//{
// int row = m_pModel->rowCount();
@ -112,7 +112,7 @@ void RobotArmControl::executeTaskWithHyperImager()
QModelIndex index = ui.taskList_listView->currentIndex();
if (-1 == index.row())
{
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD>û<EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
//弹窗提示用户选择文件
ui.textEdit->append("Please select file on the left!");
return;
}
@ -148,7 +148,7 @@ void RobotArmControl::executeTaskWithoutHyperImager()
QModelIndex index = ui.taskList_listView->currentIndex();
if (-1 == index.row())
{
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD>û<EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
//弹窗提示用户选择文件
ui.textEdit->append("Please select file on the left!");
return;
}
@ -290,7 +290,7 @@ bool RobotController::processResponse_getJbiState(QJsonObject response, QString&
void RobotController::getPoint()
{
QJsonObject response;
getJbiState(response);//0 ֹͣ״̬,1 <20><>ͣ״̬,2 <20><>ͣ״̬,3 <20><><EFBFBD><EFBFBD>״̬,4 <20><><EFBFBD><EFBFBD>״̬
getJbiState(response);//0 停止状态,1 暂停状态,2 急停状态,3 运行状态,4 错误状态
QString result;
bool x = processResponse_getJbiState(response, result);
//qDebug() << "getJbiState:" << result;
@ -302,7 +302,7 @@ void RobotController::getPoint()
m_iCurrentJbiJobLine = 0;
m_iFileCounter = 0;
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>źţ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹͣ<EFBFBD>ɼ<EFBFBD>
//发射信号,相机停止采集
emit hsiRecordSignal(-1);
return;
@ -321,12 +321,12 @@ void RobotController::getPoint()
m_iFileCounter++;
qDebug() << "Changed! CurrentJobLine:" << m_iCurrentJbiJobLine_tmp;
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>źţ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹͣ<EFBFBD>ɼ<EFBFBD>
//发射信号,相机停止采集
emit hsiRecordSignal(-1);
m_iCurrentJbiJobLine = m_iCurrentJbiJobLine_tmp;
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>źţ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD>ɼ<EFBFBD>
//发射信号,相机开始采集
emit hsiRecordSignal(m_iFileCounter);
}
}
@ -421,7 +421,7 @@ bool RobotController::getRobotMode(QJsonObject& re)
bool RobotController::checkJbiExist(const QString& jbiFilename, QJsonObject& re)
{
QJsonObject paramsRunJbi;
paramsRunJbi["filename"] = jbiFilename;//ʹ<EFBFBD>ö<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
paramsRunJbi["filename"] = jbiFilename;//使用对象结构
sendCommand("checkJbiExist", paramsRunJbi);
socket->waitForReadyRead(m_iTimeout);
@ -432,7 +432,7 @@ bool RobotController::checkJbiExist(const QString& jbiFilename, QJsonObject& re)
bool RobotController::setServoStatus(int status, QJsonObject& re)
{
QJsonObject params_set_servo_status;
params_set_servo_status["status"] = status;//ʹ<EFBFBD>ö<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
params_set_servo_status["status"] = status;//使用对象结构
sendCommand("set_servo_status", params_set_servo_status);
socket->waitForReadyRead(m_iTimeout);
@ -443,7 +443,7 @@ bool RobotController::setServoStatus(int status, QJsonObject& re)
bool RobotController::runJbi(const QString& jbiFilename, QJsonObject& re, bool isRecordHsi)
{
QJsonObject paramsRunJbi;
paramsRunJbi["filename"] = jbiFilename;//ʹ<EFBFBD>ö<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
paramsRunJbi["filename"] = jbiFilename;//使用对象结构
sendCommand("runJbi", paramsRunJbi);
socket->waitForReadyRead(m_iTimeout);

View File

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include <qdialog.h>
#include <QTcpSocket>
#include <QJsonDocument>
@ -26,33 +26,33 @@ struct ECData
quint32 msgSize;
quint64 timeStamp;
quint8 auto_cycle;
double machinePos[8];//<EFBFBD>ؽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
double machinePose[6];//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
double machineUserPose[6];//<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
double torque[8];//<EFBFBD>ؽڶ<EFBFBD><EFBFBD><EFBFBD>ذٷֱ<EFBFBD>
quint32 robotState;//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
quint32 servoReady;//<EFBFBD>ŷ<EFBFBD>ʹ<EFBFBD><EFBFBD>״̬
quint32 can_motor_run;//ͬ<EFBFBD><EFBFBD>״̬
qint32 motor_speed[8];//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><EFBFBD>
quint32 robotMode;//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģʽ
double analog_ioInput[3];//ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
double analog_ioOutput[5];//ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
quint64 digital_ioInput;//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵĶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
quint64 digital_ioOutput;//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵĶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
quint8 collision;//<EFBFBD><EFBFBD>ײ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
double machineFlangePose[6];//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>µķ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD>
double machineUserFlangePose[6];//<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>µķ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD>
quint8 emergencyStopState;//<EFBFBD><EFBFBD>ǰ<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>ͣ״̬
double tcpSpeed;//tcp<EFBFBD>˶<EFBFBD><EFBFBD>ٶ<EFBFBD>
double joIntSpeed[8];//<EFBFBD>ؽ<EFBFBD><EFBFBD>˶<EFBFBD><EFBFBD>¸<EFBFBD><EFBFBD>ؽ<EFBFBD><EFBFBD>˶<EFBFBD><EFBFBD>ٶ<EFBFBD>
double tcpAcc;//tcp<EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>
double joIntAcc[8];//<EFBFBD>ؽ<EFBFBD><EFBFBD>˶<EFBFBD><EFBFBD>¸<EFBFBD><EFBFBD>ؽڼ<EFBFBD><EFBFBD>ٶ<EFBFBD>
double joIntTemperature[6];//<EFBFBD><EFBFBD>
double joIntTorque[6];//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ť<EFBFBD><EFBFBD>
double extJoIntTorques[6];//<EFBFBD>ⲿ<EFBFBD>ؽ<EFBFBD>Ť<EFBFBD><EFBFBD>ֵ
double exTcpForceIntool[6];//<EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>µ<EFBFBD><EFBFBD>ⲿĩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD>ع<EFBFBD><D8B9><EFBFBD>ֵ
quint8 dragState;//<EFBFBD>϶<EFBFBD>ʹ<EFBFBD><EFBFBD>״̬
quint8 sensor_connected_state;//<EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
double machinePos[8];//关节坐标
double machinePose[6];//基座坐标
double machineUserPose[6];//用户坐标
double torque[8];//关节额定力矩百分比
quint32 robotState;//机器人状态
quint32 servoReady;//伺服使能状态
quint32 can_motor_run;//同步状态
qint32 motor_speed[8];//各轴电机转速
quint32 robotMode;//机器人模式
double analog_ioInput[3];//模拟量输入口数据
double analog_ioOutput[5];//模拟量输出口数据
quint64 digital_ioInput;//数字量输入口数据的二进制形式
quint64 digital_ioOutput;//数字量输出口数据的二进制形式
quint8 collision;//碰撞报警状态
double machineFlangePose[6];//基座坐标系下的法兰盘中心位姿
double machineUserFlangePose[6];//用户坐标系下的法兰盘中心位姿
quint8 emergencyStopState;//当前是否处于急停状态
double tcpSpeed;//tcp运动速度
double joIntSpeed[8];//关节运动下各关节运动速度
double tcpAcc;//tcp加速度
double joIntAcc[8];//关节运动下各关节加速度
double joIntTemperature[6];//温度
double joIntTorque[6];//输出扭矩
double extJoIntTorques[6];//外部关节扭矩值
double exTcpForceIntool[6];//当前工具坐标系下的外部末端力/力矩估计值
quint8 dragState;//拖动使能状态
quint8 sensor_connected_state;//力控传感器连接状态
quint8 reserved;
quint32 matchingWord;
};
@ -98,10 +98,10 @@ public:
bool processResponse_getJbiState(QJsonObject response, QString& result);
bool getRobotPose(QJsonObject& re);
bool getRobotState(QJsonObject& re);//ֹͣ״̬ 0<><30><EFBFBD><EFBFBD>ͣ״̬ 1<><31><EFBFBD><EFBFBD>ͣ״̬ 2<><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬ 3<><33><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬ 4<><34><EFBFBD><EFBFBD>ײ״̬ 5
bool getJbiState(QJsonObject& re);//0 ֹͣ״̬,1 <20><>ͣ״̬,2 <20><>ͣ״̬,3 <20><><EFBFBD><EFBFBD>״̬,4 <20><><EFBFBD><EFBFBD>״̬
bool getRobotState(QJsonObject& re);//停止状态 0暂停状态 1急停状态 2运行状态 3报警状态 4碰撞状态 5
bool getJbiState(QJsonObject& re);//0 停止状态,1 暂停状态,2 急停状态,3 运行状态,4 错误状态
bool getCurrentJobLine(QJsonObject& re);
bool getRobotMode(QJsonObject& re);//ʾ<EFBFBD><EFBFBD>ģʽ 0<><30><EFBFBD>Զ<EFBFBD>ģʽ 1<><31>Զ<EFBFBD><D4B6>ģʽ 2
bool getRobotMode(QJsonObject& re);//示教模式 0自动模式 1远程模式 2
bool checkJbiExist(const QString& jbiFilename, QJsonObject& re);
bool setServoStatus(int status, QJsonObject& re);
bool runJbi(const QString& jbiFilename, QJsonObject& re, bool isRecordHsi);

View File

@ -1,4 +1,4 @@
#include "TabManager.h"
#include "TabManager.h"
TabManager::TabManager(QTabWidget* tabWidget, QObject* parent)
: QObject(parent),
@ -27,7 +27,7 @@ void TabManager::hideTab(QWidget* page)
m_hiddenTabs.insert(page, info);
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><EFBFBD>ǵ<EFBFBD>ǰҳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>հ<EFBFBD>
// 如果隐藏的是当前页,先切换,避免空白
if (m_tabWidget->currentIndex() == index)
{
int next = (index > 0) ? index - 1 : 0;

View File

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include <QObject>
#include <QTabWidget>

View File

@ -18,6 +18,22 @@ TwoMotorControl::TwoMotorControl(QWidget* parent) : QDialog(parent)
connect(ui.deleteRecordLine_btn, SIGNAL(clicked()), this, SLOT(onDeleteRecordLine_btn()));
connect(ui.saveRecordLine2File_btn, SIGNAL(clicked()), this, SLOT(onSaveRecordLine2File_btn()));
connect(ui.readRecordLineFile_btn, SIGNAL(clicked()), this, SLOT(onReadRecordLineFile_btn()));
connect(this->ui.xmotor_right_btn, SIGNAL(pressed()), this, SLOT(onxMotorRight()));
connect(this->ui.xmotor_right_btn, SIGNAL(released()), this, SLOT(onxMotorStop()));
connect(this->ui.xmotor_left_btn, SIGNAL(pressed()), this, SLOT(onxMotorLeft()));
connect(this->ui.xmotor_left_btn, SIGNAL(released()), this, SLOT(onxMotorStop()));
connect(this->ui.ymotor_forward_btn, SIGNAL(pressed()), this, SLOT(onyMotorforward()));
connect(this->ui.ymotor_forward_btn, SIGNAL(released()), this, SLOT(onyMotorStop()));
connect(this->ui.ymotor_backward_btn, SIGNAL(pressed()), this, SLOT(onyMotorbackward()));
connect(this->ui.ymotor_backward_btn, SIGNAL(released()), this, SLOT(onyMotorStop()));
connect(this->ui.move2loc_x_pushButton, SIGNAL(pressed()), this, SLOT(onxMove2Loc()));
connect(this->ui.move2loc_y_pushButton, SIGNAL(pressed()), this, SLOT(onyMove2Loc()));
connect(this->ui.zero_start_btn, SIGNAL(released()), this, SLOT(zeroStart()));
connect(this->ui.rangeMeasurement_btn, SIGNAL(pressed()), this, SLOT(on_rangeMeasurement()));
}
void TwoMotorControl::setImager(ImagerOperationBase* imager)
@ -34,6 +50,9 @@ void TwoMotorControl::setPosFileName(QString posFileName)
bool TwoMotorControl::getState()
{
if (m_coordinator == nullptr)
return false;
QEventLoop loop;
bool tmp = false;
bool received = false;
@ -86,29 +105,33 @@ void TwoMotorControl::record_white()
void TwoMotorControl::run()
{
if (m_coordinator==nullptr)
{
qRegisterMetaType<QVector<PathLine>>("QVector<PathLine>");
m_coordinator = new TwoMotionCaptureCoordinator(m_multiAxisController, m_Imager);
m_coordinator->moveToThread(&m_coordinatorThread);
connect(&m_coordinatorThread, SIGNAL(finished()), m_coordinator, SLOT(deleteLater()));
connect(this, SIGNAL(start(QVector<PathLine>)), m_coordinator, SLOT(start(QVector<PathLine>)));
connect(this, SIGNAL(stopSignal()), m_coordinator, SLOT(stop()));
connect(m_coordinator, SIGNAL(startRecordLineNumSignal(int)), this, SLOT(receiveStartRecordLineNum(int)));
connect(m_coordinator, SIGNAL(finishRecordLineNumSignal(int)), this, SLOT(receiveFinishRecordLineNum(int)));
connect(m_coordinator, SIGNAL(sequenceComplete(int)), this, SLOT(onSequenceComplete()));
m_coordinatorThread.start();
}
if (getState())
{
//std::cout << "已经开始运行,请勿重复点击!!!!!!!!" << std::endl;
QMessageBox::information(this, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("已经开始运行,请勿重复点击!!!!!!!!!"));
QMessageBox::information(this, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("已经开始运行,请勿重复点击!"));
return;
}
QVector<PathLine> pathLines;
int rowCount = ui.recordLine_tableWidget->rowCount();
if(rowCount == 0)
{
QMessageBox::information(this, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("请至少添加一行采集线!"));
emit sequenceComplete();
return;
}
qRegisterMetaType<QVector<PathLine>>("QVector<PathLine>");
m_coordinator = new TwoMotionCaptureCoordinator(m_multiAxisController, m_Imager);
m_coordinator->moveToThread(&m_coordinatorThread);
connect(&m_coordinatorThread, SIGNAL(finished()), m_coordinator, SLOT(deleteLater()));
connect(this, SIGNAL(start(QVector<PathLine>)), m_coordinator, SLOT(start(QVector<PathLine>)));
connect(this, SIGNAL(stopSignal()), m_coordinator, SLOT(stop()));
connect(m_coordinator, SIGNAL(startRecordLineNumSignal(int)), this, SLOT(receiveStartRecordLineNum(int)));
connect(m_coordinator, SIGNAL(finishRecordLineNumSignal(int)), this, SLOT(receiveFinishRecordLineNum(int)));
connect(m_coordinator, SIGNAL(sequenceComplete(int)), this, SLOT(onSequenceComplete()));
m_coordinatorThread.start();
QVector<PathLine> pathLines;
//int columnCount = ui.recordLine_tableWidget->columnCount();
for (size_t i = 0; i < rowCount; i++)
{
@ -128,7 +151,7 @@ void TwoMotorControl::run()
{
for (size_t j = 0; j < ui.recordLine_tableWidget->columnCount(); j++)
{
ui.recordLine_tableWidget->item(i, j)->setBackgroundColor(QColor(240, 240, 240));
ui.recordLine_tableWidget->item(i, j)->setBackgroundColor(QColor("#0E1C4C"));
}
}
@ -151,6 +174,30 @@ TwoMotorControl::~TwoMotorControl()
void TwoMotorControl::onConnectMotor()
{
if (getMotorsConnectionStatus())
{
QMessageBox msgBox;
msgBox.setText(QString::fromLocal8Bit("马达已连接!"));
msgBox.exec();
return;
}
if (m_multiAxisController != nullptr)
{
disconnect(m_multiAxisController, SIGNAL(broadcastLocationSignal(std::vector<double>)), this, SLOT(displayRealTimeLoc(std::vector<double>)));
disconnect(this, SIGNAL(moveSignal(int, bool, double, int)), m_multiAxisController, SLOT(move(int, bool, double, int)));
disconnect(this, SIGNAL(move2LocSignal(int, double, double, int)), m_multiAxisController, SLOT(moveTo(int, double, double, int)));
disconnect(this, SIGNAL(stopSignal(int)), m_multiAxisController, SLOT(stop(int)));
disconnect(this, SIGNAL(zeroStartSignal(int)), m_multiAxisController, SLOT(zeroStart(int)));
disconnect(this, SIGNAL(rangeMeasurement(int, double, int)), m_multiAxisController, SLOT(rangeMeasurement(int, double, int)));
disconnect(this, SIGNAL(testConnectivitySignal(int, int)), m_multiAxisController, SLOT(testConnectivity(int, int)));
disconnect(m_multiAxisController, SIGNAL(broadcastConnectivity(std::vector<int>)), this, SLOT(display_motors_connectivity(std::vector<int>)));
m_motorThread.quit();
m_motorThread.wait();
m_multiAxisController = nullptr;
}
try
{
FileOperation* fileOperation = new FileOperation();
@ -164,34 +211,20 @@ void TwoMotorControl::onConnectMotor()
QMessageBox msgBox;
msgBox.setText(QString::fromLocal8Bit("请连接马达!"));
msgBox.exec();
return;
}
m_multiAxisController->moveToThread(&m_motorThread);
connect(&m_motorThread, SIGNAL(finished()), m_multiAxisController, SLOT(deleteLater()));
connect(this->ui.xmotor_right_btn, SIGNAL(pressed()), this, SLOT(onxMotorRight()));
connect(this->ui.xmotor_right_btn, SIGNAL(released()), this, SLOT(onxMotorStop()));
connect(this->ui.xmotor_left_btn, SIGNAL(pressed()), this, SLOT(onxMotorLeft()));
connect(this->ui.xmotor_left_btn, SIGNAL(released()), this, SLOT(onxMotorStop()));
connect(this->ui.ymotor_forward_btn, SIGNAL(pressed()), this, SLOT(onyMotorforward()));
connect(this->ui.ymotor_forward_btn, SIGNAL(released()), this, SLOT(onyMotorStop()));
connect(this->ui.ymotor_backward_btn, SIGNAL(pressed()), this, SLOT(onyMotorbackward()));
connect(this->ui.ymotor_backward_btn, SIGNAL(released()), this, SLOT(onyMotorStop()));
connect(this->ui.move2loc_x_pushButton, SIGNAL(pressed()), this, SLOT(onxMove2Loc()));
connect(this->ui.move2loc_y_pushButton, SIGNAL(pressed()), this, SLOT(onyMove2Loc()));
connect(m_multiAxisController, SIGNAL(broadcastLocationSignal(std::vector<double>)), this, SLOT(displayRealTimeLoc(std::vector<double>)));
connect(this, SIGNAL(moveSignal(int, bool, double, int)), m_multiAxisController, SLOT(move(int, bool, double, int)));
connect(this, SIGNAL(move2LocSignal(int, double, double, int)), m_multiAxisController, SLOT(moveTo(int, double, double, int)));
connect(this, SIGNAL(stopSignal(int)), m_multiAxisController, SLOT(stop(int)));
connect(this->ui.zero_start_btn, SIGNAL(released()), this, SLOT(zeroStart()));
connect(this, SIGNAL(zeroStartSignal(int)), m_multiAxisController, SLOT(zeroStart(int)));
connect(this->ui.rangeMeasurement_btn, SIGNAL(pressed()), this, SLOT(on_rangeMeasurement()));
connect(this, SIGNAL(rangeMeasurement(int, double, int)), m_multiAxisController, SLOT(rangeMeasurement(int, double, int)));
connect(this, SIGNAL(testConnectivitySignal(int, int)), m_multiAxisController, SLOT(testConnectivity(int, int)));
@ -223,15 +256,26 @@ void TwoMotorControl::onSequenceComplete()
{
isWritePosFile = false;
fclose(m_posFileHandle);
m_coordinatorThread.quit();
m_coordinatorThread.wait();
m_coordinator = nullptr;
emit sequenceComplete();
}
bool TwoMotorControl::getMotorsConnectionStatus()
{
return m_xMotorConnectionStatus && m_yMotorConnectionStatus;
}
void TwoMotorControl::display_motors_connectivity(std::vector<int> connectivity)
{
//std::cout << "-----------------------------------"<<connectivity.size()<< std::endl;
if (connectivity[0])
{
m_xMotorConnectionStatus = true;
this->ui.xMotorStateLabel->setStyleSheet(R"(
QLabel
{
@ -242,6 +286,8 @@ void TwoMotorControl::display_motors_connectivity(std::vector<int> connectivity)
}
else
{
m_xMotorConnectionStatus = false;
this->ui.xMotorStateLabel->setStyleSheet(R"(
QLabel
{
@ -253,6 +299,8 @@ void TwoMotorControl::display_motors_connectivity(std::vector<int> connectivity)
if (connectivity[1])
{
m_yMotorConnectionStatus = true;
this->ui.yMotorStateLabel->setStyleSheet(R"(
QLabel
{
@ -263,6 +311,8 @@ void TwoMotorControl::display_motors_connectivity(std::vector<int> connectivity)
}
else
{
m_yMotorConnectionStatus = false;
this->ui.yMotorStateLabel->setStyleSheet(R"(
QLabel
{
@ -271,6 +321,15 @@ void TwoMotorControl::display_motors_connectivity(std::vector<int> connectivity)
}
)");
}
if(getMotorsConnectionStatus())
{
this->ui.connect_btn->setText(QString::fromLocal8Bit("已连接"));
}
else
{
this->ui.connect_btn->setText(QString::fromLocal8Bit("重新连接"));
}
}
void TwoMotorControl::onxMotorRight()

View File

@ -8,12 +8,11 @@
#include "IrisMultiMotorController.h"
#include "fileOperation.h"
#include "CaptureCoordinator.h"
#include "MotorWindowBase.h"
#define PI 3.1415926
class TwoMotorControl : public QDialog
class TwoMotorControl : public QDialog, public MotorWindowBase
{
Q_OBJECT
@ -26,6 +25,8 @@ public:
void record_dark();
void record_white();
bool getMotorsConnectionStatus();
private:
ImagerOperationBase* m_Imager;
@ -35,6 +36,8 @@ private:
QString m_posFileName;
FILE* m_posFileHandle;
bool m_xMotorConnectionStatus = false;
bool m_yMotorConnectionStatus = false;
public Q_SLOTS:
void onConnectMotor();
@ -94,5 +97,5 @@ private:
DarkAndWhiteCaptureCoordinator* m_whiteCaptureCoordinator = nullptr;
QThread m_motorThread;
IrisMultiMotorController* m_multiAxisController;
IrisMultiMotorController* m_multiAxisController = nullptr;
};

View File

@ -1,4 +1,4 @@
#ifndef VIEW3D_H
#ifndef VIEW3D_H
#define VIEW3D_H
#include <QWidget>

View File

@ -1,4 +1,4 @@
#include "View3DModelManager.h"
#include "View3DModelManager.h"
View3DModelManager::View3DModelManager(QWidget* parent)
: QWidget(parent)

View File

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include <QObject>
#include <QStackedWidget>
#include <QCoreApplication>

View File

@ -288,7 +288,7 @@ QPushButton:pressed
}</string>
</property>
<property name="text">
<string>版本3.0.0</string>
<string>版本3.0.1</string>
</property>
</widget>
</item>

View File

@ -1,4 +1,4 @@
#include "aboutWindow.h"
#include "aboutWindow.h"
#include <QSvgRenderer>
#include <QPainter>
@ -6,7 +6,7 @@ aboutWindow::aboutWindow(QWidget* parent)
{
ui.setupUi(this);
ui.companylname_label->setOpenExternalLinks(true);//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊtrue<EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ
ui.companylname_label->setOpenExternalLinks(true);//设置为true才能打开网页
QString text = ui.companylname_label->text();
ui.companylname_label->setText("<a style='color: green; text-decoration: none' href = http://www.iris-rs.cn/pr.jsp?_jcp=3_10>" + text);

View File

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include <QtWidgets/qdialog.h>
#include <qstring.h>

View File

@ -1,4 +1,4 @@
#include "adjustTable.h"
#include "adjustTable.h"
adjustTable::adjustTable(QWidget *parent)
: QDialog(parent)

View File

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include <QDialog>
#include <QNetworkRequest>

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>501</width>
<height>363</height>
<height>267</height>
</rect>
</property>
<property name="sizePolicy">

View File

@ -1,4 +1,4 @@
#include "stdafx.h"
#include "stdafx.h"
#include "fileOperation.h"
#include "AppSettings.h"
@ -38,7 +38,7 @@ string FileOperation::getDirectoryFromString(string directory)
if (!dir.exists(tmp))
{
bool res = dir.mkpath(tmp);
//qDebug() << "<EFBFBD>½<EFBFBD>Ŀ¼<EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD>" << res;
//qDebug() << "新建目录是否成功" << res;
}
return directory;
}
@ -58,9 +58,9 @@ bool FileOperation::copyFile(QString source, QString target)
while (!in.eof())
{
in.read(buffer, 256); //<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD>ж<EFBFBD>ȡ256<EFBFBD><EFBFBD><EFBFBD>ֽڵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
n = in.gcount(); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>в<EFBFBD>֪<EFBFBD><EFBFBD>ȡ<EFBFBD>˶<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֽڵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ú<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>¡<EFBFBD>
out.write(buffer, n); //д<EFBFBD><EFBFBD><EFBFBD>Ǹ<EFBFBD><EFBFBD>ֽڵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
in.read(buffer, 256); //从文件中读取256个字节的数据到缓存区
n = in.gcount(); //由于最后一行不知读取了多少字节的数据,所以用函数计算一下。
out.write(buffer, n); //写入那个字节的数据
}
in.close();
out.close();
@ -68,7 +68,7 @@ bool FileOperation::copyFile(QString source, QString target)
string::size_type idx;
idx = source1.find("hdr");
if (idx == string::npos) //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڡ<EFBFBD>
if (idx == string::npos) //不存在。
emit CopyFinishedSignal();
return 1;

View File

@ -1,4 +1,4 @@
#ifndef FILE_OPERATIOIN_H
#ifndef FILE_OPERATIOIN_H
#define FILE_OPERATIOIN_H
#include <iostream>
@ -36,6 +36,6 @@ public Q_SLOTS:
signals:
void CopyFinishedSignal();//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӱ<EFBFBD><EFBFBD><EFBFBD>ź<EFBFBD>
void CopyFinishedSignal();//绘制影像信号
};
#endif

View File

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include "windows.h"
#include <cstdio>
@ -33,19 +33,19 @@
#include <Eigen/Dense>
#include <cmath>
// <EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>¼<EFBFBD><EFBFBD><EFBFBD>
// 数据记录结构体
struct PositionData {
double targetPosition; // Ŀ<EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD>
double actualPosition; // ʵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD>
double cameraIndex; // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɼ<EFBFBD>ָ<EFBFBD><EFBFBD>
QDateTime timestamp; // ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
double targetPosition; // 目标位置
double actualPosition; // 实际马达位置
double cameraIndex; // 相机采集指数
QDateTime timestamp; // 时间戳
PositionData(double target = 0, double actual = 0.0, double index = 0.0)
: targetPosition(target), actualPosition(actual),
cameraIndex(index), timestamp(QDateTime::currentDateTime()) {}
};
// Э<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// 协调控制器
class MotionCaptureCoordinator : public QObject
{
Q_OBJECT
@ -59,7 +59,7 @@ public:
bool saveToCsv(const QString& filename);
public slots:
void startStepMotion(double speed, int stepInterval = 100, double startPos = 0, double endPos = -1);//-1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զλ<EFBFBD><EFBFBD>
void startStepMotion(double speed, int stepInterval = 100, double startPos = 0, double endPos = -1);//-1:马达能到达的最远位置
void stopStepMotion();
signals:
@ -159,7 +159,7 @@ public Q_SLOTS:
void onExit();
signals:
void StartManualFocusSignal(int);//1<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><EFBFBD>ֹͣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void StartManualFocusSignal(int);//1开始调焦0停止调焦
void move2LocSignal(int, double, double, int);
void move2MaxLocSignal(int, double, int);

View File

@ -1,4 +1,4 @@
//
//
// Created by tangchao on 2023/3/25.
//
@ -301,10 +301,10 @@ bool Configfile::createConfigFile()
Setting& x = motionPlatform.add("x", Setting::TypeGroup);
Setting& y = motionPlatform.add("y", Setting::TypeGroup);
Setting& x_StepAnglemar = x.add("StepAnglemar", Setting::TypeFloat) = 1.8;//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Setting& x_Lead = x.add("Lead", Setting::TypeFloat) = 13.5;//<EFBFBD><EFBFBD><EFBFBD>̣<EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD>cm
Setting& x_SubdivisionMultiples = x.add("SubdivisionMultiples", Setting::TypeInt) = 7;//ϸ<EFBFBD>ֱ<EFBFBD><EFBFBD><EFBFBD>
Setting& x_ScaleFactor = x.add("ScaleFactor", Setting::TypeFloat) = 1.0;//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Setting& x_StepAnglemar = x.add("StepAnglemar", Setting::TypeFloat) = 1.8;//步距角
Setting& x_Lead = x.add("Lead", Setting::TypeFloat) = 13.5;//导程,单位:cm
Setting& x_SubdivisionMultiples = x.add("SubdivisionMultiples", Setting::TypeInt) = 7;//细分倍数
Setting& x_ScaleFactor = x.add("ScaleFactor", Setting::TypeFloat) = 1.0;//缩放因子
Setting& x_MaxRange = x.add("MaxRange", Setting::TypeFloat) = 120.0;
Setting& y_StepAnglemar = y.add("StepAnglemar", Setting::TypeFloat) = 1.8;
Setting& y_Lead = y.add("Lead", Setting::TypeFloat) = 13.5;
@ -569,14 +569,14 @@ bool CorningConfigfile::getPushFlowParam(int& flowSwitch, int& rgbHeight, int& f
if (!root.exists("push_flow_param"))
{
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// 配置项不存在,添加配置项
Setting& push_flow_param = root.add("push_flow_param", Setting::TypeGroup);
push_flow_param.add("flow_switch", Setting::TypeInt) = 0;
push_flow_param.add("rgb_height", Setting::TypeInt) = 720;
push_flow_param.add("framerate_video", Setting::TypeInt) = 5;
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸ĺ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><EFBFBD>ļ<EFBFBD>
// 保存修改后的配置到文件
try
{
QList<QString> fileInfo = getFileInfo(QString::fromStdString(m_configfilePath));

View File

@ -1,4 +1,4 @@
//
//
// Created by tangchao on 2023/3/25.
//
@ -62,7 +62,7 @@ public:
bool getspatialBin(int& spatialBin);
bool getEffectiveWindow(int& width, int& offsetx, int& height, int& offsety);
bool getEffectiveWindowRoi(int& width, int& offsetx);
bool getWindowOffsety_HeightOfSpectral(int& offsety, int& height, string spectralBinString);//spectralBinString = "bin1"<EFBFBD><EFBFBD><EFBFBD>ߡ<EFBFBD>bin2<EFBFBD><EFBFBD>
bool getWindowOffsety_HeightOfSpectral(int& offsety, int& height, string spectralBinString);//spectralBinString = "bin1"或者”bin2
bool getGainOffset(float& gain, float& offset);
bool getGainOffsetOfSpectralBin1(float& gain, float& offset);
bool getSN(QString& SN);

View File

@ -1,4 +1,4 @@
#include "stdafx.h"
#include "stdafx.h"
#include "image2display.h"
#include <iostream>
@ -16,7 +16,7 @@ void CImage::SetRgbImageWidthAndHeight(int BandCount, int Sample, int FrameNumbe
if (m_QRgbImage != nullptr)
{
delete m_QRgbImage;//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
delete m_QRgbImage;//有问题????????????????????????????????????????????????
}
//m_QRgbImage = new QImage(Sample, FrameNumber, QImage::Format_RGB888);
@ -54,19 +54,19 @@ void CImage::SetRgbImageWidthAndHeight(int BandCount, int Sample, int FrameNumbe
std::cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD><EFBFBD><EFBFBD><EFBFBD>" << FrameNumber << std::endl;
std::cout << "设置帧数:" << FrameNumber << std::endl;
m_iFrameCounter = 0;//ÿ<EFBFBD>ζ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ0
m_iFrameCounter = 0;//每次都重置为0
m_iSampleNumber = Sample;
m_iBandNumber = BandCount;
m_iFrameNumber = FrameNumber;
//std::cout << "rgbӰ<EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD>ַΪ<EFBFBD><EFBFBD>" << m_QRgbImage << std::endl;
//std::cout << "rgb影像内存地址为:" << m_QRgbImage << std::endl;
}
void CImage::FillRgbImage(unsigned short *datacube)
{
//uchar==unsigned char<EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><EFBFBD>1<EFBFBD><EFBFBD><EFBFBD>ֽڣ<EFBFBD><EFBFBD><EFBFBD>ΧΪ0-255
//uchar==unsigned char内存大小1个字节范围为0-255
//uchar * imagebits24 = m_QRgbImage->bits();
//uchar * imagebits24 = m_QRgbImage->scanLine(m_iFrameCounter);//??????????????????????????????????????????????????????????????????????
@ -75,26 +75,26 @@ void CImage::FillRgbImage(unsigned short *datacube)
for (int j = 0; j < m_iSampleNumber; j++)
{
//std::cout << "rgbͼ<EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD><EFBFBD><EFBFBD><EFBFBD>" << j << std::endl;
//std::cout << "rgb图像写入数据帧数:" << j << std::endl;
//ȡֵ<EFBFBD><EFBFBD>һ֡Ӱ<EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD>rgb<EFBFBD><EFBFBD>Ԫֵ
//取值一帧影像中从左到右的rgb像元值
r = *(datacube + 121 * m_iSampleNumber + j);
g = *(datacube + 79 * m_iSampleNumber + j);
b = *(datacube + 40 * m_iSampleNumber + j);
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԫֵ<EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>cv::Mat<61>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԫֵ<D4AA><D6B5>https://zhuanlan.zhihu.com/p/51842288
//int dataType = m_matRgbImage->type();//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪCV_16UC3ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>18
//std::cout << "m_matRgbImage<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>" << dataType << std::endl;
//将像元值赋值到cv::Mat中操作像元值https://zhuanlan.zhihu.com/p/51842288
//int dataType = m_matRgbImage->type();//当数据类型为CV_16UC3时,返回18
//std::cout << "m_matRgbImage数据类型为:" << dataType << std::endl;
if (m_matRgbImage->type() == CV_16UC3)
{
//std::cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>" << std::endl;
//std::cout << "操作像素值!" << std::endl;
m_matRgbImage->at<cv::Vec3w>(m_iFrameCounter, j)[2] = r;
m_matRgbImage->at<cv::Vec3w>(m_iFrameCounter, j)[1] = g;
m_matRgbImage->at<cv::Vec3w>(m_iFrameCounter, j)[0] = b;
}
////<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԫֵ<EFBFBD><EFBFBD>4095<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>255<EFBFBD>ķ<EFBFBD>Χ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>QImage<EFBFBD><EFBFBD>
////将像元值从4095归一化到255的范围并赋值到QImage
//imagebits24[j * 3] = uchar(r * 255 / 4095);
//imagebits24[j * 3 + 1] = uchar(g * 255 / 4095);
//imagebits24[j * 3 + 2] = uchar(b * 255 / 4095);
@ -102,14 +102,14 @@ void CImage::FillRgbImage(unsigned short *datacube)
m_iFrameCounter++;
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>rgbͼƬ
//保存rgb图片
if (m_iFrameCounter % m_iFramerate == 0 || m_iFrameCounter == m_iFrameNumber - 1)
{
////<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
////保存文件
//FileOperation * fileOperation = new FileOperation();
//string directory = fileOperation->getDirectoryOfExe();
//string rgbFilePathStrech = directory + "\\tmp_image_strech.png";//û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼƬ
//string rgbFilePathNoStrech = directory + "\\tmp_image_no_strech.png";//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼƬ
//string rgbFilePathStrech = directory + "\\tmp_image_strech.png";//没有拉伸图片
//string rgbFilePathNoStrech = directory + "\\tmp_image_no_strech.png";//拉伸图片
//m_QRgbImage->save(QString::fromStdString(rgbFilePathNoStrech), "PNG");
@ -147,28 +147,24 @@ void CImage::FillFocusGrayImage(unsigned short * datacube)
// }
//}
//<EFBFBD><EFBFBD>mat<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
//mat保存成文件
//cv::imwrite("D:/delete/2222222222/test.bmp", m_matFocusGrayImage);
}
void CImage::FillFocusGrayQImage(unsigned short * datacube)
{
float two_eight = pow(2.0, 8);
float two_sixteen = pow(2.0, 12);
constexpr float scale = 256.0f / 4096.0f; // 2^8 / 2^12
int width = m_qimageFocusGrayImage->width();
int height = m_qimageFocusGrayImage->height();
for (unsigned short i = 0; i < height; i++)
for (int i = 0; i < height; i++)
{
for (unsigned short j = 0; j < width; j++)
QRgb* scanLine = reinterpret_cast<QRgb*>(m_qimageFocusGrayImage->scanLine(i));
const unsigned short* srcRow = datacube + width * i;
for (int j = 0; j < width; j++)
{
//uint tmp = (two_eight* *(datacube + width * i + j)) / two_sixteen;
uint tmp = (two_eight* datacube[width*i + j]) / two_sixteen;
//uint tmp = datacube[width*i + j];
//m_qimageFocusGrayImage->setPixel(j, i, tmp);
m_qimageFocusGrayImage->setPixel(j, i, qRgb((unsigned char)tmp, (unsigned char)tmp, (unsigned char)tmp));
unsigned char gray = static_cast<unsigned char>(srcRow[j] * scale);
scanLine[j] = qRgb(gray, gray, gray);
}
}

View File

@ -1,9 +1,9 @@
#ifndef CIMAGE
#ifndef CIMAGE
#define CIMAGE
#include <stdio.h>
#include <opencv2/opencv.hpp>//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#include <opencv2/opencv.hpp>//包含了所有东西,编译很慢
//#include <opencv2/core/core.hpp>
//#include <opencv2/highgui/highgui.hpp>
@ -29,12 +29,12 @@ public:
cv::Mat *m_matRgbImage;
QImage *m_qimageFocusGrayImage;
cv::Mat *m_matFocusGrayImage;//<EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾһ֡<EFBFBD>ĻҶ<EFBFBD>ͼ
//cv::Mat m_matFocusGrayImage;//<EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾһ֡<EFBFBD>ĻҶ<EFBFBD>ͼ
cv::Mat *m_matFocusGrayImage;//用于调焦时,显示一帧的灰度图
//cv::Mat m_matFocusGrayImage;//用于调焦时,显示一帧的灰度图
//<EFBFBD><EFBFBD><EFBFBD>Ƹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>rgbͼ<EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>֡<EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ0<EFBFBD><EFBFBD>1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ú<EFBFBD><EFBFBD><EFBFBD>SetRgbImageWidthAndHeight<EFBFBD><EFBFBD>2<EFBFBD><EFBFBD>ÿ<EFBFBD>ο<EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ
//控制该填充rgb图像第几帧数据
//以下两种情况需要重置为01调用函数SetRgbImageWidthAndHeight2每次开始填充数据前
int m_iFrameCounter;

View File

@ -1,4 +1,4 @@
#include "imageControl.h"
#include "imageControl.h"
#include "RasterLayer.h"
#include <algorithm>
#include <cmath>
@ -42,7 +42,7 @@ ImageControl::ImageControl(QWidget* parent)
QDoubleSpinBox {
border: 1px solid #999;
border-radius: 4px;
padding: 2px 20px 2px 6px; /* <EFBFBD>Ҳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ť */
padding: 2px 20px 2px 6px; /* 右侧留空间给按钮 */
background: #0e1c4c;
selection-background-color: #0078d7;
font-size: 12px;

View File

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include <QDialog>
#include <QNetworkRequest>

View File

@ -1,4 +1,4 @@
#include "stdafx.h"
#include "stdafx.h"
#include "imageProcessor.h"
#include <algorithm>
@ -17,19 +17,19 @@ std::vector<cv::Point2f> ImageProcessor::CHistogram(const cv::Mat img)
int cols = mimg.cols;
int maxValue = *std::max_element(mimg.begin<unsigned short>(), mimg.end<unsigned short>());
maxValue = 65535;
//ͳ<EFBFBD><EFBFBD>ÿ<EFBFBD><EFBFBD><EFBFBD>Ҷȳ<EFBFBD><EFBFBD>ֵĴ<EFBFBD><EFBFBD><EFBFBD>
std::vector<long int> hisnum(maxValue, 0);//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//统计每个灰度出现的次数
std::vector<long int> hisnum(maxValue, 0);//
for (int i(0); i < rows; ++i)
{
//std::cout << "i<EFBFBD><EFBFBD>" << i << std::endl;
//std::cout << "i" << i << std::endl;
for (int j(0); j < cols; ++j)
{
//std::cout << "j<EFBFBD><EFBFBD>" << j << std::endl;
//std::cout << "j" << j << std::endl;
unsigned short gv = mimg.at<unsigned short>(i, j);
//std::cout << "gvֵ<EFBFBD><EFBFBD>" << gv << std::endl;
//std::cout << "gv值:" << gv << std::endl;
//<EFBFBD>Է<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>и<EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>Ǹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڿ۳<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>п<EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>ֵ
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>mat<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪCV_16UC3<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>и<EFBFBD>ֵʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ65535
//以防数据中有负值:当镜头盖盖上在扣除暗电流就有可能为负值
//如果mat的数据类型为CV_16UC3当数据中有有负值时负值表现为65535
if (gv >= maxValue)
{
++hisnum[0];
@ -40,7 +40,7 @@ std::vector<cv::Point2f> ImageProcessor::CHistogram(const cv::Mat img)
}
}
}
//<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҷ<EFBFBD>Ƶ<EFBFBD><EFBFBD>
//开始计算灰度频率
long int pnum = rows * cols;
std::vector<cv::Point2f> hisp;
for (int i(0); i < hisnum.size(); ++i)
@ -118,21 +118,21 @@ cv::Mat ImageProcessor::CStretchDeal(const cv::Mat img, const uint minnum, const
int rows = mimg.rows;
int cols = mimg.cols;
cv::Mat nimg = cv::Mat::zeros(rows, cols, CV_8U);
//<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//归一化参数
float dertnum = maxnum - minnum;
//<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//开始处理
for (int i(0); i < rows; ++i)
{
for (int j(0); j < cols; ++j)
{
unsigned short a = mimg.at<unsigned short>(i, j);
//С<EFBFBD><EFBFBD>ratio<EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵȡ0
//小于ratio对应像素值取0
if (a <= minnum)
nimg.at<uchar>(i, j) = 0;
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ratioֵ<EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵȡ255
//大于ratio值对应像素值取255
else if (a >= maxnum)
nimg.at<uchar>(i, j) = 255;
//<EFBFBD>м<EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD>0-255
//中间值拉伸到0-255
else
nimg.at<uchar>(i, j) = 255 * (mimg.at<unsigned short>(i, j) - minnum) / dertnum;
}
@ -142,26 +142,26 @@ cv::Mat ImageProcessor::CStretchDeal(const cv::Mat img, const uint minnum, const
cv::Mat ImageProcessor::CStretch(const cv::Mat img, const float ratio)
{
//Ӱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>RGB<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҷ<EFBFBD>ֱ<EFBFBD><EFBFBD>ͼ
//影像分RGB计算灰度直方图
cv::Mat mimg = img.clone();
cv::Mat bgr[3];
split(mimg, bgr);
std::vector<cv::Point2f> hb = CHistogram(bgr[0]);
std::vector<cv::Point2f> hg = CHistogram(bgr[1]);
std::vector<cv::Point2f> hr = CHistogram(bgr[2]);
//ͳ<EFBFBD><EFBFBD>ֱ<EFBFBD><EFBFBD>ͼ<EFBFBD>ۼ<EFBFBD>Ƶ<EFBFBD><EFBFBD>ratioֵ<EFBFBD><EFBFBD>Ӧ<EFBFBD>ĻҶ<EFBFBD>
//统计直方图累计频率ratio值对应的灰度
uint minb = MinRatio(hb, ratio);
uint ming = MinRatio(hg, ratio);
uint minr = MinRatio(hr, ratio);
uint maxb = MaxRatio(hb, ratio);
uint maxg = MaxRatio(hg, ratio);
uint maxr = MaxRatio(hr, ratio);
//<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//开始拉伸工作
cv::Mat b, g, r;
b = CStretchDeal(bgr[0], minb, maxb);
g = CStretchDeal(bgr[1], ming, maxg);
r = CStretchDeal(bgr[2], minr, maxr);
//<EFBFBD>ϲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//合并拉伸结果
cv::Mat newbgr;
newbgr.create(img.rows, img.cols, CV_32FC3);
cv::Mat nbgr[3] = { b, g, r };

View File

@ -1,8 +1,8 @@
#pragma once
#pragma once
#ifndef IMAGEPROCESSOR
#define IMAGEPROCESSOR
#include <opencv2/opencv.hpp>//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#include <opencv2/opencv.hpp>//包含了所有东西,编译很慢
//#include <opencv2/core/core.hpp>
//#include <opencv2/highgui/highgui.hpp>
@ -18,9 +18,9 @@ public:
QImage Mat2QImage(cv::Mat cvImg);//https://www.cnblogs.com/annt/p/ant003.html
//envi 2%<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//gdal<EFBFBD><20><> https://blog.csdn.net/HB_Programmer/article/details/82020703?utm_medium=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.control&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.control
//opencv<EFBFBD><20><> https://blog.csdn.net/qq_41824159/article/details/105469986
//envi 2%拉伸原理:
//gdal版本 → https://blog.csdn.net/HB_Programmer/article/details/82020703?utm_medium=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.control&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.control
//opencv版本 → https://blog.csdn.net/qq_41824159/article/details/105469986
cv::Mat CStretchDeal(const cv::Mat img, const uint minnum, const uint maxnum);
uint MaxRatio(const std::vector<cv::Point2f> data, const float ratio);
uint MinRatio(const std::vector<cv::Point2f> data, const float ratio);

View File

@ -1,4 +1,4 @@
#include "stdafx.h"
#include "stdafx.h"
#include "imagerSimulatioin.h"
imagerSimulatioin::imagerSimulatioin(QGraphicsItem *parent) :QGraphicsItem(parent)
@ -8,7 +8,7 @@ imagerSimulatioin::imagerSimulatioin(QGraphicsItem *parent) :QGraphicsItem(paren
setFlags(ItemIsSelectable | ItemIsMovable);
//itemChange<EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>ItemSendsGeometryChanges flag is needed to capture the change in position of QGraphicsItem
//itemChange需要:ItemSendsGeometryChanges flag is needed to capture the change in position of QGraphicsItem
this->setFlag(QGraphicsItem::ItemSendsScenePositionChanges);
m_height = 50;
m_width = 50;
@ -39,7 +39,7 @@ void imagerSimulatioin::paint(QPainter *painter, const QStyleOptionGraphicsItem
painter->setPen(outlinePen);
painter->setBrush(blueBrush);
painter->drawRect(-m_width / 2, -m_height / 2, m_width, m_height);//<EFBFBD><EFBFBD><EFBFBD>Ըı<EFBFBD>item<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><EFBFBD><EFBFBD>setSceneRect(qreal x, qreal y, qreal w, qreal h)һ<EFBFBD><EFBFBD>
painter->drawRect(-m_width / 2, -m_height / 2, m_width, m_height);//可以改变item坐标原点setSceneRect(qreal x, qreal y, qreal w, qreal h)一样
//QPen outlinePen(Qt::red);
@ -65,7 +65,7 @@ void imagerSimulatioin::setPos(qreal x, qreal y)
x = floor(x);
y = floor(y);
QGraphicsItem::setPos(x, y);//<EFBFBD><EFBFBD><EFBFBD>ø<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǵĺ<EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
QGraphicsItem::setPos(x, y);//调用父类被覆盖的函数执行相应操作
scene()->update();
}
@ -97,7 +97,7 @@ void imagerSimulatioin::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
scene()->update();
QPointF originOfItem = this->scenePos();//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>item<EFBFBD><EFBFBD><EFBFBD>Ͻ<EFBFBD><EFBFBD><EFBFBD>scene<EFBFBD>е<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
QPointF originOfItem = this->scenePos();//这是item左上角在scene中的坐标
//qDebug() << originOfItem;
QGraphicsItem::mouseMoveEvent(event);
@ -105,8 +105,8 @@ void imagerSimulatioin::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
void imagerSimulatioin::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
QPointF x = pos();//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>itemԭ<EFBFBD>㣨0<EFBFBD><EFBFBD>0<EFBFBD><EFBFBD><EFBFBD><EFBFBD>scene<EFBFBD>е<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
QPointF originOfItem = this->scenePos();//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>itemԭ<EFBFBD>㣨0<EFBFBD><EFBFBD>0<EFBFBD><EFBFBD><EFBFBD><EFBFBD>scene<EFBFBD>е<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
QPointF x = pos();//这是item原点00在scene中的坐标
QPointF originOfItem = this->scenePos();//这是item原点00在scene中的坐标
QPointF viewPos = event->pos();
@ -123,7 +123,7 @@ void imagerSimulatioin::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
emit leftMouseButtonPressed(originOfItem.x(), originOfItem.y());
//update();//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//update();//不会实时绘制
scene()->update();
QGraphicsItem::mouseReleaseEvent(event);

View File

@ -1,4 +1,4 @@
#ifndef IMAGER_SIMULATIOIN
#ifndef IMAGER_SIMULATIOIN
#define IMAGER_SIMULATIOIN
#include <QGraphicsItem>
@ -15,11 +15,11 @@ public:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
void setPos(qreal x, qreal y);
//<EFBFBD><EFBFBD>QGraphicsScene<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼԪ<EFBFBD><EFBFBD><EFBFBD>϶<EFBFBD><EFBFBD><EFBFBD>Χ<EFBFBD><EFBFBD>https://www.cnblogs.com/sfy5848/p/6611824.html
//QGraphicsScene中限制图元的拖动范围:https://www.cnblogs.com/sfy5848/p/6611824.html
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);//<EFBFBD><EFBFBD><EFBFBD>϶<EFBFBD>itemʱ<EFBFBD><EFBFBD>ͣ<EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD><EFBFBD>ƣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>϶<EFBFBD><EFBFBD><EFBFBD>Ӱ
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);//<EFBFBD><EFBFBD><EFBFBD>ſ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱͼԪ<EFBFBD><EFBFBD>scene<EFBFBD>е<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);//当拖动item时不停会的绘制消除拖动重影
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);//当放开鼠标时发射此时图元在scene中的坐标
protected:

View File

@ -1,4 +1,4 @@
#include "imager_base.h"
#include "imager_base.h"
Iris::ImagerBase::ImagerBase()
{

View File

@ -1,4 +1,4 @@
/*
/*
* Iris API
*
* By using this API, the user agrees to the terms and conditions as stated in the

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>520</width>
<height>360</height>
<height>229</height>
</rect>
</property>
<property name="windowTitle">

View File

@ -1,4 +1,4 @@
#include "HPPA.h"
#include "HPPA.h"
#include <QtWidgets/QApplication>
int main(int argc, char *argv[])

View File

@ -1,4 +1,4 @@
#include "path_tc.h"
#include "path_tc.h"
string getPathofEXE()
{

View File

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include <string>
//#include <iostream>
using namespace std;

View File

@ -1,4 +1,4 @@
#include "resononImager.h"
#include "resononImager.h"
ResononPicaLImager::ResononPicaLImager()
{
@ -9,7 +9,7 @@ ResononPicaLImager::~ResononPicaLImager()
{
if (buffer != nullptr)
{
std::cout << "<EFBFBD>ͷŶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>" << std::endl;
std::cout << "释放堆上内存" << std::endl;
free(buffer);
free(dark);
free(white);

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