Combining datasets using Geo data/ How to retain data values using 'imfuse'

1 visualización (últimos 30 días)
Hi,
I am trying to imfuse these two datasets Data1 & Data2 (data type Double) with R1 and R2 (R1 and R2 are spatial coordinates data & pixel sizes etc.). However, the end product 'AB' is changing the data type to uint 8, and this change of data type is also affecting the values in dataset (changed). I have checked the documentation but the output of 'Imfuse' is 'uint 8'.
I need some advise, How can I embed these two datasets using geo data, which dont alter its data values. If there is some other function or technique to do it. Kindly advise.
AB=imfuse(data2,R2,data1,R1,'blend','Scaling','joint');
figure;
imshow(AB);
I have attached the files.

Respuesta aceptada

Chandrika
Chandrika el 19 de Jul. de 2024
Hello Abdul,
I would suggest you referring any of the following possible workarounds in this case:
  • In your code, at the end, you may use the "im2double" function to convert back your fused data to 'double' datatype:
AB=imfuse(data2,R2,data1,R1,'blend','Scaling','joint');
AB1=im2double(AB);
figure;
imshow(AB1);
  • Another workaround could be using the "fitgeotform2d" and "imwarp" functions. In this scenario, please look into the following sample code snippet as a reference:
r1Limits = [R1.XWorldLimits; R1.YWorldLimits];
r2Limits = [R2.XWorldLimits; R2.YWorldLimits];
% Create a transformation
tform = fitgeotform2d(r2Limits, r1Limits, 'similarity');
% Align data2 to the spatial reference of data1
objectalignedData2 = imwarp(data2, R2, tform, 'OutputView', R1);
% Fuse the datasets
fusedData = double((data1 + objectalignedData2)/2);
% Display
figure;
imshow(fusedData,[])
For more details on using the "fitgeotform2d" function and "imwarp" function, you may follow the MathWorks documentation links attached below:
Hope you find it useful!
Regards,
Chandrika

Más respuestas (0)

Categorías

Más información sobre Geometric Transformation and Image Registration en Help Center y File Exchange.

Productos


Versión

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by