1. 通过sock发送设置成功的帧率;

2. 通过sock发送设置成功的曝光时间和曝光时最大的像素值;
This commit is contained in:
tangchao0503
2023-05-24 16:38:10 +08:00
parent 371c422a34
commit 09d224075a
4 changed files with 49 additions and 5 deletions

View File

@ -50,6 +50,8 @@ UdpServer::UdpServer()
connect(m_sbgRecorder, SIGNAL(sbgAccuracySignal(int,int)),this, SLOT(sendSbgAccuracyState(int,int)));
connect(m_imager, SIGNAL(ximeaImageStatus(int)),this, SLOT(sendXimeaImageStatus(int)));
connect(m_imager, SIGNAL(autoExposeMaxValueOfOneFrame(int, double)),this, SLOT(sendXimeaAutoExposeMaxValueOfOneFrame(int, double)));
connect(m_imager, SIGNAL(frameRateSignal(double)),this, SLOT(sendXimeaImageFrameRate(double)));
connect(m_copyFile, SIGNAL(copyFileStatus(int)),this, SLOT(sendCopyFileStatus(int)));
@ -295,6 +297,30 @@ void UdpServer::sendXimeaImageStatus(int ximeaImageStatus)
m_udpSocket->writeDatagram(datagram2send.data(),datagram2send.size(),m_clientIpAddress, 45455);
}
void UdpServer::sendXimeaAutoExposeMaxValueOfOneFrame(int autoExposeMaxValueOfOneFrame, double exposeTime)
{
// std::cout<<"UdpServer::sendXimeaAutoExposeMaxValueOfOneFrame---------------------:"<< ximeaImageStatus <<std::endl;
QByteArray datagram2send;
QString status = "XimeaAutoExpose," + QString::number(autoExposeMaxValueOfOneFrame) + "," + QString::number(exposeTime, 'f', 2);
datagram2send.operator =(status.toStdString().c_str());
m_udpSocket->writeDatagram(datagram2send.data(),datagram2send.size(),m_clientIpAddress, 45455);
}
void UdpServer::sendXimeaImageFrameRate(double frameRate)
{
// std::cout<<"UdpServer::sendXimeaImageFrameRate---------------------:"<< ximeaImageStatus <<std::endl;
QByteArray datagram2send;
QString status = "XimeaFrameRate," + QString::number(frameRate, 'f', 2);
datagram2send.operator =(status.toStdString().c_str());
m_udpSocket->writeDatagram(datagram2send.data(),datagram2send.size(),m_clientIpAddress, 45455);
}
void UdpServer::sendCopyFileStatus(int fileStatus)
{
// std::cout<<"UdpServer::sendCopyFileStatus---------------------:"<< fileStatus <<std::endl;

View File

@ -160,6 +160,8 @@ void XimeaImager::setFramerate(double framerate)
m_iImagerState=102;
emit ximeaImageStatus(m_iImagerState);
emit frameRateSignal(framerate);
}
catch(int xiApiErrorCodes)
{
@ -216,12 +218,22 @@ double XimeaImager::setExposureTime(float exposureTime_in_us)
}
}
double XimeaImager::wrapSetExposureTime(float exposureTime_in_us)
int XimeaImager::wrapSetExposureTime(float exposureTime_in_us)
{
setExposureTime(exposureTime_in_us);
double exposureTime = setExposureTime(exposureTime_in_us);
m_imager.start();
m_imager.get_frame(m_buffer);
m_imager.stop();
int maxValueOfOneFrame = getMaxValueOfOneFrame((short unsigned int*)m_imager.m_image.bp,m_imager.get_band_count()*m_imager.get_sample_count());
m_iImagerState=103;
emit ximeaImageStatus(m_iImagerState);
emit autoExposeMaxValueOfOneFrame(maxValueOfOneFrame, exposureTime/1000);
return maxValueOfOneFrame;
}
double XimeaImager::autoExposure()
@ -247,6 +259,7 @@ double XimeaImager::autoExposure()
m_imager.stop();
maxValueOfOneFrame=getMaxValueOfOneFrame((short unsigned int*)m_imager.m_image.bp,m_imager.get_band_count()*m_imager.get_sample_count());
printf("本帧最大值为: %d.\n",maxValueOfOneFrame);
if(maxValueOfOneFrame <= suitableMaxValue)
{
@ -281,6 +294,7 @@ double XimeaImager::autoExposure()
m_iImagerState=103;
emit ximeaImageStatus(m_iImagerState);
emit autoExposeMaxValueOfOneFrame(maxValueOfOneFrame, exposureTime/1000);
std::cout<<"自动曝光完成!"<<std::endl;
return exposureTime;
@ -438,7 +452,6 @@ int XimeaImager::getMaxValueOfOneFrame(unsigned short * data, int numberOfPixel)
int a=0;
}
}
printf("本帧最大值为: %d.\n",maxValue);
return maxValue;
}
@ -827,7 +840,7 @@ void WriteData2Disk::write2Disk()
r_qtx.unlock();
//构造rgb图像用于推流到m300遥控器
m_rgbImage->FillRgbImage(dataBuffer);
// m_rgbImage->FillRgbImage(dataBuffer);
// std::cout<<"WriteData2Disk::write2Disk-----------------------正在写磁盘!" << m_pool->max_size() <<std::endl;//