如何在Matlab中将带有元数据的红外图像保存为jpg?

时间:2017-09-20 14:08:28

标签: matlab flir

我有来自FLIR的示例代码:

video_input = videoinput('gige'); %connect to the first gige camera
source = video_input.Source; %get the source object

%To get temperature linear data, the following GenICam registers needs
%to be set
source.SensorGainMode = 'HighGainMode';
source.TemperatureLinearMode = 'On';
source.TemperatureLinearResolution = 'High';


%start the video acquisition
start(video_input);

%MATLAB will receive data in uint16 format, the camera streams in 14bit
%therefor we have to remove the two most significant bits (2^14 and 2^15)
temp_linear = double(getdata(video_input, 1, 'uint16'));
temp_linear_stripped = temp_linear -(2^15) - (2^14); %removing the 2 MSB

%the temperature is linear in this format: T = Signal * 0.04
temp_data_kelvin = temp_linear_stripped * 0.04;
%we get the data in Kelvin, so it needs to be converted
temp_data_celcius = temp_data_kelvin - 273.15;

%displaying the temperature in pixel(100,100)
%disp(temp_data_celcius(100,100));

%to display the image, we can use imagesc
imagesc(temp_data_celcius);

stop(video_input);
imaqreset;

imagesc的输出是我想要的jpg。但id也喜欢与之相关的温度数据。有没有办法在matlab中做到这一点?

我试过了 imwrite(temp_data_celcius,' image.jpg')但它给我的是一张空白图片。我的猜测是因为imwrite写的动态范围为[0,1],但恐怕我不知道这意味着什么。我想用嵌入的温度数据保存(灰度很好)。所以如果我以后打开图像,我仍然有温度数据。

感谢您的帮助!!

0 个答案:

没有答案