10 #include "PlusConfigure.h" 16 #include <vtkImageData.h> 17 #include <vtkObjectFactory.h> 43 os << indent <<
"InfraredSeekCam: Pro Seek Camera" << std::endl;
49 bool calibTemperatureRead;
50 std::string calibMulStr;
51 std::string calibBiasStr;
52 std::string flatFilepath;
53 std::string biasFilepath;
57 XML_READ_STRING_ATTRIBUTE_NONMEMBER_OPTIONAL(FlatFile, flatFilepath, deviceConfig);
58 XML_READ_STRING_ATTRIBUTE_NONMEMBER_OPTIONAL(BiasFile, biasFilepath, deviceConfig);
60 XML_READ_BOOL_ATTRIBUTE_NONMEMBER_REQUIRED(CalibrateTemperature, calibTemperatureRead, deviceConfig);
61 if (calibTemperatureRead) {
62 XML_READ_STRING_ATTRIBUTE_NONMEMBER_REQUIRED(TemperatureMultiplier, calibMulStr, deviceConfig);
63 XML_READ_STRING_ATTRIBUTE_NONMEMBER_REQUIRED(TemperatureBias, calibBiasStr, deviceConfig);
69 if (!flatFilepath.empty()) {
70 LOG_INFO(
"Detected Flat File: " << flatFilepath);
74 if (!biasFilepath.empty()) {
75 LOG_INFO(
"Detected Bias File: " << biasFilepath);
79 LOG_DEBUG(
"Configure Pro Seek Camera");
86 cv::Mat aux = cv::imread(filename, 0);
88 aux.convertTo(output, CV_32F);
93 LOG_WARNING(
"Failed to open " << filename <<
" file. This file will not be used");
120 this->
Capture = std::make_shared<LibSeek::SeekThermalPro>();
121 this->
Frame = std::make_shared<cv::Mat>();
125 LOG_ERROR(
"Failed to open seek pro");
136 this->
Frame =
nullptr;
144 if (!this->
Capture->isOpened())
147 LOG_ERROR(
"vtkInfraredSeekCam::InternalUpdate Unable to read date");
154 LOG_ERROR(
"Unable to receive frame");
175 LOG_ERROR(
"Unable to grab a video source. Skipping frame.");
189 FrameSizeType frameSize = { static_cast<unsigned int>(this->
Frame->cols), static_cast<unsigned int>(this->
Frame->rows), 1 };
205 LOG_WARNING(
"vtkInfraredSeekCam is expecting one output channel and there are " << this->
OutputChannels.size() <<
" channels. First output channel will be used.");
210 LOG_ERROR(
"No output channels defined for vtkInfraredSeekCam. Cannot proceed.");
223 std::ifstream ifs(filename, std::ios::binary);
225 LOG_ERROR(
"Cant open " << filename);
229 ifs.read((
char*)(&rows),
sizeof(
float));
230 ifs.read((
char*)(&cols),
sizeof(
float));
231 if (rows == 0 || cols == 0) {
232 LOG_ERROR(
"File corrupted or incomplete, " << filename);
237 mat.create(rows, cols, CV_32F);
238 ifs.read((
char*)(mat.data), mat.elemSize() * mat.total());
241 }
catch (
const std::ifstream::failure& ex) {
242 LOG_ERROR(ex.what() <<
" at " << filename);
virtual void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
#define XML_FIND_DEVICE_ELEMENT_REQUIRED_FOR_WRITING(deviceConfig, rootConfigElement)
virtual void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
PlusStatus SetInputFrameSize(unsigned int x, unsigned int y, unsigned int z)
bool ReadBinaryFile(const std::string &filename, cv::Mat &temp) const
virtual PlusStatus AddItem(vtkImageData *frame, US_IMAGE_ORIENTATION usImageOrientation, US_IMAGE_TYPE imageType, long frameNumber, double unfilteredTimestamp=UNDEFINED_TIMESTAMP, double filteredTimestamp=UNDEFINED_TIMESTAMP, const igsioFieldMapType *customFields=NULL)
bool RequireImageOrientationInConfiguration
PlusStatus SetImageType(US_IMAGE_TYPE imageType)
virtual PlusStatus InternalConnect() VTK_OVERRIDE
PlusStatus SetPixelType(igsioCommon::VTKScalarPixelType pixelType)
PlusStatus FreezeDevice(bool freeze)
std::shared_ptr< LibSeek::SeekThermalPro > Capture
virtual PlusStatus Disconnect()
PlusStatus GetFirstActiveOutputVideoSource(vtkPlusDataSource *&aVideoSource)
unsigned long FrameNumber
std::shared_ptr< cv::Mat > Frame
virtual PlusStatus Connect()
vtkStandardNewMacro(vtkInfraredSeekCam)
virtual PlusStatus NotifyConfigured()
#define XML_FIND_DEVICE_ELEMENT_REQUIRED_FOR_READING(deviceConfig, rootConfigElement)
PlusStatus ReadConfiguration(vtkXMLDataElement *config)
PlusStatus WriteConfiguration(vtkXMLDataElement *config)
virtual US_IMAGE_ORIENTATION GetInputImageOrientation()
bool StartThreadForInternalUpdates
bool ReadImage(cv::Mat &output, const std::string &filename) const
ChannelContainer OutputChannels
PlusStatus SetNumberOfScalarComponents(unsigned int numberOfScalarComponents)
PlusStatus InternalUpdate()
virtual PlusStatus InternalDisconnect() VTK_OVERRIDE
Class for interfacing an Infrared Seek capture device and recording frames into a Plus buffer.
virtual int GetNumberOfItems()
Interface to a 3D positioning tool, video source, or generalized data stream.