fix:IR和IR L
1、IR L采集到的一帧有异常,本来14位,最大值应该为16383,但是最右边有异常大的值(大概50000),导致自动曝光失败; 2、IR(以前的NIR)和IR L都是14位的,修改WriteHdr();
This commit is contained in:
@ -104,20 +104,25 @@ void ResononNirImager::setSpectraBin(int new_spectral_bin)
|
|||||||
double ResononNirImager::auto_exposure()
|
double ResononNirImager::auto_exposure()
|
||||||
{
|
{
|
||||||
//第一步:先设置曝光时间为在当前帧率情况下最大
|
//第一步:先设置曝光时间为在当前帧率情况下最大
|
||||||
double x = 1 / getFramerate() * 1000;//获取最大毫秒曝光时间
|
double f = getFramerate();
|
||||||
|
double x = 1 / f * 1000;//获取最大毫秒曝光时间
|
||||||
|
std::cout << f << "hz帧率下,最大曝光时间为" << x << std::endl;
|
||||||
|
|
||||||
reConnectImage();
|
reConnectImage();
|
||||||
setIntegrationTime(x);
|
setIntegrationTime(x);
|
||||||
|
|
||||||
//第二步:通过循环寻找最佳曝光时间
|
//第二步:通过循环寻找最佳曝光时间
|
||||||
imagerStartCollect();
|
imagerStartCollect();
|
||||||
|
|
||||||
|
double tmpTime;
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
getFrame(buffer);
|
getFrame(buffer);
|
||||||
if (GetMaxValue(buffer, m_FrameSize) >= 4095)
|
if (GetMaxValue(buffer, m_FrameSize) >= 16383)
|
||||||
{
|
{
|
||||||
setIntegrationTime(getIntegrationTime() * 0.8);
|
tmpTime = getIntegrationTime() * 0.8;
|
||||||
std::cout << "自动曝光-----------" << std::endl;
|
setIntegrationTime(tmpTime);
|
||||||
|
std::cout << "自动曝光-----------:" << tmpTime << std::endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -136,6 +141,22 @@ double ResononNirImager::auto_exposure()
|
|||||||
return exposureTime;
|
return exposureTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned short ResononNirImager::GetMaxValue(unsigned short* dark, int number)
|
||||||
|
{
|
||||||
|
unsigned int max = 0;
|
||||||
|
for (size_t i = 0; i < number; i++)
|
||||||
|
{
|
||||||
|
if (dark[i] > 16383) continue;//IR L为14位
|
||||||
|
|
||||||
|
if (dark[i] > max)
|
||||||
|
{
|
||||||
|
max = dark[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::cout << "本帧最大值为" << max << std::endl;
|
||||||
|
return max;
|
||||||
|
}
|
||||||
|
|
||||||
double ResononNirImager::getWavelengthAtBand(int band)
|
double ResononNirImager::getWavelengthAtBand(int band)
|
||||||
{
|
{
|
||||||
return m_ResononNirImager.get_wavelength_at_band(band);
|
return m_ResononNirImager.get_wavelength_at_band(band);
|
||||||
@ -412,7 +433,7 @@ void ResononNirImager::WriteHdr()
|
|||||||
outfile << "ENVI\n";
|
outfile << "ENVI\n";
|
||||||
outfile << "interleave = bil\n";
|
outfile << "interleave = bil\n";
|
||||||
outfile << "data type = 12\n";
|
outfile << "data type = 12\n";
|
||||||
outfile << "bit depth = 12\n";
|
outfile << "bit depth = 14\n";
|
||||||
outfile << "byte order = 0\n";
|
outfile << "byte order = 0\n";
|
||||||
outfile << "samples = " << getSampleCount() << "\n";
|
outfile << "samples = " << getSampleCount() << "\n";
|
||||||
outfile << "bands = " << getBandCount() << "\n";
|
outfile << "bands = " << getBandCount() << "\n";
|
||||||
|
|||||||
@ -38,6 +38,8 @@ public:
|
|||||||
void WriteHdr();
|
void WriteHdr();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
unsigned short GetMaxValue(unsigned short* dark, int number);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void reConnectImage();
|
void reConnectImage();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user