我正在使用Basler Ace相机,主程序在Linux环境上运行,它将加载相机和.pfs文件,然后开始抓取帧。 这是我的环境详细信息:
操作系统:“ Ubuntu 16.04.4 LTS”
编程语言:C ++
库:OpenCV 3.3.1
问题是我使用Pylon Viewer(5.0.11.10913)调整相机功能,但是当我在程序中加载此.pfs文件时,我从Windows获得了不同的结果。在这里您可以看到结果
这是一段用于在Linux上获取图像的代码:
cv::Mat Basler::grab() const
{
cv::Mat bgrImage;
cv::Mat rgbImage;
// This smart pointer will receive the grab result data
Pylon::CGrabResultPtr grabResult;
Pylon::CImageFormatConverter imageConverter;
Pylon::CPylonImage pylonImage;
try {
// Start the grabbing of images
camera->StartGrabbing(1);
imageConverter.OutputPixelFormat = Pylon::PixelType_BGR8packed;
while (camera->IsGrabbing()) {
camera->RetrieveResult(
5000,
grabResult,
Pylon::TimeoutHandling_ThrowException
);
// Image grabbed successfully
if (grabResult->GrabSucceeded()) {
imageConverter.Convert(pylonImage, grabResult);
bgrImage = cv::Mat(
grabResult->GetHeight(),
grabResult->GetWidth(),
CV_8UC3,
(uint8_t*) pylonImage.GetBuffer()
);
cv::cvtColor(bgrImage, rgbImage, CV_BGR2RGB);
return rgbImage;
}
}
} catch (const Pylon::GenericException& exception) {
std::cout << exception.GetDescription() << std::endl;
}
if (rgbImage.empty())
throw utility::Exception("Image is empty");
return rgbImage;
}
在这里您可以看到.pfs文件的内容:(对不起,我知道它太长了,但是此文件可能有问题)
ExposureAuto Off
BalanceWhiteAuto Off
GainAuto Off
Width 2448
Height 2048
OffsetX 8
OffsetY 4
CenterX 0
CenterY 0
ReverseX 0
ReverseY 0
PixelFormat BGR8
TestImageSelector Off
GainSelector All
Gain 0.00000
GainSelector All
BlackLevelSelector All
BlackLevel 0.00000
BlackLevelSelector All
Gamma 1.00000
DigitalShift 0
RemoveParameterLimitSelector Gain
RemoveParameterLimit 0
RemoveParameterLimitSelector Gain
LightSourcePreset Daylight5000K
BalanceRatioSelector Red
BalanceRatio 1.91382
BalanceRatioSelector Green
BalanceRatio 1.00000
BalanceRatioSelector Blue
BalanceRatio 1.99194
BalanceRatioSelector Red
ColorAdjustmentSelector Red
ColorAdjustmentHue 0.28125
ColorAdjustmentSelector Yellow
ColorAdjustmentHue 0.12500
ColorAdjustmentSelector Green
ColorAdjustmentHue 0.37500
ColorAdjustmentSelector Cyan
ColorAdjustmentHue 0.56250
ColorAdjustmentSelector Blue
ColorAdjustmentHue -0.06250
ColorAdjustmentSelector Magenta
ColorAdjustmentHue 1.93750
ColorAdjustmentSelector Red
ColorAdjustmentSelector Red
ColorAdjustmentSaturation 1.03125
ColorAdjustmentSelector Yellow
ColorAdjustmentSaturation 0.98438
ColorAdjustmentSelector Green
ColorAdjustmentSaturation 1.28125
ColorAdjustmentSelector Cyan
ColorAdjustmentSaturation 1.03906
ColorAdjustmentSelector Blue
ColorAdjustmentSaturation 0.96875
ColorAdjustmentSelector Magenta
ColorAdjustmentSaturation 0.85156
ColorAdjustmentSelector Red
ColorTransformationSelector RGBtoRGB
ColorTransformationValueSelector Gain00
ColorTransformationValue 1.53125
ColorTransformationValueSelector Gain01
ColorTransformationValue -0.31250
ColorTransformationValueSelector Gain02
ColorTransformationValue -0.21875
ColorTransformationValueSelector Gain10
ColorTransformationValue -0.31250
ColorTransformationValueSelector Gain11
ColorTransformationValue 1.84375
ColorTransformationValueSelector Gain12
ColorTransformationValue -0.53125
ColorTransformationValueSelector Gain20
ColorTransformationValue -0.09375
ColorTransformationValueSelector Gain21
ColorTransformationValue -0.43750
ColorTransformationValueSelector Gain22
ColorTransformationValue 1.53125
ColorTransformationSelector RGBtoRGB
ColorTransformationValueSelector Gain00
DemosaicingMode Simple
ExposureMode Timed
ExposureTime 164771.0
AcquisitionBurstFrameCount 1
TriggerSelector FrameBurstStart
TriggerMode Off
TriggerSelector FrameStart
TriggerMode Off
TriggerSelector FrameStart
TriggerSelector FrameBurstStart
TriggerSource Line1
TriggerSelector FrameStart
TriggerSource Line1
TriggerSelector FrameStart
TriggerSelector FrameBurstStart
TriggerActivation RisingEdge
TriggerSelector FrameStart
TriggerActivation RisingEdge
TriggerSelector FrameStart
TriggerDelay 0
AcquisitionFrameRateEnable 0
AcquisitionFrameRate 100.00000
DeviceLinkSelector 0
DeviceLinkThroughputLimitMode On
DeviceLinkSelector 0
DeviceLinkSelector 0
DeviceLinkThroughputLimit 360000000
DeviceLinkSelector 0
ChunkSelector Gain
ChunkEnable 0
ChunkSelector ExposureTime
ChunkEnable 0
ChunkSelector Timestamp
ChunkEnable 0
ChunkSelector LineStatusAll
ChunkEnable 0
ChunkSelector CounterValue
ChunkEnable 0
ChunkSelector SequencerSetActive
ChunkEnable 0
ChunkSelector PayloadCRC16
ChunkEnable 0
ChunkSelector Timestamp
ChunkModeActive 0
AutoTargetBrightness 0.30196
AutoFunctionProfile MinimizeGain
AutoGainLowerLimit 0.00000
AutoGainUpperLimit 36.00000
AutoExposureTimeLowerLimit 29.0
AutoExposureTimeUpperLimit 1000000.0
AutoFunctionROISelector ROI1
AutoFunctionROIWidth 2464
AutoFunctionROISelector ROI2
AutoFunctionROIWidth 2448
AutoFunctionROISelector ROI1
AutoFunctionROISelector ROI1
AutoFunctionROIHeight 2056
AutoFunctionROISelector ROI2
AutoFunctionROIHeight 2048
AutoFunctionROISelector ROI1
AutoFunctionROISelector ROI1
AutoFunctionROIOffsetX 0
AutoFunctionROISelector ROI2
AutoFunctionROIOffsetX 8
AutoFunctionROISelector ROI1
AutoFunctionROISelector ROI1
AutoFunctionROIOffsetY 0
AutoFunctionROISelector ROI2
AutoFunctionROIOffsetY 8
AutoFunctionROISelector ROI1
AutoFunctionROISelector ROI1
AutoFunctionROIUseBrightness 1
AutoFunctionROISelector ROI2
AutoFunctionROIUseBrightness 0
AutoFunctionROISelector ROI1
AutoFunctionROISelector ROI1
AutoFunctionROIUseWhiteBalance 1
AutoFunctionROISelector ROI2
AutoFunctionROIUseWhiteBalance 1
AutoFunctionROISelector ROI1
LUTSelector Luminance
LUTEnable 0
LUTSelector Luminance
LUTSelector Luminance
#I removed LUT value it was too large
LUTSelector Luminance
LineSelector Line1
LineMode Input
LineSelector Line2
LineMode Output
LineSelector Line3
LineMode Input
LineSelector Line4
LineMode Input
LineSelector Line1
LineSelector Line2
LineSource UserOutput1
LineSelector Line1
LineSelector Line1
LineInverter 0
LineSelector Line2
LineInverter 0
LineSelector Line3
LineInverter 0
LineSelector Line4
LineInverter 0
LineSelector Line1
LineSelector Line1
LineDebouncerTime 0.00000
LineSelector Line3
LineDebouncerTime 0.00000
LineSelector Line4
LineDebouncerTime 0.00000
LineSelector Line1
LineSelector Line2
LineMinimumOutputPulseWidth 0.000
LineSelector Line1
UserOutputValueAll 0
TimerSelector Timer1
TimerDuration 10.0
TimerSelector Timer1
TimerSelector Timer1
TimerDelay 0.0
TimerSelector Timer1
TimerSelector Timer1
TimerTriggerSource ExposureStart
TimerSelector Timer1
CounterSelector Counter1
CounterEventSource FrameStart
CounterSelector Counter2
CounterEventSource FrameStart
CounterSelector Counter1
CounterSelector Counter1
CounterResetSource Off
CounterSelector Counter2
CounterResetSource Counter2End
CounterSelector Counter1
EventSelector ExposureEnd
EventNotification Off
EventSelector FrameStart
EventNotification Off
EventSelector FrameBurstStart
EventNotification Off
EventSelector FrameStartOvertrigger
EventNotification Off
EventSelector FrameBurstStartOvertrigger
EventNotification Off
EventSelector CriticalTemperature
EventNotification Off
EventSelector OverTemperature
EventNotification Off
EventSelector FrameStartWait
EventNotification Off
EventSelector FrameBurstStartWait
EventNotification Off
EventSelector ExposureEnd
UserDefinedValueSelector Value1
UserDefinedValue 0
UserDefinedValueSelector Value2
UserDefinedValue 0
UserDefinedValueSelector Value3
UserDefinedValue 0
UserDefinedValueSelector Value4
UserDefinedValue 0
UserDefinedValueSelector Value5
UserDefinedValue 0
UserDefinedValueSelector Value1