How to interpolate missing z-values: looking for ideas
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello Everyone,
I have an image that represents a magnetic (field) anomaly map (attached below). I had (x,y,z) data (.xyz file). Here, x-axis represents longitude values, y-axis represents latitude values, and z values are simply the anomaly values. I loaded the data on matlab and then saved it as a binary image (using imwrite). White pixels (255) represent anomaly values, and black pixels (0) represent background.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1092810/image.png)
The anomaly values (in white) show dominantly linear patterns (marked with red lines), and are oriented nearly north-south. However, as the image shows, the linear patterns show discontinuities due to missing data (labelled in 2 places, with green rectangular boxes). Is there any way that I could fill these blanks (region of missing data) with some kind of interpolation, approaching from either end of the gap? Any other ideas would be appreciated? Thank you so much.
I have tried the function imclose (code attached below), but it was not helpful (see the output image below). I have attached my script for 'imclose' below. Thanks!
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1092815/image.png)
Script for 'imclose':
close all
clear all
% Use the imclose function to fill appropriate gaps in input image
figure
ima = gapClose('testimg.bmp',17,-82);
function [ima] = gapClose (imb, len, deg)
%% Input parameteres
% imb = Input image (image before gap completion is applied)
% Optional parameters (takes default values if left blank)
% len = length of the line for the function strel ('line')
% deg = orientation of the line (in degrees) for the function strel
% ima = Output image
imb = imread(imb);
% if len ==
se2 = strel('line', len, deg); % create line elements using 'strel'
ima=imclose(imb,se2); % apply imclose to fil the gaps
montage({imb,ima},'ThumbnailSize',[]) % display before and after images side by side
end
4 comentarios
Akira Agata
el 15 de Ag. de 2022
Editada: Akira Agata
el 15 de Ag. de 2022
The original (x,y,z) data (.xyz file) should have much more information than the attached binary image data.
Therefore, I think it would be better to start this analysis from the original (x,y,z) data.
Respuestas (0)
Ver también
Categorías
Más información sobre Geometric Transformation and Image Registration en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!