Heatmapping using temperature data from drone images/ Imfusing data is altering temperature values

2 Ansichten (letzte 30 Tage)
Hi, I am working on infrared (IR) drone images and my main objective is to attain heatmap as per road profile/ road layout. I have extracted pixel wise heat data (data1.mat and data2.mat) from the IR images (0001_JPG and 0002_JPG). The extracted data is in type 'double'.
To develop the road profile using heat data, I decided to use GPS data from IR images so I can find distance between two images center to center (c/c). All the steps have gone fine, but at moment when I 'imfuse' two heat data files as per road layout keeping GPS based c/c distance, the output file (AB.mat) changes the data type (to unit8), which alter the temperture values in pixels.
Kindly advise, what other functions or options I can use to combine two data files without alter pixel temperature values. I just want to retain temperture values pixel wise so on combining datasets I can display whole heatmap along road profile/ road layout. As few images are overlapping so I need to keep them as per GPS, as center, to get exact layout.
I hope I have clarified my query.
Please advise.
data1;
Picinfo1 = imfinfo('0001_T.JPG');
Xx1=Picinfo1.GPSInfo.GPSLatitude;
X1= dms2degrees(Xx1);
Yy1=Picinfo1.GPSInfo.GPSLongitude;
Y1= dms2degrees(Yy1);
data2;
Picinfo2 = imfinfo('0002_T.JPG');
Xx2=Picinfo2.GPSInfo.GPSLatitude;
X2= dms2degrees(Xx2);
Yy2=Picinfo2.GPSInfo.GPSLongitude;
Y2= dms2degrees(Yy2);
% distance between two images c/c
wgs84 = wgs84Ellipsoid("m");
Ds1 = distance(X2,Y2,X1,Y1,wgs84);
%determining pixel sizes w & h
% Pixel size factors
DD1=str2double(Picinfo1.XMPData.drone_dji.RelativeAltitude); % Altitude value is Character array
DD2=str2double(Picinfo2.XMPData.drone_dji.RelativeAltitude);
FOV=82.9; % from DJI website
%image 1
pixelsize1w=tan(FOV/2)*DD1/Picinfo1.Width; % meters
pixelsize1h=tan(FOV/2)*DD1/Picinfo1.Height; % meters
%image 2
pixelsize2w=tan(FOV/2)*DD2/Picinfo2.Width; % meters
pixelsize2h=tan(FOV/2)*DD2/Picinfo2.Height; % meters
% pixel box
R1 = imref2d(size(data1),pixelsize1w,pixelsize1h);
R2 = imref2d(size(data2),pixelsize2w,pixelsize2h);
%Referencing Images from each other (center to center)
R1.XWorldLimits = R1.XWorldLimits;
R1.YWorldLimits = R1.YWorldLimits;
R2.XWorldLimits = R2.XWorldLimits+Ds1;
R2.YWorldLimits = R2.YWorldLimits;
%Mapping Heat Data
AB=imfuse(data2,R2,data1,R1,'blend','Scaling','joint');
figure;
imshow(AB);
Please any suggestion or advise will be helpful. I want to follow the above mentioned strategy.

Akzeptierte Antwort

Suraj Kumar
Suraj Kumar am 2 Aug. 2024
Hi Abdul,
I understand the difficulty you are facing with the imfuse function since it alters the temperature values by converting the data type to uint8.
Please refer to the workaround given below, to preserve the original data while combining the datasets:
1. Instead of using the “imfuse” function, the matrices can be manually combined to preserve the data type. This can be done by calculating the necessary offsets based on GPS data and creating a composite image matrix large enough to hold both datasets.
% Calculate offset in pixels
offset_x = round(Ds1 / pixelsize1w);
offset_y = round(Ds1 / pixelsize1h);
% Create a composite image
composite_size_x = max(size(data1, 1), size(data2, 1) + offset_x);
composite_size_y = max(size(data1, 2), size(data2, 2) + offset_y);
composite_image = NaN(composite_size_x, composite_size_y);
2. Then the heat data from both images can be inserted into this composite matrix.
% Insert data1 into composite image
composite_image(1:size(data1, 1), 1:size(data1, 2)) = data1;
% Insert data2 into composite image
composite_image(offset_x + (1:size(data2, 1)), offset_y + (1:size(data2, 2))) = data2;
3. The “imagesc” function can be used to display the composite heatmap, with a colorbar for reference.
figure;
imagesc(composite_image);
colorbar;
title('Composite Heatmap');
Refer to the output for better understanding:
For more information, kindly refer to the documentation links below:
Happy Coding!

Weitere Antworten (0)

Kategorien

Mehr zu Colormaps finden Sie in Help Center und File Exchange

Produkte


Version

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by